From 0bac046242cff4c98c78958ceb958176a8d05fc5 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 18 Feb 2020 16:57:27 -0600 Subject: Qt UI: Implement UI.Partition.Install.Manual and some of UI.Partition.Runtime* --- ui/qt5/partitionmanualpage.cc | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 ui/qt5/partitionmanualpage.cc (limited to 'ui/qt5/partitionmanualpage.cc') 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 +#ifdef HAS_INSTALL_ENV +# include +# include +#endif /* HAS_INSTALL_ENV */ +#include + +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 */ -- cgit v1.2.3-60-g2f50