Subversion Repositories Kolibri OS

Rev

Rev 3877 | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. void InstallationLoop()
  3. {
  4.         byte id, key, started=false;
  5.         goto _INSTALL_DRAW;
  6.    
  7.         loop() switch(WaitEvent())
  8.         {                                                  
  9.                         case evButton:
  10.                                         id=GetButtonID();
  11.                                         if(id == 1) ExitProcess();
  12.                                         if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/donate.php");
  13.                                         if (id == 10) HalloLoop();
  14.                                         break;
  15.                         case evKey:
  16.                                         key = GetKey();
  17.                                         break;
  18.                                    
  19.                         case evReDraw: _INSTALL_DRAW:
  20.                                         if !(DefineWindow("Installation Started", "Stop")) break;
  21.                                         if (started) break;
  22.                                         started = true;
  23.                                         Install();
  24.         }
  25. }
  26.  
  27.  
  28. char iclock[3]={1,2};
  29. void ShowProgress(dword text1)
  30. {
  31.         iclock[0]><iclock[1];
  32.         _PutImage(WIN_W+LOGOW/2, WIN_H+LOGOH/2, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo);
  33.         if (text1)
  34.         {
  35.                 DrawBar(TEXTX, BLACK_H+30, Form.cwidth-TEXTX, 12, 0xFFFfff);
  36.                 DrawBar(TEXTX, BLACK_H+50, Form.cwidth-TEXTX, 12, 0xFFFfff);
  37.                 WriteText(TEXTX, BLACK_H+30, 0x80, 0, text1);
  38.         }
  39. }
  40.  
  41.  
  42. void Install()
  43. {
  44.         int i;
  45.         proc_info Process;
  46.  
  47.         ShowProgress("Mounting virtual disk...");
  48.         //if (TmpDiskAdd(9, 100)!=0) RunProgram("/sys/tmpdisk", "a9s100");
  49.         for (i=0; i<256; i++;)
  50.         {
  51.                 GetProcessInfo(#Process, i);
  52.                 if (i==Form.ID) || (strcmp(#Process.name, "OS")==0) continue;
  53.                 //debug(#Process.name);
  54.                 KillProcess(i);
  55.         }
  56.         //RunProgram("/sys/develop/board", NULL); //temp============
  57.         RunProgram("/sys/REFRSCRN", NULL);
  58.         //pause(100);
  59.         ShowProgress("Copying files...");
  60.         copyf("/sys/docpack", "/kolibrios/docpack");
  61.         DeleteFile("/sys/docpack");
  62.         copyf(abspath("sys"), "/rd/1");
  63.         //copyf(abspath("tmp"), "/tmp9/1");
  64.         SetAddApplDir("kolibrios", abspath("kolibrios"));
  65.  
  66.         ShowProgress("Post install actions...");
  67.         RunProgram("/sys/launcher", NULL);
  68.         SetSystemSkin("/kolibrios/skins/latte.skn");
  69.         EndLoop();
  70. }
  71.  
  72. void copyf_Action(dword filename)
  73. {
  74.         if (CheckEvent()==evReDraw) { DefineWindow("Installation Started", "Stop"); ShowProgress("Copying files..."); }
  75.         ShowProgress(NULL);
  76.         DrawBar(TEXTX, BLACK_H+50, Form.cwidth-TEXTX, 12, 0xFFFfff);
  77.         WriteText(TEXTX, BLACK_H+50, 0x80, 0, filename);
  78. }
  79.  
  80.  
  81. void EndLoop()
  82. {
  83.         byte id, key;
  84.  
  85.         goto _END_DRAW;
  86.    
  87.         loop() switch(WaitEvent())
  88.         {                                                  
  89.                         case evButton:
  90.                                         id=GetButtonID();
  91.                                         if(id == 1) ExitProcess();
  92.                                         if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
  93.                                         if (id == 10) ExitProcess();
  94.                                         break;
  95.                         case evKey:
  96.                                         key = GetKey();
  97.                                         break;
  98.                                    
  99.                         case evReDraw: _END_DRAW:
  100.                                         if !(DefineWindow("Installation complete", "Exit")) break;
  101.                                         WriteText(TEXTX, BLACK_H*2, 0x80, 0, "KolibriN install complete.");
  102.                                         WriteText(TEXTX, BLACK_H*2+40, 0x80, 0, "I spent a lot of time improving KolibriN, so I hope you'll like it.");
  103.                                         WriteText(TEXTX, BLACK_H*2+55, 0x80, 0, "Please, donate as much as you can to help me further improve Kolibri,");
  104.                                         WriteText(TEXTX, BLACK_H*2+70, 0x80, 0, "the project I love so much. Visit my site for more information:");
  105.                                         DrawLink(TEXTX, BLACK_H*2+85, 0x80, 11, "http://kolibri-n.org/donate.php");
  106.         }
  107. }
  108.  
  109.