diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-13 12:43:34 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-12-13 12:43:34 -0600 |
commit | 5f42328911ec644cb2626b796d48c18f3167e59b (patch) | |
tree | a867932c7bbead4d89222fc1fd865e683ee4fc03 /ui | |
parent | 0a4b3b9cd1095f05651bff685d02c809db8768a9 (diff) | |
download | horizon-5f42328911ec644cb2626b796d48c18f3167e59b.tar.gz horizon-5f42328911ec644cb2626b796d48c18f3167e59b.tar.bz2 horizon-5f42328911ec644cb2626b796d48c18f3167e59b.tar.xz horizon-5f42328911ec644cb2626b796d48c18f3167e59b.zip |
Qt UI: Handle edge case (see comment)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt5/pkgdefaults.cc | 50 | ||||
-rw-r--r-- | ui/qt5/pkgdefaults.hh | 7 | ||||
-rw-r--r-- | ui/qt5/pkgsimple.cc | 24 | ||||
-rw-r--r-- | ui/qt5/pkgsimple.hh | 1 |
4 files changed, 70 insertions, 12 deletions
diff --git a/ui/qt5/pkgdefaults.cc b/ui/qt5/pkgdefaults.cc index 1d24f89..de18858 100644 --- a/ui/qt5/pkgdefaults.cc +++ b/ui/qt5/pkgdefaults.cc @@ -37,15 +37,13 @@ PkgDefaultsPage::PkgDefaultsPage(QWidget *parent) : HorizonWizardPage(parent) { QButtonGroup *shellGroup = new QButtonGroup; QLabel *shellLabel = new QLabel(tr("Shell to use for /bin/sh:")); - QRadioButton *dashShell = new QRadioButton("Dash"); - dashShell->setChecked(true); + dashShell = new QRadioButton("Dash"); dashShell->setWhatsThis(tr("Use the lightweight Dash shell. " "This is an Almquist-style shell, also used as /bin/sh on Debian-derived distributions. " "Choose this option for faster boot times and full POSIX compatibility.")); shellGroup->addButton(dashShell, HorizonWizard::Dash); - QRadioButton *bashShell = new QRadioButton("Bash"); - bashShell->setChecked(false); + bashShell = new QRadioButton("Bash"); bashShell->setWhatsThis(tr("Use the Bash shell. " "This shell is popular on GNU systems. " "Choose this option for compatibility with non-portable scripts. " @@ -70,13 +68,11 @@ PkgDefaultsPage::PkgDefaultsPage(QWidget *parent) : HorizonWizardPage(parent) { QButtonGroup *initGroup = new QButtonGroup; QLabel *initLabel = new QLabel(tr("Init system (/sbin/init):")); - QRadioButton *s6Init = new QRadioButton("s6-linux-init"); - s6Init->setChecked(true); + s6Init = new QRadioButton("s6-linux-init"); s6Init->setWhatsThis(tr("Use the lightweight, customisable s6-linux-init init system.")); initGroup->addButton(s6Init, HorizonWizard::S6); - QRadioButton *sysvInit = new QRadioButton("SysV Init"); - sysvInit->setChecked(false); + sysvInit = new QRadioButton("SysV Init"); sysvInit->setWhatsThis(tr("Use the traditional sysvinit init system.")); initGroup->addButton(sysvInit, HorizonWizard::SysVInit); @@ -98,14 +94,12 @@ PkgDefaultsPage::PkgDefaultsPage(QWidget *parent) : HorizonWizardPage(parent) { QButtonGroup *udevGroup = new QButtonGroup; QLabel *udevLabel = new QLabel(tr("uevent management daemon:")); - QRadioButton *eudev = new QRadioButton("eudev"); - eudev->setChecked(true); + eudev = new QRadioButton("eudev"); eudev->setWhatsThis(tr("Use the traditional, UDev-compatible eudev system. " "It is highly recommended that you use eudev unless you know it is inappropriate for your use case.")); udevGroup->addButton(eudev, true); - QRadioButton *mdevd = new QRadioButton("mdevd"); - mdevd->setChecked(false); + mdevd = new QRadioButton("mdevd"); mdevd->setWhatsThis(tr("Use the minimalist, lightweight mdevd system. " "This is the skarnet fork of mdevd. " "Choosing this option on a desktop system will require manual intervention.")); @@ -126,3 +120,35 @@ PkgDefaultsPage::PkgDefaultsPage(QWidget *parent) : HorizonWizardPage(parent) { setLayout(mainLayout); } + +void PkgDefaultsPage::initializePage() { + switch(horizonWizard()->binsh) { + case HorizonWizard::Dash: + dashShell->setChecked(true); + bashShell->setChecked(false); + break; + case HorizonWizard::Bash: + dashShell->setChecked(false); + bashShell->setChecked(true); + break; + } + + switch(horizonWizard()->sbininit) { + case HorizonWizard::S6: + s6Init->setChecked(true); + sysvInit->setChecked(false); + break; + case HorizonWizard::SysVInit: + s6Init->setChecked(false); + sysvInit->setChecked(true); + break; + } + + if(horizonWizard()->eudev) { + eudev->setChecked(true); + mdevd->setChecked(false); + } else { + eudev->setChecked(false); + mdevd->setChecked(true); + } +} diff --git a/ui/qt5/pkgdefaults.hh b/ui/qt5/pkgdefaults.hh index 08288ed..e96cdbd 100644 --- a/ui/qt5/pkgdefaults.hh +++ b/ui/qt5/pkgdefaults.hh @@ -14,10 +14,17 @@ #define PKGDEFAULTS_HH #include "horizonwizardpage.hh" +#include <QRadioButton> class PkgDefaultsPage : public HorizonWizardPage { public: PkgDefaultsPage(QWidget *parent = nullptr); + + void initializePage(); +private: + QRadioButton *dashShell, *bashShell, + *s6Init, *sysvInit, + *eudev, *mdevd; }; #endif /* !PKGDEFAULTS_HH */ diff --git a/ui/qt5/pkgsimple.cc b/ui/qt5/pkgsimple.cc index 9ae9495..ecb192a 100644 --- a/ui/qt5/pkgsimple.cc +++ b/ui/qt5/pkgsimple.cc @@ -11,6 +11,7 @@ */ #include "pkgsimple.hh" +#include "pkgdefaults.hh" #include <QButtonGroup> #include <QGridLayout> @@ -104,3 +105,26 @@ int PkgSimplePage::nextId() const { return HorizonWizard::Page_Boot; } + +bool PkgSimplePage::validatePage() { + /* This code handles the following scenario: + * + * - 'Custom' is selected + * - A non-default option is selected on the Defaults page (i.e., mdevd) + * - Back is chosen + * - A non-custom package selection choice is selected + * + * We need to completely 'reset' the state of the Defaults, including + * the selections on the Defaults page, whenever Next is chosen. + */ + if(horizonWizard()->pkgtype == HorizonWizard::Custom) { + horizonWizard()->removePage(HorizonWizard::Page_PkgCustomDefault); + horizonWizard()->setPage(HorizonWizard::Page_PkgCustomDefault, new PkgDefaultsPage); + } else { + horizonWizard()->sbininit = HorizonWizard::S6; + horizonWizard()->binsh = HorizonWizard::Dash; + horizonWizard()->eudev = true; + } + + return true; +} diff --git a/ui/qt5/pkgsimple.hh b/ui/qt5/pkgsimple.hh index 4a49356..2475d70 100644 --- a/ui/qt5/pkgsimple.hh +++ b/ui/qt5/pkgsimple.hh @@ -22,6 +22,7 @@ public: PkgSimplePage(QWidget *parent = nullptr); void initializePage(); int nextId() const; + bool validatePage(); private: QRadioButton *standardButton; }; |