Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9286 → Rev 9287

/programs/cmm/downloader/const.h
1,4 → 1,4
//Copyright 2020 by Leency
//Copyright 2021 by Leency
 
#ifdef LANG_RUS
#define DL_WINDOW_HEADER "Œ¥­¥¤¦¥à § £à㧮ª"
9,10 → 9,9
#define T_SPEED_TEST "’¥áâ ᪮à®áâ¨"
#define FILE_SAVED_AS "'Œ¥­¥¤¦¥à § £à㧮ª\n” ©« á®åà ­¥­ ª ª %s' -Dt"
#define FILE_NOT_SAVED "'Œ¥­¥¤¦¥à § £à㧮ª\nŽè¨¡ª ! ” ©« ­¥ ¬®¦¥â ¡ëâì á®åà ­¥­ ª ª\n%s' -Et"
#define KB_RECEIVED "ˆ¤¥â ᪠稢 ­¨¥... %s ¯®«ã祭®"
#define KB_RECEIVED "ˆ¤¥â ᪠稢 ­¨¥: %i.%i Mb ¯®«ã祭® (%i Kb/s) "
#define T_ERROR_STARTING_DOWNLOAD "'¥¢®§¬®¦­® ­ ç âì ᪠稢 ­¨¥.\nà®¢¥àì⥠¢¢¥¤¥­­ë© ¯ãâì ¨ ᮥ¤¨­¥­¨¥ á ˆ­â¥à­¥â®¬.' -E"
#define T_AUTOCLOSE "€¢â®§ ªàë⨥"
#define SPEED_TEST_INFO_MESSAGE "'‘ª®à®áâì § £à㧪¨ ®â®¡à ¦ ¥âáï ¢ ¯®«¥ Download ¯à®£à ¬¬ë Network status.'-Id"
char accept_language[]= "Accept-Language: ru\n";
#else
#define DL_WINDOW_HEADER "Download Manager"
23,15 → 22,14
#define T_SPEED_TEST "Speed test"
#define FILE_SAVED_AS "'Download manager\nFile saved as %s' -Dt"
#define FILE_NOT_SAVED "'Download manager\nError! Can\96t save file as %s' -Et"
#define KB_RECEIVED "Downloading... %s received"
#define KB_RECEIVED "Downloading: %i.%i Mb received (%i Kb/s) "
#define T_ERROR_STARTING_DOWNLOAD "'Error while starting download process.\nCheck entered path and Internet connection.' -E"
#define T_AUTOCLOSE "Autoclose"
#define SPEED_TEST_INFO_MESSAGE "'Download speed is shown after `Download`\nlabel in the Network status program.'-Id"
char accept_language[]= "Accept-Language: en\n";
#endif
 
#define GAPX 15
#define WIN_W 580
#define WIN_W 540
#define WIN_H 100
 
char save_dir[] = "/tmp0/1/Downloads";
/programs/cmm/downloader/dl.c
10,6 → 10,8
bool exit_param = false;
bool open_file = false;
 
dword speed;
 
_http http;
 
checkbox autoclose = { T_AUTOCLOSE, false };
17,7 → 19,7
char uEdit[URL_SIZE];
char filepath[URL_SIZE+96];
 
progress_bar pb = {0, GAPX, 58, 315, 17, 0, NULL, NULL, 0xFFFfff, 0x74DA00, NULL};
progress_bar pb = {0, GAPX, 58, 380, 17, 0, NULL, NULL, 0xFFFfff, 0x74DA00, NULL};
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,
0x10000000, sizeof(uEdit)-2,#uEdit,0,ed_focus,19,19};
 
51,8 → 53,6
 
if (streq(#param, "-test")) {
strcpy(#uEdit, URL_SPEED_TEST);
RunProgram("/sys/network/netstat", NULL);
notify(SPEED_TEST_INFO_MESSAGE);
}
}
if (uEdit[0]) StartDownloading(); else {
107,7 → 107,7
DrawStandartCaptButton(GAPX+276, BUT_Y, BTN_RUN, T_RUN);
}
} else {
DrawStandartCaptButton(WIN_W - 240, BUT_Y, BTN_STOP, T_CANCEL);
DrawStandartCaptButton(WIN_W - 120, BUT_Y, BTN_STOP, T_CANCEL);
DrawDownloadingProgress();
}
//ed.offset=0; //DEL?
118,6 → 118,7
{
char get_url[URL_SIZE+33];
if (http.transfer > 0) return;
ResetDownloadSpeed();
filepath = '\0';
if (!strncmp(#uEdit,"https:",6)) {
miniprintf(#get_url, "http://gate.aspero.pro/?site=%s", #uEdit);
146,6 → 147,7
void DrawDownloadingProgress()
{
char bytes_received[70];
dword gotkb = http.content_received/1024;
 
EDI = http.content_received / 100;
if (pb.value == EDI) return;
153,9 → 155,9
pb.value = EDI;
pb.max = http.content_length / 100;
progressbar_draw stdcall(#pb);
miniprintf(#bytes_received, KB_RECEIVED, ConvertSizeToKb(http.content_received) );
CalculateDownloadSpeed();
sprintf(#bytes_received, KB_RECEIVED, gotkb/1024, gotkb%1024/103, speed);
WriteTextWithBg(GAPX, pb.top + 22, 0xD0, sc.work_text, #bytes_received, sc.work);
//CalculateSpeed();
}
void StopDownloading()
269,7 → 271,6
}
 
 
/*
struct TIME
{
dword old;
278,22 → 279,25
} time = {0,0,0};
 
dword netdata_received;
dword speed;
 
void CalculateSpeed()
void ResetDownloadSpeed()
{
time.old = 0;
netdata_received = 0;
}
 
void CalculateDownloadSpeed()
{
time.cur = GetStartTime();
 
if (time.old) {
time.gone = time.cur - time.old;
if (time.gone > 200) {
speed = http.content_received - netdata_received / time.gone * 100;
debugval("speed", speed);
debugln(ConvertSizeToKb(speed) );
if (time.gone >= 200) {
speed = http.content_received - netdata_received / time.gone / 10;
time.old = time.cur;
netdata_received = http.content_received;
}
} else {
time.old = time.cur;
}
else time.old = time.cur;
}
*/
}
/programs/cmm/lib/socket.h
14,94 → 14,89
#define MSG_PEEK 0x02
#define MSG_DONTWAIT 0x40
 
dword errorcode;
 
struct sockaddr_in
struct SockAddr
{
word sin_family;
word sin_port;
dword sin_addr;
char padding[8];
char data[14];
};
 
inline fastcall dword Socket(ECX, EDX, ESI)
// ecx = domain
// edx = type
// esi = protocol
inline fastcall dword socket_open(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 0
$mov bl, 0
$int 0x40
errorcode = EBX;
$pop ebx
}
 
inline fastcall dword Close(ECX)
// ecx = socket number
inline fastcall dword socket_close(ECX)
{
$push ebx
$mov eax, 75
$mov ebx, 1
$mov bl, 1
$int 0x40
errorcode = EBX;
$pop ebx
}
 
inline fastcall dword Bind(ECX, EDX, ESI)
// ecx = socket number
// edx = pointer to sockaddr structure
// esi = length of sockaddr structure
inline fastcall dword socket_bind(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 2
$mov bl, 2
$int 0x40
errorcode = EBX;
$pop ebx
}
 
inline fastcall dword Listen(ECX, EDX)
// ecx = socket number
// edx = backlog
inline fastcall dword socket_listen(ECX, EDX)
{
$push ebx
$mov eax, 75
$mov ebx, 3
$mov bl, 3
$int 0x40
errorcode = EBX;
$pop ebx
}
 
inline fastcall dword Connect(ECX, EDX, ESI)
// ecx = socket number
// edx = pointer to sockaddr structure
// esi = length of sockaddr structure
inline fastcall dword socket_connect(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 4
$mov bl, 4
$int 0x40
errorcode = EBX;
$pop ebx
}
 
inline fastcall dword Accept(ECX, EDX, ESI)
// ecx = socket number
// edx = pointer to sockaddr structure
// esi = length of sockaddr structure
inline fastcall dword socket_accept(ECX, EDX, ESI)
{
$push ebx
$mov eax, 75
$mov ebx, 5
$mov bl, 5
$int 0x40
errorcode = EBX;
$pop ebx
}
 
inline fastcall dword Send(ECX, EDX, ESI, EDI)
// ecx = socket number
// edx = pointer to buffer
// esi = length of buffer
// edi = flags
inline fastcall dword socket_send(ECX, EDX, ESI, EDI)
{
$push ebx
$mov eax, 75
$mov ebx, 6
$mov bl, 6
$int 0x40
errorcode = EBX;
$pop ebx
}
 
inline fastcall dword Receive(ECX, EDX, ESI, EDI)
// ecx = socket number
// edx = pointer to buffer
// esi = length of buffer
// edi = flags
inline fastcall dword socket_receive(ECX, EDX, ESI, EDI)
{
$push ebx
$mov eax, 75
$mov ebx, 7
$mov bl, 7
$int 0x40
errorcode = EBX;
$pop ebx
}
 
#endif
/programs/cmm/liza/mail_box.c
1,12 → 1,11
//Leency & SoUrcerer, LGPL
//Hidnplayer
 
TWebBrowser WB1;
 
#define LIST_INFO_H 59
int status_bar_h = 15;
 
scroll_bar scroll1 = { 17,200,210, LIST_INFO_H-3,18,0,115,15,0,0xCCCccc,0xD2CED0,0x555555,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
scroll_bar scroll_wv;
 
char *listbuffer;
char *listpointer;
17,6 → 16,7
 
int cur_charset;
 
llist list;
 
enum {
GET_MAIL = 20,
93,7 → 93,6
 
case SEND_RETR:
from = to = date = subj = cur_charset = NULL;
WB1.list.ClearList();
DrawMailBox();
request_len = GetRequest("RETR", itoa(mail_list.cur_y+1));
if (Send(socketnum, #request, request_len, 0) == 0xffffffff)
150,7 → 149,6
 
mail_list.h = Form.cheight/4;
mail_list.ClearList();
WB1.list.no_selection = true;
SetMailBoxStatus( NULL , NULL);
cur_charset = 0;
aim = SEND_NSTAT;
176,7 → 174,7
break;
}
 
links.hover(mouse.x, mouse.y);
//links.hover(mouse.x, mouse.y);
 
if (!mail_list.count) break;
if (!panels_drag) { scrollbar_v_mouse (#scroll1); scrollbar_v_mouse (#scroll_wv); }
187,9 → 185,9
DrawMailList();
break;
};
if (WB1.list.first <> scroll_wv.position)
if (list.first <> scroll_wv.position)
{
WB1.list.first = scroll_wv.position;
list.first = scroll_wv.position;
DrawLetter();
break;
};
200,7 → 198,7
}
else
{
if (WB1.list.MouseScroll(mouse.vert)) DrawLetter();
if (list.MouseScroll(mouse.vert)) DrawLetter();
}
if (mouse.lkm) && (mail_list.MouseOver(mouse.x, mouse.y)) && (!clicked_list) clicked_list=1;
if (!mouse.lkm) && (clicked_list) if (mail_list.ProcessMouse(mouse.x, mouse.y))
282,7 → 280,6
{
DrawMailList();
DrawLetterInfo();
InitTWB();
DrawLetter();
DrawStatusBar();
}
351,19 → 348,8
}
 
 
void InitTWB() {
WB1.list.SetSizes(0, mail_list.y+mail_list.h+LIST_INFO_H+1, Form.cwidth - scroll_wv.size_x - 1,
Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 12);
WB1.list.column_max = WB1.list.w - 30 / 6;
WB1.list.visible = WB1.list.h / WB1.list.item_h;
DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h);
WB1.list.first = WB1.list.count = 0;
}
 
 
void DrawLetter() {
WB1.ParseHtml(mdata, strlen(mdata));
WB1.DrawPage();
//DrawTextLines();
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, 0xFFFfff);
}
 
418,6 → 404,8
}
 
 
/*
void EventClickLink() {
RunProgram("/sys/network/WebView", links.active_url);
}
}
*/