Advertisement
AquaJD

[AOS] Main

Jan 29th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.94 KB | None | 0 0
  1. --[[
  2.  
  3.   AquaOS v1.51 - by AutoLocK and SSS
  4.   Copyright 2013
  5.  
  6.   This is the Main Screen!
  7.  
  8.   REQUIREMENTS:
  9.   - HTTP API needs to be enabled
  10.   - Computer Width = 51
  11.   - Computer Height = 19
  12.  
  13. --]]
  14.  
  15. themeWater = { 2048,8,512,1 }
  16. themeFire = { 16384,16,2,32768 }
  17. themeCarbon = { 32768,32,1,32 }
  18. themeGreyScale = { 32768,1,256,1 }
  19.  
  20. os.loadAPI("/AquaOS/Resources/APIs/QuickTils")
  21. os.loadAPI("/AquaOS/Resources/APIs/Settings")
  22. slc = 0
  23. contextX = 0
  24. contextY = 0
  25. version = "1.51"
  26. filePath = "/AquaOS/.Boot/Main"
  27. cFilePath = "/AquaOS/Resources/.control"
  28. bootPath = "/AquaOS/.Boot/"
  29. configPath = "/AquaOS/.cfg"
  30. lLayout = ".loginLayout"
  31.  
  32. sAliasBoot = {
  33.   "originalPos = '/AquaOS/Resources/.aosBoot/startup'",
  34.   "newPos = '/startup'",
  35.   "function mvFiles()",
  36.   " fs.delete('/startup')",
  37.   " fs.move(originalPos,newPos)",
  38.   " os.reboot()",
  39.   "end",
  40.   "mvFiles()"
  41. }
  42.  
  43. sBootContents = {
  44.   "term.clear()",
  45.   "term.setCursorPos(1,1)",
  46.   "term.setTextColor(colors.yellow)",
  47.   "print('CraftOS - launched by AquaOS')",
  48.   "term.setTextColor(colors.lightGray)",
  49.   "print('Type AOSReturn to return to AquaOS!')",
  50.   "shell.setAlias('AOSReturn','/AquaOS/Resources/.aosBoot/aliasFunc')"
  51. }
  52.  
  53. if not fs.exists(configPath) then
  54.   firstRun = true
  55. else
  56.   firstRun = false
  57. end
  58.  
  59. mainTitleText1 = "AquaOS"
  60. mainTitleText2 = "Launcher"
  61. mainBodyText1 = "version "..version..":   "
  62. mainBodyText2 = "Just a bugbuster update.."
  63. mainBodyText3 = "- Quick code-run-through "
  64. mainBodyText4 = "- Quick bug-fixing       "
  65. mainBodyText5 = "- Minor code changes     "
  66. mainBodyText6 = "OS assisted by QuickTils "
  67. mainBodyText7 = "Made by AutoLocK and SSS "
  68.  
  69. if firstRun == false then
  70.   configFile = Settings.openSettingsFile(configPath)
  71.   bGPic = configFile.getSectionedValue("Appearance","bGPic")
  72.   iCon1Text = configFile.getSectionedValue("Appearance","iCon1Text")
  73.   iCon1Pic = configFile.getSectionedValue("Appearance","iCon1Pic")
  74.   iCon1Link= configFile.getSectionedValue("Appearance","iCon1Link")
  75.   iCon2Text = configFile.getSectionedValue("Appearance","iCon2Text")
  76.   iCon2Pic = configFile.getSectionedValue("Appearance","iCon2Pic")
  77.   iCon2Link = configFile.getSectionedValue("Appearance","iCon2Link")
  78.   tBarCol = configFile.getSectionedValue("Appearance","tBarCol")
  79.   tBarTextCol = configFile.getSectionedValue("Appearance","tBarTextCol")
  80.   backColor = configFile.getSectionedValue("Appearance","backColor")
  81.   textColor = configFile.getSectionedValue("Appearance","textColor")
  82.   adminUser = configFile.getSectionedValue("Accounts","adminUser")
  83.   adminPass = configFile.getSectionedValue("Accounts","adminPass")
  84.   basicUser1 = configFile.getSectionedValue("Accounts","basicUser1")
  85.   basicPass1 = configFile.getSectionedValue("Accounts","basicPass1")
  86.   basicUser2 = configFile.getSectionedValue("Accounts","basicUser2")
  87.   basicPass2 = configFile.getSectionedValue("Accounts","basicPass2")
  88.   basicUser3 = configFile.getSectionedValue("Accounts","basicUser3")
  89.   basicPass3 = configFile.getSectionedValue("Accounts","basicPass3")
  90.   loginPass = configFile.getSectionedValue("Other","loginPass")
  91.   showIcons = configFile.getSectionedValue("Other","showIcons")
  92.   currentTheme = configFile.getSectionedValue("Other","currentTheme")
  93.   currentUser = configFile.getSectionedValue("Other","currentUser")
  94.   tBarCol = tonumber(tBarCol)
  95.   tBarTextCol = tonumber(tBarTextCol)
  96.   backColor = tonumber(backColor)
  97.   textColor = tonumber(textColor)
  98.   loginPass = tonumber(loginPass)
  99. elseif firstRun == true then
  100.   local file = fs.open(configPath,"w")
  101.   file.writeLine("[Appearance]".."\n")
  102.   file.writeLine("\n")
  103.   file.writeLine("[Accounts]".."\n")
  104.   file.writeLine("\n")
  105.   file.writeLine("[Other]".."\n")
  106.   file.writeLine("\n")
  107.   file.close()
  108.   configFile = Settings.openSettingsFile(configPath)
  109.   configFile.setSectionedValue("Appearance","bGPic",".mainBG")
  110.   configFile.setSectionedValue("Appearance","iCon1Text","LuaIDE")
  111.   configFile.setSectionedValue("Appearance","iCon1Pic",".icon")
  112.   configFile.setSectionedValue("Appearance","iCon1Link","LuaIDE")
  113.   configFile.setSectionedValue("Appearance","iCon2Text","File Browser")
  114.   configFile.setSectionedValue("Appearance","iCon2Pic",".iconFM")
  115.   configFile.setSectionedValue("Appearance","iCon2Link","FileManager")
  116.   configFile.setSectionedValue("Appearance","tBarCol","32768")
  117.   configFile.setSectionedValue("Appearance","tBarTextCol","32")
  118.   configFile.setSectionedValue("Appearance","backColor","1")
  119.   configFile.setSectionedValue("Appearance","textColor","32")
  120.   configFile.setSectionedValue("Accounts","adminUser","MUser")
  121.   configFile.setSectionedValue("Accounts","adminPass","MPass")
  122.   configFile.setSectionedValue("Accounts","basicUser1","User1")
  123.   configFile.setSectionedValue("Accounts","basicPass1","password")
  124.   configFile.setSectionedValue("Accounts","basicUser2","User2")
  125.   configFile.setSectionedValue("Accounts","basicPass2","password")
  126.   configFile.setSectionedValue("Accounts","basicUser3","User3")
  127.   configFile.setSectionedValue("Accounts","basicPass3","password")
  128.   configFile.setSectionedValue("Other","loginPass","0")
  129.   configFile.setSectionedValue("Other","showIcons","true")
  130.   configFile.setSectionedValue("Other","currentTheme","Carbon")
  131.   configFile.setSectionedValue("Other","currentUser","admin")
  132.   configFile.save(configPath)
  133. end
  134.  
  135. -- The Title Bar
  136. function titleBar()
  137.   QuickTils.cursor(1,1)
  138.   QuickTils.bColor(tBarCol)
  139.   QuickTils.color(tBarTextCol)
  140.   term.clearLine()
  141.   QuickTils.cursor(3,1)
  142.   print("[LOGOUT]")
  143.   QuickTils.cursor(19,1)
  144.   print("[APPLICATIONS]")
  145.   QuickTils.cursor(41,1)
  146.   print("[OPTIONS]")
  147. end
  148.  
  149. function lTitleBar()
  150.   QuickTils.cursor(1,1)
  151.   QuickTils.bColor(tBarCol)
  152.   QuickTils.color(tBarTextCol)
  153.   term.clearLine()
  154.   QuickTils.cursor(3,1)
  155.   print("[OPTIONS]")
  156.   QuickTils.cursor(41,1)
  157.   print("AOSLauncher")
  158. end
  159.  
  160. function fTitleBar()
  161.   QuickTils.cursor(1,1)
  162.   QuickTils.bColor(colors.lightBlue)
  163.   QuickTils.color(colors.white)
  164.   term.clearLine()
  165.   QuickTils.cursor(3,1)
  166.   print("AOS FirstRun")
  167.   QuickTils.cursor(41,1)
  168.   print("AOSLauncher")
  169. end
  170.  
  171. -- Returns to CraftOS
  172. function aosExit()
  173.   QuickTils.bColor(colors.black)
  174.   QuickTils.clean(1,1)
  175.   if not fs.exists("/AquaOS/Resources/.aosBoot") then
  176.     fs.makeDir("/AquaOS/Resources/.aosBoot")
  177.     local file = fs.open("/AquaOS/Resources/.aosBoot/aliasFunc","w")
  178.     for i=1,#sAliasBoot do
  179.       file.writeLine(sAliasBoot[i])
  180.     end
  181.     file.close()
  182.   end
  183.   fs.move("/startup","/AquaOS/Resources/.aosBoot/startup")
  184.   local file = fs.open("/startup","w")
  185.   for i=1,#sBootContents do
  186.     file.writeLine(sBootContents[i])
  187.   end
  188.   file.close()
  189.   os.reboot()
  190. end
  191.  
  192. -- The Desktop Layout
  193. function drawDesktop()
  194.   QuickTils.bColor(backColor)
  195.   term.clear()
  196.   bground = paintutils.loadImage("/AquaOS/Resources/.backgrounds/"..bGPic)
  197.   paintutils.drawImage(bground,-1,2)
  198.   if showIcons == "true" then
  199.     fileIcon1 = paintutils.loadImage("/AquaOS/Resources/.icons/"..iCon1Pic)
  200.     paintutils.drawImage(fileIcon1,3,3)
  201.     fileIcon2 = paintutils.loadImage("/AquaOS/Resources/.icons/"..iCon2Pic)
  202.     paintutils.drawImage(fileIcon2,40,3)
  203.     QuickTils.bColor(backColor)
  204.     QuickTils.cursor(2,7)
  205.     QuickTils.color(colors.red)
  206.     print("+")
  207.     QuickTils.bColor(backColor)
  208.     QuickTils.cursor(39,7)
  209.     print("+")
  210.     QuickTils.color(textColor)
  211.     QuickTils.cursor(3,8)
  212.     print(iCon1Text)
  213.     QuickTils.cursor(40,8)
  214.     print(iCon2Text)
  215.   end
  216.   titleBar()
  217. end
  218.  
  219. function lDrawDesktop()
  220.   QuickTils.bColor(backColor)
  221.   QuickTils.color(colors.black)
  222.   term.clear()
  223.   bGround = paintutils.loadImage("/AquaOS/Resources/.backgrounds/"..lLayout)
  224.   paintutils.drawImage(bGround,1,1)
  225.   QuickTils.bColor(backColor)
  226.   QuickTils.cursor(35,5)
  227.   QuickTils.color(colors.blue)
  228.   print(mainTitleText1.." "..version)
  229.   QuickTils.cursor(36,6)
  230.   QuickTils.color(colors.black)
  231.   print(mainTitleText2)
  232.   QuickTils.cursor(5,5)
  233.   QuickTils.color(colors.blue)
  234.   print(mainTitleText1)
  235.   QuickTils.cursor(5,6)
  236.   QuickTils.color(colors.black)
  237.   print(mainBodyText1)
  238.   QuickTils.cursor(5,8)
  239.   QuickTils.color(128)
  240.   print(mainBodyText2)
  241.   QuickTils.cursor(5,9)
  242.   print(mainBodyText3)
  243.   QuickTils.cursor(5,10)
  244.   print(mainBodyText4)
  245.   QuickTils.cursor(5,11)
  246.   print(mainBodyText5)
  247.   QuickTils.cursor(5,15)
  248.   QuickTils.color(colors.black)
  249.   print(mainBodyText6)
  250.   QuickTils.cursor(5,16)
  251.   QuickTils.color(256)
  252.   print(mainBodyText7)
  253.   QuickTils.cursor(35,10)
  254.   QuickTils.color(colors.orange)
  255.   print("|")
  256.   QuickTils.cursor(37,10)
  257.   QuickTils.color(colors.black)
  258.   print("User Login")
  259.   QuickTils.cursor(48,10)
  260.   QuickTils.color(colors.orange)
  261.   print("|")
  262.   QuickTils.cursor(35,9)
  263.   print("--------------")
  264.   QuickTils.cursor(35,11)
  265.   print("--------------")
  266.   QuickTils.cursor(34,13)
  267.   QuickTils.color(colors.black)
  268.   print("Username")
  269.   QuickTils.cursor(34,16)
  270.   print("Password")
  271.   QuickTils.cursor(34,14)
  272.   QuickTils.bColor(colors.gray)
  273.   print("                ")
  274.   QuickTils.cursor(34,17)
  275.   QuickTils.bColor(colors.gray)
  276.   print("                ")
  277.   lTitleBar()
  278. end
  279.  
  280. -- Menu 1
  281. function drawMenu1()
  282.   QuickTils.color(textColor)
  283.   QuickTils.bColor(tBarCol)
  284.   QuickTils.cursor(1,2)
  285.   print("           ")
  286.   QuickTils.cursor(1,3)
  287.   print(" Shutdown  ")
  288.   QuickTils.cursor(1,4)
  289.   print(" Restart   ")
  290.   QuickTils.cursor(1,5)
  291.   print(" CraftOS   ")
  292.   QuickTils.cursor(1,6)
  293.   print("           ")
  294. end
  295.  
  296. function lDrawMenu1()
  297.   QuickTils.color(textColor)
  298.   QuickTils.bColor(tBarCol)
  299.   QuickTils.cursor(1,2)
  300.   print("          ")
  301.   QuickTils.cursor(1,3)
  302.   print(" Shutdown ")
  303.   QuickTils.cursor(1,4)
  304.   print(" Restart  ")
  305.   QuickTils.cursor(1,5)
  306.   print("          ")
  307. end
  308.  
  309. -- Menu 2
  310. function drawMenu2()
  311.   QuickTils.bColor(tBarCol)
  312.   QuickTils.color(textColor)
  313.   QuickTils.cursor(contextX,contextY)
  314.   print("             ")
  315.   QuickTils.cursor(contextX,contextY+1)
  316.   print(" edit AquaOS ")
  317.   QuickTils.cursor(contextX,contextY+2)
  318.   print(" Preferences ")
  319.   QuickTils.cursor(contextX,contextY+3)
  320.   print("             ")
  321. end
  322.  
  323. -- Menu 3
  324. function drawMenu3(iX,iY)
  325.   QuickTils.bColor(tBarCol)
  326.   QuickTils.color(textColor)
  327.   QuickTils.cursor(iX,iY)
  328.   print("          ")
  329.   QuickTils.cursor(iX,iY+1)
  330.   print(" Rename   ")
  331.   QuickTils.cursor(iX,iY+2)
  332.   print(" Re-Paint ")
  333.   QuickTils.cursor(iX,iY+3)
  334.   print(" Re-Link  ")
  335.   QuickTils.cursor(iX,iY+4)
  336.   print("          ")
  337. end
  338.  
  339. -- Menu 4
  340. function drawMenu4()
  341.   QuickTils.bColor(tBarCol)
  342.   QuickTils.color(textColor)
  343.   QuickTils.cursor(40,2)
  344.   print("            ")
  345.   QuickTils.cursor(40,3)
  346.   print("   About    ")
  347.   QuickTils.cursor(40,4)
  348.   print(" Ctrl Panel ")
  349.   QuickTils.cursor(40,5)
  350.   print("            ")
  351. end
  352.  
  353. -- Menu 5
  354. function drawMenu5()
  355.   QuickTils.bColor(tBarCol)
  356.   QuickTils.color(textColor)
  357.   QuickTils.cursor(19,2)
  358.   print("             ")
  359.   QuickTils.cursor(19,3)
  360.   print("   LuaIDE    ")
  361.   QuickTils.cursor(19,4)
  362.   print("  NPaintPro  ")
  363.   QuickTils.cursor(19,5)
  364.   print(" FileBrowser ")
  365.   QuickTils.cursor(19,6)
  366.   print("             ")
  367. end
  368.  
  369. -- Main Desktop
  370. function mainDesktop()
  371. drawDesktop()
  372. while true do
  373.   local event,button,X,Y = os.pullEventRaw()
  374.   if slc == 0 then
  375.     if event == "mouse_click" then
  376.       if X>=3 and X<=13 and Y==1 and button==1 then
  377.         drawMenu1()
  378.         slc = 1
  379.       elseif X>=41 and X<=49 and Y==1 and button==1 then
  380.         drawMenu4()
  381.         slc = 6
  382.       elseif X>=19 and X<=32 and Y==1 and button==1 then
  383.         drawMenu5()
  384.         slc = 7
  385.       elseif X>=3 and X<=6 and button==1 and Y>=3 and Y<=5 then
  386.         shell.run("/AquaOS/Resources/Apps/"..iCon1Link)
  387.         return
  388.         shell.run(filePath)
  389.       elseif X>=40 and X<=44 and button==1 and Y>=3 and Y<=5 then
  390.         shell.run("/AquaOS/Resources/Apps/"..iCon2Link)
  391.         return
  392.         shell.run(filePath)
  393.       elseif X >=1 and Y >=2 and button==2 then slc = 2
  394.         if X >=38 then
  395.           contextX = 38
  396.         end
  397.         if Y >=14 then
  398.           contextX = 14
  399.         end
  400.         if X <=38 then
  401.           contextX = X
  402.         end
  403.         if Y <=14 then
  404.           contextY = Y
  405.         end
  406.         drawMenu2()
  407.       elseif X==2 and Y==7 and button==1 then slc = 3
  408.         drawMenu3(2,7)
  409.       elseif X==39 and Y==7 and button==1 then slc = 4
  410.         drawMenu3(39,7)
  411.       end
  412.     end
  413.   elseif slc == 1 then
  414.     if X>=2 and X<=9 and button==1 and Y==3 then slc=0
  415.       configFile.setSectionedValue("Other","loginPass","0")
  416.       configFile.save(configPath)
  417.       os.shutdown()
  418.     elseif X>=2 and X<=9 and button==1 and Y==4 then slc=0
  419.       configFile.setSectionedValue("Other","loginPass","0")
  420.       configFile.save(configPath)
  421.       os.reboot()
  422.     elseif X>=2 and X<=9 and button==1 and Y==5 then slc=0
  423.       configFile.setSectionedValue("Other","loginPass","0")
  424.       configFile.save(configPath)
  425.       aosExit()
  426.       break
  427.     else
  428.       slc = 0
  429.       drawDesktop()
  430.     end
  431.   elseif slc == 2 then
  432.     if X >= contextX and X <= contextX+13 and Y ==contextY+1 and button==1 then slc = 0
  433.       if admin == true then
  434.         shell.run("edit",filePath)
  435.         return
  436.         shell.run(filePath)
  437.       end
  438.     elseif X >= contextX and X <= contextX+13 and Y==contextY+2 and button == 1 then slc = 0
  439.       if admin == true then
  440.         shell.run("edit",configPath)
  441.         shell.run(filePath)
  442.       end
  443.     else
  444.       slc = 0
  445.       drawDesktop()
  446.     end
  447.   elseif slc == 3 then
  448.     if X >=2 and X <=10 and Y == 8 and button == 1 then
  449.       drawDesktop()
  450.       QuickTils.color(256)
  451.       QuickTils.bColor(backColor)
  452.       QuickTils.cursor(2,8)
  453.       print("          ")
  454.       QuickTils.cursor(2,8)
  455.       local txtInput = read()
  456.       configFile.setSectionedValue("Appearance","iCon1Text",txtInput)
  457.       configFile.save(configPath)
  458.       shell.run(filePath)
  459.     elseif X >=2 and X <=10 and Y == 9 and button == 1 then
  460.       drawDesktop()
  461.       QuickTils.bColor(tBarCol)
  462.       QuickTils.cursor(16,7)
  463.       print("    [CHANGE ICON]     ")
  464.       QuickTils.bColor(128)
  465.       lY = 8
  466.       for i=1,3 do
  467.         QuickTils.cursor(16,lY)
  468.         print("                      ")
  469.         lY = lY+1
  470.       end
  471.       QuickTils.bColor(256)
  472.       QuickTils.cursor(17,9)
  473.       print("                    ")
  474.       QuickTils.cursor(17,9)
  475.       QuickTils.color(textColor)
  476.       write("Path: ")
  477.       local picInput = read()
  478.       if not picInput == "" then
  479.         if fs.exists("/AquaOS/Resources/.icons/"..picInput) then
  480.           configFile.setSectionedValue("Appearance","iCon1Pic",picInput)
  481.           configFile.save(configPath)
  482.         end
  483.       end
  484.       shell.run(filePath)
  485.     elseif X >=2 and X <=10 and Y == 10 and button == 1 then
  486.       drawDesktop()
  487.       QuickTils.bColor(tBarCol)
  488.       QuickTils.cursor(16,7)
  489.       print("    [CHANGE ICON]     ")
  490.       QuickTils.bColor(128)
  491.       lY = 8
  492.       for i=1,3 do
  493.         QuickTils.cursor(16,lY)
  494.         print("                      ")
  495.         lY = lY+1
  496.       end
  497.       QuickTils.bColor(256)
  498.       QuickTils.cursor(17,9)
  499.       print("                    ")
  500.       QuickTils.cursor(17,9)
  501.       QuickTils.color(textColor)
  502.       write("Path: ")
  503.       local lnkInput = read()
  504.       if fs.exists("/AquaOS/Resources/Apps/"..lnkInput) then
  505.         configFile.setSectionedValue("Appearance","iCon1Link",lnkInput)
  506.         configFile.save(configPath)
  507.       end
  508.       shell.run(filePath)
  509.     else
  510.       slc = 0
  511.       drawDesktop()
  512.     end
  513.   elseif slc == 4 then
  514.     if X >=39 and X <=49 and Y == 8 and button == 1 then
  515.       drawDesktop()
  516.       QuickTils.color(256)
  517.       QuickTils.bColor(backColor)
  518.       QuickTils.cursor(40,8)
  519.       print("          ")
  520.       QuickTils.cursor(40,8)
  521.       local txtInput2 = read()
  522.       configFile.setSectionedValue("Appearance","iCon2Text",txtInput2)
  523.       configFile.save(configPath)
  524.       shell.run(filePath)
  525.     elseif X >=39 and X <=49 and Y == 9 and button == 1 then
  526.       drawDesktop()
  527.       QuickTils.bColor(tBarCol)
  528.       QuickTils.cursor(16,7)
  529.       print("    [CHANGE ICON]     ")
  530.       QuickTils.bColor(128)
  531.       lY = 8
  532.       for i=1,3 do
  533.         QuickTils.cursor(16,lY)
  534.         print("                      ")
  535.         lY = lY+1
  536.       end
  537.       QuickTils.bColor(256)
  538.       QuickTils.cursor(17,9)
  539.       print("                    ")
  540.       QuickTils.cursor(17,9)
  541.       QuickTils.color(textColor)
  542.       write("Path: ")
  543.       local picInput2 = read()
  544.       if not picInput2 == "" then
  545.         if fs.exists("/AquaOS/Resources/.icons/"..picInput2) then
  546.         configFile.setSectionedValue("Appearance","iCon2Pic",picInput2)
  547.         configFile.save(configPath)
  548.         end
  549.       end
  550.       shell.run(filePath)
  551.     elseif X >=39 and X <=49 and Y == 10 and button == 1 then
  552.       drawDesktop()
  553.       QuickTils.bColor(tBarCol)
  554.       QuickTils.cursor(16,7)
  555.       print("    [CHANGE ICON]     ")
  556.       QuickTils.bColor(128)
  557.       lY = 8
  558.       for i=1,3 do
  559.         QuickTils.cursor(16,lY)
  560.         print("                      ")
  561.         lY = lY+1
  562.       end
  563.       QuickTils.bColor(256)
  564.       QuickTils.cursor(17,9)
  565.       print("                    ")
  566.       QuickTils.cursor(17,9)
  567.       QuickTils.color(textColor)
  568.       write("Path: ")
  569.       local lnkInput2 = read()
  570.       if fs.exists("/AquaOS/Resources/Apps/"..lnkInput2) then
  571.         configFile.setSectionedValue("Appearance","iCon2Link",lnkInput2)
  572.         configFile.save(configPath)
  573.       end
  574.       shell.run(filePath)        
  575.     else
  576.       slc = 0
  577.       drawDesktop()
  578.     end      
  579.   elseif slc == 6 then
  580.     if X>=40 and X<=50 and Y==3 and button==1 then
  581.       shell.run("/AquaOS/Resources/.about")
  582.       break
  583.     elseif X>=40 and X<=50 and Y==4 and button==1 then
  584.       shell.run(cFilePath)
  585.       break
  586.     else
  587.       slc = 0
  588.       drawDesktop()
  589.     end
  590.   elseif slc == 7 then
  591.     if X>=19 and X<=31 and Y==3 and button==1 then
  592.       shell.run("/AquaOS/Resources/Apps/LuaIDE")
  593.       return
  594.       shell.run(filePath)
  595.     elseif X>=19 and X<=31 and Y==4 and button==1 then
  596.       drawDesktop()
  597.       QuickTils.bColor(tBarCol)
  598.       QuickTils.cursor(16,7)
  599.       print("     [NPAINTPRO]     ")
  600.       QuickTils.bColor(128)
  601.       lY = 8
  602.       for i=1,3 do
  603.         QuickTils.cursor(16,lY)
  604.         print("                     ")
  605.         lY = lY+1
  606.       end
  607.       QuickTils.bColor(256)
  608.       QuickTils.cursor(17,9)
  609.       print("                   ")
  610.       QuickTils.cursor(17,9)
  611.       QuickTils.color(textColor)
  612.       write("Path: ")
  613.       local paintFile = read()
  614.       if not fs.exists(paintFile) then
  615.         shell.run("/AquaOS/Resources/Apps/NPaintPro","-t "..paintFile)
  616.       end
  617.       return
  618.       shell.run(filePath)
  619.     elseif X>=19 and X<=31 and Y==5 and button==1 then
  620.       shell.run("/AquaOS/Resources/Apps/FileManager")
  621.       return
  622.       shell.run(filePath)
  623.     else
  624.       slc = 0
  625.       drawDesktop()
  626.     end
  627.   end
  628. end
  629. end
  630.  
  631.  
  632. -- The Launcher Desktop
  633. function lMainDesktop()
  634. lDrawDesktop()
  635. while true do
  636.   local event,button,X,Y = os.pullEventRaw()
  637.   if slc == 0 then
  638.     if event == "mouse_click" then
  639.       if X>=34 and X<=50 and Y==14 and button==1 then
  640.         QuickTils.bColor(colors.gray)
  641.         QuickTils.color(textColor)
  642.         QuickTils.cursor(34,14)
  643.         local userInput = read()
  644.         QuickTils.cursor(34,17)
  645.         local passInput = read("*")
  646.         if userInput == adminUser and passInput == adminPass then
  647.           admin = true
  648.           lDrawDesktop()
  649.           QuickTils.bColor(backColor)
  650.           QuickTils.color(colors.lime)
  651.           QuickTils.cursor(35,18)
  652.           print("Welcome.")
  653.           configFile.setSectionedValue("Other","loginPass","1")
  654.           configFile.setSectionedValue("Other","currentUser","admin")
  655.           configFile.save(configPath)
  656.           sleep(3)
  657.           shell.run(filePath)
  658.           break
  659.         elseif userInput == basicUser1 and passInput == basicPass1 then
  660.           admin = false
  661.           lDrawDesktop()
  662.           QuickTils.bColor(backColor)
  663.           QuickTils.color(colors.lime)
  664.           QuickTils.cursor(35,18)
  665.           print("Welcome.")
  666.           configFile.setSectionedValue("Other","loginPass","1")
  667.           configFile.setSectionedValue("Other","currentUser","user1")
  668.           configFile.save(configPath)
  669.           sleep(3)
  670.           shell.run(filePath)
  671.           break
  672.         elseif userInput == basicUser2 and passInput == basicPass2 then
  673.           admin = false
  674.           lDrawDesktop()
  675.           QuickTils.bColor(backColor)
  676.           QuickTils.color(colors.lime)
  677.           QuickTils.cursor(35,18)
  678.           print("Welcome.")
  679.           configFile.setSectionedValue("Other","loginPass","1")
  680.           configFile.setSectionedValue("Other","currentUser","user2")
  681.           configFile.save(configPath)
  682.           sleep(3)
  683.           shell.run(filePath)
  684.           break
  685.         elseif userInput == basicUser3 and passInput == basicPass3 then
  686.           admin = false
  687.           lDrawDesktop()
  688.           QuickTils.bColor(backColor)
  689.           QuickTils.color(colors.lime)
  690.           QuickTils.cursor(35,18)
  691.           print("Welcome.")
  692.           sleep(3)
  693.           configFile.setSectionedValue("Other","loginPass","1")
  694.           configFile.setSectionedValue("Other","currentUser","user3")
  695.           configFile.save(configPath)
  696.           shell.run(filePath)
  697.           break
  698.         else
  699.           lDrawDesktop()
  700.           QuickTils.bColor(backColor)
  701.           QuickTils.color(colors.red)
  702.           QuickTils.cursor(35,18)
  703.           print("Invalid.")
  704.         end
  705.       elseif X>=3 and X<=11 and Y==1 and button==1 then
  706.         lDrawMenu1()
  707.         slc = 1
  708.       else
  709.         lDrawDesktop()
  710.       end
  711.     end
  712.   elseif slc == 1 then
  713.     if X>=2 and X<=9 and button==1 and Y==3 then slc=0
  714.       configFile.setSectionedValue("Other","loginPass","0")
  715.       configFile.save(configPath)
  716.       return
  717.       os.shutdown()
  718.     elseif X>=2 and X<=9 and button==1 and Y==4 then slc=0
  719.       configFile.setSectionedValue("Other","loginPass","0")
  720.       configFile.save(configPath)
  721.       return
  722.       os.reboot()
  723.     else
  724.       slc = 0
  725.       lDrawDesktop()
  726.     end
  727.   end
  728. end
  729. end
  730.  
  731. if firstRun == true then
  732.   QuickTils.bColor(colors.white)
  733.   QuickTils.clean(1,1)
  734.   fTitleBar()
  735.   QuickTils.bColor(colors.white)
  736.   QuickTils.color(colors.black)
  737.   QuickTils.cursor(20,4)
  738.   print("Admin Username:")
  739.   QuickTils.cursor(20,8)
  740.   print("Admin Password:")
  741.   QuickTils.bColor(colors.gray)
  742.   QuickTils.cursor(20,5)
  743.   print("               ")
  744.   QuickTils.cursor(20,9)
  745.   print("               ")
  746.   QuickTils.cursor(20,5)
  747.   QuickTils.color(colors.lightGray)
  748.   local userInput = read()
  749.   QuickTils.cursor(20,9)
  750.   local passInput = read("*")
  751.   configFile.setSectionedValue("Accounts","adminUser",userInput)
  752.   configFile.setSectionedValue("Accounts","adminPass",passInput)
  753.   configFile.save(configPath)
  754.   shell.run(filePath)
  755. elseif firstRun == false then
  756.   QuickTils.bColor(backColor)
  757.   QuickTils.clean(1,1)
  758.   if loginPass == 0 then
  759.     lMainDesktop()
  760.   elseif loginPass == 1 then
  761.     mainDesktop()
  762.   else
  763.     error("I don't know how to start!")
  764.   end
  765. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement