From 8e86ed8e8dcbe7b5243d480b06e4f212277fb667 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 14 Mar 2022 13:19:36 -0400 Subject: [PATCH] Stop update progress dialog from appearing randomly This also removes the extraneous boolean required for this. --- include/assetupdater.h | 2 -- src/assetupdater.cpp | 15 ++++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/include/assetupdater.h b/include/assetupdater.h index 2b03934..9a4f59c 100644 --- a/include/assetupdater.h +++ b/include/assetupdater.h @@ -49,6 +49,4 @@ private: QJsonArray remoteDalamudAssetArray; QString dataDir; - - bool wantsCancel = false; }; diff --git a/src/assetupdater.cpp b/src/assetupdater.cpp index 3de9aa5..f1c1728 100644 --- a/src/assetupdater.cpp +++ b/src/assetupdater.cpp @@ -33,12 +33,6 @@ const QString dotnetDesktopPackageURL = AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) { launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy); - dialog = new QProgressDialog("Updating assets...", "Cancel", 0, 0); - - connect(dialog, &QProgressDialog::canceled, [this] { - wantsCancel = true; - }); - dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); } @@ -50,8 +44,7 @@ void AssetUpdater::update(const ProfileSettings& profile) { return; } - wantsCancel = false; - dialog->show(); + dialog = new QProgressDialog("Updating assets...", "Cancel", 0, 0); // first, we want to collect all of the remote versions @@ -178,7 +171,7 @@ void AssetUpdater::beginInstall() { } void AssetUpdater::checkIfDalamudAssetsDone() { - if(wantsCancel) + if(dialog->wasCanceled()) return; if(dalamudAssetNeededFilenames.empty()) { @@ -196,7 +189,7 @@ void AssetUpdater::checkIfDalamudAssetsDone() { } void AssetUpdater::checkIfFinished() { - if(wantsCancel) + if(dialog->wasCanceled()) return; if (doneDownloadingDalamud && @@ -216,7 +209,7 @@ void AssetUpdater::checkIfFinished() { } void AssetUpdater::checkIfCheckingIsDone() { - if(wantsCancel) + if(dialog->wasCanceled()) return; if(remoteDalamudVersion.isEmpty() || remoteRuntimeVersion.isEmpty() || remoteDalamudAssetVersion == -1) {