diff --git a/.lang/.pot b/.lang/.pot index 6f5cf87..723899b 100644 --- a/.lang/.pot +++ b/.lang/.pot @@ -292,7 +292,7 @@ msgstr "" msgid "Advanced selection" msgstr "" -#: frmPackages.class:147 frmPartitions.class:266 +#: frmPackages.class:147 frmPartitions.class:265 msgid "Manual" msgstr "" @@ -373,7 +373,7 @@ msgid "" "\n" msgstr "" -#: frmPartitions.class:217 +#: frmPartitions.class:216 msgid "" "

Available partitioning modes:

\n" "\n" @@ -384,8 +384,8 @@ msgid "" "disk for VL. WARNING: this option will DELETE " "everything on your hard disk, or offer a choice if there are multiple disks. " "You have been WARNED.\n" -"
  • Free space: using available free (unpartitioned) disk space.\n" +"
  • Unpartitioned space: using available free (unpartitioned) disk " +"space.
  • \n" "\n" "Manual partitioning: You have full control of partitioning.\n" "\n" msgstr "" -#: frmPartitions.class:229 +#: frmPartitions.class:228 msgid "Partitioning mode" msgstr "" -#: frmPartitions.class:244 +#: frmPartitions.class:243 msgid "Automatic" msgstr "" -#: frmPartitions.class:251 +#: frmPartitions.class:250 msgid "Full disk" msgstr "" -#: frmPartitions.class:259 -msgid "Free space" +#: frmPartitions.class:258 +msgid "Unpartitioned space" msgstr "" -#: frmPartitions.class:273 +#: frmPartitions.class:272 msgid "GParted" msgstr "" -#: frmPartitions.class:281 +#: frmPartitions.class:280 msgid "cfdisk" msgstr "" -#: frmPartitions.class:288 +#: frmPartitions.class:287 msgid "Others" msgstr "" -#: frmPartitions.class:295 +#: frmPartitions.class:294 msgid "Preset strategies" msgstr "" -#: frmPartitions.class:303 +#: frmPartitions.class:302 msgid "No partitioning" msgstr "" diff --git a/.lang/frmPartitions.pot b/.lang/frmPartitions.pot index 18261ec..52c9c8a 100644 --- a/.lang/frmPartitions.pot +++ b/.lang/frmPartitions.pot @@ -14,47 +14,47 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: frmPartitions.class:217 -msgid "

    Available partitioning modes:

    \n\nAutomatic partitioning: The installer will handle all partition related decisions for you:\n\nManual partitioning: You have full control of partitioning.\n\nOther partitioning:\n\n" +#: frmPartitions.class:216 +msgid "

    Available partitioning modes:

    \n\nAutomatic partitioning: The installer will handle all partition related decisions for you:\n\nManual partitioning: You have full control of partitioning.\n\nOther partitioning:\n\n" msgstr "" -#: frmPartitions.class:229 +#: frmPartitions.class:228 msgid "Partitioning mode" msgstr "" -#: frmPartitions.class:244 +#: frmPartitions.class:243 msgid "Automatic" msgstr "" -#: frmPartitions.class:251 +#: frmPartitions.class:250 msgid "Full disk" msgstr "" -#: frmPartitions.class:259 -msgid "Free space" +#: frmPartitions.class:258 +msgid "Unpartitioned space" msgstr "" -#: frmPartitions.class:266 +#: frmPartitions.class:265 msgid "Manual" msgstr "" -#: frmPartitions.class:273 +#: frmPartitions.class:272 msgid "GParted" msgstr "" -#: frmPartitions.class:281 +#: frmPartitions.class:280 msgid "cfdisk" msgstr "" -#: frmPartitions.class:288 +#: frmPartitions.class:287 msgid "Others" msgstr "" -#: frmPartitions.class:295 +#: frmPartitions.class:294 msgid "Preset strategies" msgstr "" -#: frmPartitions.class:303 +#: frmPartitions.class:302 msgid "No partitioning" msgstr "" diff --git a/.project b/.project index cf491e7..3541fb9 100644 --- a/.project +++ b/.project @@ -2,7 +2,7 @@ Title=VL-gui-installer Startup=Main Icon=vl_logo_icon2.png -Version=0.0.238 +Version=0.0.254 Library=gb.qt Library=gb.qt.ext TabSize=3 diff --git a/.settings b/.settings index 5f543f1..52b4402 100644 --- a/.settings +++ b/.settings @@ -2,7 +2,7 @@ Count=0 [FFind] -SearchIn="Module" +SearchIn="Sub" CaseSensitive=True SearchWord=False SearchComment=False diff --git a/Functions.module b/Functions.module index c4da424..c1944a8 100644 --- a/Functions.module +++ b/Functions.module @@ -232,6 +232,7 @@ DIM sTemp AS String DIM sTemp2 AS String DIM sFreeBlocks AS String DIM sBlockSize AS String +DIM sUsedBlocks AS String DIM arrTemp AS NEW String[] DIM iFreeBytes AS Long @@ -281,21 +282,22 @@ ELSE IF sFilesystem = "NTFS" THEN SHELL "ntfsresize --info --force --no-progress-bar " & sDevice TO sTemp sTemp = Trim$(sTemp) arrTemp = Split(sTemp, Chr$(10)) - PRINT arrTemp[10] 'It would be a lot easier to use an expression in the output of ntfsresize to identify the number of free bytes, but that is not i18n ready! 'So "chomp" away portions of the string until the first integer is found (this will be the free space value) sTemp = arrTemp[10] WHILE Len(sTemp) > 0 sTemp2 = Trim$(Left$(sTemp, InStr(sTemp, Space$(1)))) IF IsInteger(Val(sTemp2)) OR IsLong(Val(sTemp2)) THEN - sFreeBlocks = CLng(Val(sTemp2)) + sUsedBlocks = CLng(Val(sTemp2)) BREAK ELSE sTemp = Trim$(Mid$(sTemp, InStr(sTemp, Space$(1)))) ENDIF WEND - sBlockSize = Trim$(Mid$(Left$(arrTemp[3], RInStr(arrTemp[3], Space$(1))), InStr(arrTemp[3], ":") + 1)) - iFreeBytes = CLng(sFreeBlocks) * CLng(sBlockSize) + 'sBlockSize = Trim$(Mid$(Left$(arrTemp[3], RInStr(arrTemp[3], Space$(1))), InStr(arrTemp[3], ":") + 1)) + sTemp = Trim$(Mid$(arrTemp[5], InStr(arrTemp[5], ":") + 1)) 'Get total partition size + sTemp2 = Trim$(Left(sTemp, InStr(sTemp, Space$(1)))) + iFreeBytes = CLng(sTemp2) - CLng(sUsedBlocks) ELSE iFreeBytes = 0 ENDIF diff --git a/Global.class b/Global.class index 63d813c..ae0d705 100644 --- a/Global.class +++ b/Global.class @@ -31,7 +31,7 @@ STATIC PUBLIC enumPACKS AS Long 'Package selection mode. ' 3 = No extras STATIC PUBLIC enumPARTMODE AS Long 'Partitioning mode. ' 0 = Full disk -' 1 = Free space +' 1 = Unpartitioned space ' 2 = GParted ' 3 = cfdisk ' 4 = Preset strategies diff --git a/Utils.module b/Utils.module index 689e3b4..3525c8b 100644 --- a/Utils.module +++ b/Utils.module @@ -56,20 +56,22 @@ ELSE ENDIF ' Parse what fdisk has to say: -Parse_fdisk(sTemp) -'Get filesystem data -'getFileSystems() +ProcessDiskInfo(sTemp) + END -PUBLIC SUB Parse_fdisk(sTemp AS String) -' Parse what fdisk has to say: +PUBLIC SUB ProcessDiskInfo(sTemp AS String) +' Parse what fdisk has to say, including other commands for useful hard-drive/partition information DIM vDI AS NEW cDiskInfo DIM vPI AS NEW cPartInfo DIM arrTemp1 AS NEW String[] DIM arrTemp2 AS NEW String[] DIM arrTemp3 AS NEW String[] DIM sTemp2 AS String +DIM iDisk AS Long +DIM iPart AS Long +DIM iDiskUsedBytes AS Long DIM pos AS Long DIM n AS Long, m AS Long DIM pcounter AS Long @@ -79,7 +81,7 @@ IF Global.DebugMode = TRUE THEN message.Info("Working in Simulation Mode..." & gb.NewLine & sTemp) ENDIF -' Parse it: +' Parse fdisk arrTemp1 = Split(sTemp, Chr$(10)) FOR n = 0 TO arrTemp1.Max pos = InStr(arrTemp1[n], "/dev/") @@ -110,6 +112,7 @@ FOR n = 0 TO arrTemp1.Max vPI.ID = arrTemp2[4] ENDIF + 'Get filesystem information from "disktype" IF Functions.getPartType(vPI.ID) = "Extended" THEN vPI.FileSystem = "Extended" ELSE IF Functions.getPartType(vPI.ID) = "HPFS/NTFS" THEN @@ -121,7 +124,12 @@ FOR n = 0 TO arrTemp1.Max vPI.FileSystem = Trim$(Left$(arrTemp3[2], InStr(arrTemp3[2], Space$(1)))) ENDIF - vPI.FreeBytes = Functions.getFreePartSpace(vPI.Device, vPI.FileSystem) + 'Get free space information for each partition based on the filesystem + IF vPI.FileSystem = "Blank" THEN + vPI.FreeBytes = vPI.Bytes + ELSE + vPI.FreeBytes = Functions.getFreePartSpace(vPI.Device, vPI.FileSystem) + ENDIF Global.PartInfo.Push(vPI) ELSE IF pos > 1 ' Parse a disk drive. @@ -133,11 +141,29 @@ FOR n = 0 TO arrTemp1.Max ELSE vDI.Bytes = Val(arrTemp2[3]) ENDIF + Global.DiskInfo.Push(vDI) ELSE ' Nothing. END IF NEXT +'Get unallocated space on the hard-drives (it would be cool to have this in the main FOR loop... +'but its only possible after knowing each partiton's size) +FOR iDisk = 0 TO Global.DiskInfo.Max + iDiskUsedBytes = 0 'Reset the used-bytes counter + FOR iPart = 0 TO Global.PartInfo.Max + IF InStr(Global.PartInfo[iPart].Device, Global.DiskInfo[iDisk].Device) THEN + IF Global.PartInfo[iPart].FileSystem <> "Extended" THEN 'Ignore extended partitions, only account for primary and logical ones + iDiskUsedBytes = iDiskUsedBytes + Global.PartInfo[iPart].Bytes + ENDIF + ENDIF + NEXT + Global.DiskInfo[iDisk].UnallocatedBytes = Global.DiskInfo[iDisk].Bytes - iDiskUsedBytes + PRINT global.DiskInfo[iDisk].UnallocatedBytes +NEXT + + + ' 4 debug: IF Global.DebugMode = TRUE THEN FOR n = 0 TO Global.DiskInfo.Max diff --git a/cDiskInfo.class b/cDiskInfo.class index 263af34..e408258 100644 --- a/cDiskInfo.class +++ b/cDiskInfo.class @@ -3,3 +3,4 @@ ' Structure for drive information array: PUBLIC Device AS String PUBLIC Bytes AS Long +PUBLIC UnallocatedBytes AS Long diff --git a/frmPartSelect.class b/frmPartSelect.class index 5b0e51b..ad380f2 100644 --- a/frmPartSelect.class +++ b/frmPartSelect.class @@ -24,9 +24,9 @@ Global.PARTinst.Clear gridDisk.Columns.Count = 4 'gridDisk.Rows.Count = MaxDisks gridDisk.Rows.Count = 32 -gridDisk.Columns[0].Width = 0.4 * gridDisk.ClientWidth +gridDisk.Columns[0].Width = 0.35 * gridDisk.ClientWidth gridDisk.Columns[1].Width = 0.25 * gridDisk.ClientWidth -gridDisk.Columns[2].Width = 0.2 * gridDisk.ClientWidth +gridDisk.Columns[2].Width = 0.25 * gridDisk.ClientWidth gridDisk.Columns[3].Width = 0.15 * gridDisk.ClientWidth 'Center gridDisk titles alignment: @@ -37,7 +37,7 @@ NEXT 'Setup gridDisk titles: gridDisk[0, 0].Text = "Drive" gridDisk[0, 1].Text = "Size" -gridDisk[0, 2].Text = "Units" +gridDisk[0, 2].Text = "Unallocated" gridDisk[0, 3].Text = "Sel." 'Set gridDisk cell alignment; left for text, right for numbers, fill in gridDisk data: @@ -46,11 +46,11 @@ FOR m = 1 TO MaxDisks gridDisk.Rows[m].Height = 20 gridDisk[m, 0].Text = Global.DiskInfo[m - 1].Device gridDisk[m, 1].Alignment = Align.Right - gridDisk[m, 1].Text = Global.DiskInfo[m - 1].Bytes - arrTemp = Split(Functions.AutoUnits(Global.DiskInfo[m - 1].Bytes), " ", "", TRUE) - gridDisk[m, 1].Text = arrTemp[0] - gridDisk[m, 2].Alignment = Align.Left - gridDisk[m, 2].Text = arrTemp[1] + gridDisk[m, 1].Text = Functions.AutoUnits(Global.DiskInfo[m - 1].Bytes) + 'arrTemp = Split(Functions.AutoUnits(Global.DiskInfo[m - 1].Bytes), " ", "", TRUE) + 'gridDisk[m, 1].Text = arrTemp[0] + gridDisk[m, 2].Alignment = Align.Right + gridDisk[m, 2].Text = Functions.AutoUnits(Global.DiskInfo[m - 1].UnallocatedBytes) gridDisk[m, 3].Alignment = Align.Center NEXT diff --git a/frmPartitions.class b/frmPartitions.class index 49f1743..bb58702 100644 --- a/frmPartitions.class +++ b/frmPartitions.class @@ -173,4 +173,3 @@ frmPartSelect.ShowModal Global.flagBUTTExec = FALSE END - diff --git a/frmPartitions.form b/frmPartitions.form index 711de11..2f9290b 100644 --- a/frmPartitions.form +++ b/frmPartitions.form @@ -1,7 +1,7 @@ # Gambas Form File 2.0 { Form Form - MoveScaled(4,6,90.5714,78.2857) + MoveScaled(4,6,90.5,78.25) Font = Font["Luxi Sans"] Background = &HFFFFFF& Text = ("") @@ -18,7 +18,7 @@ Background = &HDFFFFF& Padding = 10 AutoResize = True - Text = ("

    Available partitioning modes:

    \n\nAutomatic partitioning: The installer will handle all partition related decisions for you:\n\nManual partitioning: You have full control of partitioning.\n\nOther partitioning:\n\n") + Text = ("

    Available partitioning modes:

    \n\nAutomatic partitioning: The installer will handle all partition related decisions for you:\n\nManual partitioning: You have full control of partitioning.\n\nOther partitioning:\n\n") } } { VBox1 VBox @@ -49,12 +49,12 @@ Foreground = Color.ButtonForeground Text = ("Full disk") } - { btnFreeSpace Button + { btnUnpartSpace Button MoveScaled(1,9,23,5) Font = Font["Luxi Sans,14"] Background = Color.ButtonBackground Foreground = Color.ButtonForeground - Text = ("Free space") + Text = ("Unpartitioned space") } } { Frame2 Frame