Subversion Repositories Kolibri OS

Rev

Rev 5640 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5640 Rev 5674
Line 15... Line 15...
15
	#define FILE_SAVED_AS "'Download manager\nFile saved as "
15
	#define FILE_SAVED_AS "'Download manager\nFile saved as "
16
	#define KB_RECEIVED " received"
16
	#define KB_RECEIVED " received"
17
#endif
17
#endif
Line 18... Line 18...
18
 
18
 
19
proc_info DL_Form;
-
 
20
system_colors sc;
19
proc_info DL_Form;
21
char DL_URL[10000];
20
char DL_URL[10000];
22
dword DL_bufpointer, DL_bufsize, DL_http_transfer, DL_http_buffer;
21
dword DL_bufpointer, DL_bufsize, DL_http_transfer, DL_http_buffer;
23
char filepath[4096];
22
char filepath[4096];
24
int downloaded_size, full_size;
23
int downloaded_size, full_size;
Line 75... Line 74...
75
				}
74
				}
76
				if (key==13) DL_Scan(301);
75
				if (key==13) DL_Scan(301);
77
				break;
76
				break;
Line 78... Line 77...
78
 
77
 
79
			case evReDraw:
78
			case evReDraw:
80
				sc.get();
79
				system.color.get();
81
				DefineAndDrawWindow(215, 100, 420, 120, 0x74, sc.work, DL_WINDOW_HEADER, 0);
80
				DefineAndDrawWindow(215, 100, 420, 120, 0x74, system.color.work, DL_WINDOW_HEADER, 0);
82
				GetProcessInfo(#DL_Form, SelfInfo);
81
				GetProcessInfo(#DL_Form, SelfInfo);
83
				if (DL_Form.status_window>2) break;
82
				if (DL_Form.status_window>2) break;
84
				if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120);
83
				if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120);
85
				if (DL_Form.width<280) MoveSize(OLD,OLD,280,OLD);
84
				if (DL_Form.width<280) MoveSize(OLD,OLD,280,OLD);
Line 134... Line 133...
134
 
133
 
135
 
134
 
136
 
135
 
137
void DL_Draw_Window()
136
void DL_Draw_Window()
138
{	
137
{	
139
	DrawBar(0,0, DL_Form.cwidth, DL_Form.cheight, sc.work);
138
	DrawBar(0,0, DL_Form.cwidth, DL_Form.cheight, system.color.work);
140
	DeleteButton(305);
139
	DeleteButton(305);
141
	DeleteButton(306);
140
	DeleteButton(306);
142
	if (download_state == STATE_NOT_STARTED) ||  (download_state == STATE_COMPLETED)
141
	if (download_state == STATE_NOT_STARTED) ||  (download_state == STATE_COMPLETED)
143
	{
142
	{
144
		DrawCaptButton(cleft, 50, 130, 27, 301, sc.work_button, sc.work_button_text, START_DOWNLOADING);	
143
		DrawCaptButton(cleft, 50, 130, 27, 301, system.color.work_button, system.color.work_button_text, START_DOWNLOADING);	
145
	}
144
	}
146
	if (download_state == STATE_IN_PROGRESS)
145
	if (download_state == STATE_IN_PROGRESS)
147
	{
146
	{
148
		DrawCaptButton(cleft, 50, 140, 27, 302, sc.work_button, sc.work_button_text, STOP_DOWNLOADING);
147
		DrawCaptButton(cleft, 50, 140, 27, 302, system.color.work_button, system.color.work_button_text, STOP_DOWNLOADING);
149
		DrawDownloading();
148
		DrawDownloading();
150
	}
149
	}
151
	if (download_state == STATE_COMPLETED)
150
	if (download_state == STATE_COMPLETED)
152
	{
151
	{
153
		DrawCaptButton(cleft+140, 50, 110, 27, 305, sc.work_button, sc.work_button_text, SHOW_IN_FOLDER);
152
		DrawCaptButton(cleft+140, 50, 110, 27, 305, system.color.work_button, system.color.work_button_text, SHOW_IN_FOLDER);
154
		DrawCaptButton(cleft+260, 50, 120, 27, 306, sc.work_button, sc.work_button_text, OPEN_FILE);	
153
		DrawCaptButton(cleft+260, 50, 120, 27, 306, system.color.work_button, system.color.work_button_text, OPEN_FILE);	
155
	} 
154
	} 
156
	WriteText(cleft, DL_address_box.top + 4, 0x80, sc.work_text, "URL:");
155
	WriteText(cleft, DL_address_box.top + 4, 0x80, system.color.work_text, "URL:");
157
	DL_address_box.left = strlen("URL:")*6 + 10 + cleft;
156
	DL_address_box.left = strlen("URL:")*6 + 10 + cleft;
158
	DL_address_box.width = DL_Form.cwidth - DL_address_box.left - cleft - 3;
157
	DL_address_box.width = DL_Form.cwidth - DL_address_box.left - cleft - 3;
Line 169... Line 168...
169
	char bytes_received[70];
168
	char bytes_received[70];
Line 170... Line 169...
170
 
169
 
171
	tmp = ConvertSizeToKb(downloaded_size);
170
	tmp = ConvertSizeToKb(downloaded_size);
172
	strcpy(#bytes_received, tmp);
171
	strcpy(#bytes_received, tmp);
173
	strcat(#bytes_received, KB_RECEIVED);
172
	strcat(#bytes_received, KB_RECEIVED);
174
	DrawBar(DL_progress_bar.left, DL_progress_bar.top + 17, DL_Form.cwidth - DL_progress_bar.left, 9, sc.work);
173
	DrawBar(DL_progress_bar.left, DL_progress_bar.top + 17, DL_Form.cwidth - DL_progress_bar.left, 9, system.color.work);
175
	WriteText(DL_progress_bar.left, DL_progress_bar.top + 17, 0x80, sc.work_text, #bytes_received);
174
	WriteText(DL_progress_bar.left, DL_progress_bar.top + 17, 0x80, system.color.work_text, #bytes_received);
176
	progressbar_draw stdcall(#DL_progress_bar);
175
	progressbar_draw stdcall(#DL_progress_bar);