diff options
author | flow <flowlnlnln@gmail.com> | 2022-10-14 14:22:13 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-12-06 17:00:29 -0300 |
commit | 08d008a5aa7379efe76201250b2511b66665d9a7 (patch) | |
tree | 21db69a4b55809770293d5459ade1507ce5b7696 /launcher/modplatform/modrinth | |
parent | 9e17ff884f84601bd6e48721b32c2af51ca8ee7d (diff) | |
download | PrismLauncher-08d008a5aa7379efe76201250b2511b66665d9a7.tar.gz PrismLauncher-08d008a5aa7379efe76201250b2511b66665d9a7.tar.bz2 PrismLauncher-08d008a5aa7379efe76201250b2511b66665d9a7.zip |
refactor: abstract away update confirmation dialog
... so that we can avoid code duplication.
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp index ddeea224..762feef6 100644 --- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp +++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp @@ -49,23 +49,10 @@ bool ModrinthCreationTask::updateInstance() auto version_name = inst->getManagedPackVersionName(); auto version_str = !version_name.isEmpty() ? tr(" (version %1)").arg(version_name) : ""; - auto info = CustomMessageBox::selectable( - m_parent, tr("Similar modpack was found!"), - tr("One or more of your instances are from this same modpack%1. Do you want to create a " - "separate instance, or update the existing one?\n\nNOTE: Make sure you made a backup of your important instance data before " - "updating, as worlds can be corrupted and some configuration may be lost (due to pack overrides).") - .arg(version_str), - QMessageBox::Information, QMessageBox::Ok | QMessageBox::Reset | QMessageBox::Abort); - info->setButtonText(QMessageBox::Ok, tr("Create new instance")); - info->setButtonText(QMessageBox::Abort, tr("Update existing instance")); - info->setButtonText(QMessageBox::Reset, tr("Cancel")); - - info->exec(); - - if (info->clickedButton() == info->button(QMessageBox::Ok)) + auto should_update = askIfShouldUpdate(m_parent, version_str); + if (should_update == ShouldUpdate::SkipUpdating) return false; - - if (info->clickedButton() == info->button(QMessageBox::Reset)) { + if (should_update == ShouldUpdate::Cancel) { m_abort = true; return false; } |