Subversion Repositories Kolibri OS

Rev

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.         RunProgram("/sys/media/kiv", "\\S__/tmp9/1/wallpapers/Retro flower.jpg");
  71.         SetSystemSkin("/tmp9/1/skins/latte.skn");
  72.         EndLoop();
  73. }
  74.  
  75.  
  76. void EndLoop()
  77. {
  78.         byte id, key;
  79.  
  80.         goto _END_DRAW;
  81.    
  82.         loop() switch(WaitEvent())
  83.         {                                                  
  84.                         case evButton:
  85.                                         id=GetButtonID();
  86.                                         if(id == 1) ExitProcess();
  87.                                         if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
  88.                                         if (id == 10) ExitProcess();
  89.                                         break;
  90.                         case evKey:
  91.                                         key = GetKey();
  92.                                         break;
  93.                                    
  94.                         case evReDraw: _END_DRAW:
  95.                                         if !(DefineWindow("Installation complete", "Exit")) break;
  96.                                         WriteText(TEXTX, BLACK_H*2, 0x80, 0, "KolibriN install complete.");
  97.                                         WriteText(TEXTX, BLACK_H*2+40, 0x80, 0, "I spent a lot of time improving KolibriN, so I hope you'll like it.");
  98.                                         WriteText(TEXTX, BLACK_H*2+55, 0x80, 0, "Please, donate as much as you can to help me further improve Kolibri,");
  99.                                         WriteText(TEXTX, BLACK_H*2+70, 0x80, 0, "the project I love so much. Visit my site for more information:");
  100.                                         DrawLink(TEXTX, BLACK_H*2+85, 0x80, 11, "http://kolibri-n.org/donate.php");
  101.         }
  102. }
  103.