diff options
-rw-r--r-- | ui/qt5/CMakeLists.txt | 4 | ||||
-rw-r--r-- | ui/qt5/horizonwizard.cc | 6 | ||||
-rw-r--r-- | ui/qt5/partitionchoicepage.cc | 6 | ||||
-rw-r--r-- | ui/qt5/partitiondiskpage.cc | 21 | ||||
-rw-r--r-- | ui/qt5/partitiondiskpage.hh | 10 |
5 files changed, 42 insertions, 5 deletions
diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt index 92e70ec..c798407 100644 --- a/ui/qt5/CMakeLists.txt +++ b/ui/qt5/CMakeLists.txt @@ -15,7 +15,6 @@ set(UI_SOURCES intropage.cc inputpage.cc - partitionpage.cc partitiondiskpage.cc partitionchoicepage.cc networkingpage.cc @@ -50,7 +49,8 @@ set(RUN_QT_SOURCES IF(INSTALL) LIST(APPEND UI_SOURCES commitpage.cc - partitionprobe.cc) + partitionprobe.cc + partitionpage.cc) ELSE(INSTALL) LIST(APPEND UI_SOURCES writeoutpage.cc) ENDIF(INSTALL) diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index 862d2d6..818f631 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -66,7 +66,9 @@ static std::map<int, std::string> help_id_map = { #ifdef NON_LIBRE_FIRMWARE {HorizonWizard::Page_Firmware, "firmware"}, #endif /* NON_LIBRE_FIRMWARE */ +#ifdef HAS_INSTALL_ENV {HorizonWizard::Page_Partition, "partition"}, +#endif /* HAS_INSTALL_ENV */ {HorizonWizard::Page_PartitionDisk, "partition-disk"}, {HorizonWizard::Page_PartitionChoose, "partition-manipulation"}, {HorizonWizard::Page_PartitionManual, "partition-manual"}, @@ -211,7 +213,9 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { #ifdef NON_LIBRE_FIRMWARE setPage(Page_Firmware, new FirmwarePage); #endif /* NON_LIBRE_FIRMWARE */ +#ifdef HAS_INSTALL_ENV setPage(Page_Partition, new PartitionPage); +#endif /* HAS_INSTALL_ENV */ setPage(Page_PartitionDisk, new PartitionDiskPage); setPage(Page_PartitionChoose, new PartitionChoicePage); setPage(Page_Network, new NetworkingPage); @@ -398,7 +402,7 @@ QString HorizonWizard::toHScript() { break; } - if(chosen_disk.empty()) { + if(chosen_disk.empty() || !auto_part) { lines << part_lines; } else { /* XXX TODO: examples for thoughts on auto-partition setups are in diff --git a/ui/qt5/partitionchoicepage.cc b/ui/qt5/partitionchoicepage.cc index f98ab91..3045b79 100644 --- a/ui/qt5/partitionchoicepage.cc +++ b/ui/qt5/partitionchoicepage.cc @@ -89,6 +89,7 @@ void PartitionChoicePage::initializePage() { manualButton->setHidden(false); manualLabel->setHidden(false); +#ifdef HAS_INSTALL_ENV Horizon::DiskMan::Disk *d = nullptr; for(auto &disk : horizonWizard()->disks) { if(disk.node() == horizonWizard()->chosen_disk) { @@ -117,6 +118,11 @@ void PartitionChoicePage::initializePage() { "Continuing will erase any data present on the disk, if any.")); } } +#else /* !HAS_INSTALL_ENV */ + /* Go ahead and give the user the choice to use existing. */ + useExistingButton->setHidden(false); + useExistingLabel->setHidden(false); +#endif /* HAS_INSTALL_ENV */ QString chosen{QString::fromStdString(horizonWizard()->chosen_disk)}; descLabel->setText(descLabel->text().arg(chosen)); diff --git a/ui/qt5/partitiondiskpage.cc b/ui/qt5/partitiondiskpage.cc index 2f7f9e9..b47000b 100644 --- a/ui/qt5/partitiondiskpage.cc +++ b/ui/qt5/partitiondiskpage.cc @@ -41,9 +41,12 @@ PartitionDiskPage::PartitionDiskPage(QWidget *parent) loadWatermark("disk"); setTitle(tr("Select Installation Disk")); - QLabel *descLabel = new QLabel(tr("Choose the hard disk on which to install Adélie Linux.")); + QLabel *descLabel = new QLabel; descLabel->setWordWrap(true); +#ifdef HAS_INSTALL_ENV + descLabel->setText(tr("Choose the hard disk on which to install Adélie Linux.")); + diskChooser = new QListWidget; connect(diskChooser, &QListWidget::currentItemChanged, [=]{ if(diskChooser->currentItem() != nullptr) { @@ -66,6 +69,16 @@ PartitionDiskPage::PartitionDiskPage(QWidget *parent) .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.")); +#else /* !HAS_INSTALL_ENV */ + descLabel->setText(tr("Enter the path to the hard disk device on which to install Adélie Linux. For instance, /dev/sda or /dev/nvme0n1.\n\nDo not input the path to a partition.")); + + diskChooser = new QLineEdit; + connect(diskChooser, &QLineEdit::textEdited, [=](QString text) { + horizonWizard()->chosen_disk = text.toStdString(); + emit completeChanged(); + }); + diskChooser->setPlaceholderText(tr("/dev/...")); +#endif /* HAS_INSTALL_ENV */ QVBoxLayout *layout = new QVBoxLayout; layout->addSpacing(10); @@ -76,6 +89,7 @@ PartitionDiskPage::PartitionDiskPage(QWidget *parent) } void PartitionDiskPage::initializePage() { +#ifdef HAS_INSTALL_ENV for(auto disk : horizonWizard()->disks) { QString name{QString("%1 (%2)\n%3 MB available of %4 MB") .arg(QString::fromStdString(disk.model())) @@ -100,8 +114,13 @@ void PartitionDiskPage::initializePage() { myLayout->addWidget(explanation, 0, Qt::AlignCenter); myLayout->addStretch(); } +#endif /* HAS_INSTALL_ENV */ } bool PartitionDiskPage::isComplete() const { +#ifdef HAS_INSTALL_ENV return diskChooser->currentIndex().row() != -1; +#else /* !HAS_INSTALL_ENV */ + return !diskChooser->text().isEmpty(); +#endif /* HAS_INSTALL_ENV */ } diff --git a/ui/qt5/partitiondiskpage.hh b/ui/qt5/partitiondiskpage.hh index fc85926..d687943 100644 --- a/ui/qt5/partitiondiskpage.hh +++ b/ui/qt5/partitiondiskpage.hh @@ -15,7 +15,11 @@ #include "horizonwizardpage.hh" -#include <QListWidget> +#ifdef HAS_INSTALL_ENV +# include <QListWidget> +#else /* !HAS_INSTALL_ENV */ +# include <QLineEdit> +#endif /* HAS_INSTALL_ENV */ class PartitionDiskPage : public HorizonWizardPage { public: @@ -23,7 +27,11 @@ public: void initializePage() override; bool isComplete() const override; private: +#ifdef HAS_INSTALL_ENV QListWidget *diskChooser; +#else /* !HAS_INSTALL_ENV */ + QLineEdit *diskChooser; +#endif /* HAS_INSTALL_ENV */ }; #endif /* !PARTITIONDISKPAGE_HH */ |