Subversion Repositories Kolibri OS

Rev

Rev 3440 | Go to most recent revision | 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=2; i<256; i++;)
  50.         {
  51.                 GetProcessInfo(#Process, i);
  52.                 if (i==Form.ID) || (strchr(#Process.name, '/')) || (strchr(#Process.name, 'Z')) continue;
  53.                 KillProcess(i);
  54.         }
  55.         //RunProgram("/sys/develop/board", NULL); //temp============
  56.         RunProgram("/sys/REFRSCRN", NULL);
  57.         pause(100);
  58.         ShowProgress("Copying files...");
  59.         copyf("/sys/docpack", "/tmp9/1/docpack");
  60.         DeleteFile("/sys/docpack");
  61.         copyf(abspath("sys"), "/rd/1");
  62.         copyf(abspath("tmp"), "/tmp9/1");
  63.         ShowProgress("Post install actions...");
  64.         RunProgram("/sys/launcher", NULL);
  65.         SetSystemSkin("/tmp9/1/skins/latte.skn");
  66.         EndLoop();
  67. }
  68.  
  69. void copyf_Action(dword filename)
  70. {
  71.         if (CheckEvent()==evReDraw) { DefineWindow("Installation Started", "Stop"); ShowProgress("Copying files..."); }
  72.         ShowProgress(NULL);
  73.         DrawBar(TEXTX, BLACK_H+50, Form.cwidth-TEXTX, 12, 0xFFFfff);
  74.         WriteText(TEXTX, BLACK_H+50, 0x80, 0, filename);
  75. }
  76.  
  77.  
  78. void EndLoop()
  79. {
  80.         byte id, key;
  81.  
  82.         goto _END_DRAW;
  83.    
  84.         loop() switch(WaitEvent())
  85.         {                                                  
  86.                         case evButton:
  87.                                         id=GetButtonID();
  88.                                         if(id == 1) ExitProcess();
  89.                                         if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
  90.                                         if (id == 10) ExitProcess();
  91.                                         break;
  92.                         case evKey:
  93.                                         key = GetKey();
  94.                                         break;
  95.                                    
  96.                         case evReDraw: _END_DRAW:
  97.                                         if !(DefineWindow("Installation complete", "Exit")) break;
  98.                                         WriteText(TEXTX, BLACK_H*2, 0x80, 0, "KolibriN install complete.");
  99.                                         WriteText(TEXTX, BLACK_H*2+40, 0x80, 0, "I spent a lot of time improving KolibriN, so I hope you'll like it.");
  100.                                         WriteText(TEXTX, BLACK_H*2+55, 0x80, 0, "Please, donate as much as you can to help me further improve Kolibri,");
  101.                                         WriteText(TEXTX, BLACK_H*2+70, 0x80, 0, "the project I love so much. Visit my site for more information:");
  102.                                         DrawLink(TEXTX, BLACK_H*2+85, 0x80, 11, "http://kolibri-n.org/donate.php");
  103.         }
  104. }
  105.