From 9e5872dffe8e91bc4b67a689c36a629a0b128963 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 19 Nov 2019 18:57:47 -0600 Subject: Qt UI: Implement UI.Packages.SimpleSel --- ui/qt5/CMakeLists.txt | 1 + ui/qt5/horizonwizard.cc | 2 + ui/qt5/horizonwizard.hh | 9 +++++ ui/qt5/pkgsimple.cc | 103 ++++++++++++++++++++++++++++++++++++++++++++++++ ui/qt5/pkgsimple.hh | 24 +++++++++++ 5 files changed, 139 insertions(+) create mode 100644 ui/qt5/pkgsimple.cc create mode 100644 ui/qt5/pkgsimple.hh diff --git a/ui/qt5/CMakeLists.txt b/ui/qt5/CMakeLists.txt index d33e74a..72500ba 100644 --- a/ui/qt5/CMakeLists.txt +++ b/ui/qt5/CMakeLists.txt @@ -15,6 +15,7 @@ set(UI_SOURCES netdhcppage.cc datetimepage.cc hostnamepage.cc + pkgsimple.cc horizon.qrc) diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index b3e6c51..c59be5d 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -40,6 +40,7 @@ extern "C" { #include "netdhcppage.hh" #include "datetimepage.hh" #include "hostnamepage.hh" +#include "pkgsimple.hh" static std::map help_id_map = { {HorizonWizard::Page_Intro, "intro"}, @@ -186,6 +187,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { setPage(Page_Network_DHCP, new NetDHCPPage); setPage(Page_DateTime, new DateTimePage); setPage(Page_Hostname, new HostnamePage); + setPage(Page_PkgSimple, new PkgSimplePage); 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 f009426..e721df0 100644 --- a/ui/qt5/horizonwizard.hh +++ b/ui/qt5/horizonwizard.hh @@ -77,6 +77,14 @@ public: QString mac; }; + enum PackageType { + Standard, + Mobile, + Compact, + TextOnly, + Custom + }; + HorizonWizard(QWidget *parent = nullptr); QShortcut *f1, *f3, *f5, *f8; @@ -88,6 +96,7 @@ public: std::map interfaces; bool network; std::string chosen_auto_iface; + PackageType pkgtype; }; #endif /* !HORIZONWIZARD_HH */ diff --git a/ui/qt5/pkgsimple.cc b/ui/qt5/pkgsimple.cc new file mode 100644 index 0000000..b3e7d79 --- /dev/null +++ b/ui/qt5/pkgsimple.cc @@ -0,0 +1,103 @@ +/* + * pkgsimple.cc - Implementation of the UI.Packages.SimpleSel 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 "pkgsimple.hh" + +#include +#include +#include +#include +#include + +PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) { + setTitle(tr("Software Selection")); + loadWatermark("software"); + + QLabel *descLabel = new QLabel(tr( + "Select the software you want to install on this computer.\n\n" + "You can install and uninstall more software at any time using the Package Manager. For more information, see the User's Handbook in Online Help.")); + descLabel->setWordWrap(true); + + QRadioButton *standardButton, *mobileButton, *compactButton, *textButton, + *customButton; + QLabel *standardLabel, *mobileLabel, *compactLabel, *textLabel, *customLabel; + standardButton = new QRadioButton(tr("&Standard")); + standardButton->setIcon(QIcon::fromTheme("preferences-desktop-theme")); + standardButton->setIconSize(QSize(32, 32)); + standardLabel = new QLabel(tr("Includes a full KDE desktop environment, including Web browser, email client, media player, and office suite.")); + standardLabel->setBuddy(standardButton); + standardLabel->setWordWrap(true); + + mobileButton = new QRadioButton(tr("&Mobile")); + mobileButton->setIcon(QIcon::fromTheme("battery")); + mobileButton->setIconSize(QSize(32, 32)); + mobileLabel = new QLabel(tr("Includes the Standard software and additional utilities for notebook and tablet computers.")); + mobileLabel->setBuddy(mobileButton); + mobileLabel->setWordWrap(true); + + compactButton = new QRadioButton(tr("&Compact")); + compactButton->setIcon(QIcon::fromTheme("preferences-ubuntu-panel")); + compactButton->setIconSize(QSize(32, 32)); + compactLabel = new QLabel(tr("Includes a lightweight LXQt desktop environment and a text editor.")); + compactLabel->setBuddy(compactButton); + compactLabel->setWordWrap(true); + + textButton = new QRadioButton(tr("&Text-Only")); + textButton->setIcon(QIcon::fromTheme("utilities-terminal")); + textButton->setIconSize(QSize(32, 32)); + textLabel = new QLabel(tr("Includes support for text-mode only. Select this option on servers, or computers with very limited resources.")); + textLabel->setBuddy(textButton); + textLabel->setWordWrap(true); + + customButton = new QRadioButton(tr("C&ustom")); + customButton->setIcon(QIcon::fromTheme("preferences-activities")); + customButton->setIconSize(QSize(32, 32)); + customLabel = new QLabel(tr("Customise the packages installed on your computer.")); + customLabel->setBuddy(customButton); + customLabel->setWordWrap(true); + + QButtonGroup *group = new QButtonGroup(this); + group->addButton(standardButton, HorizonWizard::Standard); + group->addButton(mobileButton, HorizonWizard::Mobile); + group->addButton(compactButton, HorizonWizard::Compact); + group->addButton(textButton, HorizonWizard::TextOnly); + group->addButton(customButton, HorizonWizard::Custom); + connect(group, static_cast(&QButtonGroup::buttonClicked), + [=](int id) { + horizonWizard()->pkgtype = static_cast(id); + }); + + QGridLayout *buttonLayout = new QGridLayout; + buttonLayout->addWidget(standardButton, 0, 0); + buttonLayout->addWidget(standardLabel, 0, 1); + buttonLayout->addWidget(mobileButton, 1, 0); + buttonLayout->addWidget(mobileLabel, 1, 1); + buttonLayout->addWidget(compactButton, 2, 0); + buttonLayout->addWidget(compactLabel, 2, 1); + buttonLayout->addWidget(textButton, 3, 0); + buttonLayout->addWidget(textLabel, 3, 1); + buttonLayout->addWidget(customButton, 4, 0); + buttonLayout->addWidget(customLabel, 4, 1); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(descLabel); + mainLayout->addStretch(); + mainLayout->addLayout(buttonLayout); + setLayout(mainLayout); +} + +int PkgSimplePage::nextId() const { + if(horizonWizard()->pkgtype == HorizonWizard::Custom) + return HorizonWizard::Page_PkgCustom; + + return HorizonWizard::Page_Boot; +} diff --git a/ui/qt5/pkgsimple.hh b/ui/qt5/pkgsimple.hh new file mode 100644 index 0000000..0a7f087 --- /dev/null +++ b/ui/qt5/pkgsimple.hh @@ -0,0 +1,24 @@ +/* + * pkgsimple.hh - Definition of the UI.Packages.SimpleSel 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 PKGSIMPLE_HH +#define PKGSIMPLE_HH + +#include "horizonwizardpage.hh" + +class PkgSimplePage : public HorizonWizardPage { +public: + PkgSimplePage(QWidget *parent = nullptr); + int nextId() const; +}; + +#endif /* !PKGSIMPLE_HH */ -- cgit v1.2.3-60-g2f50