summaryrefslogtreecommitdiff
path: root/ui/qt5
diff options
context:
space:
mode:
Diffstat (limited to 'ui/qt5')
-rw-r--r--ui/qt5/CMakeLists.txt1
-rw-r--r--ui/qt5/horizon.qrc1
-rw-r--r--ui/qt5/horizonwizard.cc2
-rw-r--r--ui/qt5/partitiondiskpage.cc95
-rw-r--r--ui/qt5/partitiondiskpage.hh29
-rw-r--r--ui/qt5/partitionpage.cc7
-rw-r--r--ui/qt5/partitionpage.hh2
-rw-r--r--ui/qt5/partitionprobe.cc2
-rw-r--r--ui/qt5/resources/disk-high.pngbin0 -> 190936 bytes
-rw-r--r--ui/qt5/resources/disk-low.pngbin6553 -> 75962 bytes
10 files changed, 136 insertions, 3 deletions
diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt
index dfcaf53..0134fcd 100644
--- a/ui/qt5/CMakeLists.txt
+++ b/ui/qt5/CMakeLists.txt
@@ -16,6 +16,7 @@ set(UI_SOURCES
intropage.cc
inputpage.cc
partitionpage.cc
+ partitiondiskpage.cc
networkingpage.cc
networkifacepage.cc
netsimplewifipage.cc
diff --git a/ui/qt5/horizon.qrc b/ui/qt5/horizon.qrc
index 9e67f22..f91afc1 100644
--- a/ui/qt5/horizon.qrc
+++ b/ui/qt5/horizon.qrc
@@ -3,6 +3,7 @@
<file>resources/intro-high.png</file>
<file>resources/intro-low.png</file>
<file>resources/disk-low.png</file>
+ <file>resources/disk-high.png</file>
<file>resources/network-low.png</file>
<file>resources/network-high.png</file>
<file>resources/software-high.png</file>
diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc
index 9672006..90024c4 100644
--- a/ui/qt5/horizonwizard.cc
+++ b/ui/qt5/horizonwizard.cc
@@ -39,6 +39,7 @@ extern "C" {
#include "intropage.hh"
#include "inputpage.hh"
#include "partitionpage.hh"
+#include "partitiondiskpage.hh"
#ifdef NON_LIBRE_FIRMWARE
#include "firmwarepage.hh"
#endif /* NON_LIBRE_FIRMWARE */
@@ -207,6 +208,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) {
setPage(Page_Intro, new IntroPage);
setPage(Page_Input, new InputPage);
setPage(Page_Partition, new PartitionPage);
+ setPage(Page_PartitionDisk, new PartitionDiskPage);
#ifdef NON_LIBRE_FIRMWARE
setPage(Page_Firmware, new FirmwarePage);
#endif /* NON_LIBRE_FIRMWARE */
diff --git a/ui/qt5/partitiondiskpage.cc b/ui/qt5/partitiondiskpage.cc
new file mode 100644
index 0000000..65a2994
--- /dev/null
+++ b/ui/qt5/partitiondiskpage.cc
@@ -0,0 +1,95 @@
+/*
+ * partitiondiskpage.cc - Implementation of UI.Partition.Install.UserPrompt
+ * horizon-qt5, the Qt 5 user interface for
+ * Project Horizon
+ *
+ * Copyright (c) 2020 Adélie Linux and contributors. All rights reserved.
+ * This code is licensed under the AGPL 3.0 license, as noted in the
+ * LICENSE-code file in the root directory of this repository.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+#include "partitiondiskpage.hh"
+
+#include <QLabel>
+#include <QVBoxLayout>
+
+QIcon iconForDisk(Horizon::DiskMan::Disk disk) {
+ QString iconName;
+ if(disk.dev_path().find("usb") != std::string::npos) {
+ iconName = "drive-removable-media-usb";
+ } else if(disk.dev_path().find("firewire") != std::string::npos) {
+ iconName = "drive-harddisk-ieee1394";
+ } else if(disk.node().find("mmcblk") != std::string::npos) {
+ iconName = "media-flash-sd-mmc";
+ } else if(disk.node().find("/md") != std::string::npos) {
+ iconName = "drive-multidisk";
+ } else if(disk.node().find("nvme") != std::string::npos) {
+ /* this is papirus-specific */
+ iconName = "gnome-dev-memory";
+ } else {
+ iconName = "drive-harddisk";
+ }
+
+ return QIcon::fromTheme(iconName);
+}
+
+PartitionDiskPage::PartitionDiskPage(QWidget *parent)
+ : HorizonWizardPage(parent) {
+ loadWatermark("disk");
+ setTitle(tr("Select Installation Disk"));
+
+ QLabel *descLabel = new QLabel(tr("Choose the hard disk on which to install Adélie Linux."));
+ descLabel->setWordWrap(true);
+
+ diskChooser = new QListWidget;
+ connect(diskChooser, &QListWidget::currentItemChanged,
+ this, &PartitionDiskPage::completeChanged);
+ diskChooser->setAutoFillBackground(true);
+ diskChooser->setFrameShape(QFrame::NoFrame);
+ diskChooser->setIconSize(QSize(32, 32));
+ diskChooser->setMovement(QListView::Static);
+ QColor color = this->palette().background().color();
+ diskChooser->setStyleSheet(QString{"QListView { background: rgb(%1, %2, %3); }"}
+ .arg(color.red()).arg(color.green()).arg(color.blue()));
+ diskChooser->setWrapping(true);
+ diskChooser->setWhatsThis(tr("This is a list of hard disk drives found in your computer. Select the hard disk you wish to use for installation."));
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addSpacing(10);
+ layout->addWidget(descLabel);
+ layout->addSpacing(10);
+ layout->addWidget(diskChooser);
+ setLayout(layout);
+}
+
+void PartitionDiskPage::initializePage() {
+ for(auto disk : horizonWizard()->disks) {
+ QString name{QString("%1 (%2)\n%3 MB available of %4 MB")
+ .arg(QString::fromStdString(disk.model()))
+ .arg(QString::fromStdString(disk.name()))
+ .arg(disk.contiguous_block()).arg(disk.total_size())};
+ QListWidgetItem *item = new QListWidgetItem(iconForDisk(disk), name, diskChooser);
+ item->setToolTip(QString::fromStdString(disk.dev_path()));
+ }
+
+ if(horizonWizard()->disks.size() == 0) {
+ QLabel *exclamation, *explanation;
+ exclamation = new QLabel;
+ exclamation->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(QSize(128, 128)));
+ explanation = new QLabel(tr("<p><strong>No disks have been found on your computer.</strong></p><p>Consult the Installation Handbook for more information.</p>"));
+ explanation->setAlignment(Qt::AlignCenter);
+ explanation->setTextFormat(Qt::RichText);
+ diskChooser->setHidden(true);
+ QVBoxLayout *myLayout = dynamic_cast<QVBoxLayout *>(layout());
+ myLayout->addStretch();
+ myLayout->addWidget(exclamation, 0, Qt::AlignCenter);
+ myLayout->addWidget(explanation, 0, Qt::AlignCenter);
+ myLayout->addStretch();
+ }
+}
+
+bool PartitionDiskPage::isComplete() const {
+ return diskChooser->currentIndex().row() != -1;
+}
diff --git a/ui/qt5/partitiondiskpage.hh b/ui/qt5/partitiondiskpage.hh
new file mode 100644
index 0000000..fc85926
--- /dev/null
+++ b/ui/qt5/partitiondiskpage.hh
@@ -0,0 +1,29 @@
+/*
+ * partitiondiskpage.hh - Definition of the UI.Partition.Install.UserPrompt page
+ * horizon-qt5, the Qt 5 user interface for
+ * Project Horizon
+ *
+ * Copyright (c) 2020 Adélie Linux and contributors. All rights reserved.
+ * This code is licensed under the AGPL 3.0 license, as noted in the
+ * LICENSE-code file in the root directory of this repository.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+#ifndef PARTITIONDISKPAGE_HH
+#define PARTITIONDISKPAGE_HH
+
+#include "horizonwizardpage.hh"
+
+#include <QListWidget>
+
+class PartitionDiskPage : public HorizonWizardPage {
+public:
+ PartitionDiskPage(QWidget *parent = nullptr);
+ void initializePage() override;
+ bool isComplete() const override;
+private:
+ QListWidget *diskChooser;
+};
+
+#endif /* !PARTITIONDISKPAGE_HH */
diff --git a/ui/qt5/partitionpage.cc b/ui/qt5/partitionpage.cc
index 8ca704a..1d259b1 100644
--- a/ui/qt5/partitionpage.cc
+++ b/ui/qt5/partitionpage.cc
@@ -4,7 +4,7 @@
* horizon-qt5, the Qt 5 user interface for
* Project Horizon
*
- * Copyright (c) 2019 Adélie Linux and contributors. All rights reserved.
+ * Copyright (c) 2020 Adélie Linux and contributors. All rights reserved.
* This code is licensed under the AGPL 3.0 license, as noted in the
* LICENSE-code file in the root directory of this repository.
*
@@ -14,6 +14,7 @@
#include "partitionpage.hh"
#include <QVBoxLayout>
+#include "partitiondiskpage.hh"
PartitionPage::PartitionPage(QWidget *parent) : HorizonWizardPage(parent) {
loadWatermark("disk");
@@ -90,6 +91,10 @@ void PartitionPage::processDisks(void *disk_obj) {
horizonWizard()->disks.swap(*disks);
delete disks;
+ /* ensure that the Disk page receives our new disk information */
+ horizonWizard()->removePage(HorizonWizard::Page_PartitionDisk);
+ horizonWizard()->setPage(HorizonWizard::Page_PartitionDisk, new PartitionDiskPage);
+
scanDone = true;
emit completeChanged();
wizard()->next();
diff --git a/ui/qt5/partitionpage.hh b/ui/qt5/partitionpage.hh
index ab9ad79..259a3f2 100644
--- a/ui/qt5/partitionpage.hh
+++ b/ui/qt5/partitionpage.hh
@@ -27,7 +27,7 @@
class PartitionPage : public HorizonWizardPage {
public:
PartitionPage(QWidget *parent = nullptr);
- void initializePage();
+ void initializePage() override;
bool isComplete() const override;
private:
#ifdef HAS_INSTALL_ENV
diff --git a/ui/qt5/partitionprobe.cc b/ui/qt5/partitionprobe.cc
index 32a45ab..af60034 100644
--- a/ui/qt5/partitionprobe.cc
+++ b/ui/qt5/partitionprobe.cc
@@ -14,6 +14,6 @@
void PartitionProbeThread::run() {
vector<Disk> *disks = new vector<Disk>{myMan.find_disks(true, true, false)};
- sleep(3);
+ sleep(1);
emit foundDisks(disks);
}
diff --git a/ui/qt5/resources/disk-high.png b/ui/qt5/resources/disk-high.png
new file mode 100644
index 0000000..fd83b44
--- /dev/null
+++ b/ui/qt5/resources/disk-high.png
Binary files differ
diff --git a/ui/qt5/resources/disk-low.png b/ui/qt5/resources/disk-low.png
index 845ca7f..f715751 100644
--- a/ui/qt5/resources/disk-low.png
+++ b/ui/qt5/resources/disk-low.png
Binary files differ