From 729cec5f45468e9647027ea75155fc1fb6d7c0f1 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:23:10 -0700 Subject: [PATCH] fix don't hang the ui for a full version load Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com> (cherry picked from commit 7bd04ae928527b065174021fba98dc78d0d119a3) --- launcher/minecraft/Component.cpp | 5 +++-- launcher/minecraft/Component.h | 2 +- launcher/ui/pages/instance/VersionPage.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/launcher/minecraft/Component.cpp b/launcher/minecraft/Component.cpp index 1073ef324..ad7ef545c 100644 --- a/launcher/minecraft/Component.cpp +++ b/launcher/minecraft/Component.cpp @@ -222,11 +222,12 @@ bool Component::isMoveable() return true; } -bool Component::isVersionChangeable() +bool Component::isVersionChangeable(bool wait) { auto list = getVersionList(); if (list) { - list->waitToLoad(); + if (wait) + list->waitToLoad(); return list->count() != 0; } return false; diff --git a/launcher/minecraft/Component.h b/launcher/minecraft/Component.h index 7ff30889f..203cc2241 100644 --- a/launcher/minecraft/Component.h +++ b/launcher/minecraft/Component.h @@ -72,7 +72,7 @@ class Component : public QObject, public ProblemProvider { bool isRevertible(); bool isRemovable(); bool isCustom(); - bool isVersionChangeable(); + bool isVersionChangeable(bool wait = true); bool isKnownModloader(); QStringList knownConflictingComponents(); diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp index 0c25b4c0c..cb04f9db1 100644 --- a/launcher/ui/pages/instance/VersionPage.cpp +++ b/launcher/ui/pages/instance/VersionPage.cpp @@ -243,7 +243,7 @@ void VersionPage::updateButtons(int row) ui->actionRemove->setEnabled(patch && patch->isRemovable()); ui->actionMove_down->setEnabled(patch && patch->isMoveable()); ui->actionMove_up->setEnabled(patch && patch->isMoveable()); - ui->actionChange_version->setEnabled(patch && patch->isVersionChangeable()); + ui->actionChange_version->setEnabled(patch && patch->isVersionChangeable(false)); ui->actionEdit->setEnabled(patch && patch->isCustom()); ui->actionCustomize->setEnabled(patch && patch->isCustomizable()); ui->actionRevert->setEnabled(patch && patch->isRevertible());