summaryrefslogtreecommitdiff
path: root/ui/qt5/partitionmanualpage.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-18 16:57:27 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-18 16:57:27 -0600
commit0bac046242cff4c98c78958ceb958176a8d05fc5 (patch)
treee446875153afa84c10b2ff03e153b36b6225f849 /ui/qt5/partitionmanualpage.cc
parent29a9748bb0ee776665ff9931a2ab5bca7c7a5124 (diff)
downloadhorizon-0bac046242cff4c98c78958ceb958176a8d05fc5.tar.gz
horizon-0bac046242cff4c98c78958ceb958176a8d05fc5.tar.bz2
horizon-0bac046242cff4c98c78958ceb958176a8d05fc5.tar.xz
horizon-0bac046242cff4c98c78958ceb958176a8d05fc5.zip
Qt UI: Implement UI.Partition.Install.Manual and some of UI.Partition.Runtime*
Diffstat (limited to 'ui/qt5/partitionmanualpage.cc')
-rw-r--r--ui/qt5/partitionmanualpage.cc69
1 files changed, 69 insertions, 0 deletions
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 */