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

shadzik shadzik at pld-linux.org
Wed Dec 8 00:21:06 CET 2010


Author: shadzik
Date: Wed Dec  8 00:21:03 2010
New Revision: 11977

Modified:
   PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
   PLDLiveInstaller/trunk/PLDLiveInstaller.h
Log:
- get rid of some code
- as suggested by vip, info about ram can go away, and the selection of swap is totally optional now


Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.cpp	(original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.cpp	Wed Dec  8 00:21:03 2010
@@ -42,7 +42,7 @@
   : KAssistantDialog( parent )
 {
     setPlainCaption(i18n("PLD Live Installer"));
-    setFixedSize(800,600);
+    setFixedSize(780,550);
     showButton(KDialog::Help, false);
     showButton(KDialog::Cancel, false);
     showButton(KDialog::User1, false);
@@ -216,8 +216,6 @@
   {
     destSwap=diskListWidget->parthash->value(availablePartitions[pos-1]);
     selSwap=destSwap.as<Solid::Block>()->device();
-    memInfoIcon2->setVisible(false);
-    memInfo2->setVisible(false);
     if(swapPartPos==rootPartPos)
     {
       samePartTwiceIcon->setVisible(true);
@@ -228,17 +226,10 @@
     {
       samePartTwiceIcon->setVisible(false);
       samePartTwice->setVisible(false);
-      if(isPartBigEnough)
-	setValid(selectPartitionsPage, true);
     }
   }
   else
   {
-    if(!isRamEnough)
-    {
-      memInfoIcon2->setVisible(true);
-      memInfo2->setVisible(true);
-    }
     samePartTwiceIcon->setVisible(false);
     samePartTwice->setVisible(false);
   }
@@ -432,34 +423,6 @@
     swapText->setAlignment(Qt::AlignRight);
     swapText->setFixedWidth(150);
     
-    memInfo = new QLabel;
-    memInfo->setText("<html>"
-	  "You seem to have >= 2GB of RAM installed.<br/>"
-	  "You don't have to select a swap partition!"
-	  "<html>");
-    memInfo->setAlignment(Qt::AlignLeft);
-    memInfo->setMargin(10);
-    memInfo->setVisible(false);
-    
-    memInfo2 = new QLabel;
-    memInfo2->setText("<html>"
-	  "You seem to have &lt; 2GB of RAM installed.<br/>"
-	  "It is recommended that you select a swap partition!"
-	  "<html>");
-    memInfo2->setAlignment(Qt::AlignLeft);
-    memInfo2->setMargin(10);
-    memInfo2->setVisible(false);
-    
-    memInfoIcon = new QLabel;
-    memInfoIcon->setPixmap(KIcon("dialog-information").pixmap(32));
-    memInfoIcon->setAlignment(Qt::AlignRight);
-    memInfoIcon->setVisible(false);
-    
-    memInfoIcon2 = new QLabel;
-    memInfoIcon2->setPixmap(KIcon("dialog-warning").pixmap(32));
-    memInfoIcon2->setAlignment(Qt::AlignRight);
-    memInfoIcon2->setVisible(false);
-    
     devSizeInfo = new QLabel;
     devSizeInfo->setAlignment(Qt::AlignLeft);
     devSizeInfo->setMargin(10);
@@ -492,14 +455,6 @@
     instBlLayout->addWidget(instBootLoader);
     instBlLayout->setMargin(0);
     
-    QHBoxLayout *memInfoLayout = new QHBoxLayout;
-    memInfoLayout->addWidget(memInfoIcon);
-    memInfoLayout->addWidget(memInfo);
-    memInfoLayout->addWidget(memInfoIcon2);
-    memInfoLayout->addWidget(memInfo2);
-    memInfoLayout->setAlignment(Qt::AlignLeft);
-    memInfoLayout->setMargin(0);
-    
     QHBoxLayout *devSizeLayout = new QHBoxLayout;
     devSizeLayout->addWidget(devSizeInfoIcon);
     devSizeLayout->addWidget(devSizeInfo);
@@ -533,7 +488,6 @@
     disksLayout->addLayout(rootLayout);
     disksLayout->addLayout(formatLayout);
     disksLayout->addLayout(swapLayout);
-    disksLayout->addLayout(memInfoLayout);
     disksLayout->addLayout(devSizeLayout);
     disksLayout->addLayout(samePartTwiceLayout);
     disksLayout->addStretch();
@@ -1548,22 +1502,6 @@
   pbar->setValue(++pbarVal);
 }
 
-int PLDLiveInstaller::getMemoryAmount()
-{
-  QFile meminfo("/proc/meminfo");
-  if (!meminfo.open(QIODevice::ReadOnly | QIODevice::Text))
-    return 1;
-  
-  QString totalMem = meminfo.readLine();
-  totalMem.remove(QRegExp("^MemTotal:[ \t]+"));
-  totalMem.remove(QRegExp("[ \t]+(kB).*"));
-  int totalMemInt = totalMem.toInt()/1024; // MB
-  
-  //qDebug() << "Total Mem:" << totalMemInt;
-  
-  return totalMemInt;
-}
-
 void PLDLiveInstaller::installation()
 {
     bool cont = true;
@@ -1923,15 +1861,6 @@
         "You've selected disk: <b>" + dev + "</b><br />"
         "Now select where you want to install the system and swap</p></html>");
 	}
-	if(getMemoryAmount() >= 1990)
-	{
-	  memInfoIcon->setVisible(true);
-	  memInfo->setVisible(true);
-	  isRamEnough=true;
-	} else {
-	  memInfoIcon2->setVisible(true);
-	  memInfo2->setVisible(true);
-	}
       }
 	
       if (currentPage() == createUserPage)

Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.h
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.h	(original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.h	Wed Dec  8 00:21:03 2010
@@ -47,13 +47,13 @@
     DiskListWidget *diskListWidget;
     QListWidgetItem * selectedDisk;
     Solid::Device selectedBlockDev, destPartition, destSwap;
-    QLabel *selectPartitionPageText, *installationText, *installationHeader, *failText, *memInfo, *memInfoIcon;
-    QLabel *memInfo2, *memInfoIcon2, *devSizeInfo, *devSizeInfoIcon, *samePartTwice, *samePartTwiceIcon;
+    QLabel *selectPartitionPageText, *installationText, *installationHeader, *failText;
+    QLabel *devSizeInfo, *devSizeInfoIcon, *samePartTwice, *samePartTwiceIcon;
     QStringList availablePartitions, fsTypes, formatOpts;
     KComboBox * rootPart,* swapPart, * fs;
     QRadioButton *autoLogin, *noAutoLogin;
     int rootPartPos, swapPartPos, pbarVal;
-    bool selHDDisRem, isPartBigEnough, isRamEnough, installBootLoader, pwMatch, userSet, doFormat;
+    bool selHDDisRem, isPartBigEnough, 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);
@@ -66,7 +66,6 @@
     bool makeGrubConfig(), installGrub(), geninitrd(), mountProcSysDev(), umountProcSysDev();
     void move2dest(QString from, QString to), renameConfigFiles(QStringList files), delUtmpx();
     bool createHostname(), createFstabEntries(), createUser(), copySettings(QString file), deleteLiveUser();
-    int getMemoryAmount();
     int effectivePasswordLength(const QString& password);
     void removeJunk(QString filedir, QString argstorm);
     void substr(QString file, QString string1, QString string2);


More information about the pld-cvs-commit mailing list