minor fixes

git-svn-id: svn://kolibrios.org@8281 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-11-30 00:55:04 +00:00
parent 5941f0e334
commit c92932964b
5 changed files with 29 additions and 24 deletions

View File

@ -6,18 +6,19 @@
#ifdef LANG_RUS
#define DL_WINDOW_HEADER "Œ¥­¥¤¦¥à § £à㧮ª"
#define START_DOWNLOADING "<EFBFBD> ç âì § ª çªã"
#define START_DOWNLOADING "‘ª ç âì"
#define STOP_DOWNLOADING "Žâ¬¥­ "
#define SHOW_IN_FOLDER "<22>®ª § âì ¢ ¯ ¯ª¥"
#define OPEN_FILE_TEXT "Žâªàëâì ä ©«"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª %s' -Dt"
#define FILE_NOT_SAVED "'Œ¥­¥¤¦¥à § £à㧮ª\nŽè¨¡ª ! ” ©« ­¥ ¬®¦¥â ¡ëâì å®à ­¥­ ª ª\n%s' -Et"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª %s' -Dt"
#define FILE_NOT_SAVED "'Œ¥­¥¤¦¥à § £à㧮ª\nŽè¨¡ª ! ” ©« ­¥ ¬®¦¥â ¡ëâì á®åà ­¥­ ª ª\n%s' -Et"
#define KB_RECEIVED "ˆ¤¥â ᪠稢 ­¨¥... %s ¯®«ã祭®"
#define T_ERROR_STARTING_DOWNLOAD "'<27>¥¢®§¬®¦­® ­ ç âì ᪠稢 ­¨¥.\n<>®¦ «ã©áâ , ¯à®¢¥àì⥠¢¢¥¤¥­­ë© ¯ãâì ¨ ᮥ¤¨­¥­¨¥ á ˆ­â¥à­¥â®¬.' -E"
#define T_AUTOCLOSE "€¢â®§ ªàë⨥"
char accept_language[]= "Accept-Language: ru\n";
#else
#define DL_WINDOW_HEADER "Download Manager"
#define START_DOWNLOADING "Start downloading"
#define START_DOWNLOADING "Download"
#define STOP_DOWNLOADING "Cancel"
#define SHOW_IN_FOLDER "Show in folder"
#define OPEN_FILE_TEXT "Open file"
@ -25,6 +26,7 @@
#define FILE_NOT_SAVED "'Download manager\nError! Can\96t save file as %s' -Et"
#define KB_RECEIVED "Downloading... %s received"
#define T_ERROR_STARTING_DOWNLOAD "'Error while starting download process.\nPlease, check entered path and Internet connection.' -E"
#define T_AUTOCLOSE "Autoclose"
char accept_language[]= "Accept-Language: en\n";
#endif

View File

@ -3,22 +3,26 @@
#define MEMSIZE 1024 * 100
#include "../lib/gui.h"
#include "../lib/random.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/http.h"
#include "../lib/obj/libini.h"
#include "../lib/patterns/http_downloader.h"
#include "const.h"
DOWNLOADER downloader;
checkbox autoclose = { T_AUTOCLOSE, true };
char downloader_edit[4000];
char filepath[4096];
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,
sizeof(downloader_edit)-2,#downloader_edit,0,ed_focus,19,19};
progress_bar pb = {0, GAPX, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
progress_bar pb = {0, GAPX, 58, 315, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;
bool exit_when_done = false;
bool exit_when_done = false;
void main()
@ -26,6 +30,7 @@ void main()
dword shared_url;
load_dll(boxlib, #box_lib_init,0);
load_dll(libHTTP, #http_lib_init,1);
load_dll(libini, #lib_init,1);
if (!dir_exists(#save_to)) CreateDir(#save_to);
@ -36,7 +41,7 @@ void main()
}
if (!strncmp(#param, "-mem", 5)) {
shared_url = memopen(#dl_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE);
//shared_url = memopen(#dl_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE);
strcpy(#downloader_edit, shared_url);
} else {
strcpy(#downloader_edit, #param);
@ -90,6 +95,7 @@ void main()
void ProcessEvent(int id)
{
autoclose.click(id);
if (id==001) { StopDownloading(); ExitProcess(); }
if (id==301) && (downloader.httpd.transfer <= 0) StartDownloading();
if (id==302) StopDownloading();
@ -103,24 +109,26 @@ void ProcessEvent(int id)
void DrawWindow()
{
int but_x = 0;
int but_y = 58;
#define BUT_Y 58;
sc.get();
pb.frame_color = sc.work_dark;
DefineAndDrawWindow(110 + random(300), 100 + random(300), WIN_W+9, WIN_H + 5 + skin_height, 0x34, sc.work, DL_WINDOW_HEADER, 0);
autoclose.draw(WIN_W-135, BUT_Y+6);
if (downloader.state == STATE_NOT_STARTED) || (downloader.state == STATE_COMPLETED)
{
but_x = GAPX + DrawStandartCaptButton(GAPX, but_y, 301, START_DOWNLOADING);
but_x = GAPX + DrawStandartCaptButton(GAPX, BUT_Y, 301, START_DOWNLOADING);
if (filepath[0])
{
but_x += DrawStandartCaptButton(but_x, but_y, 305, SHOW_IN_FOLDER);
DrawStandartCaptButton(but_x, but_y, 306, OPEN_FILE_TEXT);
but_x += DrawStandartCaptButton(but_x, BUT_Y, 305, SHOW_IN_FOLDER);
DrawStandartCaptButton(but_x, BUT_Y, 306, OPEN_FILE_TEXT);
}
}
if (downloader.state == STATE_IN_PROGRESS)
{
DrawStandartCaptButton(WIN_W - 190, but_y, 302, STOP_DOWNLOADING);
DrawStandartCaptButton(WIN_W - 240, BUT_Y, 302, STOP_DOWNLOADING);
DrawDownloading();
}
ed.offset=0;
@ -239,4 +247,5 @@ void SaveDownloadedFile()
*/
if (!exit_when_done) notify(#notify_message);
if (autoclose.checked) ExitProcess();
}

View File

@ -19,13 +19,11 @@ dword edit_box_draw = #aEdit_box_draw;
dword edit_box_key = #aEdit_box_key;
dword edit_box_mouse = #aEdit_box_mouse;
dword edit_box_set_text = #aEdit_box_set_text;
dword version_ed = #aVersion_ed;
dword scrollbar_v_draw = #aScrollbar_v_draw;
dword scrollbar_v_mouse = #aScrollbar_v_mouse;
dword scrollbar_h_draw = #aScrollbar_h_draw;
dword scrollbar_h_mouse = #aScrollbar_h_mouse;
dword version_scrollbar = #aVersion_scrollbar;
dword PathShow_prepare = #aPathShow_prepare;
dword PathShow_draw = #aPathShow_draw;
@ -41,19 +39,17 @@ char aEdit_box_draw [] = "edit_box";
char aEdit_box_key [] = "edit_box_key";
char aEdit_box_mouse[] = "edit_box_mouse";
char aEdit_box_set_text[] = "edit_box_set_text";
char aVersion_ed [] = "version_ed";
char aboxlib_init[] = "lib_init";
char aboxlib_init[] = "lib_init";
char aScrollbar_v_draw [] = "scrollbar_v_draw";
char aScrollbar_v_mouse[] = "scrollbar_v_mouse";
char aScrollbar_h_draw [] = "scrollbar_h_draw";
char aScrollbar_h_mouse[] = "scrollbar_h_mouse";
char aVersion_scrollbar[] = "version_scrollbar";
char aPathShow_prepare [] = "PathShow_prepare";
char aPathShow_draw [] = "PathShow_draw";
char aProgressbar_draw [] = "progressbar_draw";
char aProgressbar_draw [] = "progressbar_draw";
char aProgressbar_progress[] = "progressbar_progress";
char aFrame_draw[] = "frame_draw";

View File

@ -25,8 +25,8 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
from_chs = from_chs*10+#charsets;
debug("iconv: from_chs = "); debugln(from_chs);
debug("iconv: to_chs = "); debugln(to_chs);
//debug("iconv: from_chs = "); debugln(from_chs);
//debug("iconv: to_chs = "); debugln(to_chs);
iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5
if (EAX==-1) {
@ -38,9 +38,9 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
in_len = out_len = strlen(conv_buf)+1;
new_buf = mem_Alloc(in_len);
iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len);
cd = EAX;
if (cd!=0)
if (EAX!=0)
{
cd = EAX;
debugval("iconv: something is wrong with stdcall iconv()", cd);
debugval("in_len", in_len);
debugval("out_len", out_len);

View File

@ -23,7 +23,6 @@
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h"
#include "../lib/obj/libini.h"
#include "../lib/obj/box_lib.h"
#include "../lib/patterns/select_list.h"
@ -110,7 +109,6 @@ void load_lib()
{
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
}