From 2533566cb859d9bae6250749973a4c014d4dcc21 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 11 May 2019 23:48:06 -0500 Subject: Add partition page stub --- horizon-qt5.pro | 8 +++-- horizon.qrc | 1 + horizonwizard.cc | 3 ++ partitionpage.cc | 69 ++++++++++++++++++++++++++++++++++++++++++++ partitionpage.hh | 22 ++++++++++++++ resources/partition-help.txt | 5 ++++ welcomepage.cc | 13 +-------- 7 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 partitionpage.cc create mode 100644 partitionpage.hh create mode 100644 resources/partition-help.txt diff --git a/horizon-qt5.pro b/horizon-qt5.pro index 98ca621..7a258d1 100644 --- a/horizon-qt5.pro +++ b/horizon-qt5.pro @@ -13,7 +13,8 @@ SOURCES += main.cc \ horizonwizardpage.cc \ softwarepage.cc \ horizonhelpwindow.cc \ - netsimplewifipage.cc + netsimplewifipage.cc \ + partitionpage.cc HEADERS += \ horizonwizard.hh \ @@ -22,7 +23,8 @@ HEADERS += \ horizonwizardpage.hh \ softwarepage.hh \ horizonhelpwindow.hh \ - netsimplewifipage.hh + netsimplewifipage.hh \ + partitionpage.hh RESOURCES += \ horizon.qrc @@ -30,3 +32,5 @@ RESOURCES += \ unix: CONFIG += link_pkgconfig unix: PKG_CONFIG = PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkgconf unix: PKGCONFIG += horizon-core + +DISTFILES += diff --git a/horizon.qrc b/horizon.qrc index 601eb25..dfe0fa8 100644 --- a/horizon.qrc +++ b/horizon.qrc @@ -11,5 +11,6 @@ resources/welcome-help.txt resources/network-start-help.txt resources/software-help.txt + resources/partition-help.txt diff --git a/horizonwizard.cc b/horizonwizard.cc index 5e8845f..1b66136 100644 --- a/horizonwizard.cc +++ b/horizonwizard.cc @@ -12,6 +12,7 @@ # include using Horizon::NetworkInterface; #endif +#include "partitionpage.hh" #include "networkingpage.hh" #include "netsimplewifipage.hh" #include "softwarepage.hh" @@ -21,6 +22,7 @@ using std::string; static map help_id_map = { {HorizonWizard::Page_Welcome, "welcome"}, + {HorizonWizard::Page_Partition, "partition"}, {HorizonWizard::Page_Networking, "network-start"}, {HorizonWizard::Page_Network_SimpleWireless, "network-wifi"}, {HorizonWizard::Page_Network_SimpleWired, "network-wired"}, @@ -46,6 +48,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) setSizeGripEnabled(false); setPage(Page_Welcome, new WelcomePage); + setPage(Page_Partition, new PartitionPage); setPage(Page_Networking, new NetworkingPage); setPage(Page_Network_SimpleWireless, new NetworkSimpleWirelessPage); setPage(Page_Software, new SoftwarePage); diff --git a/partitionpage.cc b/partitionpage.cc new file mode 100644 index 0000000..6a9d381 --- /dev/null +++ b/partitionpage.cc @@ -0,0 +1,69 @@ +#include "partitionpage.hh" +#include "horizonwizard.hh" + +#ifndef NOT_NATIVE +# include +# include +#endif + +#include +#include + +PartitionPage::PartitionPage(QWidget *parent) : HorizonWizardPage (parent) +{ + QLabel *infoLabel; + QVBoxLayout *layout = new QVBoxLayout; +#ifndef NOT_NATIVE + QHBoxLayout *buttonLayout = new QHBoxLayout; +#endif + + loadWatermark("partition"); + setTitle(tr("Partition Disk Drive")); + + infoLabel = new QLabel(tr( +#ifdef NOT_NATIVE + "You must partition the disk before continuing. Unfortunately the Horizon Wizard cannot help you at this time." +#else + "You must partition your computer's disk drive(s) before " + "you can install the Adélie Linux system.\n\nIf you have " + "already partitioned your computer's disk drive(s) before " + "beginning this installation, choose Next. Otherwise, " + "choose \"Launch Partitioner\" to start the disk " + "partitioning process.\n\n" + + "NOTE: Incorrectly partitioning your computer's disk " + "drive(s) may cause data loss, or require further " + "partitioning in order to boot. Consult the owner's " + "manual for your computer and/or firmware for more " + "information." +#endif + )); + infoLabel->setWordWrap(true); + + layout->addWidget(infoLabel); +#ifndef NOT_NATIVE + openEditor = new QPushButton(tr("Launch Partitioner")); + QObject::connect(openEditor, static_cast(&QPushButton::clicked), + [](bool checked) { + QProcess *parted = new QProcess; + + }); + buttonLayout->addWidget(openEditor, 0, Qt::AlignCenter); + layout->addLayout(buttonLayout); +#endif + this->setLayout(layout); +} + +int PartitionPage::nextId() const +{ +#ifdef NOT_NATIVE + return HorizonWizard::Page_Networking; +#else + if(this->horizonWizard()->interfaces.size() > 0) + { + return HorizonWizard::Page_Networking; + } else { + return HorizonWizard::Page_Software; + } +#endif +} diff --git a/partitionpage.hh b/partitionpage.hh new file mode 100644 index 0000000..0819cb3 --- /dev/null +++ b/partitionpage.hh @@ -0,0 +1,22 @@ +#ifndef PARTITIONPAGE_HH +#define PARTITIONPAGE_HH + +#include "horizonwizardpage.hh" + +#ifndef NOT_NATIVE +# include +#endif + +class PartitionPage : public HorizonWizardPage +{ +public: + PartitionPage(QWidget *parent = nullptr); + + int nextId() const; +private: +#ifndef NOT_NATIVE + QPushButton *openEditor; +#endif +}; + +#endif // SOFTWAREPAGE_HH diff --git a/resources/partition-help.txt b/resources/partition-help.txt new file mode 100644 index 0000000..0f0bf19 --- /dev/null +++ b/resources/partition-help.txt @@ -0,0 +1,5 @@ +

Partitioning the Hard Disk Drive

+ +Please help the user partition the disk drive here. + +Do not ship this content. diff --git a/welcomepage.cc b/welcomepage.cc index aa84eb5..6da1474 100644 --- a/welcomepage.cc +++ b/welcomepage.cc @@ -55,16 +55,5 @@ WelcomePage::WelcomePage(QWidget *parent) : HorizonWizardPage(parent) int WelcomePage::nextId() const { -#ifndef NOT_NATIVE - if(this->horizonWizard()->interfaces.size() > 0) - { -#endif - return HorizonWizard::Page_Networking; -#ifndef NOT_NATIVE - } - else - { - return HorizonWizard::Page_Software; - } -#endif + return HorizonWizard::Page_Partition; } -- cgit v1.2.3-70-g09d2