[PC-BSD Commits] r5111 - pcbsd/trunk/SysInstaller
svn at pcbsd.org
svn at pcbsd.org
Fri Nov 20 11:13:17 PST 2009
Author: kris
Date: 2009-11-20 11:13:17 -0800 (Fri, 20 Nov 2009)
New Revision: 5111
Modified:
pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
pcbsd/trunk/SysInstaller/dialogFileSystem.h
pcbsd/trunk/SysInstaller/dialogFileSystem.ui
Log:
Added more logic to the dialog for file-system setup, connect slider boxes, start
working on some verification to figure out how much free disk space we have
Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.cpp 2009-11-20 17:20:02 UTC (rev 5110)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.cpp 2009-11-20 19:13:17 UTC (rev 5111)
@@ -12,9 +12,27 @@
void dialogFileSystem::dialogInit(QList<QStringList> disks, QList<QStringList> disklayout)
{
+ // Connnect our slots
connect(pushCancel, SIGNAL(clicked()), this, SLOT(slotPushCancel()));
connect(pushSave, SIGNAL(clicked()), this, SLOT(slotPushSave()));
+ connect(comboDiskSelection, SIGNAL(currentIndexChanged(int)), this, SLOT(slotDiskChanged(int)));
+ connect(comboDiskType, SIGNAL(currentIndexChanged(int)), this, SLOT(slotTypeChanged(int)));
+ connect(horizontalSizeSlider, SIGNAL(sliderMoved(int)), this, SLOT(slotSliderChangedValue(int)));
+ connect(spinSize, SIGNAL(valueChanged(int)), this, SLOT(slotSpinBoxChanged(int)));
+ // Add the file-system types
+ comboDiskType->addItem("UFS");
+ comboDiskType->addItem("UFS+S");
+ comboDiskType->addItem("UFS+J");
+ comboDiskType->addItem("ZFS");
+ comboDiskType->addItem("SWAP");
+ comboDiskType->addItem("MIRROR");
+
+ comboMirrorTypes->addItem("load");
+ comboMirrorTypes->addItem("prefer");
+ comboMirrorTypes->addItem("round-robin");
+ comboMirrorTypes->addItem("split");
+
sysDisks = disks;
sysFinalDiskLayout = disklayout;
comboDiskSelection->clear();
@@ -22,14 +40,79 @@
// Start adding / listing our disks / partitions available
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" )
+ if ( sysDisks.at(i).at(0) == "DRIVE" ) {
comboDiskSelection->addItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + sysDisks.at(i).at(3));
- else
+ comboMirrorDisk->addItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + sysDisks.at(i).at(3));
+ } else {
comboDiskSelection->addItem(" " + sysDisks.at(i).at(2) + " - " + sysDisks.at(i).at(3) + "MB " + sysDisks.at(i).at(4));
+ }
}
}
+// Slot for checking the current type
+void dialogFileSystem::slotTypeChanged(int index)
+{
+ if ( comboDiskType->itemText(index) == "MIRROR" )
+ stackedWidgetOptions->setCurrentIndex(1);
+ else
+ stackedWidgetOptions->setCurrentIndex(0);
+}
+
+// Slot for checking the current selected disk / partition
+void dialogFileSystem::slotDiskChanged(int index)
+{
+ int count, typeIndex;
+
+ // Save where we are on the type
+ typeIndex = comboDiskType->currentIndex();
+
+ count = comboDiskType->count();
+ for ( int i = 0; i < count ; i++)
+ {
+ if ( comboDiskType->itemText(i) == "MIRROR" )
+ comboDiskType->removeItem(i);
+ }
+
+ if ( sysDisks.at(index).at(0) == "DRIVE" )
+ {
+ comboDiskType->addItem("MIRROR");
+ }
+
+ if ( typeIndex <= comboDiskType->count() )
+ comboDiskType->setCurrentIndex(typeIndex);
+ else
+ comboDiskType->setCurrentIndex(0);
+
+ // Now figure out how much disk space to show
+ int maxsize = calculateFreeSpace(index);
+ horizontalSizeSlider->setMinimum(0);
+ horizontalSizeSlider->setMaximum(maxsize);
+ horizontalSizeSlider->setValue(maxsize);
+ spinSize->setRange(0, maxsize);
+ spinSize->setValue(maxsize);
+
+}
+
+
+// function which updates the spinbox when the user drags the slider
+void dialogFileSystem::slotSliderChangedValue(int newVal)
+{
+ spinSize->setValue(newVal);
+}
+
+// function which updates the spinbox when the user drags the slider
+void dialogFileSystem::slotSpinBoxChanged(int newVal)
+{
+ horizontalSizeSlider->setValue(newVal);
+}
+
+// function which calculates the free space available for a disk / partition that we can show the user
+int dialogFileSystem::calculateFreeSpace(int diskIndex)
+{
+ return 500;
+}
+
// Slot for closing the dialog
void dialogFileSystem::slotPushCancel()
{
@@ -41,3 +124,4 @@
{
close();
}
+
Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.h
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.h 2009-11-20 17:20:02 UTC (rev 5110)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.h 2009-11-20 19:13:17 UTC (rev 5111)
@@ -26,8 +26,13 @@
private slots:
void slotPushCancel();
void slotPushSave();
+ void slotDiskChanged(int index);
+ void slotTypeChanged(int index);
+ void slotSpinBoxChanged(int newVal);
+ void slotSliderChangedValue(int newVal);
private:
+ int calculateFreeSpace(int diskIndex);
QList<QStringList> sysDisks; // Our lists which contains disk info
QList<QStringList> sysFinalDiskLayout; // Our lists which contains the final disk layout
};
Modified: pcbsd/trunk/SysInstaller/dialogFileSystem.ui
===================================================================
--- pcbsd/trunk/SysInstaller/dialogFileSystem.ui 2009-11-20 17:20:02 UTC (rev 5110)
+++ pcbsd/trunk/SysInstaller/dialogFileSystem.ui 2009-11-20 19:13:17 UTC (rev 5111)
@@ -14,7 +14,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>File System</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
More information about the Commits
mailing list