From 386ff62ca3aba790f9831ee7c194d24f6fb781fe Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 8 Nov 2019 02:38:58 -0600 Subject: UI: Import some of the 2016 prototype - welcome to Qt UI development --- ui/qt5/horizonwizard.cc | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 ui/qt5/horizonwizard.cc (limited to 'ui/qt5/horizonwizard.cc') diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc new file mode 100644 index 0000000..72b4239 --- /dev/null +++ b/ui/qt5/horizonwizard.cc @@ -0,0 +1,79 @@ +#include "horizonwizard.hh" +#include "horizonhelpwindow.hh" + +#include +#include +#include +#include +#include + +#include "intropage.hh" +#include "networkingpage.hh" +#include "netsimplewifipage.hh" + +using std::map; +using std::string; + +static map help_id_map = { + {HorizonWizard::Page_Intro, "intro"}, + {HorizonWizard::Page_Input, "input"}, + {HorizonWizard::Page_Partition, "partition"}, +#ifdef NON_LIBRE_FIRMWARE + {HorizonWizard::Page_Firmware, "firmware"}, +#endif /* NON_LIBRE_FIRMWARE */ + {HorizonWizard::Page_Network, "network-start"}, + {HorizonWizard::Page_Network_Iface, "network-iface"}, + {HorizonWizard::Page_Network_Wireless, "network-wifi"}, + {HorizonWizard::Page_Network_DHCP, "none"}, + {HorizonWizard::Page_Network_Portal, "network-portal"}, + {HorizonWizard::Page_Network_Manual, "network-manual"}, + {HorizonWizard::Page_DateTime, "datetime"}, + {HorizonWizard::Page_Hostname, "hostname"}, + {HorizonWizard::Page_PkgSimple, "packages-simple"}, + {HorizonWizard::Page_PkgCustom, "packages-custom"}, + {HorizonWizard::Page_Boot, "startup"}, + {HorizonWizard::Page_Root, "rootpw"}, + {HorizonWizard::Page_Accounts, "accounts"}, +#ifndef HAS_INSTALL_ENV + {HorizonWizard::Page_Write, "writeout"}, +#else /* HAS_INSTALL_ENV */ + {HorizonWizard::Page_Commit, "commit"} +#endif /* !HAS_INSTALL_ENV */ +}; + +HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) { + setWindowTitle(tr("Adélie Linux System Installation")); + + setFixedSize(QSize(650, 450)); + + setOption(DisabledBackButtonOnLastPage); + setOption(HaveHelpButton); + setOption(NoCancelButton); + + setSizeGripEnabled(false); + + setPage(Page_Intro, new IntroPage); + setPage(Page_Network, new NetworkingPage); + + QObject::connect(this, static_cast(&QWizard::helpRequested), + [=](void) { + if(help_id_map.find(currentId()) == help_id_map.end()) { + qDebug() << "no help available for " << currentId(); + QMessageBox nohelp(QMessageBox::Warning, + tr("No Help Available"), + tr("Help is not available for the current page." + " Consult the Installation Guide for more " + "information."), + QMessageBox::Ok, + this); + nohelp.exec(); + return; + } + string helppath = ":/wizard_help/resources/" + + help_id_map.at(currentId()) + "-help.txt"; + QFile helpfile(helppath.c_str()); + helpfile.open(QFile::ReadOnly); + HorizonHelpWindow help(&helpfile, this); + help.exec(); + }); +} -- cgit v1.2.3-70-g09d2