[PC-BSD Commits] r22034 - pcbsd/current/src-qt4/pc-installgui

svn at pcbsd.org svn at pcbsd.org
Tue Apr 2 15:43:35 PDT 2013


Author: kris
Date: 2013-04-02 22:43:35 +0000 (Tue, 02 Apr 2013)
New Revision: 22034

Modified:
   pcbsd/current/src-qt4/pc-installgui/installer.cpp
   pcbsd/current/src-qt4/pc-installgui/installer.h
   pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
Log:

Switch how we do disk space checks, do it right before the install starts
and warn the user if the size looks too small for a desktop or server



Modified: pcbsd/current/src-qt4/pc-installgui/installer.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/installer.cpp	2013-04-02 21:33:13 UTC (rev 22033)
+++ pcbsd/current/src-qt4/pc-installgui/installer.cpp	2013-04-02 22:43:35 UTC (rev 22034)
@@ -12,6 +12,7 @@
 {
     setupUi(this);
     translator = new QTranslator();
+    haveWarnedSpace=false;
 
     connect(abortButton, SIGNAL(clicked()), this, SLOT(slotAbort()));
     connect(backButton, SIGNAL(clicked()), this, SLOT(slotBack()));
@@ -225,14 +226,6 @@
   if( !ok )
     return false;
 
-  // Lets print a nice handy warning for users with possible
-  // low disk space issues
-  if ( totalSize < 48000 ) {
-  QMessageBox::warning(this, tr("PC-BSD Installer"),
-      tr("The detected disk is less than 50GB. PC-BSD recommends at least 50GB of space for a desktop and 20GB for a server."),
-      QMessageBox::Ok,
-      QMessageBox::Ok);
-  }
 
   // If on amd64 lets use ZFS, it rox
   if ( Arch == "amd64" ) {
@@ -997,6 +990,10 @@
 
 void Installer::startConfigGen()
 {
+
+  if ( ! haveWarnedSpace )
+     checkSpaceWarning();
+
   QStringList cfgList;
 
   // Generate the config file now
@@ -1638,3 +1635,54 @@
         break;
     }
 }
+
+void Installer::checkSpaceWarning()
+{
+  int totalSize = -1;
+  int targetSize;
+  int targetLoc;
+  bool ok;
+  QString workingDisk = sysFinalDiskLayout.at(0).at(0);
+  QString workingSlice = sysFinalDiskLayout.at(0).at(1);
+  QString targetType;
+  QString target;
+  //qDebug() << "Disk layout:" << workingDisk << workingSlice;
+
+  if ( workingSlice == "ALL" ) {
+    targetType = "DRIVE";
+    target = workingDisk;
+    targetLoc = 1;
+  } else {
+    targetType = "SLICE";
+    target = workingDisk + workingSlice;
+    targetLoc = 2;
+  }
+  
+  // Lets get the size for this disk / partition
+  for (int i=0; i < sysDisks.count(); ++i) {
+      // Make sure to only add the slices to the listDiskSlices
+      if ( sysDisks.at(i).at(0) == targetType && target == sysDisks.at(i).at(targetLoc))
+        totalSize = sysDisks.at(i).at(targetLoc + 1).toInt(&ok);
+  }
+
+  //qDebug() << totalSize;
+
+  if ( installStackWidget->currentIndex() == 1 && (wheelCurItem == wFREEBSD || wheelCurItem == wPCSERVER || wheelCurItem == 12) )
+     targetSize=20000;
+  else
+     targetSize=50000;
+
+  qDebug() << totalSize << targetSize;
+
+  // Lets print a nice handy warning for users with possible
+  // low disk space issues
+  if ( totalSize < targetSize ) {
+  QMessageBox::warning(this, tr("PC-BSD Installer"),
+      QString(tr("The selected disk / partition is less than recommended %1MB. The installation may fail...")).arg(targetSize),
+      QMessageBox::Ok,
+      QMessageBox::Ok);
+      haveWarnedSpace = true;      
+  }
+
+  return;
+}

Modified: pcbsd/current/src-qt4/pc-installgui/installer.h
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/installer.h	2013-04-02 21:33:13 UTC (rev 22033)
+++ pcbsd/current/src-qt4/pc-installgui/installer.h	2013-04-02 22:43:35 UTC (rev 22034)
@@ -84,6 +84,7 @@
     QStringList getComponentCfgSettings();
 
     void startConfigGen(); // Function which takes pieces of cfg, and assembles
+    void checkSpaceWarning(); // Function to check space of disk drive
 
     void proceed(bool);
     bool isInstalled();
@@ -130,6 +131,7 @@
     bool hasInstallOnMedia;
     bool hasFreeBSDOnMedia;
     bool toggleKeyLayout;
+    bool haveWarnedSpace;
 
     // Hardware checker
     dialogCheckHardware *pcHardware;

Modified: pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2013-04-02 21:33:13 UTC (rev 22033)
+++ pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2013-04-02 22:43:35 UTC (rev 22034)
@@ -238,10 +238,13 @@
 	 else
 	   checkGPT->setVisible(false);
 
-	 if ( ! checkDiskSpace() ) {
-           button(QWizard::NextButton)->setEnabled(false);
-	   return false;
-	 }
+         // Comment out this disk space check
+	 // We will warn the user right before install if the selected
+	 // Disk / partition looks too small
+	 //if ( ! checkDiskSpace() ) {
+         //  button(QWizard::NextButton)->setEnabled(false);
+	 //  return false;
+	 //}
 	
          // if we get this far, all the fields are filled in
          button(QWizard::NextButton)->setEnabled(true);



More information about the Commits mailing list