summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-10 11:05:47 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-02-10 11:05:47 -0600
commitde766db11e5677dc830bfdf0a383e887f6de3404 (patch)
tree7d244d8727c294b3996436455beb78994e6e7e3c /ui
parent04f0270f9a5f28ec1d2fa029d7ee78c8d0e5f9b2 (diff)
downloadhorizon-de766db11e5677dc830bfdf0a383e887f6de3404.tar.gz
horizon-de766db11e5677dc830bfdf0a383e887f6de3404.tar.bz2
horizon-de766db11e5677dc830bfdf0a383e887f6de3404.tar.xz
horizon-de766db11e5677dc830bfdf0a383e887f6de3404.zip
Qt Runner: Add method to automatically close after completion
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/runner/executorwizard.cc5
-rw-r--r--ui/qt5/runner/executorwizard.hh5
-rw-r--r--ui/qt5/runner/finishedpage.cc14
-rw-r--r--ui/qt5/runner/finishedpage.hh1
4 files changed, 22 insertions, 3 deletions
diff --git a/ui/qt5/runner/executorwizard.cc b/ui/qt5/runner/executorwizard.cc
index 95aea6e..ab444b5 100644
--- a/ui/qt5/runner/executorwizard.cc
+++ b/ui/qt5/runner/executorwizard.cc
@@ -18,7 +18,8 @@
#include "errorpage.hh"
#include "finishedpage.hh"
-ExecutorWizard::ExecutorWizard(QWidget *parent) : QWizard(parent) {
+ExecutorWizard::ExecutorWizard(QWidget *parent, bool _autom)
+ : QWizard(parent), automatic(_autom) {
setWindowTitle(tr("Adélie Linux System Installation"));
setFixedSize(QSize(650, 450));
@@ -32,7 +33,7 @@ ExecutorWizard::ExecutorWizard(QWidget *parent) : QWizard(parent) {
setOption(NoCancelButtonOnLastPage);
QList<QWizard::WizardButton> buttonLayout;
- buttonLayout << Stretch << FinishButton << CancelButton;
+ buttonLayout << Stretch << FinishButton;
setButtonLayout(buttonLayout);
}
diff --git a/ui/qt5/runner/executorwizard.hh b/ui/qt5/runner/executorwizard.hh
index eb09bcc..f1f3662 100644
--- a/ui/qt5/runner/executorwizard.hh
+++ b/ui/qt5/runner/executorwizard.hh
@@ -23,8 +23,11 @@ public:
Page_Finished
};
- ExecutorWizard(QWidget *parent = nullptr);
+ ExecutorWizard(QWidget *parent = nullptr, bool automatic = false);
void reject();
+ bool isAutomatic() { return this->automatic; };
+private:
+ bool automatic;
};
#endif /* !EXECUTORWIZARD_HH */
diff --git a/ui/qt5/runner/finishedpage.cc b/ui/qt5/runner/finishedpage.cc
index 933a372..dd85068 100644
--- a/ui/qt5/runner/finishedpage.cc
+++ b/ui/qt5/runner/finishedpage.cc
@@ -10,12 +10,14 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+#include "executorwizard.hh"
#include "finishedpage.hh"
#include <QFileDialog>
#include <QLabel>
#include <QMessageBox>
#include <QPushButton>
+#include <QTimer>
#include <QVBoxLayout>
FinishedPage::FinishedPage(QWidget *parent) : HorizonWizardPage(parent) {
@@ -55,3 +57,15 @@ FinishedPage::FinishedPage(QWidget *parent) : HorizonWizardPage(parent) {
setLayout(layout);
}
+
+void FinishedPage::initializePage() {
+ if(static_cast<ExecutorWizard *>(wizard())->isAutomatic()) {
+ QTimer *finishTimer = new QTimer(this);
+ finishTimer->setInterval(15000);
+ finishTimer->setSingleShot(true);
+ connect(finishTimer, &QTimer::timeout, [=]{
+ wizard()->accept();
+ });
+ finishTimer->start();
+ }
+}
diff --git a/ui/qt5/runner/finishedpage.hh b/ui/qt5/runner/finishedpage.hh
index 3cdb236..98206b5 100644
--- a/ui/qt5/runner/finishedpage.hh
+++ b/ui/qt5/runner/finishedpage.hh
@@ -18,6 +18,7 @@
class FinishedPage : public HorizonWizardPage {
public:
FinishedPage(QWidget *parent = nullptr);
+ void initializePage() override;
};
#endif /* !FINISHEDPAGE_HH */