summaryrefslogtreecommitdiff
path: root/ui/qt5
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-19 23:01:41 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-19 23:01:41 -0600
commit5a2edfafa2465ee615eece5655601be96d7c0cde (patch)
tree98800c6efeb798664307aae7d3fc730bfe411f22 /ui/qt5
parentaf7111f3750eec9b90b6025297c522b97952cd38 (diff)
downloadhorizon-5a2edfafa2465ee615eece5655601be96d7c0cde.tar.gz
horizon-5a2edfafa2465ee615eece5655601be96d7c0cde.tar.bz2
horizon-5a2edfafa2465ee615eece5655601be96d7c0cde.tar.xz
horizon-5a2edfafa2465ee615eece5655601be96d7c0cde.zip
Qt UI: Add UI.Boot page
Diffstat (limited to 'ui/qt5')
-rw-r--r--ui/qt5/CMakeLists.txt3
-rw-r--r--ui/qt5/bootpage.cc93
-rw-r--r--ui/qt5/bootpage.hh30
-rw-r--r--ui/qt5/horizon.qrc1
-rw-r--r--ui/qt5/horizonwizard.cc7
-rw-r--r--ui/qt5/horizonwizard.hh2
-rw-r--r--ui/qt5/resources/startup-help.txt46
7 files changed, 182 insertions, 0 deletions
diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt
index 72500ba..7b955b7 100644
--- a/ui/qt5/CMakeLists.txt
+++ b/ui/qt5/CMakeLists.txt
@@ -6,6 +6,7 @@ set(UI_SOURCES
horizonwizardpage.cc
horizonhelpwindow.cc
main.cc
+ ${CMAKE_SOURCE_DIR}/3rdparty/Section.cpp
intropage.cc
inputpage.cc
@@ -16,6 +17,7 @@ set(UI_SOURCES
datetimepage.cc
hostnamepage.cc
pkgsimple.cc
+ bootpage.cc
horizon.qrc)
@@ -23,6 +25,7 @@ IF(UNSUPPORTED_NONFREE_FIRMWARE)
LIST(APPEND UI_SOURCES firmwarepage.cc)
ENDIF(UNSUPPORTED_NONFREE_FIRMWARE)
+include_directories(${CMAKE_SOURCE_DIR}/3rdparty)
add_executable(horizon-qt5 ${UI_SOURCES})
target_link_libraries(horizon-qt5 Qt5::Network Qt5::Widgets)
diff --git a/ui/qt5/bootpage.cc b/ui/qt5/bootpage.cc
new file mode 100644
index 0000000..ff44455
--- /dev/null
+++ b/ui/qt5/bootpage.cc
@@ -0,0 +1,93 @@
+/*
+ * bootpage.cc - Implementation of the UI.Boot page
+ * horizon-qt5, the Qt 5 user interface for
+ * Project Horizon
+ *
+ * Copyright (c) 2019 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 "bootpage.hh"
+
+#include <QButtonGroup>
+#include <QLabel>
+#include <QVBoxLayout>
+
+#include <Section.h>
+
+BootPage::BootPage(QWidget *parent) : HorizonWizardPage(parent) {
+ setTitle(tr("Startup Configuration"));
+ loadWatermark("intro");
+
+ QLabel *descLabel = new QLabel(tr(
+ "<p>By default, Adélie Linux will install a bootloader to your hard disk. "
+ "If you will be using multiple operating systems on this computer (not common), you may need to select \"Do not install a boot loader\".</p>"
+ "<p><strong>Most users should choose the default.</strong></p>"
+ "<p>Do you want to install a bootloader?</p>"));
+ descLabel->setTextFormat(Qt::RichText);
+ descLabel->setWordWrap(true);
+
+ yesGrub = new QRadioButton(tr("&Install a boot loader."));
+ yesGrub->setWhatsThis(tr("This option will install a bootloader to your hard disk, replacing any other bootloader if present."));
+ noGrub = new QRadioButton(tr("&Do not install a boot loader."));
+ noGrub->setWhatsThis(tr("This option will not install a bootloader to your hard disk. You may be required to configure a bootloader yourself before your computer will start up properly."));
+ QButtonGroup *grubChoices = new QButtonGroup;
+ grubChoices->addButton(yesGrub, true);
+ grubChoices->addButton(noGrub, false);
+ connect(grubChoices, static_cast<void (QButtonGroup:: *)(int)>(&QButtonGroup::buttonClicked),
+ [=](int choice) {
+ horizonWizard()->grub = static_cast<bool>(choice);
+ });
+
+ Section *kernDisclosure = new Section("Kernel options");
+
+ /* We set the default option, chosen during wizard initialisation,
+ * as checked. */
+ easyKernel = new QRadioButton(tr("Use the &stable kernel."),
+ kernDisclosure);
+ easyKernel->setWhatsThis(tr("This option will install the LTS version of the Linux kernel, which is well supported and thoroughly tested. However, it may not support the newest hardware options."));
+ mlKernel = new QRadioButton(tr("Use the &mainline kernel. (Potentially unstable)"),
+ kernDisclosure);
+ mlKernel->setWhatsThis(tr("This option will install the latest version of the Linux kernel, which has not been as thoroughly tested as the stable kernel. Use this option if you have hardware that requires a newer kernel version than LTS."));
+ QButtonGroup *kernelChoices = new QButtonGroup;
+ kernelChoices->addButton(easyKernel);
+ kernelChoices->addButton(mlKernel);
+ connect(kernelChoices, static_cast<void(QButtonGroup:: *)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
+ [=](QAbstractButton *button) {
+ if(button == easyKernel) {
+ horizonWizard()->kernel = "easy-kernel";
+ } else if(button == mlKernel) {
+ horizonWizard()->kernel = "mainline-kernel";
+ }
+ });
+
+ QVBoxLayout *kernelLayout = new QVBoxLayout;
+ kernelLayout->addWidget(easyKernel);
+ kernelLayout->addWidget(mlKernel);
+
+ kernDisclosure->setContentLayout(*kernelLayout);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(descLabel);
+ mainLayout->addSpacing(25);
+ mainLayout->addWidget(yesGrub);
+ mainLayout->addWidget(noGrub);
+ mainLayout->addStretch();
+ mainLayout->addWidget(kernDisclosure);
+ setLayout(mainLayout);
+}
+
+void BootPage::initializePage() {
+ yesGrub->click();
+
+ if(horizonWizard()->kernel == "easy-kernel") {
+ easyKernel->setChecked(true);
+ } else if(horizonWizard()->kernel == "mainline-kernel") {
+ mlKernel->setChecked(true);
+ } else {
+ /* ?! */
+ }
+}
diff --git a/ui/qt5/bootpage.hh b/ui/qt5/bootpage.hh
new file mode 100644
index 0000000..4cda4c6
--- /dev/null
+++ b/ui/qt5/bootpage.hh
@@ -0,0 +1,30 @@
+/*
+ * bootpage.hh - Definition of the UI.Boot page
+ * horizon-qt5, the Qt 5 user interface for
+ * Project Horizon
+ *
+ * Copyright (c) 2019 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 BOOTPAGE_HH
+#define BOOTPAGE_HH
+
+#include "horizonwizardpage.hh"
+
+#include <QRadioButton>
+
+class BootPage : public HorizonWizardPage {
+public:
+ BootPage(QWidget *parent = nullptr);
+
+ void initializePage();
+private:
+ QRadioButton *yesGrub, *noGrub,
+ *easyKernel, *mlKernel;
+};
+
+#endif /* !BOOTPAGE_HH */
diff --git a/ui/qt5/horizon.qrc b/ui/qt5/horizon.qrc
index 9ef9255..56bb067 100644
--- a/ui/qt5/horizon.qrc
+++ b/ui/qt5/horizon.qrc
@@ -24,6 +24,7 @@
<file>resources/datetime-help.txt</file>
<file>resources/hostname-help.txt</file>
<file>resources/packages-simple-help.txt</file>
+ <file>resources/startup-help.txt</file>
</qresource>
<qresource prefix="/">
<file alias="horizon-256.png">../../assets/horizon-256.png</file>
diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc
index c59be5d..2b3dd8b 100644
--- a/ui/qt5/horizonwizard.cc
+++ b/ui/qt5/horizonwizard.cc
@@ -41,6 +41,7 @@ extern "C" {
#include "datetimepage.hh"
#include "hostnamepage.hh"
#include "pkgsimple.hh"
+#include "bootpage.hh"
static std::map<int, std::string> help_id_map = {
{HorizonWizard::Page_Intro, "intro"},
@@ -167,6 +168,11 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) {
mirror_domain = "distfiles.adelielinux.org";
version = "stable";
+ /* TODO XXX:
+ * Determine which platform kernel is being used, if any (-power8 etc)
+ * Determine hardware requirements (easy or mainline)
+ */
+ kernel = "easy-kernel";
/* REQ: UI.Global.Back.Save */
setOption(IndependentPages);
@@ -188,6 +194,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) {
setPage(Page_DateTime, new DateTimePage);
setPage(Page_Hostname, new HostnamePage);
setPage(Page_PkgSimple, new PkgSimplePage);
+ setPage(Page_Boot, new BootPage);
QObject::connect(this, &QWizard::helpRequested, [=](void) {
if(help_id_map.find(currentId()) == help_id_map.end()) {
diff --git a/ui/qt5/horizonwizard.hh b/ui/qt5/horizonwizard.hh
index e721df0..b025589 100644
--- a/ui/qt5/horizonwizard.hh
+++ b/ui/qt5/horizonwizard.hh
@@ -97,6 +97,8 @@ public:
bool network;
std::string chosen_auto_iface;
PackageType pkgtype;
+ bool grub;
+ std::string kernel;
};
#endif /* !HORIZONWIZARD_HH */
diff --git a/ui/qt5/resources/startup-help.txt b/ui/qt5/resources/startup-help.txt
new file mode 100644
index 0000000..9605a08
--- /dev/null
+++ b/ui/qt5/resources/startup-help.txt
@@ -0,0 +1,46 @@
+<h2>Startup Configuration</h2>
+
+<p>This page allows you to choose options for starting up your computer.</p>
+
+<h3>What is a bootloader?</h3>
+
+<p>A <i>bootloader</i> is the program that runs when you power on your
+computer. The bootloader is responsible for locating Adélie Linux and/or
+other operating environments on your computer, and then loading them in to
+memory.</p>
+
+<h3>What option should I choose?</h3>
+
+<p>Typically, <strong>you should always choose to install a bootloader</strong>
+unless you have a configuration that will use a different method of booting.
+</p>
+
+<ul>
+<li><strong>Install a boot loader:</strong> <p>This option will install a
+bootloader to your hard disk, replacing any other bootloader if present.</p>
+</li>
+<li><strong>Do not install a boot loader:</strong> <p>This option will not
+install a bootloader to your hard disk. You may be required to configure a
+bootloader yourself before your computer will start up properly. Choose this
+option if you already have another operating environment with a bootloader, or
+if your computer has a bootloader in firmware (such as OPAL or UEFI).</p></li>
+</ul>
+
+<hr>
+
+<h3>What are the kernel options?</h3>
+
+<p>The kernel options disclosure allows you to choose which Linux kernel you
+want to use on your computer. <strong>Only change these options if you have
+hardware that requires it, or your administrator or hardware manufacturer has
+told you that you need a special kernel.</strong></p>
+
+<ul>
+<li><strong>Use the stable kernel:</strong> <p>This option will install the
+LTS version of the Linux kernel, which is well supported and thoroughly tested.
+However, it may not support the newest hardware options.</p></li>
+<li><strong>Use the mainline kernel:</strong> <p>This option will install the
+latest version of the Linux kernel, which has not been as thoroughly tested as
+the stable kernel. Use this option if you have hardware that requires a newer
+kernel version than LTS.</p></li>
+</ul>