19,32 → 19,41 |
|
_http http; |
proc_info Form; |
bool install_complete = false; |
sensor progress; |
|
#define WINW 400 |
#define WINH 300 |
#define WINW 460 |
|
char accept_language[]="en"; //not used, necessary for http.get() |
//#define LANG_RUS 1 |
|
#ifdef LANG_RUS |
#define T_INTRO "®¯à®¡ã©â¥ ®¢®¥ ¢¨§ã «ì®¥ ®ä®à¬«¥¨¥ ®«¨¡à¨, ª®â®à®¥ à ìè¥ ¡ë«® ¤®áâ㯮 ⮫쪮 ¢ KolibriNext."; |
#define T_INSTALL "áâ ®¢¨âì" |
#define T_COMPLETE "áâ ®¢ª § ¢¥àè¥ " |
#define WINH 345 |
#define T_WINDOW_TITLE "« © ®¡®¢«¥¨¥ KolibriOS" |
#define T_TITLE_H1 "
" |
#define T_INTRO " ®¥ ¯à¨«®¦¥¨¥ áª ç ¥â ¯®á«¥¤îî ¢¥àá¨î KolibriOS ¨ à ᯠªã¥â ¥¥ RAM-¤¨áª. ਠí⮬ ï¤à® ¥ ¡ã¤¥â ¯¥à¥§ ¯ã饮, ¤«ï í⮣® ¥®¡å®¤¨¬® á®åà ¨âì ®¡à § ¨ ¯¥à¥§ £à㧨âáï. ®¦ «ã©áâ , § ªà®©â¥ ¢á¥ ®âªàëâë¥ ¯à¨«®¦¥¨ï ¯¥à¥¤ ç «®¬ ®¡®¢«¥¨ï. |
|
: ᥠ¨§¬¥ë¥ ä ©«ë RAM-¤¨áª¥ ¡ã¤ãâ ¯¥à¥§ ¯¨á ë!"; |
#define T_INSTALL "¡®¢¨âì" |
#define T_COMPLETE "¡®¢«¥¨¥ § ¢¥à襮" |
#define T_EXIT "ë室" |
#define IMG_URL "http://builds.kolibrios.org/rus/data/data/kolibri.img" |
#else |
#define T_INTRO "This app will download the latest KolibriOS dirsto and update your RAM-disk with it. Kernel won't be restarted. Please close all opened apps before start."; |
#define WINH 305 |
#define T_WINDOW_TITLE "KolibriOS Online Updater" |
#define T_TITLE_H1 "ONLINE UPDATE" |
#define T_INTRO "This app will download the latest KolibriOS dirsto and update your RAM-disk with it. Kernel won't be restarted. |
Please close all opened apps before start. |
|
ALERT: All chages on RAM-disk will be lost!"; |
#define T_INSTALL "Update" |
#define T_COMPLETE "Update complete" |
#define T_EXIT "Exit" |
#define IMG_URL "http://builds.kolibrios.org/eng/data/data/kolibri.img" |
#endif |
char accept_language[]="en"; //not used, necessary for http.get() |
|
|
bool install_complete = false; |
|
void main() |
{ |
word btn; |
//load_dll(libini, #lib_init,1); |
load_dll(libio, #libio_init,1); |
load_dll(libimg, #libimg_init,1); |
53,9 → 62,7 |
loop() switch(WaitEventTimeout(300) & 0xFF) |
{ |
case evButton: |
btn = GetButtonID(); |
if (btn == 1) ExitProcess(); |
else EventInstall(); |
if (GetButtonID() == 1) ExitProcess(); else EventInstall(); |
break; |
|
case evKey: |
74,8 → 81,9 |
case evNetwork: |
if (http.transfer <= 0) break; |
http.receive(); |
if (http.content_length) DrawProgressBar(30, WINH-140, WINW-60, 20, sc.work, 0xC3C3C3, |
0x54B1D6, sc.work_text, 100 * http.content_received / http.content_length); |
if (http.content_length) { |
progress.draw_progress(http.content_length - http.content_received * progress.w / http.content_length); |
} |
if (http.receive_result == 0) EventDownloadComplete(); |
} |
} |
84,11 → 92,16 |
{ |
sc.get(); |
DefineAndDrawWindow(screen.width-WINW/2,screen.height-WINH/2, |
WINW+9,WINH+skin_height,0x34,sc.work,"KolibriOS Online Updater",0); |
WINW+9,WINH+skin_height,0x34,sc.work,T_WINDOW_TITLE,0); |
GetProcessInfo(#Form, -1); |
WriteText(30, 20, 0x81, 0xEC008C, "ONLINE UPDATE"); |
if (install_complete) DrawInstallComplete(); else DrawIntro(); |
WriteText(30, 20, 0x81, 0xEC008C, T_TITLE_H1); |
if (install_complete) { |
DrawInstallComplete(); |
} else { |
DrawIntro(); |
progress.set_size(30, WINH-130, WINW-60, 20); |
} |
} |
|
void DrawIntro() |
{ |
115,16 → 128,18 |
{ |
dword unimg_id, slot_n; |
|
CreateFile(http.content_received, http.content_pointer, "/tmp0/1/last.img"); |
CreateFile(http.content_received, http.content_pointer, "/tmp0/1/latest.img"); |
http.free(); |
|
unimg_id = RunProgram("/tmp0/1/unimg", "/tmp0/1/last.img -e"); |
unimg_id = RunProgram("/sys/unimg", "/tmp0/1/latest.img /tmp0/1/latest_img -e"); |
do { |
slot_n = GetProcessSlot(unimg_id); |
pause(10); |
} while (slot_n!=0); |
|
copyf("/tmp0/1/KOLIBRI.IMG", "/rd/1"); |
copyf("/rd/1/settings", "/tmp0/1/settings_backup"); |
copyf("/tmp0/1/latest_img", "/rd/1"); |
copyf("/tmp0/1/settings_backup", "/rd/1/settings"); |
|
RestartAllProcess(); |
install_complete = true; |