diff options
-rw-r--r-- | devel/requirements/3_functional.xml | 4 | ||||
-rw-r--r-- | ui/qt5/commitpage.cc | 17 | ||||
-rw-r--r-- | ui/qt5/commitpage.hh | 1 | ||||
-rw-r--r-- | ui/qt5/horizonwizard.hh | 3 | ||||
-rw-r--r-- | ui/qt5/intropage.cc | 15 |
5 files changed, 34 insertions, 6 deletions
diff --git a/devel/requirements/3_functional.xml b/devel/requirements/3_functional.xml index f26d7ec..701b557 100644 --- a/devel/requirements/3_functional.xml +++ b/devel/requirements/3_functional.xml @@ -928,6 +928,10 @@ <title>UI.Commit.Buttons</title> <para>The system shall label the Next button as "Install", or its translation.</para> </formalpara> + <formalpara id="UI.Commit.ToolClosure"> + <title>UI.Commit.ToolClosure</title> + <para>The system shall ensure all tools launched via UI.Intro.Tools have been closed. If not, the system shall prompt the user to close them before continuing.</para> + </formalpara> </section> </section> <section id="ui_perform"> diff --git a/ui/qt5/commitpage.cc b/ui/qt5/commitpage.cc index ed35c19..7856a4a 100644 --- a/ui/qt5/commitpage.cc +++ b/ui/qt5/commitpage.cc @@ -18,6 +18,7 @@ #include <QLabel> #include <QVariant> +#include <QMessageBox> #include <QVBoxLayout> CommitPage::CommitPage(QWidget *parent) : HorizonWizardPage(parent) { @@ -110,3 +111,19 @@ void CommitPage::initializePage() { .arg(softString) .arg(field("hostname").toString())); } + +bool CommitPage::validatePage() { + bool running = std::any_of( + horizonWizard()->tools.begin(), horizonWizard()->tools.end(), + [](QProcess *tool) { + return tool->state() == QProcess::Running; + }); + + if(running) { + QMessageBox::information(horizonWizard(), tr("Tool(s) Still Running"), + tr("You must quit all tools before beginning System Installation.")); + return false; + } + + return true; +} diff --git a/ui/qt5/commitpage.hh b/ui/qt5/commitpage.hh index a4f480e..71f869d 100644 --- a/ui/qt5/commitpage.hh +++ b/ui/qt5/commitpage.hh @@ -22,6 +22,7 @@ public: CommitPage(QWidget *parent = nullptr); void initializePage(); + bool validatePage(); private: QLabel *choices; }; diff --git a/ui/qt5/horizonwizard.hh b/ui/qt5/horizonwizard.hh index ce5c22d..b39287c 100644 --- a/ui/qt5/horizonwizard.hh +++ b/ui/qt5/horizonwizard.hh @@ -14,6 +14,7 @@ #define HORIZONWIZARD_HH #include <diskman/disk.hh> +#include <QProcess> #include <QShortcut> #include <QWizard> #include <map> @@ -159,6 +160,8 @@ public: #ifdef HAS_INSTALL_ENV /*! The disks present on this computer. */ std::vector<Horizon::DiskMan::Disk> disks; + /*! Any spawned tools from the intro page. */ + std::vector<QProcess *> tools; #endif /*! Whether to automatically partition the disk. */ bool auto_part; diff --git a/ui/qt5/intropage.cc b/ui/qt5/intropage.cc index da32373..76d7644 100644 --- a/ui/qt5/intropage.cc +++ b/ui/qt5/intropage.cc @@ -42,16 +42,19 @@ IntroPage::IntroPage(QWidget *parent) : HorizonWizardPage(parent) { toolButton->setWhatsThis(tr("Displays a menu of utilities that you can launch from the Installation Environment.")); toolMenu = new QMenu("&Tools", toolButton); connect(toolMenu->addAction("&Terminal"), &QAction::triggered, [=](void) { - QProcess p; - p.execute("xterm", {"-fa", "Liberation Mono", "-fs", "12"}); + QProcess *p = new QProcess(this); + p->start("xterm", {"-fa", "Liberation Mono", "-fs", "12", "-bg", "DarkGreen", "-fg", "White"}); + horizonWizard()->tools.push_back(p); }); connect(toolMenu->addAction("&Partition Editor"), &QAction::triggered, [=](void) { - QProcess p; - p.execute("partitionmanager", QStringList()); + QProcess *p = new QProcess(this); + p->start("partitionmanager", QStringList()); + horizonWizard()->tools.push_back(p); }); connect(toolMenu->addAction("&Web Browser"), &QAction::triggered, [=](void){ - QProcess p; - p.execute("netsurf-gtk", QStringList()); + QProcess *p = new QProcess(this); + p->start("netsurf-gtk", QStringList()); + horizonWizard()->tools.push_back(p); }); toolButton->setMenu(toolMenu); |