[PC-BSD Commits] r5092 - pcbsd/trunk/SysInstaller

svn at pcbsd.org svn at pcbsd.org
Thu Nov 19 12:08:52 PST 2009


Author: kris
Date: 2009-11-19 12:08:52 -0800 (Thu, 19 Nov 2009)
New Revision: 5092

Modified:
   pcbsd/trunk/SysInstaller/backend.h
   pcbsd/trunk/SysInstaller/sysinstaller.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
Log:

Added space requirement checking to the GUI for automatic partitioning, now onto the 
advanced disk setup stuff!



Modified: pcbsd/trunk/SysInstaller/backend.h
===================================================================
--- pcbsd/trunk/SysInstaller/backend.h	2009-11-19 18:45:46 UTC (rev 5091)
+++ pcbsd/trunk/SysInstaller/backend.h	2009-11-19 20:08:52 UTC (rev 5092)
@@ -11,6 +11,8 @@
 
 #define PCSYSINSTALL    QString("/pc-sysinstall/pc-sysinstall")
 #define PCSYSINSTALLDIR QString("/pc-sysinstall")
+#define FBSD_MINSIZE 1000
+#define PCBSD_MINSIZE 10000
 
 
 namespace Scripts {

Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-19 18:45:46 UTC (rev 5091)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-19 20:08:52 UTC (rev 5092)
@@ -126,6 +126,62 @@
 
 }
 
+// Slot which checks any disk requirements before procceding to the next page
+bool SysInstaller::checkDiskRequirements()
+{
+  int minsize, mysize;
+  bool ok, goodsize;
+  QString tmp;
+
+  goodsize = true;
+
+  if ( radioInstallPCBSD->isChecked() )
+    minsize = PCBSD_MINSIZE;
+  else
+    minsize = FBSD_MINSIZE;
+
+  // Do our checks if we are on a auto-partition config
+  if ( radioAutoPartition->isChecked() ) {
+    if ( checkUseEntireDisk->isChecked() ) {
+      // Check if we have enough space on the entire disk
+      QString disk = comboDiskList->currentText();
+      disk.truncate(disk.indexOf(" -"));
+      for (int i=0; i < sysDisks.count(); ++i) {
+        // Make sure to only add the drives to the comboDiskList
+        if ( sysDisks.at(i).at(0) == "DRIVE" && sysDisks.at(i).at(1) == disk ) {
+          qDebug() << "Selected Disk Size: " +  sysDisks.at(i).at(2);
+          mysize = sysDisks.at(i).at(2).toInt(&ok); 
+          if( !ok || mysize < minsize)
+            goodsize=false;
+        }
+      }
+    } else if ( listDiskSlices->currentItem() ){
+      // Using a specific partition, check that size
+      QString slice = listDiskSlices->currentItem()->text();
+      slice.truncate(slice.indexOf(":"));
+      for (int i=0; i < sysDisks.count(); ++i) {
+        // Make sure to only add the slices to the listDiskSlices
+        if ( sysDisks.at(i).at(0) == "SLICE" && slice == sysDisks.at(i).at(2)) {
+          qDebug() << "Selected Slice Size: " +  sysDisks.at(i).at(3);
+          mysize = sysDisks.at(i).at(3).toInt(&ok);
+          if( !ok || mysize < minsize)
+            goodsize=false;
+        }
+      }
+    } else {
+      goodsize = false;
+    }
+    
+  } // End of auto-partition checks
+
+  if (!goodsize)
+    QMessageBox::critical(this, tr("PC-BSD Installer Error"),
+                                tr("This install requires a disk/slice with at least") \
+				+ " " + tmp.setNum(minsize) + "MB " + tr("of disk space."),
+                                QMessageBox::Ok);
+  return goodsize;
+}
+
 // Check if use entire disk is checked
 void SysInstaller::slotUseEntireDiskClicked()
 {
@@ -216,7 +272,13 @@
 
 void SysInstaller::slotNext()
 {
-    proceed(true);
+   bool goforward;
+   goforward = true;
+   if ( stackWidget->currentIndex() == 3 && ! checkDiskRequirements())
+     goforward = false;
+
+   if (goforward)
+      proceed(true);
 }
 
 void SysInstaller::slotBack()

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-19 18:45:46 UTC (rev 5091)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-19 20:08:52 UTC (rev 5092)
@@ -87,6 +87,7 @@
 
     void proceed(bool);
     bool isInstalled();
+    bool checkDiskRequirements();
 
     QStackedWidget *stackWidget;
 



More information about the Commits mailing list