From 5fc36d5743cb33d031be0191fb347e7353b5f7cd Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Thu, 8 Dec 2022 15:07:45 +0100 Subject: [PATCH] RMG: fix InstallUpdateDialog not showing --- .../Dialog/InstallUpdateDialog.cpp | 18 ++++++++++++++---- .../Dialog/InstallUpdateDialog.hpp | 3 +++ .../Dialog/InstallUpdateDialog.ui | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.cpp b/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.cpp index e031f237..73d547eb 100644 --- a/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.cpp +++ b/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.cpp @@ -24,7 +24,7 @@ InstallUpdateDialog::InstallUpdateDialog(QWidget *parent, QString installationDi this->installationDirectory = installationDirectory; this->temporaryDirectory = temporaryDirectory; this->filename = filename; - this->install(); + this->startTimer(100); } InstallUpdateDialog::~InstallUpdateDialog(void) @@ -33,9 +33,6 @@ InstallUpdateDialog::~InstallUpdateDialog(void) void InstallUpdateDialog::install(void) { - this->label->setText("Extracting " + this->filename + "..."); - this->progressBar->setValue(50); - QString fullFilePath; fullFilePath = this->temporaryDirectory; fullFilePath += "/" + this->filename; @@ -46,6 +43,7 @@ void InstallUpdateDialog::install(void) #ifdef _WIN32 if (this->filename.endsWith(".exe")) { + this->label->setText("Executing " + this->filename + "..."); QStringList scriptLines = { "@echo off", @@ -59,6 +57,9 @@ void InstallUpdateDialog::install(void) } #endif // _WIN32 + this->label->setText("Extracting " + this->filename + "..."); + this->progressBar->setValue(50); + QDir dir(this->temporaryDirectory); if (!dir.mkdir("extract")) { @@ -78,6 +79,9 @@ void InstallUpdateDialog::install(void) return; } + this->label->setText("Executing update script..."); + this->progressBar->setValue(100); + #ifdef _WIN32 QStringList scriptLines = { @@ -155,3 +159,9 @@ void InstallUpdateDialog::showErrorMessage(QString error, QString details) msgBox.exec(); } + void InstallUpdateDialog::timerEvent(QTimerEvent *event) + { + this->killTimer(event->timerId()); + this->install(); + } + diff --git a/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.hpp b/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.hpp index 24a29f91..f233efc6 100644 --- a/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.hpp +++ b/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.hpp @@ -36,6 +36,9 @@ class InstallUpdateDialog : public QDialog, private Ui::InstallUpdateDialog void launchProcess(QString file, QStringList arguments); void showErrorMessage(QString error, QString details); + protected: + void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; + public: InstallUpdateDialog(QWidget *parent, QString installationDirectory, QString temporaryDirectory, QString filename); ~InstallUpdateDialog(void); diff --git a/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.ui b/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.ui index 46039f43..09a61077 100644 --- a/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.ui +++ b/Source/RMG/UserInterface/Dialog/InstallUpdateDialog.ui @@ -17,14 +17,14 @@ - Extracting ... + Installing... - 24 + 0