RMG: fix InstallUpdateDialog not showing

This commit is contained in:
Rosalie Wanders committed 2022-12-08 15:07:45 +01:00
1 parent c745ec18bb
commit 5fc36d5743
3 files changed
+19 -6

No files matched your search

@@ -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();
}
@@ -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);
@@ -17,14 +17,14 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Extracting ...</string>
<string>Installing...</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
<number>0</number>
</property>
</widget>
</item>