From df550933fb33ad6ed8bbbf7559afa1f6d797ac85 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 14 Dec 2019 12:57:43 -0600 Subject: Qt UI: Add splash --- ui/qt5/main.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ui/qt5/main.cc b/ui/qt5/main.cc index 1881876..fe97b51 100644 --- a/ui/qt5/main.cc +++ b/ui/qt5/main.cc @@ -11,12 +11,35 @@ */ #include +#include #include +#include #include #include +#include #include "horizonwizard.hh" +class WaitDialog : public QDialog { +public: + WaitDialog(QWidget *parent = nullptr); + void accept() override; + void reject() override; +}; + +WaitDialog::WaitDialog(QWidget *parent) : QDialog(parent) { + setWindowTitle(tr("Loading...")); + QVBoxLayout *layout = new QVBoxLayout; + QLabel *descLabel = new QLabel(tr("System Installation is loading.\n\nPlease wait a moment.")); + descLabel->setAlignment(Qt::AlignCenter); + layout->addWidget(descLabel); + setLayout(layout); +} + +/* Prevents the user from interacting in any way. */ +void WaitDialog::accept() { return; } +void WaitDialog::reject() { return; } + int main(int argc, char *argv[]) { QApplication app(argc, argv); @@ -30,9 +53,16 @@ int main(int argc, char *argv[]) { app.installTranslator(translator); } + WaitDialog d; + d.show(); + app.setOverrideCursor(Qt::WaitCursor); + app.processEvents(QEventLoop::AllEvents, 300); + app.setWindowIcon(QIcon(":/horizon-256.png")); HorizonWizard wizard; + d.hide(); + app.restoreOverrideCursor(); wizard.show(); return app.exec(); -- cgit v1.2.3-60-g2f50