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

svn at pcbsd.org svn at pcbsd.org
Thu Nov 19 14:06:14 PST 2009


Author: kris
Date: 2009-11-19 14:06:14 -0800 (Thu, 19 Nov 2009)
New Revision: 5095

Added:
   pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
Modified:
   pcbsd/trunk/SysInstaller/SysInstaller.pro
   pcbsd/trunk/SysInstaller/backend.cpp
   pcbsd/trunk/SysInstaller/backend.h
   pcbsd/trunk/SysInstaller/sysinstaller.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
   pcbsd/trunk/SysInstaller/sysinstaller.ui
Log:

Started adding support for auto-generating a partition layout, still working on it :)



Modified: pcbsd/trunk/SysInstaller/SysInstaller.pro
===================================================================
--- pcbsd/trunk/SysInstaller/SysInstaller.pro	2009-11-19 21:08:33 UTC (rev 5094)
+++ pcbsd/trunk/SysInstaller/SysInstaller.pro	2009-11-19 22:06:14 UTC (rev 5095)
@@ -8,6 +8,7 @@
 TEMPLATE = app
 SOURCES += main.cpp \
     sysinstaller.cpp \
+    sys-diskwidget.cpp \
     backend.cpp
 HEADERS += sysinstaller.h \
     backend.h

Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp	2009-11-19 21:08:33 UTC (rev 5094)
+++ pcbsd/trunk/SysInstaller/backend.cpp	2009-11-19 22:06:14 UTC (rev 5095)
@@ -79,6 +79,28 @@
     return media;
 }
 
+
+int Backend::systemMemory()
+{
+  int mem;
+  QString tmp;
+  bool ok;
+
+  Process p(QStringList() << "sys-mem");
+
+  if (p.waitForFinished()) {
+      while (p.canReadLine()) {
+          tmp = p.readLine().simplified();
+      }
+  }
+  mem = tmp.toInt(&ok);
+  qDebug() << "System Mem:" << mem;
+  if ( ok )
+    return mem;
+  else
+    return -1;
+}
+
 QStringList Backend::networkDevices()
 {
     QStringList nics;

Modified: pcbsd/trunk/SysInstaller/backend.h
===================================================================
--- pcbsd/trunk/SysInstaller/backend.h	2009-11-19 21:08:33 UTC (rev 5094)
+++ pcbsd/trunk/SysInstaller/backend.h	2009-11-19 22:06:14 UTC (rev 5095)
@@ -11,7 +11,7 @@
 
 #define PCSYSINSTALL    QString("/pc-sysinstall/pc-sysinstall")
 #define PCSYSINSTALLDIR QString("/pc-sysinstall")
-#define FBSD_MINSIZE 1000
+#define FBSD_MINSIZE 3000
 #define PCBSD_MINSIZE 10000
 
 
@@ -33,6 +33,7 @@
     static QStringList bootableMedia();
     static QStringList networkDevices();
     static QList<QStringList> hardDrives();
+    static int systemMemory();
     //static QList<QStringList> slices();
 
 };

Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-19 21:08:33 UTC (rev 5094)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-19 22:06:14 UTC (rev 5095)
@@ -115,6 +115,7 @@
     connect(checkUseEntireDisk,SIGNAL(clicked()), this, SLOT(slotUseEntireDiskClicked()));
     connect(radioCustomDisk,SIGNAL(toggled(bool)), this, SLOT(slotChangeRadioCustomDisk()));
     connect(radioAutoPartition,SIGNAL(toggled(bool)), this, SLOT(slotChangeRadioCustomDisk()));
+    connect(listDiskSlices,SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(slotSliceListClicked()));
 
     setKbDefaults();
 
@@ -128,116 +129,10 @@
     // Load any nics
     loadNics();
 
+    systemMemory = Scripts::Backend::systemMemory();
 }
 
-// Slot which switches between basic / advanced disk setup
-void SysInstaller::slotChangeRadioCustomDisk()
-{
-  if ( radioAutoPartition->isChecked())
-     stackedWidgetDiskSetup->setCurrentIndex(0);
-  else
-     stackedWidgetDiskSetup->setCurrentIndex(1);
-}
 
-// 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()
-{
-  if ( checkUseEntireDisk->isChecked() )
-    listDiskSlices->setEnabled(false);
-  else
-    listDiskSlices->setEnabled(true);
-}
-
-// Load the Disk string list
-void SysInstaller::loadDiskInfo()
-{
-  // load drives
-  comboDiskList->clear();
-  sysDisks = Scripts::Backend::hardDrives();
-  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" )
-      comboDiskList->addItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + sysDisks.at(i).at(3));
-  }
-
-  // Reload the slice list box
-  slotChangedDisk();
-}
-
-// The selected disk has changed, refresh our partition box
-void SysInstaller::slotChangedDisk()
-{
-  if ( !comboDiskList->currentText().isEmpty())
-  {
-    listDiskSlices->clear();
-
-    QString disk = comboDiskList->currentText();
-    disk.truncate(disk.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" && disk == sysDisks.at(i).at(1))
-        listDiskSlices->addItem(sysDisks.at(i).at(2) + ": " +  sysDisks.at(i).at(3) + "MB " + sysDisks.at(i).at(4));
-    }
-  }
-}
-
-
 // Load the NICS
 void SysInstaller::loadNics()
 {
@@ -287,9 +182,22 @@
 {
    bool goforward;
    goforward = true;
-   if ( stackWidget->currentIndex() == 3 && ! checkDiskRequirements())
+   if ( stackWidget->currentIndex() == 3 && ! checkDiskRequirements()) {
      goforward = false;
+     int minsize;
+     QString tmp;
+     if ( radioInstallPCBSD->isChecked() )
+       minsize = PCBSD_MINSIZE;
+     else
+       minsize = FBSD_MINSIZE;
 
+      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);
+   }
+
+
    if (goforward)
       proceed(true);
 }

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-19 21:08:33 UTC (rev 5094)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-19 22:06:14 UTC (rev 5095)
@@ -73,6 +73,7 @@
     void slotChangedDisk();
     void slotUseEntireDiskClicked();
     void slotChangeRadioCustomDisk();
+    void slotSliceListClicked();
 
 private:
     void initSteps();
@@ -85,6 +86,7 @@
     void setCurrentIndex(int);
     void setKbVariants(const QString &);
     void setKbDefaults();
+    void autoGenPartitionLayout(QString target, bool isDisk);
 
     void proceed(bool);
     bool isInstalled();
@@ -96,7 +98,8 @@
     QList<Label *> labels;  // just to handle the "Labels" list
     QList<QStringList> sysDisks; // Our lists which contains disk info
     QList<QStringList> sysPartitions; // Our lists which contains partition info
-    //QList<QRadioButton *> radioOS; //the operating system choice :)
+    QList<QStringList> sysFinalDiskLayout; // Our lists which contains the final disk layout
+    int systemMemory; // Ammount of system RAM we have in MB
 };
 
 #endif // SYSINSTALLER_H

Modified: pcbsd/trunk/SysInstaller/sysinstaller.ui
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.ui	2009-11-19 21:08:33 UTC (rev 5094)
+++ pcbsd/trunk/SysInstaller/sysinstaller.ui	2009-11-19 22:06:14 UTC (rev 5095)
@@ -118,7 +118,7 @@
       <number>10</number>
      </property>
      <item>
-      <widget class="QWidget" name="widget_2" native="true">
+      <widget class="QWidget" name="widgetTopBar" native="true">
        <property name="styleSheet">
         <string>background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(229, 229, 229, 230), stop:1 rgba(255, 255, 255, 255));</string>
        </property>



More information about the Commits mailing list