Merge pull request #2981 from PrismLauncher/backport-2975-to-release-9.x

[Backport release-9.x] fix: don't hang the ui for a full version load
This commit is contained in:
Alexandru Ionut Tripon 2024-10-24 15:09:19 +03:00 committed by GitHub
commit 89041531e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -222,10 +222,11 @@ bool Component::isMoveable()
return true;
}
bool Component::isVersionChangeable()
bool Component::isVersionChangeable(bool wait)
{
auto list = getVersionList();
if (list) {
if (wait)
list->waitToLoad();
return list->count() != 0;
}

View File

@ -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();

View File

@ -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());