Subversion Repositories Kolibri OS

Rev

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