Rev 6278 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6278 | Rev 6366 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifdef LANG_RUS |
1 | #ifdef LANG_RUS |
2 | #define DL_WINDOW_HEADER "¥¥¤¦¥à § £à㧮ª" |
2 | #define DL_WINDOW_HEADER "¥¥¤¦¥à § £à㧮ª" |
3 | #define START_DOWNLOADING " ç âì § ª çªã" |
3 | #define START_DOWNLOADING " ç âì § ª çªã" |
4 | #define STOP_DOWNLOADING "áâ ®¢¨âì" |
4 | #define STOP_DOWNLOADING "áâ ®¢¨âì" |
5 | #define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥" |
5 | #define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥" |
6 | #define OPEN_FILE "âªàëâì ä ©«" |
6 | #define OPEN_FILE_TEXT "âªàëâì ä ©«" |
7 | #define FILE_SAVED_AS "'¥¥¤¦¥à § £à㧮ª\n ©« á®åà ¥ ª ª " |
7 | #define FILE_SAVED_AS "'¥¥¤¦¥à § £à㧮ª\n ©« á®åà ¥ ª ª " |
8 | #define KB_RECEIVED " ¯®«ã祮" |
8 | #define KB_RECEIVED " ¯®«ã祮" |
9 | #else |
9 | #else |
10 | #define DL_WINDOW_HEADER "Download Manager" |
10 | #define DL_WINDOW_HEADER "Download Manager" |
11 | #define START_DOWNLOADING "Start downloading" |
11 | #define START_DOWNLOADING "Start downloading" |
12 | #define STOP_DOWNLOADING "Stop downloading" |
12 | #define STOP_DOWNLOADING "Stop downloading" |
13 | #define SHOW_IN_FOLDER "Show in folder" |
13 | #define SHOW_IN_FOLDER "Show in folder" |
14 | #define OPEN_FILE "Open file" |
14 | #define OPEN_FILE_TEXT "Open file" |
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 |
18 | char save_to[4096] = "/tmp0/1/Downloads/"; |
18 | char save_to[4096] = "/tmp0/1/Downloads"; |
Line 19... | Line 19... | ||
19 | 19 | ||
20 | proc_info DL_Form; |
20 | proc_info DL_Form; |
21 | char downloader_edit[10000]; |
21 | char downloader_edit[10000]; |
22 | char filepath[4096]; |
22 | char filepath[4096]; |
23 | int mouse_twbi; |
23 | int mouse_twbi; |
24 | edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19}; |
24 | edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19}; |
Line 25... | Line 25... | ||
25 | progress_bar pb = {0, 170, 51, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
25 | progress_bar pb = {0, 170, 51, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
- | 26 | ||
Line 26... | Line 27... | ||
26 | 27 | byte downloader_opened; |
|
27 | byte downloader_opened; |
28 | char downloader_stak[4096]; |
28 | 29 | ||
Line 78... | Line 79... | ||
78 | progressbar_draw stdcall(#pb); |
79 | progressbar_draw stdcall(#pb); |
79 | DrawDownloading(); |
80 | DrawDownloading(); |
80 | } |
81 | } |
81 | if (downloader.state == STATE_COMPLETED) |
82 | if (downloader.state == STATE_COMPLETED) |
82 | { |
83 | { |
- | 84 | if (!dir_exists(#save_to)) CreateDir(#save_to); |
|
83 | strcpy(#filepath, #save_to); |
85 | strcpy(#filepath, #save_to); |
- | 86 | chrcat(#filepath, '/'); |
|
84 | strcat(#filepath, #save_to+strrchr(#save_to, '/')); |
87 | strcat(#filepath, #downloader_edit+strrchr(#downloader_edit, '/')); |
85 | if (WriteFile(downloader.bufsize, downloader.bufpointer, #filepath)==0) |
88 | if (WriteFile(downloader.data_downloaded_size, downloader.bufpointer, #filepath)==0) |
86 | sprintf(#notify_message, "%s%s%s",FILE_SAVED_AS,#filepath,"' -Dt"); |
89 | sprintf(#notify_message, "%s%s%s",FILE_SAVED_AS,#filepath,"' -Dt"); |
87 | else |
90 | else |
88 | sprintf(#notify_message, "%s%s%s","'Download manager\nError! Can\96t save file as ",#filepath,"' -Et"); |
91 | sprintf(#notify_message, "%s%s%s","'Download manager\nError! Can\96t save file as ",#filepath,"' -Et"); |
89 | notify(#notify_message); |
92 | notify(#notify_message); |
90 | StopDownloading(); |
93 | StopDownloading(); |
Line 120... | Line 123... | ||
120 | DrawDownloading(); |
123 | DrawDownloading(); |
121 | } |
124 | } |
122 | if (downloader.state == STATE_COMPLETED) |
125 | if (downloader.state == STATE_COMPLETED) |
123 | { |
126 | { |
124 | DrawCaptButton(cleft+140, 50, 110, 27, 305, system.color.work_button, system.color.work_button_text, SHOW_IN_FOLDER); |
127 | DrawCaptButton(cleft+140, 50, 110, 27, 305, system.color.work_button, system.color.work_button_text, SHOW_IN_FOLDER); |
125 | DrawCaptButton(cleft+260, 50, 120, 27, 306, system.color.work_button, system.color.work_button_text, OPEN_FILE); |
128 | DrawCaptButton(cleft+260, 50, 120, 27, 306, system.color.work_button, system.color.work_button_text, OPEN_FILE_TEXT); |
126 | } |
129 | } |
127 | WriteText(cleft, ed.top + 4, 0x80, system.color.work_text, "URL:"); |
130 | WriteText(cleft, ed.top + 4, 0x80, system.color.work_text, "URL:"); |
128 | ed.left = strlen("URL:")*6 + 10 + cleft; |
131 | ed.left = strlen("URL:")*6 + 10 + cleft; |
129 | ed.width = DL_Form.cwidth - ed.left - cleft - 3; |
132 | ed.width = DL_Form.cwidth - ed.left - cleft - 3; |
130 | ed.offset=0; |
133 | ed.offset=0; |