Source

vlocity-vinstall-gambas / Vlocity / .svn / text-base / Step8.class.svn-base

Full commit
' Gambas class file
'    This file is part of vinstall-ng

'    vinstall-ng is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 2 of the License, or
'    (at your option) any later version.

'    vinstall-ng  is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with vinstall-ng.  If not, see <http://www.gnu.org/licenses/>.

PRIVATE PicInfo AS Picture
PRIVATE PicTask AS Picture
PRIVATE PicDisk AS Picture
PRIVATE PicPackage AS Picture
PRIVATE PicTlz AS Picture


PUBLIC SUB Form_Open()

  ME.tlbanner.Text = "<h2>" & tlbanner.text & "</h2>"
  PicInfo = Picture.load("images/info.png")
  PicTask = Picture.load("images/task-due.png")
  PicDisk = Picture.load("images/hdd.png")
  PicPackage = Picture.Load("images/package.png")
  PicTlz = Picture.Load("images/tlz.png")

  
  'ME.TreeView1.Clear()
  'ME.SUMMARIZE_DISTRO_INFO()
  'ME.SUMMARIZE_PARTITION_SELECTION()


END
PUBLIC FUNCTION GetNext() AS String
  
  MdlMain.ADVANCE_STATUS_TREE("Step3", "Step4")
  ' ClsGlobal.fRunningMainForm.listview1["Step4"].Picture = MdlStartUp.pNow
  ' ClsGlobal.fRunningMainForm.listview1["Step3"].picture = MdlStartUp.pDone
  
  
  RETURN "Step9"
  
END

PUBLIC SUB SUMMARIZE_DISTRO_INFO()
  
  WITH ME.TreeView1
    .Add("DistroInfo", ("Distribution"), MdlStartUp.pCategory)
    .Add("Distro0", Main.Install.Name & Space(1) & main.Install.Version, PicInfo, "DistroInfo")
    '.Add("Distro0", ClsGlobal.sDistroName & Space(1) & ClsGlobal.sDistroVer, PicInfo, "DistroInfo")
    '.Add("Distro0", ("Name"), PicInfo, "DistroInfo")
    '.Add("Distro00", Trim(ClsGlobal.sDistroName),, "Distro0")
    '.Add("Distro1", ("Version"), PicInfo, "DistroInfo")
    '.'Add("Distro10", Trim(ClsGlobal.sDistroVer),, "Distro1")
  END WITH 
  
END

PUBLIC SUB SUMMARIZE_PARTITION_SELECTION()
  DIM i, n AS Integer
  DIM item, sList, sPart, sMntPnt, sFs, sSwap, sSize AS String
  DIM sarr, sentry, sswaps AS String[]
  
    ME.TreeView1.Add("Part", ("Partitions to be used"), MdlStartUp.pCategory)
    
    FOR i = 0 TO main.Install.Partitions.Max
      item = main.Install.Partitions[i]
        sentry = Split(item, "-")
        sPart = sentry[0]
        sMntPnt = sentry[2]
        sSize = sentry[1]
        sfs = sentry[sentry.Max]
        TreeView1.Add("Part." & i, sPart & Space(5) & sSize, PicDisk, "Part")
          IF sfs = ("Not Formatted") THEN 
          '.Add("Part." & i, sPart & " -- " & sSize, PicDisk, "Part")
            TreeView1.Add("Part." & i & "." & i, ("Mount to") & Space(1) & sMntPnt & Space(5) & ("Leave unformatted"), PicTask, "Part." & i)
          ELSE IF sfs LIKE "swap" THEN 
            TreeView1.Add("Part." & i & "." & i, ("Swap space"), PicTask, "Part." & i)
          ELSE 
            TreeView1.Add("Part." & i & "." & i, ("Format to") & Space(1) & sfs & Space(1) & ("and mount to") & Space(1) & sMntPnt, PicTask, "Part." & i)
          END IF
    NEXT 

  'blank end means "not formmated"
  ' /dev/sdb5-20.0GB-/-
  ' /dev/sdc4-15.1GB-Swap-linux-swap
  
  
  
END

PRIVATE SUB Language_Summary()
  
  DIM sLang, sDesc AS String
  DIM i AS Integer
  ME.TreeView1.Add("Lang", ("Additional Language Packs"), MdlStartUp.pCategory)
  
  FOR EACH sLang IN main.LangPacks
    ME.TreeView1.Add("Lang" & i, sLang, PicPackage, "Lang")
    INC i
  NEXT 
  
END


PUBLIC SUB SUMMARIZE_INSTALL_TYPE()
  
  DIM sInsType, sList, sPkg, sBulkList, sBulk AS String
  DIM sBulks, sPkgs AS String[]
  DIM i AS Integer
  
  SELECT CASE ClsGlobal.iInstallMethod
    CASE 0
      sInsType = ("Full")
    CASE 1
      sInsType = ("Customized")
    CASE 2
      sInsType = ("Minimal")
  END SELECT 
  
  ME.TreeView1.Add("Install Type", ("Installation Method"), MdlStartUp.pCategory)
  ME.TreeView1.Add("Install Type.1", sInsType, PicInfo, "Install Type")
  
  ' if installation is customized... provide details
  IF ClsGlobal.iInstallMethod = 1 THEN 
    ME.TreeView1.Add("Software", ("Software Selection"), MdlStartUp.pCategory)
    ME.TreeView1.Add("Bulks", ("Major Components"),, "Software")
    
      ' sBulkList = ClsGlobal.sBulkListToInstall
      ' sBulks = Split(sBulkList, ",")
        'FOR i = 0 TO main.Install.Bulks.Max
        FOR EACH sBulk IN main.Install.Bulks
          'sBulk = Trim(main.Install.Bulks[i])
          'IF sBulk AND IF Exist(main.Install.SrcMnt &/ "veclinux" &/ sBulk) THEN 
            ME.TreeView1.Add(sBulk, sBulk, PicTlz, "Bulks")
          'END IF
        NEXT 
    IF main.Install.Packages.Count > 0 THEN 
    ME.TreeView1.Add("Pkgs", ("Additional Software"),, "Software")
    
      'sList = ClsGlobal.sPkgListToInstall
      ' sPkgs = Split(sList, ",")
        FOR i = 0 TO main.Install.Packages.Max
          sPkg = Trim(main.install.Packages[i])
            IF sPkg THEN 
              ME.TreeView1.Add(sPkg, sPkg, PicPackage, "Pkgs")
            END IF
        NEXT 
      END IF
          IF main.SelectedSrc.MultiDisk = TRUE AND main.Install.CD2Bulks.Count > 0 THEN 
              ME.TreeView1.Add("Bonus", ("Bonus Software"),, "Software")
                FOR i = 0 TO main.Install.CD2Bulks.Max
                  ME.TreeView1.Add(main.Install.CD2Bulks[i], main.Install.CD2Bulks[i], PicTlz, "Bonus")
                NEXT 
        END IF
    'Message(ME.TreeView1["Pkgs"].Children)
  END IF
    
  
END


PUBLIC SUB print_debug_summary()
  
  DIM s AS String
  DIM part AS String[]
  DIM i AS Integer
    SELECT CASE ClsGlobal.iInstallMethod
      CASE 0
        s = "Complete"
      CASE 1
        s = "Customized"
      CASE 2
        s = "Minimal"
    END SELECT 
  
  PRINT "READY TO BEGIN INSTALLING " & Main.Install.Name & Space(1) & main.Install.Version
  PRINT "INSTALL SUMMARY:"
  PRINT "Install Media type = " & main.SelectedSrc.Type
  IF main.SelectedSrc.IsISO THEN 
  PRINT "Installing from = " & main.SelectedSrc.IsoName & " from " & main.SelectedSrc.HostDevice
  ELSE 
    PRINT "Installing from = " & main.SelectedSrc.HostDevice
  END IF
  PRINT "Installation Method = " & s
  PRINT "PARTITIONS TO BE USED"
  PRINT "--------------------------"
   
    FOR i = 0 TO main.Install.Partitions.Max
      part = Split(main.Install.Partitions[i], "-") 'PRINT main.Install.Partitions[i]
      PRINT part[2] & Space(1) & "=" & Space(1) & part[0] & Space(5) & "Size:" & part[1]
    NEXT 
      
  
  
  
END


PUBLIC SUB OnExit()
  

  SELECT CASE ClsGlobal.iInstallMethod
    CASE 0
      'sInsType = ("Full")
      'MdlInstall.make_bulks_for_full_install() ' THIS IS HANDLED RIGHT AFTER EXITING THE INSTALL TYPE SELECTION WINDOW.
    CASE 1
      'sInsType = ("Customized")
      main.Install.BulkObjects.Clear()
      main.Install.CD2BulkObjects.Clear()
      MdlInstall.Create_Minimal_install_bulks()
      MdlInstall.create_Optionals_Bulk(FALSE)
      MdlInstall.created_selected_bulk_objects()
      MdlInstall.Create_Required_Bulks()
      MdlInstall.create_CD2_Bulk_Objects()
    CASE 2
      'sInsType = ("Minimal")
      MdlInstall.Create_Required_Bulks()
      MdlInstall.Create_Minimal_install_bulks()
  END SELECT 
  MdlMain.$pkgtotal = MdlInstall.Count_Package_Total()

  
  print_debug_summary()

  
END

PUBLIC SUB Expand_Tree()
  
  ME.TreeView1["DistroInfo"].Expanded = TRUE
  ME.TreeView1["Part"].Expanded = TRUE
  ME.TreeView1["Install Type"].Expanded = TRUE
    IF ME.TreeView1.Exist("Software") THEN 
    ME.TreeView1["Software"].Expanded = TRUE
  END IF
  
  
  ' MdlInstall.Create_Required_Bulks()
  ' MdlInstall.create_Optionals_Bulk() ' This is the bulk created from the OPTIONALS package.
  ' MdlInstall.create_CD2_Bulk_Objects()
END


PUBLIC SUB StartUp()
  ME.TreeView1.Clear()
  ME.SUMMARIZE_DISTRO_INFO()
  ME.SUMMARIZE_PARTITION_SELECTION()
  ME.SUMMARIZE_INSTALL_TYPE()
  IF main.LangPacks.Count > 0 THEN Language_Summary()
  ME.Expand_Tree()
  
END



PUBLIC SUB Form_Resize()

  TreeView1.Height = ME.ClientH - TreeView1.Top - 24  

END