From 40426b314c02727bab5e8cd720838037644defad Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Wed, 6 Dec 2023 08:05:41 -0600 Subject: Qt UI: Refactor package selection page, again * Allows one to choose Standard, Mobile, or Compact of any DE. * Refactor automatic package selection to better reflect what users are likely to expect from their selection. * Use tabs to separate graphical desktop, text-only / server, and custom options. This will allow us to add more options later, as well. * Fit in given size. --- ui/qt5/horizonwizard.cc | 38 ++++++++++++++++-------- ui/qt5/pkgsimple.cc | 77 ++++++++++++++++++++++++++----------------------- 2 files changed, 67 insertions(+), 48 deletions(-) diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc index 36746ea..985f416 100644 --- a/ui/qt5/horizonwizard.cc +++ b/ui/qt5/horizonwizard.cc @@ -217,7 +217,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent), arch{UnknownCPU grub{true}, eudev{true}, binsh{Dash}, sbininit{S6} { setWindowTitle(tr("Adélie Linux System Installation")); - setFixedSize(QSize(650, 512)); + setFixedSize(QSize(650, 450)); mirror_domain = "distfiles.adelielinux.org"; version = "stable"; @@ -490,13 +490,27 @@ QString packagesForDesktop(HorizonWizard::DesktopType desktop) { switch(desktop) { case HorizonWizard::Plasma: default: - return "x11 kde calligra"; + return "adelie-kde-theme plasma-desktop"; case HorizonWizard::LXQt: - return "x11 lxqt-desktop"; + return "adelie-lxqt-theme lxqt-desktop"; case HorizonWizard::MATE: - return "x11 mate-complete"; + return "adelie-mate-theme mate-complete"; case HorizonWizard::XFCE: - return "x11 xfce-desktop xfce-plugins"; + return "xfce-desktop xfce-plugins"; + } +} + + +/*! Determine the packages to install for a "full" desktop environment experience. */ +QString optionalPackagesForDesktop(HorizonWizard::DesktopType desktop) { + switch(desktop) { + case HorizonWizard::Plasma: + default: + return "x11 kde calligra"; + case HorizonWizard::LXQt: + return "x11 kde-games kde-graphics kde-multimedia kde-utilities calligra trojita"; + case HorizonWizard::MATE: + return "x11 abiword gnumeric"; } } @@ -633,15 +647,15 @@ QString HorizonWizard::toHScript() { [[ fallthrough ]]; #endif case Standard: - lines << "pkginstall adelie-base-posix bluez sddm docs"; - lines << ("pkginstall " + packagesForDesktop(desktopType)); + lines << "pkginstall adelie-base-posix bluez docs"; + lines << ("pkginstall " + optionalPackagesForDesktop(desktopType)); lines << "svcenable bluetooth"; - lines << "svcenable elogind"; - lines << "svcenable sddm"; - break; +#if __cplusplus >= 201703L + [[ fallthrough ]]; +#endif case Compact: - lines << "pkginstall adelie-base netsurf featherpad lxqt-desktop " - "abiword gnumeric sddm xorg-apps xorg-drivers xorg-server"; + lines << "pkginstall adelie-base sddm netsurf featherpad sddm x11"; + lines << ("pkginstall " + packagesForDesktop(desktopType)); lines << "svcenable elogind"; lines << "svcenable sddm"; break; diff --git a/ui/qt5/pkgsimple.cc b/ui/qt5/pkgsimple.cc index e168583..eab4066 100644 --- a/ui/qt5/pkgsimple.cc +++ b/ui/qt5/pkgsimple.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) { @@ -30,12 +31,13 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) { QRadioButton *mobileButton, *compactButton, *textButton, *customButton; QLabel *standardLabel, *mobileLabel, *compactLabel, *textLabel, *customLabel; + QTabWidget *tabWidget; standardButton = new QRadioButton(tr("&Standard")); standardButton->setIcon(QIcon::fromTheme("preferences-desktop-theme")); standardButton->setIconSize(QSize(32, 32)); standardLabel = new QLabel( - tr("Includes a full desktop environment, including Web browser, email client, media player, and office suite.")); + tr("Includes a full desktop environment, Web browser, email client, media player, and software suite.")); standardLabel->setBuddy(standardButton); standardLabel->setIndent(40); standardLabel->setWordWrap(true); @@ -45,7 +47,7 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) { 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.")); + tr("Includes the Standard software set and additional utilities for notebook and tablet computers.")); mobileLabel->setBuddy(mobileButton); mobileLabel->setIndent(40); mobileLabel->setWordWrap(true); @@ -54,7 +56,7 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) { 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 = new QLabel(tr("Desktop environment and lightweight utilities only.")); compactLabel->setBuddy(compactButton); compactLabel->setIndent(40); compactLabel->setWordWrap(true); @@ -94,51 +96,54 @@ PkgSimplePage::PkgSimplePage(QWidget *parent) : HorizonWizardPage(parent) { horizonWizard()->desktopType = static_cast(desktopGroup->id(choice)); }); - auto *buttonLayout = new QVBoxLayout; - buttonLayout->addWidget(standardButton); - buttonLayout->addWidget(standardLabel); - buttonLayout->addWidget(mobileButton); - buttonLayout->addWidget(mobileLabel); - buttonLayout->addWidget(compactButton); - buttonLayout->addWidget(compactLabel); - buttonLayout->addWidget(textButton); - buttonLayout->addWidget(textLabel); - buttonLayout->addWidget(customButton); - buttonLayout->addWidget(customLabel); - - QButtonGroup *group = new QButtonGroup(this); + auto *desktopLayout = new QHBoxLayout; + for(auto button: {deskPlasmaButton, deskLXQtButton, deskMATEButton, deskXFCEButton}) { + desktopLayout->addWidget(button); + } + auto *gfxButtonLayout = new QVBoxLayout; + gfxButtonLayout->addLayout(desktopLayout); + gfxButtonLayout->addStretch(); + gfxButtonLayout->addWidget(standardButton); + gfxButtonLayout->addWidget(standardLabel); + gfxButtonLayout->addWidget(mobileButton); + gfxButtonLayout->addWidget(mobileLabel); + gfxButtonLayout->addWidget(compactButton); + gfxButtonLayout->addWidget(compactLabel); + auto *gfxTab = new QWidget; + gfxTab->setLayout(gfxButtonLayout); + + auto *textButtonLayout = new QVBoxLayout; + textButtonLayout->addWidget(textButton); + textButtonLayout->addWidget(textLabel); + auto *textTab = new QWidget; + textTab->setLayout(textButtonLayout); + + auto *customButtonLayout = new QVBoxLayout; + customButtonLayout->addWidget(customButton); + customButtonLayout->addWidget(customLabel); + auto *customTab = new QWidget; + customTab->setLayout(customButtonLayout); + + auto *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, QOverload::of(&QButtonGroup::buttonClicked), - [this, group, buttonLayout](QAbstractButton *choice) { + [this, group](QAbstractButton *choice) { horizonWizard()->pkgtype = static_cast(group->id(choice)); - if(choice == standardButton) { - auto *desktopLayout = new QHBoxLayout; - desktopLayout->setObjectName("desk-buttons"); - for(auto button: {deskPlasmaButton, deskLXQtButton, deskMATEButton, deskXFCEButton}) { - button->show(); - desktopLayout->addWidget(button); - } - buttonLayout->insertLayout(2, desktopLayout); - layout()->invalidate(); - } else { - auto item = buttonLayout->itemAt(2); - if(item->layout() && item->layout()->objectName() == "desk-buttons") { - buttonLayout->removeItem(item); - for (auto button: {deskPlasmaButton, deskLXQtButton, deskMATEButton, deskXFCEButton}) { - button->hide(); - } - } - } }); + tabWidget = new QTabWidget(this); + tabWidget->addTab(gfxTab, tr("Desktop")); + tabWidget->addTab(textTab, tr("Text/Server")); + tabWidget->addTab(customTab, tr("Custom")); + auto *mainLayout = new QVBoxLayout; mainLayout->addWidget(descLabel); mainLayout->addStretch(); - mainLayout->addLayout(buttonLayout); + mainLayout->addWidget(tabWidget); setLayout(mainLayout); } -- cgit v1.2.3-60-g2f50