diff options
author | Andreas Loibl <andreas@andreas-loibl.de> | 2011-10-02 22:16:11 +0200 |
---|---|---|
committer | Andreas Loibl <andreas@andreas-loibl.de> | 2011-10-02 22:16:11 +0200 |
commit | ecb5cc2be5527e84ae29239ec8fa789c3ee8587e (patch) | |
tree | 4c7c59827ea325c1999daa9160877b764c079756 /wizard | |
parent | 17dd2d0281bf750768bb9820a677806980380c10 (diff) | |
download | acritoxinstaller-ecb5cc2be5527e84ae29239ec8fa789c3ee8587e.zip acritoxinstaller-ecb5cc2be5527e84ae29239ec8fa789c3ee8587e.tar.gz |
use ListItems with formatted size info in frontend
Diffstat (limited to 'wizard')
-rw-r--r-- | wizard/bootloader.cpp | 10 | ||||
-rw-r--r-- | wizard/partmansel.cpp | 8 | ||||
-rw-r--r-- | wizard/rootpartition.cpp | 9 |
3 files changed, 20 insertions, 7 deletions
diff --git a/wizard/bootloader.cpp b/wizard/bootloader.cpp index a066d05..0b4ccf8 100644 --- a/wizard/bootloader.cpp +++ b/wizard/bootloader.cpp @@ -11,7 +11,7 @@ wpBootloader::wpBootloader(QWidget *parent) : QWizardPage(parent) connect(backend, SIGNAL(finishedCommand(QString)), this, SLOT(backendFinishedCommand(QString))); connect(bootloader, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete())); connect(bootloaderTarget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete())); - //bootloader->setItemDelegate(new ListDelegate(this)); + bootloaderTarget->setItemDelegate(new ListDelegate(this)); } void wpBootloader::initializePage() @@ -36,7 +36,11 @@ void wpBootloader::receivedDataLine(QString data, QString line) } if(data == "bootloader_targets") { - QListWidgetItem *item = new QListWidgetItem(QIcon::fromTheme("drive-harddisk"), line); + QString dev = line.section(" ",0,0); + qlonglong size = line.section(" ",1,1).toLongLong(); + QString desc = QString("%1 (%L2)").arg(backend->sizeToString(size)).arg(size); + desc += "<br />" + line.section(" ",2); + QListWidgetItem *item = new ListItem(dev, desc, "drive-harddisk", dev); bootloaderTarget->addItem(item); } } @@ -69,6 +73,6 @@ bool wpBootloader::validatePage() { if(!isComplete()) return false; backend->cfg("bootloader", bootloader->currentItem()->text().section(" ",0,0).toLower()); - backend->cfg("bootloader_target", bootloaderTarget->currentItem()->text().section(" ",0,0).toLower()); + backend->cfg("bootloader_target", bootloaderTarget->currentItem()->data(ListItem::ItemData).toString()); return true; } diff --git a/wizard/partmansel.cpp b/wizard/partmansel.cpp index 3a3d78b..9c509e6 100644 --- a/wizard/partmansel.cpp +++ b/wizard/partmansel.cpp @@ -11,6 +11,7 @@ wpPartManSel::wpPartManSel(QWidget *parent) : QWizardPage(parent) connect(partMan, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete())); connect(partDisk, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete())); partMan->setItemDelegate(new ListDelegate(this)); + partDisk->setItemDelegate(new ListDelegate(this)); } void wpPartManSel::initializePage() @@ -67,7 +68,10 @@ void wpPartManSel::receivedDataLine(QString data, QString line) } if(data == "list_of_disks") { - QListWidgetItem *item = new QListWidgetItem(QIcon::fromTheme("drive-harddisk"), line); + QString dev = line.section(" ",0,0); + qlonglong size = line.section(" ",1,1).toLongLong(); + QString desc = QString("%1 (%L2)").arg(backend->sizeToString(size)).arg(size); + QListWidgetItem *item = new ListItem(dev, desc, "drive-harddisk", dev); partDisk->addItem(item); } } @@ -88,6 +92,6 @@ bool wpPartManSel::validatePage() { if(!isComplete()) return false; backend->cfg("partman_program", partMan->currentItem()->data(ListItem::ItemData).toString()); - backend->cfg("partman_disk", partDisk->currentItem()->text().section(" ",0,0)); + backend->cfg("partman_disk", partDisk->currentItem()->data(ListItem::ItemData).toString()); return true; } diff --git a/wizard/rootpartition.cpp b/wizard/rootpartition.cpp index 2b2b023..7a979d6 100644 --- a/wizard/rootpartition.cpp +++ b/wizard/rootpartition.cpp @@ -13,6 +13,7 @@ wpRootPartition::wpRootPartition(QWidget *parent) : QWizardPage(parent) connect(backend, SIGNAL(finishedCommand(QString)), this, SLOT(backendFinishedCommand(QString))); connect(rootPartitionDev, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(updateComplete())); connect(chkAdvanced, SIGNAL(stateChanged(int)), this, SLOT(updateComplete())); + rootPartitionDev->setItemDelegate(new ListDelegate(this)); checkPassed = false; } @@ -36,7 +37,11 @@ void wpRootPartition::receivedDataLine(QString data, QString line) { if(data == "possible_root_partitions") { - QListWidgetItem *item = new QListWidgetItem(QIcon::fromTheme("drive-harddisk"), line); + QString dev = line.section(" ",0,0); + qlonglong size = line.section(" ",1,1).toLongLong(); + QString desc = QString("%1 (%L2)").arg(backend->sizeToString(size)).arg(size); + desc += "<br />" + line.section(" ",2); + QListWidgetItem *item = new ListItem(dev, desc, "drive-harddisk", dev); rootPartitionDev->addItem(item); } if(data == "possible_root_filesystems") @@ -83,7 +88,7 @@ bool wpRootPartition::validatePage() } if(rootPartitionDev->currentItem()) backend->exec(QString("hdmap_set %1:/:%2:auto") - .arg(rootPartitionDev->currentItem()->text().section(" ",0,0)) + .arg(rootPartitionDev->currentItem()->data(ListItem::ItemData).toString()) .arg(chkFormat->isChecked() ? rootPartitionFs->currentText() : "")); backend->exec("fill_hdmap"); |