summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2023-03-25 23:53:16 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2023-03-25 23:53:16 -0500
commit7060a34f73bbd26af6fabaaba4926565d78818b4 (patch)
tree04fb8979b6e2328704a272d3f4bd0791bca39b29 /ui
parent9fb439ac12c81a3d58eecd30de2b2655b27c6f38 (diff)
downloadhorizon-7060a34f73bbd26af6fabaaba4926565d78818b4.tar.gz
horizon-7060a34f73bbd26af6fabaaba4926565d78818b4.tar.bz2
horizon-7060a34f73bbd26af6fabaaba4926565d78818b4.tar.xz
horizon-7060a34f73bbd26af6fabaaba4926565d78818b4.zip
Qt UI: Support DE choice, current as default
In the Runtime Environment, we default to Plasma. In the Install Environment, we use the current desktop. Closes: #340
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/horizonwizard.cc23
-rw-r--r--ui/qt5/horizonwizard.hh15
-rw-r--r--ui/qt5/pkgsimple.cc79
-rw-r--r--ui/qt5/pkgsimple.hh1
4 files changed, 94 insertions, 24 deletions
diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc
index 7fefee5..68f9d41 100644
--- a/ui/qt5/horizonwizard.cc
+++ b/ui/qt5/horizonwizard.cc
@@ -272,7 +272,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) {
setPage(Page_Commit, new CommitPage);
#endif /* !HAS_INSTALL_ENV */
- QObject::connect(this, &QWizard::helpRequested, [=](void) {
+ QObject::connect(this, &QWizard::helpRequested, [=]() {
if(help_id_map.find(currentId()) == help_id_map.end()) {
qDebug() << "no help available for " << currentId();
QMessageBox nohelp(QMessageBox::Warning,
@@ -491,6 +491,21 @@ QStringList bootForArch(const std::string &raw_disk, HorizonWizard::Arch arch,
}
+/*! Determine the packages to install for the specified desktop environment. */
+QString packagesForDesktop(HorizonWizard::DesktopType desktop) {
+ switch(desktop) {
+ case HorizonWizard::Plasma:
+ return "x11 kde calligra";
+ case HorizonWizard::LXQt:
+ return "x11 lxqt-desktop";
+ case HorizonWizard::MATE:
+ return "x11 mate-complete";
+ case HorizonWizard::XFCE:
+ return "x11 xfce-desktop xfce-plugins";
+ }
+}
+
+
QString HorizonWizard::toHScript() {
QStringList lines;
@@ -630,8 +645,8 @@ QString HorizonWizard::toHScript() {
[[ fallthrough ]];
#endif
case Standard:
- lines << "pkginstall adelie-base-posix firefox-esr libreoffice "
- "thunderbird vlc kde x11 bluez sddm docs";
+ lines << "pkginstall adelie-base-posix bluez sddm docs";
+ lines << ("pkginstall " + packagesForDesktop(desktopType));
lines << "svcenable bluetooth";
lines << "svcenable elogind";
lines << "svcenable sddm";
@@ -711,7 +726,7 @@ QString HorizonWizard::toHScript() {
} else {
lines << "firmware false";
}
-#endif /* NON_LIBRE_FIRWMARE */
+#endif /* NON_LIBRE_FIRMWARE */
lines << ("timezone " +
dynamic_cast<DateTimePage *>(page(Page_DateTime))->selectedTimeZone());
diff --git a/ui/qt5/horizonwizard.hh b/ui/qt5/horizonwizard.hh
index 8af9df7..ce5c22d 100644
--- a/ui/qt5/horizonwizard.hh
+++ b/ui/qt5/horizonwizard.hh
@@ -122,6 +122,13 @@ public:
Custom
};
+ enum DesktopType {
+ Plasma,
+ LXQt,
+ MATE,
+ XFCE
+ };
+
enum BinShProvider {
Dash,
Bash
@@ -132,9 +139,9 @@ public:
SysVInit
};
- HorizonWizard(QWidget *parent = nullptr);
- void accept();
- void reject();
+ explicit HorizonWizard(QWidget *parent = nullptr);
+ void accept() override;
+ void reject() override;
/*! Emit a HorizonScript file with the user's choices. */
QString toHScript();
QShortcut *f1, *f3, *f6, *f8, *f10;
@@ -190,6 +197,8 @@ public:
InitSystem sbininit;
/*! Determines the packages to install. */
PackageType pkgtype;
+ /*! If pkgtype is Standard, which desktop environment to install. */
+ DesktopType desktopType;
/*! If pkgtype is Custom, a list of packages to install. */
QStringList packages;
/*! Determines the kernel to install. */
diff --git a/ui/qt5/pkgsimple.cc b/ui/qt5/pkgsimple.cc
index 2cd61b9..7ad65f8 100644
--- a/ui/qt5/pkgsimple.cc
+++ b/ui/qt5/pkgsimple.cc
@@ -23,17 +23,19 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) {
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 Handbook in Online Help."));
+ "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 Handbook in Online Help."));
descLabel->setWordWrap(true);
QRadioButton *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 = new QLabel(
+ tr("Includes a full desktop environment, including Web browser, email client, media player, and office suite."));
standardLabel->setBuddy(standardButton);
standardLabel->setWordWrap(true);
standardButton->setWhatsThis(standardLabel->text());
@@ -41,7 +43,8 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) {
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 = new QLabel(
+ tr("Includes the Standard software and additional utilities for notebook and tablet computers."));
mobileLabel->setBuddy(mobileButton);
mobileLabel->setWordWrap(true);
mobileButton->setWhatsThis(mobileLabel->text());
@@ -57,7 +60,8 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) {
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 = new QLabel(
+ tr("Includes only text-mode support. Select for servers, or computers with very limited resources."));
textLabel->setBuddy(textButton);
textLabel->setWordWrap(true);
textButton->setWhatsThis(textLabel->text());
@@ -70,6 +74,33 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) {
customLabel->setWordWrap(true);
customButton->setWhatsThis(customLabel->text());
+ deskPlasmaButton = new QRadioButton(tr("KDE Plasma"));
+ deskLXQtButton = new QRadioButton(tr("LXQt"));
+ deskMATEButton = new QRadioButton(tr("MATE"));
+ deskXFCEButton = new QRadioButton(tr("XFCE"));
+
+ QButtonGroup *desktopGroup = new QButtonGroup(this);
+ desktopGroup->addButton(deskPlasmaButton, HorizonWizard::Plasma);
+ desktopGroup->addButton(deskLXQtButton, HorizonWizard::LXQt);
+ desktopGroup->addButton(deskMATEButton, HorizonWizard::MATE);
+ desktopGroup->addButton(deskXFCEButton, HorizonWizard::XFCE);
+ connect(desktopGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
+ [=](QAbstractButton *choice) {
+ horizonWizard()->desktopType = static_cast<HorizonWizard::DesktopType>(desktopGroup->id(choice));
+ });
+
+ QGridLayout *buttonLayout = new QGridLayout;
+ buttonLayout->addWidget(standardButton, 0, 0);
+ buttonLayout->addWidget(standardLabel, 0, 1);
+ buttonLayout->addWidget(mobileButton, 2, 0);
+ buttonLayout->addWidget(mobileLabel, 2, 1);
+ buttonLayout->addWidget(compactButton, 3, 0);
+ buttonLayout->addWidget(compactLabel, 3, 1);
+ buttonLayout->addWidget(textButton, 4, 0);
+ buttonLayout->addWidget(textLabel, 4, 1);
+ buttonLayout->addWidget(customButton, 5, 0);
+ buttonLayout->addWidget(customLabel, 5, 1);
+
QButtonGroup *group = new QButtonGroup(this);
group->addButton(standardButton, HorizonWizard::Standard);
group->addButton(mobileButton, HorizonWizard::Mobile);
@@ -79,20 +110,23 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) {
connect(group, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
[=](QAbstractButton *choice) {
horizonWizard()->pkgtype = static_cast<HorizonWizard::PackageType>(group->id(choice));
+ if(choice == standardButton) {
+ QHBoxLayout *desktopLayout = new QHBoxLayout;
+ for(auto button: {deskPlasmaButton, deskLXQtButton, deskMATEButton, deskXFCEButton}) {
+ button->show();
+ desktopLayout->addWidget(button);
+ }
+ buttonLayout->addLayout(desktopLayout, 1, 1);
+ layout()->invalidate();
+ } else {
+ auto item = buttonLayout->itemAtPosition(1, 1);
+ buttonLayout->removeItem(item);
+ for(auto button: {deskPlasmaButton, deskLXQtButton, deskMATEButton, deskXFCEButton}) {
+ button->hide();
+ }
+ }
});
- 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();
@@ -102,6 +136,17 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) {
void PkgSimplePage::initializePage() {
standardButton->click();
+#ifdef HAS_INSTALL_ENV
+ auto curr_desktop = qEnvironmentVariable("XDG_CURRENT_DESKTOP").toStdString();
+ if(curr_desktop == "LXQt") {
+ deskLXQtButton->click();
+ } else if(curr_desktop == "MATE") {
+ deskMATEButton->click();
+ } else if(curr_desktop == "XFCE") {
+ deskXFCEButton->click();
+ } else
+#endif /* HAS_INSTALL_ENV */
+ deskPlasmaButton->click();
}
int PkgSimplePage::nextId() const {
diff --git a/ui/qt5/pkgsimple.hh b/ui/qt5/pkgsimple.hh
index 2475d70..4e5b078 100644
--- a/ui/qt5/pkgsimple.hh
+++ b/ui/qt5/pkgsimple.hh
@@ -25,6 +25,7 @@ public:
bool validatePage();
private:
QRadioButton *standardButton;
+ QRadioButton *deskPlasmaButton, *deskLXQtButton, *deskMATEButton, *deskXFCEButton;
};
#endif /* !PKGSIMPLE_HH */