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

svn at pcbsd.org svn at pcbsd.org
Mon Nov 23 14:33:44 PST 2009


Author: kris
Date: 2009-11-23 14:33:44 -0800 (Mon, 23 Nov 2009)
New Revision: 5126

Modified:
   pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
   pcbsd/trunk/SysInstaller/dialogFileSystem.h
   pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
Log:

Add checks for exiting mounts, start linking in the add button support, now able to create a partition
and save it



Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.cpp	2009-11-23 21:22:59 UTC (rev 5125)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.cpp	2009-11-23 22:33:44 UTC (rev 5126)
@@ -66,7 +66,7 @@
   for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
     // Check if this drive already has some partitions created for it
     if ( sysFinalDiskLayout.at(i).at(0) == Disk && \
-       ( sysFinalDiskLayout.at(i).at(1) == Slice || sysFinalDiskLayout.at(i).at(1) == "ALL" ) )
+         sysFinalDiskLayout.at(i).at(1) == "ALL" )
      return false;
   }
   return true;
@@ -182,7 +182,7 @@
      tmp = sysDisks.at(diskIndex).at(2);
      fullSize = tmp.toInt(&ok);
   } else {
-     Disk = sysDisks.at(diskIndex).at(2);
+     Disk = sysDisks.at(diskIndex).at(1);
      Slice = sysDisks.at(diskIndex).at(2);
      Slice = Slice.remove(0, Slice.size() -2);
      tmp = sysDisks.at(diskIndex).at(3);
@@ -223,6 +223,14 @@
      ready = false;
     if ( lineEditMount->text().isEmpty() || lineEditMount->text().indexOf("/") != 0 )
      ready = false;
+
+    // Make sure we don't have a duplicate mount point
+    for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
+      // Check if this mount is on the target partition / drive
+      if ( sysFinalDiskLayout.at(i).at(2) == lineEditMount->text() )
+        ready = false;
+    }
+
   } else {
     // Using a mirror, make sure we don't have the same disk selected as target as source
     if ( comboDiskSelection->currentText() == comboMirrorDisk->currentText() )
@@ -239,9 +247,48 @@
   close();
 }
 
+
+// add the new FS to our list, and emit it back to the parent
+void dialogFileSystem::addEmit()
+{
+  QStringList fileSystem;
+  QString Disk, Slice, Size, Mount, fsType, tmp;
+
+  // Get the index
+  int diskIndex = comboDiskSelection->currentIndex();
+
+  // Set our vars with Disk / Slice info, size, etc
+  if ( sysDisks.at(diskIndex).at(0) == "DRIVE") {
+     Disk = sysDisks.at(diskIndex).at(1);
+     Slice = "ALL";
+  } else {
+     Disk = sysDisks.at(diskIndex).at(1);
+     Slice = sysDisks.at(diskIndex).at(2);
+     Slice = Slice.remove(0, Slice.size() -2);
+  }
+
+  if ( comboDiskType->currentText() == "MIRROR" ) {
+     Size = "0";
+     Mount = "MIRROR";
+     fsType = "MIRROR";
+  } else {
+     Size = tmp.setNum(spinSize->value());
+     Mount = lineEditMount->text();
+     fsType = comboDiskType->currentText();
+  }
+
+
+
+  fileSystem << Disk << Slice << Mount << fsType << Size;
+  sysFinalDiskLayout << fileSystem;
+
+  emit updated(sysFinalDiskLayout);
+}
+
 // Slot for saving the dialog
 void dialogFileSystem::slotPushSave()
 {
+  addEmit();  
   close();
 }
 

Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.h
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.h	2009-11-23 21:22:59 UTC (rev 5125)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.h	2009-11-23 22:33:44 UTC (rev 5126)
@@ -34,12 +34,16 @@
     void slotCheckSanity();
 
 private:
+    void addEmit();
     bool diskNoExistingPartition(QString Device);
     bool sliceNoExistingDiskPartition(QString Device);
     void addDisksSane();
     int calculateFreeSpace(int diskIndex);
     QList<QStringList> sysDisks; // Our lists which contains disk info
     QList<QStringList> sysFinalDiskLayout; // Our lists which contains the final disk layout
+
+signals:
+    void updated(QList<QStringList> newDiskLayout);
 };
 
 #endif // DIALOGFS_H

Modified: pcbsd/trunk/SysInstaller/sys-diskwidget.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sys-diskwidget.cpp	2009-11-23 21:22:59 UTC (rev 5125)
+++ pcbsd/trunk/SysInstaller/sys-diskwidget.cpp	2009-11-23 22:33:44 UTC (rev 5126)
@@ -203,9 +203,16 @@
 {
   dialogFileSystem *dls = new dialogFileSystem();
   dls->dialogInit(sysDisks, sysFinalDiskLayout);
+  connect(dls, SIGNAL(updated(QList <QStringList>)), this, SLOT(slotUpdateFileSystemLayout(QList<QStringList>)));
   dls->show();
 }
 
+void SysInstaller::slotUpdateFileSystemLayout(QList<QStringList> newFileSystemLayout)
+{
+  sysFinalDiskLayout = newFileSystemLayout;
+  slotRefreshCustomPartitionWidget();
+}
+
 // Function which will edit a filesystem the user has selected
 void SysInstaller::slotEditFileSystem()
 {
@@ -228,6 +235,8 @@
   QStringList tmpList;
   QString tmp;
 
+  qDebug() << sysFinalDiskLayout;
+
   treeWidgetCustomPartition->clear();
   for (int i=0; i < sysFinalDiskLayout.count(); ++i) {
       tmpList.clear();

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-23 21:22:59 UTC (rev 5125)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-23 22:33:44 UTC (rev 5126)
@@ -79,6 +79,7 @@
     void slotAddNewFileSystem();
     void slotEditFileSystem();
     void slotRemoveFileSystem();
+    void slotUpdateFileSystemLayout(QList<QStringList> newFileSystemLayout);
 
 private:
     void initSteps();



More information about the Commits mailing list