summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-05 06:25:52 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-05 06:25:52 -0500
commite34d60f58d7845641646eb872bbd9c0e8ee40f2a (patch)
treefc38d0ae89229df59809b4372c2338b22a8f2bcf /ui
parent394222a77a55a4b180cbfea726ab0438b2dee2d8 (diff)
downloadhorizon-e34d60f58d7845641646eb872bbd9c0e8ee40f2a.tar.gz
horizon-e34d60f58d7845641646eb872bbd9c0e8ee40f2a.tar.bz2
horizon-e34d60f58d7845641646eb872bbd9c0e8ee40f2a.tar.xz
horizon-e34d60f58d7845641646eb872bbd9c0e8ee40f2a.zip
Qt UI: QoI improvements to launching tools
* Terminal now uses dark background with light text, which makes root prompt readable when started from Install CD. * Tools are now spawned instead of run modally. This means you can interact with the Horizon wizard while using the Terminal or Web browser. If a tool is still running at the end, Horizon will prompt the user before allowing them to commit to disk.
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/commitpage.cc17
-rw-r--r--ui/qt5/commitpage.hh1
-rw-r--r--ui/qt5/horizonwizard.hh3
-rw-r--r--ui/qt5/intropage.cc15
4 files changed, 30 insertions, 6 deletions
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);