Kolibri N9 Installer Beta

git-svn-id: svn://kolibrios.org@4137 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-10-30 01:12:01 +00:00
parent e2d29bf68d
commit 2775767bec
4 changed files with 35 additions and 76 deletions

View File

@ -12,20 +12,14 @@
#define LOGOW 16 #define LOGOW 16
#define LOGOH 16 #define LOGOH 16
#define BLACK_H 40 #define WIN_W 240
#define TEXTX 20 #define WIN_H 140
#define WIN_W 300
#define WIN_H 200
unsigned char logo[LOGOW*LOGOH*3]= FROM "img\logo.raw"; unsigned char logo[LOGOW*LOGOH*3]= FROM "img\logo.raw";
char iclock[3]={1,2};
proc_info Form; proc_info Form;
system_colors sc; system_colors sc;
char dialog;
enum {
INSTALL,
END
};
#ifdef LANG_RUS #ifdef LANG_RUS
?define T_WTITILE "Установка Kolibri N9" ?define T_WTITILE "Установка Kolibri N9"
@ -35,72 +29,32 @@ enum {
?define T_END "KolibriN install complete." ?define T_END "KolibriN install complete."
#endif #endif
int DefineWindow(dword wtitle, wbutton)
{
sc.get();
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2-30, WIN_W+9, WIN_H+GetSkinHeight()+4,0x74,0,T_WTITILE);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return 0; //rolled_up
DrawBar(0, 0, Form.cwidth, BLACK_H, 0);
_PutImage(BLACK_H-LOGOW/2, BLACK_H-LOGOH/2, LOGOW,LOGOH, #logo);
WriteTextB(BLACK_H-LOGOW + LOGOW, BLACK_H-6/2, 0x90, 0xFFFfff, wtitle);
DrawBar(0, BLACK_H, Form.cwidth, Form.cheight-BLACK_H, 0xFFFfff);
DrawCaptButton(Form.cwidth-107, Form.cheight-40, 90, 24, 10, sc.work_button, sc.work_button_text,wbutton);
return 1;
}
void main() void main()
{ {
byte id, started=false;
mem_Init(); mem_Init();
InstallationLoop(INSTALL);
}
char iclock[3]={1,2};
void InstallationLoop(int dialog_t)
{
byte id, key, started=false;
int free_ram;
unsigned char free_ram_text[256];
dialog = dialog_t;
goto _DRAW_WIN;
loop() switch(WaitEvent()) loop() switch(WaitEvent())
{ {
case evButton: case evButton:
id=GetButtonID(); if (GetButtonID() == 01) ExitProcess();
if (id == 01) ExitProcess();
if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
if (id == 10)
{
if (dialog==INSTALL) InstallationLoop(END);
else if (dialog==END) ExitProcess();
}
break; break;
case evReDraw: case evReDraw:
_DRAW_WIN: sc.get();
if (dialog==INSTALL) DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2-30, WIN_W+9, WIN_H+GetSkinHeight()+4,
{ 0x34,0xFFFfff,T_WTITILE);
if !(DefineWindow("Installation Started", "Stop")) break; GetProcessInfo(#Form, SelfInfo);
//iclock[0]><iclock[1]; if (Form.status_window>2) break;
_PutImage(Form.cwidth-LOGOW/2, Form.height-LOGOH/2, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo);
if (!started) _PutImage(Form.cwidth-LOGOW/2, Form.height-LOGOH/2, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo); //iclock[0]><iclock[1];
{ WriteTextB(-strlen(T_WTITILE)*6+Form.cwidth/2, Form.cheight - 35, 0x90, 0, T_WTITILE);
started = true;
if (GetFreeRAM()/1024<15) notify("Too less free ram. May cause problems"); if (!started)
Install();
}
}
if (dialog==END)
{ {
if !(DefineWindow("Installation complete", "Exit")) break; started = true;
WriteText(TEXTX, BLACK_H*2, 0x80, 0, T_END); if (GetFreeRAM()/1024<15) notify("Too less free ram. May cause problems");
DrawLink(TEXTX, BLACK_H*2+15, 0x80, 11, "http://kolibri-n.org"); Install();
} }
} }
} }
@ -109,23 +63,22 @@ void InstallationLoop(int dialog_t)
void Install() void Install()
{ {
int i; int i;
dword temp;
proc_info Process; proc_info Process;
for (i=0; i<256; i++;)
for (i=0; i<1000; i++;)
{ {
GetProcessInfo(#Process, i); GetProcessInfo(#Process, i);
if (i==Form.ID) || (strcmp(#Process.name, "OS")==0) continue; if (strcmp(#Process.name, "@ICON")==0) KillProcess(Process.ID);
KillProcess(i);
} }
SetAddApplDir("kolibrios", abspath("kolibrios")+1); SetAddApplDir("kolibrios", abspath("kolibrios")+1);
RunProgram("/sys/REFRSCRN", NULL); RunProgram("/sys/REFRSCRN", NULL);
copyf(abspath("sys"), "/rd/1"); copyf(abspath("sys"), "/rd/1");
RunProgram("/sys/launcher", NULL); RunProgram("/sys/launcher", NULL);
SetSystemSkin("/kolibrios/skins/latte.skn"); SetSystemSkin("/kolibrios/skins/latte.skn");
InstallationLoop(END); notify(T_END);
//===to tmp=== ExitProcess();
// RunProgram("/sys/tmpdisk", "a9s100");
// copyf(abspath("tmp"), "/tmp9/1");
} }
void copyf_Draw_Progress(dword filename) { return; } void copyf_Draw_Progress(dword filename) { return; }

View File

@ -127,7 +127,7 @@
:void GrayScaleImage(dword color_image, w, h) :void GrayScaleImage(dword color_image, w, h)
{ {
dword i,j, gray,rr,gg,bb; dword i,gray,rr,gg,bb;
for (i = 0; i < w*h*3; i+=3) for (i = 0; i < w*h*3; i+=3)
{ {
rr = DSBYTE[i+color_image]; rr = DSBYTE[i+color_image];

View File

@ -235,9 +235,15 @@ enum
:dword abspath(dword relative_path) //GetAbsolutePathFromRelative() :dword abspath(dword relative_path) //GetAbsolutePathFromRelative()
{ {
char absolute_path[4096]; char absolute_path[4096];
if (ESBYTE[relative_path]=='/') return relative_path; if (ESBYTE[relative_path]=='/')
strcpy(#absolute_path, #program_path); {
absolute_path[strrchr(#absolute_path, '/')] = '\0'; strcpy(#absolute_path, relative_path);
strcat(#absolute_path, relative_path); }
else
{
strcpy(#absolute_path, #program_path);
absolute_path[strrchr(#absolute_path, '/')] = '\0';
strcat(#absolute_path, relative_path);
}
return #absolute_path; return #absolute_path;
} }

View File

@ -180,7 +180,7 @@ struct proc_info
#define SelfInfo -1 #define SelfInfo -1
dword use_cpu; dword use_cpu;
word pos_in_stack,num_slot,rezerv1; word pos_in_stack,num_slot,rezerv1;
char name[11]; unsigned char name[11];
char rezerv2; char rezerv2;
dword adress,use_memory,ID,left,top,width,height; dword adress,use_memory,ID,left,top,width,height;
word status_slot,rezerv3; word status_slot,rezerv3;