1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 04:57:44 +00:00

Stop update progress dialog from appearing randomly

This also removes the extraneous boolean required for this.
This commit is contained in:
Joshua Goins 2022-03-14 13:19:36 -04:00
parent e708eda1e8
commit 8e86ed8e8d
2 changed files with 4 additions and 13 deletions

View file

@ -49,6 +49,4 @@ private:
QJsonArray remoteDalamudAssetArray; QJsonArray remoteDalamudAssetArray;
QString dataDir; QString dataDir;
bool wantsCancel = false;
}; };

View file

@ -33,12 +33,6 @@ const QString dotnetDesktopPackageURL =
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) { AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) {
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy); launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
dialog = new QProgressDialog("Updating assets...", "Cancel", 0, 0);
connect(dialog, &QProgressDialog::canceled, [this] {
wantsCancel = true;
});
dataDir = dataDir =
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
} }
@ -50,8 +44,7 @@ void AssetUpdater::update(const ProfileSettings& profile) {
return; return;
} }
wantsCancel = false; dialog = new QProgressDialog("Updating assets...", "Cancel", 0, 0);
dialog->show();
// first, we want to collect all of the remote versions // first, we want to collect all of the remote versions
@ -178,7 +171,7 @@ void AssetUpdater::beginInstall() {
} }
void AssetUpdater::checkIfDalamudAssetsDone() { void AssetUpdater::checkIfDalamudAssetsDone() {
if(wantsCancel) if(dialog->wasCanceled())
return; return;
if(dalamudAssetNeededFilenames.empty()) { if(dalamudAssetNeededFilenames.empty()) {
@ -196,7 +189,7 @@ void AssetUpdater::checkIfDalamudAssetsDone() {
} }
void AssetUpdater::checkIfFinished() { void AssetUpdater::checkIfFinished() {
if(wantsCancel) if(dialog->wasCanceled())
return; return;
if (doneDownloadingDalamud && if (doneDownloadingDalamud &&
@ -216,7 +209,7 @@ void AssetUpdater::checkIfFinished() {
} }
void AssetUpdater::checkIfCheckingIsDone() { void AssetUpdater::checkIfCheckingIsDone() {
if(wantsCancel) if(dialog->wasCanceled())
return; return;
if(remoteDalamudVersion.isEmpty() || remoteRuntimeVersion.isEmpty() || remoteDalamudAssetVersion == -1) { if(remoteDalamudVersion.isEmpty() || remoteRuntimeVersion.isEmpty() || remoteDalamudAssetVersion == -1) {