SVN: PLDLiveInstaller/trunk: PLDLiveInstaller.cpp PLDLiveInstaller.h

shadzik shadzik at pld-linux.org
Thu Dec 2 13:14:34 CET 2010


Author: shadzik
Date: Thu Dec  2 13:14:34 2010
New Revision: 11919

Modified:
   PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
   PLDLiveInstaller/trunk/PLDLiveInstaller.h
Log:
- select whether to format the partition or use the existing fs
- requested by sajmon on forum.pld


Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.cpp	(original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.cpp	Thu Dec  2 13:14:34 2010
@@ -260,8 +260,8 @@
 
 void PLDLiveInstaller::isFsSelected(int pos)
 {
-  qDebug() << "FS type: " << fsTypes[pos];
   selFS=fsTypes[pos];
+  qDebug() << "FS type: " << selFS;
 }
 
 void PLDLiveInstaller::reboot()
@@ -364,13 +364,25 @@
     qDebug() << "No boot loader";
 }
 
+void PLDLiveInstaller::shouldBeFormated(int pos)
+{
+  if(pos == 1)
+    doFormat=false;
+  else
+    doFormat=true;
+  
+  qDebug() << "Should be formated: " << doFormat;
+}
+
 QWidget * PLDLiveInstaller::selectPartitionsWidget()
 {   
     swapPartPos = 0;
     rootPartPos = 0;
     installBootLoader = false;
     fsTypes << "ext4" << "ext3" << "ext2" << "xfs";
+    formatOpts << "Yes" << "No";
     selFS=fsTypes[0];
+    doFormat=true;
   
     KTitleWidget *titleWidget = new KTitleWidget(this);
     titleWidget->setText(i18n("<html><p align=\"center\"><font size=\"10\"><b>Install PLD Linux</b></font><br /><br />"
@@ -408,11 +420,21 @@
     fs->setCurrentItem("ext4");
     connect(fs, SIGNAL(activated(int)), this, SLOT(isFsSelected(int)));
     
+    KComboBox *formatBox = new KComboBox(this);
+    formatBox->addItems(formatOpts);
+    formatBox->setCurrentIndex(0);
+    connect(formatBox, SIGNAL(activated(int)), this, SLOT(shouldBeFormated(int)));
+    
     QLabel *rootText = new QLabel;
     rootText->setText("Root (/):");
     rootText->setAlignment(Qt::AlignRight);
     rootText->setFixedWidth(150);
     
+    QLabel *formatText = new QLabel;
+    formatText->setText("Format rootfs?:");
+    formatText->setAlignment(Qt::AlignRight);
+    formatText->setFixedWidth(150);
+    
     QLabel *swapText = new QLabel;
     swapText->setText("Swap:");
     swapText->setAlignment(Qt::AlignRight);
@@ -504,6 +526,11 @@
     rootLayout->addWidget(fs);
     rootLayout->addStretch();
     
+    QHBoxLayout *formatLayout = new QHBoxLayout;
+    formatLayout->addWidget(formatText);
+    formatLayout->addWidget(formatBox);
+    formatLayout->addStretch();
+    
     QHBoxLayout *swapLayout = new QHBoxLayout;
     swapLayout->addWidget(swapText);
     swapLayout->addWidget(swapPart);
@@ -512,6 +539,7 @@
     QVBoxLayout *disksLayout = new QVBoxLayout;
     disksLayout->addWidget(selectPartitionPageText);
     disksLayout->addLayout(rootLayout);
+    disksLayout->addLayout(formatLayout);
     disksLayout->addLayout(swapLayout);
     disksLayout->addLayout(memInfoLayout);
     disksLayout->addLayout(devSizeLayout);
@@ -1495,17 +1523,19 @@
     if(isMounted(destPartition))
       umountDev(destPartition);
     
-    if(cont && !makeFS(destPartition)) {
-      cont = false;
-      failText->setText("<html><p align=\"center\">"
-      "Creating file system failed.<br/><br/>"
-      "Click Close to close the installer.<br />"
-      "</p></html>"
-      );
-      KAssistantDialog::setValid(installingPage,true);
-      KAssistantDialog::next();
-      KAssistantDialog::showButtonSeparator(false);     
-    };
+    if(doFormat) {
+      if(cont && !makeFS(destPartition)) {
+	cont = false;
+	failText->setText("<html><p align=\"center\">"
+	"Creating file system failed.<br/><br/>"
+	"Click Close to close the installer.<br />"
+	"</p></html>"
+	);
+	KAssistantDialog::setValid(installingPage,true);
+	KAssistantDialog::next();
+	KAssistantDialog::showButtonSeparator(false);     
+      }
+    }
 
     if(cont) {
       qDebug() << "trying to create swap";

Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.h
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.h	(original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.h	Thu Dec  2 13:14:34 2010
@@ -49,10 +49,10 @@
     Solid::Device selectedBlockDev, destPartition, destSwap;
     QLabel *selectPartitionPageText, *installationText, *installationHeader, *failText, *memInfo, *memInfoIcon;
     QLabel *memInfo2, *memInfoIcon2, *devSizeInfo, *devSizeInfoIcon, *samePartTwice, *samePartTwiceIcon;
-    QStringList availablePartitions, fsTypes;
+    QStringList availablePartitions, fsTypes, formatOpts;
     KComboBox * rootPart,* swapPart, * fs;
     int rootPartPos, swapPartPos, pbarVal;
-    bool selHDDisRem, isPartBigEnough, isRamEnough, installBootLoader, pwMatch, userSet;
+    bool selHDDisRem, isPartBigEnough, isRamEnough, installBootLoader, pwMatch, userSet, doFormat;
     QLabel *defimage, *image, *image2, *partImage, *partImage2, *partDescr;
     QString selFS, selUser, selPasswd, selHostname, failReason, selRoot, selSwap, selCred;
     int isMounted(Solid::Device partition);
@@ -82,6 +82,7 @@
     void isRootPartitionSelected(int pos);
     void isSwapPartitionSelected(int pos);
     void isFsSelected(int pos);
+    void shouldBeFormated(int pos);
     void isUserEntered();
     void instBootLoaderIsChecked(int state);
     void checkPwStrength();


More information about the pld-cvs-commit mailing list