From a3c5b6e75573ebe22b2cd2319448cdf828eaf1fc Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 27 Feb 2017 20:08:10 -0600 Subject: Add software selection page --- horizon-qt5.pro | 6 ++- horizon.qrc | 2 + horizonwizard.cc | 4 ++ horizonwizard.hh | 3 ++ resources/software-high.png | Bin 0 -> 287010 bytes resources/software-low.png | Bin 0 -> 95747 bytes softwarepage.cc | 91 ++++++++++++++++++++++++++++++++++++++++++++ softwarepage.hh | 22 +++++++++++ 8 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 resources/software-high.png create mode 100644 resources/software-low.png create mode 100644 softwarepage.cc create mode 100644 softwarepage.hh diff --git a/horizon-qt5.pro b/horizon-qt5.pro index 7d96e3a..14909e9 100644 --- a/horizon-qt5.pro +++ b/horizon-qt5.pro @@ -10,13 +10,15 @@ SOURCES += main.cc \ horizonwizard.cc \ welcomepage.cc \ networkingpage.cc \ - horizonwizardpage.cc + horizonwizardpage.cc \ + softwarepage.cc HEADERS += \ horizonwizard.hh \ welcomepage.hh \ networkingpage.hh \ - horizonwizardpage.hh + horizonwizardpage.hh \ + softwarepage.hh RESOURCES += \ horizon.qrc diff --git a/horizon.qrc b/horizon.qrc index 5fcf84f..741a7f5 100644 --- a/horizon.qrc +++ b/horizon.qrc @@ -4,5 +4,7 @@ resources/welcome-low.png resources/network-low.png resources/network-high.png + resources/software-high.png + resources/software-low.png diff --git a/horizonwizard.cc b/horizonwizard.cc index cd87423..1f7229f 100644 --- a/horizonwizard.cc +++ b/horizonwizard.cc @@ -2,6 +2,7 @@ #include "welcomepage.hh" #include "networkingpage.hh" +#include "softwarepage.hh" HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { @@ -17,4 +18,7 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) setPage(Page_Welcome, new WelcomePage); setPage(Page_Networking, new NetworkingPage); + setPage(Page_Software, new SoftwarePage); + + selected.insert("adelie-base"); } diff --git a/horizonwizard.hh b/horizonwizard.hh index 3428266..ca7cc03 100644 --- a/horizonwizard.hh +++ b/horizonwizard.hh @@ -2,6 +2,8 @@ #define HORIZONWIZARD_HH #include +#include +#include class HorizonWizard : public QWizard { @@ -23,6 +25,7 @@ public: }; HorizonWizard(QWidget *parent = 0); + std::set selected; }; #endif // HORIZONWIZARD_HH diff --git a/resources/software-high.png b/resources/software-high.png new file mode 100644 index 0000000..b58ddf9 Binary files /dev/null and b/resources/software-high.png differ diff --git a/resources/software-low.png b/resources/software-low.png new file mode 100644 index 0000000..72ff89d Binary files /dev/null and b/resources/software-low.png differ diff --git a/softwarepage.cc b/softwarepage.cc new file mode 100644 index 0000000..28805e3 --- /dev/null +++ b/softwarepage.cc @@ -0,0 +1,91 @@ +#include "softwarepage.hh" +#include "horizonwizard.hh" + +#include +#include +#include + +SoftwarePage::SoftwarePage(QWidget *parent) : HorizonWizardPage(parent) +{ + QLabel *descLabel; + QVBoxLayout *layout, *desktopLayout; + QHBoxLayout *nudgeOver; + + loadWatermark("software"); + setTitle(tr("Select Software")); + + descLabel = new QLabel(tr( + "You can select what software you want to install on " + "your computer.")); + descLabel->setWordWrap(true); + + desktop = new QCheckBox(tr( + "&Desktop Software - Web browser, email client, media " + "player, and more")); + kde = new QCheckBox(tr( + "Use the &KDE Plasma 5 desktop\nIdeal for newer computers, " + "KDE Plasma 5 provides a clean,\nmodern experience.")); + xfce = new QCheckBox(tr( + "Use the &XFCE 4 desktop\nXFCE provides a classic desktop " + "experience well suited to\nsmaller screens.")); + lxqt = new QCheckBox(tr( + "Use the &LXQt desktop\nLXQt provides a modern experience " + "similar to KDE Plasma 5\noptimised for older hardware.")); + openbox = new QCheckBox(tr( + "Use the &OpenBox desktop\nOpenBox is for people who are " + "familiar with other Linux/Unix\ndesktop experiences.")); + server = new QCheckBox(tr( + "&Server Software - Web server, print server, and more")); + advanced = new QCheckBox(tr( + "&Advanced - select which software to install")); + + QObject::connect(desktop, (void (QCheckBox:: *)(bool))&QCheckBox::clicked, + [=](bool checked) { + this->toggleDesktops(checked); + }); + + desktop->setChecked(true); + + typeGroup = new QButtonGroup(this); + typeGroup->addButton(kde); + typeGroup->addButton(xfce); + typeGroup->addButton(lxqt); + typeGroup->addButton(openbox); + + desktopLayout = new QVBoxLayout; + desktopLayout->addWidget(kde); + desktopLayout->addWidget(xfce); + desktopLayout->addWidget(lxqt); + desktopLayout->addWidget(openbox); + + nudgeOver = new QHBoxLayout; + nudgeOver->addSpacing(20); + nudgeOver->addLayout(desktopLayout); + + layout = new QVBoxLayout; + layout->addWidget(descLabel); + layout->addSpacing(50); + layout->addWidget(desktop); + layout->addLayout(nudgeOver); + layout->addWidget(server); + layout->addWidget(advanced); + setLayout(layout); +} + +void SoftwarePage::toggleDesktops(bool show) +{ + kde->setVisible(show); + xfce->setVisible(show); + lxqt->setVisible(show); + openbox->setVisible(show); +} + +int SoftwarePage::nextId() const +{ + if(advanced->isChecked()) + { + return HorizonWizard::Page_AdvancedSoftware; + } else { + return HorizonWizard::Page_Startup; + } +} diff --git a/softwarepage.hh b/softwarepage.hh new file mode 100644 index 0000000..03cece0 --- /dev/null +++ b/softwarepage.hh @@ -0,0 +1,22 @@ +#ifndef SOFTWAREPAGE_HH +#define SOFTWAREPAGE_HH + +#include "horizonwizardpage.hh" + +#include +#include + +class SoftwarePage : public HorizonWizardPage +{ +public: + SoftwarePage(QWidget *parent = 0); + + int nextId() const; + void toggleDesktops(bool show); +private: + QButtonGroup *typeGroup; + QCheckBox *desktop, *server, *advanced, + *kde, *xfce, *lxqt, *openbox; +}; + +#endif // SOFTWAREPAGE_HH -- cgit v1.2.3-70-g09d2