[PC-BSD Commits] r4614 - pcbsd/trunk/SysInstaller/phases

svn at pcbsd.org svn at pcbsd.org
Thu Oct 8 13:19:02 PDT 2009


Author: kris
Date: 2009-10-08 13:19:02 -0700 (Thu, 08 Oct 2009)
New Revision: 4614

Modified:
   pcbsd/trunk/SysInstaller/phases/anteinstall.cpp
Log:

Added drive auto-detection to the GUI, doesn't seem to work quite as expected though, maybe
drives.append() isn't displaying on the GUI properly?



Modified: pcbsd/trunk/SysInstaller/phases/anteinstall.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/phases/anteinstall.cpp	2009-10-08 20:18:25 UTC (rev 4613)
+++ pcbsd/trunk/SysInstaller/phases/anteinstall.cpp	2009-10-08 20:19:02 UTC (rev 4614)
@@ -176,17 +176,60 @@
 {
     //detect hard drives and append to stringlist
     QStringList drive;
-    // <ForDemo>
-    for (int i = 0; i < 5; i++) {
-        QString mount = "/dev/ad" + QString::number(i, 10);
-        QString size = QString::number(40000 * 1, 10) + "MB";
-        QString type = "Seagate ST09834" + QString::number(i + 2 * 2, 10) + "A 3.01";
-        QString device = "ATA/IDE Device";
-        comboHardDrive->addItem(mount);
-        drive << mount << size << type << device;
+    QString device, devinfo, size, type;
+
+    // Create process to load the drive list from the backend
+    QString line, line2, tmp, dev;
+    QProcess getDiskProc, getDiskInfoProc;
+    QString prog = PCSYSINSTALL;
+    QStringList args;
+    args << "disk-list";
+    getDiskProc.setReadChannel(QProcess::StandardOutput);
+    getDiskProc.start(prog, args);
+
+    // Wait for the process to finish
+    if ( getDiskProc.waitForFinished() )
+    {
+      while (getDiskProc.canReadLine()) {
+        // Get the disk device name
+        line = getDiskProc.readLine();
+        dev = line.simplified();  
+        dev.truncate(line.indexOf(":"));
+        QString device = "/dev/" + dev;
+
+        // Get the disk type / description
+        tmp = line.simplified(); 
+        tmp = tmp.remove(0, line.indexOf(":") + 2);
+        QString devinfo = tmp;
+        
+        // Get the disk size / type
+        args.clear();
+        args << "disk-info" << dev;
+        getDiskInfoProc.setReadChannel(QProcess::StandardOutput);
+        getDiskInfoProc.start(prog, args);
+        // Wait for the process to finish
+        if ( getDiskInfoProc.waitForFinished() )
+        {
+          // load keyboards in "keyboards" stringlist
+          while (getDiskInfoProc.canReadLine()) {
+            // Get the disk device name
+            line2 = getDiskInfoProc.readLine();
+            if ( line2.indexOf("size=") == 0) {
+              size = line2.replace("size=", "");
+            }
+            if ( line2.indexOf("type=") == 0) {
+              type = line2.replace("type=", "");
+            }
+          }
+        }
+
+        // Add our Device info to the GUI now
+        comboHardDrive->addItem(device);
+        drive << device << size << type << devinfo;
         drives.append(drive);
+      }
     }
-    // </ForDemo>
+
 }
 
 void AnteInstall::slotLanguageChanged(int index)



More information about the Commits mailing list