SVN: PLDLiveInstaller/trunk: PLDLiveInstaller.cpp PLDLiveInstaller.h Updater.cpp
shadzik
shadzik at pld-linux.org
Wed Jan 12 16:17:55 CET 2011
Author: shadzik
Date: Wed Jan 12 16:17:55 2011
New Revision: 12033
Modified:
PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
PLDLiveInstaller/trunk/PLDLiveInstaller.h
PLDLiveInstaller/trunk/Updater.cpp
Log:
- simplified usb vs hd detection
- variable names changed and are more readable now
- set local result on updater and return it, gets rid of warnings
- Solid framework is yet not able to identify usb sticks (not readers) etc.
Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.cpp (original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.cpp Wed Jan 12 16:17:55 2011
@@ -130,18 +130,19 @@
setValid(selectDiskPage, true);
selectedDisk = diskListWidget->currentItem();
selectedBlockDev = diskListWidget->devhash->value(selectedDisk->text());
- selHDDisRem = selectedBlockDev.as<Solid::StorageDrive>()->isRemovable();
- qDebug() << "selHDD in isDIsk..." << selHDDisRem;
- defimage->setVisible(false);
- if (selHDDisRem)
- {
- image2->setVisible(true);
- image->setVisible(false);
- }
- else
- {
- image->setVisible(true);
- image2->setVisible(false);
+ selHDDBus = selectedBlockDev.as<Solid::StorageDrive>()->bus();
+ qDebug() << "selHDDBus..." << selHDDBus;
+ defHDDimage->setVisible(false);
+ switch (selHDDBus)
+ {
+ case Solid::StorageDrive::Usb: //CompactFlash
+ HDDimageUSB->setVisible(true);
+ HDDimageHD->setVisible(false);
+ break;
+ default:
+ HDDimageHD->setVisible(true);
+ HDDimageUSB->setVisible(false);
+ break;
}
}
@@ -309,25 +310,25 @@
startPartitionManager->setDisabled(true);
connect(startPartitionManager, SIGNAL(clicked()), this, SLOT(startPM()));
- defimage = new QLabel;
- defimage->setPixmap(KIcon("media-optical").pixmap(128));
- defimage->setAlignment(Qt::AlignLeft);
- defimage->setVisible(true);
-
- image = new QLabel;
- image->setPixmap(KIcon("drive-harddisk").pixmap(128));
- image->setAlignment(Qt::AlignLeft);
- image->setVisible(false);
-
- image2 = new QLabel;
- image2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
- image2->setAlignment(Qt::AlignLeft);
- image2->setVisible(false);
+ defHDDimage = new QLabel;
+ defHDDimage->setPixmap(KIcon("media-optical").pixmap(128));
+ defHDDimage->setAlignment(Qt::AlignLeft);
+ defHDDimage->setVisible(true);
+
+ HDDimageHD = new QLabel;
+ HDDimageHD->setPixmap(KIcon("drive-harddisk").pixmap(128));
+ HDDimageHD->setAlignment(Qt::AlignLeft);
+ HDDimageHD->setVisible(false);
+
+ HDDimageUSB = new QLabel;
+ HDDimageUSB->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+ HDDimageUSB->setAlignment(Qt::AlignLeft);
+ HDDimageUSB->setVisible(false);
QHBoxLayout *imageLayout = new QHBoxLayout;
- imageLayout->addWidget(defimage);
- imageLayout->addWidget(image);
- imageLayout->addWidget(image2);
+ imageLayout->addWidget(defHDDimage);
+ imageLayout->addWidget(HDDimageHD);
+ imageLayout->addWidget(HDDimageUSB);
QLabel *text = new QLabel(this);
text->setText(i18n("<html><p align=\"left\">"
@@ -411,23 +412,23 @@
"<font size=\"5\"><b>Select partitions where you want PLD Linux<br/> to install and click Next.</b></font>"
"</p></html>"));
- partImage = new QLabel;
- partImage->setPixmap(KIcon("drive-harddisk").pixmap(128));
- partImage->setAlignment(Qt::AlignLeft);
- partImage->setVisible(false);
-
- partImage2 = new QLabel;
- partImage2->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
- partImage2->setAlignment(Qt::AlignLeft);
- partImage2->setVisible(false);
+ partImageHD = new QLabel;
+ partImageHD->setPixmap(KIcon("drive-harddisk").pixmap(128));
+ partImageHD->setAlignment(Qt::AlignLeft);
+ partImageHD->setVisible(false);
+
+ partImageUSB = new QLabel;
+ partImageUSB->setPixmap(KIcon("drive-removable-media-usb").pixmap(128));
+ partImageUSB->setAlignment(Qt::AlignLeft);
+ partImageUSB->setVisible(false);
partDescr = new QLabel;
partDescr->setVisible(true);
partDescr->setAlignment(Qt::AlignLeft);
QVBoxLayout *imageLayout = new QVBoxLayout;
- imageLayout->addWidget(partImage);
- imageLayout->addWidget(partImage2);
+ imageLayout->addWidget(partImageHD);
+ imageLayout->addWidget(partImageUSB);
imageLayout->addWidget(partDescr);
selectPartitionPageText = new QLabel(this);
@@ -1908,18 +1909,19 @@
availablePartitions.append(part);
qDebug() << dev << "has partition: " << part;
}
- selHDDisRem = selectedBlockDev.as<Solid::StorageDrive>()->isRemovable();
- if (selHDDisRem)
- {
- partImage2->setVisible(true);
- partImage->setVisible(false);
- }
- else
+ //selHDDBus = selectedBlockDev.as<Solid::StorageDrive>()->bus();
+ qDebug() << "SelHDDBus #2..." << selHDDBus;
+ switch (selHDDBus)
{
- partImage->setVisible(true);
- partImage2->setVisible(false);
+ case Solid::StorageDrive::Usb: //CompactFlash
+ partImageUSB->setVisible(true);
+ partImageHD->setVisible(false);
+ break;
+ default:
+ partImageHD->setVisible(true);
+ partImageUSB->setVisible(false);
+ break;
}
- qDebug() << "selHDDisRem" << selHDDisRem;
availablePartitions.removeDuplicates();
qDebug() << "Partitions: " << availablePartitions;
if(rootPart->count()>0)
Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.h
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.h (original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.h Wed Jan 12 16:17:55 2011
@@ -54,8 +54,8 @@
KComboBox * rootPart,* swapPart, * fs;
QRadioButton *autoLogin, *noAutoLogin, *entireDisk, *notEntireDisk;
int rootPartPos, swapPartPos, pbarVal;
- bool selHDDisRem, isPartBigEnough, installBootLoader, pwMatch, userSet, doFormat;
- QLabel *defimage, *image, *image2, *partImage, *partImage2, *partDescr;
+ bool isPartBigEnough, installBootLoader, pwMatch, userSet, doFormat;
+ QLabel *defHDDimage, *HDDimageHD, *HDDimageUSB, *partImageHD, *partImageUSB, *partDescr;
QString selFS, selUser, selPasswd, selHostname, failReason, selRoot, selSwap, selCred;
int isMounted(Solid::Device partition);
bool mountDev(Solid::Device partition), umountDev(Solid::Device partition);
@@ -73,6 +73,7 @@
void toggleService(QString service, bool action);
qlonglong curSizeArray[256];
void rereadPartitionTable(QString device);
+ Solid::StorageDrive::Bus selHDDBus;
public:
PLDLiveInstaller( QWidget * parent = 0 );
Modified: PLDLiveInstaller/trunk/Updater.cpp
==============================================================================
--- PLDLiveInstaller/trunk/Updater.cpp (original)
+++ PLDLiveInstaller/trunk/Updater.cpp Wed Jan 12 16:17:55 2011
@@ -26,6 +26,7 @@
bool Updater::shouldWeCheckForUpdate()
{
+ bool result = false;
QFile *lastChecked = new QFile(QDir::homePath() + "/.config/pliLastChecked");
QDateTime *datetime = new QDateTime;
if(lastChecked->exists())
@@ -35,7 +36,7 @@
qDebug() << "Couldn't open last check file";
delete lastChecked;
lastChecked = 0;
- return true;
+ result = true;
}
else
{
@@ -52,13 +53,13 @@
QTextStream out(lastChecked);
out << datetime->currentDateTime().toTime_t() << "\n";
lastChecked->close();
- return true;
+ result = true;
}
}
else
{
lastChecked->close();
- return false;
+ result = false;
}
}
}
@@ -70,9 +71,10 @@
out << datetime->currentDateTime().toTime_t() << "\n";
lastChecked->close();
qDebug() << "Wrote last checked";
- return true;
+ result = true;
}
}
+ return result;
}
void Updater::startInstaller()
@@ -285,6 +287,7 @@
setMainWidget(mainWidget);
this->exec();
+ return mainWidget;
}
void UpdateNotification::getUpdate()
More information about the pld-cvs-commit
mailing list