diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt5/CMakeLists.txt | 1 | ||||
-rw-r--r-- | ui/qt5/horizonwizard.cc | 2 | ||||
-rw-r--r-- | ui/qt5/partitionmanualpage.cc | 69 | ||||
-rw-r--r-- | ui/qt5/partitionmanualpage.hh | 32 |
4 files changed, 104 insertions, 0 deletions
diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt index c798407..6e3cf4e 100644 --- a/ui/qt5/CMakeLists.txt +++ b/ui/qt5/CMakeLists.txt @@ -17,6 +17,7 @@ set(UI_SOURCES inputpage.cc partitiondiskpage.cc partitionchoicepage.cc + partitionmanualpage.cc networkingpage.cc networkifacepage.cc netsimplewifipage.cc diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index 818f631..4b948be 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -44,6 +44,7 @@ extern "C" { #include "partitionpage.hh" #include "partitiondiskpage.hh" #include "partitionchoicepage.hh" +#include "partitionmanualpage.hh" #include "networkingpage.hh" #include "networkifacepage.hh" #include "netsimplewifipage.hh" @@ -218,6 +219,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { #endif /* HAS_INSTALL_ENV */ setPage(Page_PartitionDisk, new PartitionDiskPage); setPage(Page_PartitionChoose, new PartitionChoicePage); + setPage(Page_PartitionManual, new PartitionManualPage); setPage(Page_Network, new NetworkingPage); setPage(Page_Network_Iface, new NetworkIfacePage); setPage(Page_Network_Wireless, new NetworkSimpleWirelessPage); diff --git a/ui/qt5/partitionmanualpage.cc b/ui/qt5/partitionmanualpage.cc new file mode 100644 index 0000000..87a2d0f --- /dev/null +++ b/ui/qt5/partitionmanualpage.cc @@ -0,0 +1,69 @@ +/* + * partitionmanualpage.cc - Implementation of UI.Partition.Install.Manual 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 + */ + +#include "partitionmanualpage.hh" + +#include <QLabel> +#ifdef HAS_INSTALL_ENV +# include <QProcess> +# include <QPushButton> +#endif /* HAS_INSTALL_ENV */ +#include <QVBoxLayout> + +PartitionManualPage::PartitionManualPage(QWidget *parent) + : HorizonWizardPage(parent) { + QLabel *descLabel = new QLabel; + descLabel->setWordWrap(true); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(descLabel); + + loadWatermark("disk"); +#ifdef HAS_INSTALL_ENV + setTitle(tr("Launch Manual Partitioner")); + + descLabel->setText(tr("Choose 'Launch Partitioner' to launch the manual partitioning utility.\n\n" + "When you have finished partitioning the disk, quit the partitioning utility and choose Next.")); + + QPushButton *button = new QPushButton(tr("Launch Partitioner")); + connect(button, &QPushButton::clicked, [=]{ + QProcess p; + p.execute("partitionmanager"); + }); + layout->addStretch(); + layout->addWidget(button, 0, Qt::AlignCenter); + layout->addStretch(); +#else /* !HAS_INSTALL_ENV */ + setTitle(tr("Enter Partitioning Information")); + + descLabel->setText(tr("Enter the partitioning commands you wish to use for the target computer.\n\n" + "For a list of valid commands, choose Help or review the HorizonScript Reference.")); + + partitionEdit = new QTextEdit; + connect(partitionEdit, &QTextEdit::textChanged, [=]{ + horizonWizard()->part_lines = partitionEdit->toPlainText().split("\n"); + emit completeChanged(); + }); + partitionEdit->setAcceptRichText(false); + partitionEdit->setFontFamily("monospace"); + partitionEdit->setReadOnly(false); + layout->addWidget(partitionEdit); +#endif /* HAS_INSTALL_ENV */ + + setLayout(layout); +} + +#ifndef HAS_INSTALL_ENV +bool PartitionManualPage::isComplete() const { + return partitionEdit->toPlainText().size() > 0; +} +#endif /* !HAS_INSTALL_ENV */ diff --git a/ui/qt5/partitionmanualpage.hh b/ui/qt5/partitionmanualpage.hh new file mode 100644 index 0000000..c62bf26 --- /dev/null +++ b/ui/qt5/partitionmanualpage.hh @@ -0,0 +1,32 @@ +/* + * partitionmanualpage.hh - Definition of the UI.Partition.Install.Manual 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 PARTITIONMANUALPAGE_HH +#define PARTITIONMANUALPAGE_HH + +#include "horizonwizardpage.hh" + +#ifndef HAS_INSTALL_ENV +# include <QTextEdit> +#endif /* !HAS_INSTALL_ENV */ + +class PartitionManualPage : public HorizonWizardPage { +public: + PartitionManualPage(QWidget *parent = nullptr); +#ifndef HAS_INSTALL_ENV + bool isComplete() const override; +private: + QTextEdit *partitionEdit; +#endif /* !HAS_INSTALL_ENV */ +}; + +#endif /* !PARTITIONMANUALPAGE_HH */ |