From 55dc9e6a84ee1a4b3d92a01ea79fe5b24d26a0b7 Mon Sep 17 00:00:00 2001 From: Dylan Schooner Date: Mon, 10 Nov 2025 03:24:00 -0500 Subject: [PATCH 1/4] Add optionCheckBox to ScrollMessageBox ui Add 'Disable unavailable mods' option on check update failure Signed-off-by: Dylan Schooner --- launcher/CMakeLists.txt | 2 ++ launcher/ui/dialogs/ResourceUpdateDialog.cpp | 14 ++++++--- launcher/ui/dialogs/ScrollMessageBox.cpp | 5 ++++ launcher/ui/dialogs/ScrollMessageBox.h | 4 ++- launcher/ui/dialogs/ScrollMessageBox.ui | 29 +++++++++++++------ .../ui/dialogs/UpdateCheckFailedDialog.cpp | 13 +++++++++ launcher/ui/dialogs/UpdateCheckFailedDialog.h | 10 +++++++ 7 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 launcher/ui/dialogs/UpdateCheckFailedDialog.cpp create mode 100644 launcher/ui/dialogs/UpdateCheckFailedDialog.h diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 6d6e2ae7f..7654ff29d 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1073,6 +1073,8 @@ SET(LAUNCHER_SOURCES ui/dialogs/ResourceDownloadDialog.h ui/dialogs/ScrollMessageBox.cpp ui/dialogs/ScrollMessageBox.h + ui/dialogs/UpdateCheckFailedDialog.cpp + ui/dialogs/UpdateCheckFailedDialog.h ui/dialogs/BlockedModsDialog.cpp ui/dialogs/BlockedModsDialog.h ui/dialogs/ChooseProviderDialog.h diff --git a/launcher/ui/dialogs/ResourceUpdateDialog.cpp b/launcher/ui/dialogs/ResourceUpdateDialog.cpp index eeaf6b3d0..39fedc5d7 100644 --- a/launcher/ui/dialogs/ResourceUpdateDialog.cpp +++ b/launcher/ui/dialogs/ResourceUpdateDialog.cpp @@ -5,6 +5,7 @@ #include "ProgressDialog.h" #include "ScrollMessageBox.h" #include "StringUtils.h" +#include "UpdateCheckFailedDialog.h" #include "minecraft/mod/tasks/GetModDependenciesTask.h" #include "modplatform/ModIndex.h" #include "modplatform/flame/FlameAPI.h" @@ -175,16 +176,21 @@ void ResourceUpdateDialog::checkCandidates() text += "
"; } - ScrollMessageBox message_dialog(m_parent, tr("Failed to check for updates"), - tr("Could not check or get the following resources for updates:
" - "Do you wish to proceed without those resources?"), - text); + UpdateCheckFailedDialog message_dialog(m_parent, text); message_dialog.setModal(true); if (message_dialog.exec() == QDialog::Rejected) { m_aborted = true; QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection); return; } + + // Disable incompatible mods + if (message_dialog.isOptionChecked()) { + for (const auto& failed : m_failedCheckUpdate) { + const auto& mod = std::get<0>(failed); + mod->enable(EnableAction::DISABLE); + } + } } if (m_includeDeps && !APPLICATION->settings()->get("ModDependenciesDisabled").toBool()) { // dependencies diff --git a/launcher/ui/dialogs/ScrollMessageBox.cpp b/launcher/ui/dialogs/ScrollMessageBox.cpp index 1cfb848f4..d2652b0c9 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.cpp +++ b/launcher/ui/dialogs/ScrollMessageBox.cpp @@ -18,3 +18,8 @@ ScrollMessageBox::~ScrollMessageBox() { delete ui; } + +bool ScrollMessageBox::isOptionChecked() const +{ + return ui->optionCheckBox->isChecked(); +} diff --git a/launcher/ui/dialogs/ScrollMessageBox.h b/launcher/ui/dialogs/ScrollMessageBox.h index 8fd6769c4..774dd2cbc 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.h +++ b/launcher/ui/dialogs/ScrollMessageBox.h @@ -16,6 +16,8 @@ class ScrollMessageBox : public QDialog { ~ScrollMessageBox() override; - private: + bool isOptionChecked() const; + + protected: Ui::ScrollMessageBox* ui; }; diff --git a/launcher/ui/dialogs/ScrollMessageBox.ui b/launcher/ui/dialogs/ScrollMessageBox.ui index e684185f2..2ebe86074 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.ui +++ b/launcher/ui/dialogs/ScrollMessageBox.ui @@ -25,14 +25,25 @@ - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + + + + false + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + @@ -81,4 +92,4 @@ - + \ No newline at end of file diff --git a/launcher/ui/dialogs/UpdateCheckFailedDialog.cpp b/launcher/ui/dialogs/UpdateCheckFailedDialog.cpp new file mode 100644 index 000000000..7b97fad21 --- /dev/null +++ b/launcher/ui/dialogs/UpdateCheckFailedDialog.cpp @@ -0,0 +1,13 @@ +#include "UpdateCheckFailedDialog.h" +#include "ui_ScrollMessageBox.h" + +UpdateCheckFailedDialog::UpdateCheckFailedDialog(QWidget* parent, const QString& body) + : ScrollMessageBox(parent, + tr("Failed to check for updates"), + tr("Could not check or get the following resources for updates:
" + "Do you wish to proceed without those resources?"), + body) +{ + ui->optionCheckBox->setVisible(true); + ui->optionCheckBox->setText(tr("Disable unavailable mods")); +} \ No newline at end of file diff --git a/launcher/ui/dialogs/UpdateCheckFailedDialog.h b/launcher/ui/dialogs/UpdateCheckFailedDialog.h new file mode 100644 index 000000000..570821c5b --- /dev/null +++ b/launcher/ui/dialogs/UpdateCheckFailedDialog.h @@ -0,0 +1,10 @@ +#pragma once + +#include "ScrollMessageBox.h" + +class UpdateCheckFailedDialog final : public ScrollMessageBox { + Q_OBJECT + + public: + explicit UpdateCheckFailedDialog(QWidget* parent, const QString& body); +}; \ No newline at end of file From 11a2ba63b3341396116692eb0918552d0b89faa0 Mon Sep 17 00:00:00 2001 From: Dylan Schooner Date: Mon, 10 Nov 2025 04:52:26 -0500 Subject: [PATCH 2/4] Pass option as constructor parameter Signed-off-by: Dylan Schooner --- launcher/CMakeLists.txt | 2 -- launcher/ui/dialogs/ResourceUpdateDialog.cpp | 8 +++++--- launcher/ui/dialogs/ScrollMessageBox.cpp | 7 ++++++- launcher/ui/dialogs/ScrollMessageBox.h | 2 +- launcher/ui/dialogs/UpdateCheckFailedDialog.cpp | 13 ------------- launcher/ui/dialogs/UpdateCheckFailedDialog.h | 10 ---------- 6 files changed, 12 insertions(+), 30 deletions(-) delete mode 100644 launcher/ui/dialogs/UpdateCheckFailedDialog.cpp delete mode 100644 launcher/ui/dialogs/UpdateCheckFailedDialog.h diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 7654ff29d..6d6e2ae7f 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1073,8 +1073,6 @@ SET(LAUNCHER_SOURCES ui/dialogs/ResourceDownloadDialog.h ui/dialogs/ScrollMessageBox.cpp ui/dialogs/ScrollMessageBox.h - ui/dialogs/UpdateCheckFailedDialog.cpp - ui/dialogs/UpdateCheckFailedDialog.h ui/dialogs/BlockedModsDialog.cpp ui/dialogs/BlockedModsDialog.h ui/dialogs/ChooseProviderDialog.h diff --git a/launcher/ui/dialogs/ResourceUpdateDialog.cpp b/launcher/ui/dialogs/ResourceUpdateDialog.cpp index 39fedc5d7..715a1a3fa 100644 --- a/launcher/ui/dialogs/ResourceUpdateDialog.cpp +++ b/launcher/ui/dialogs/ResourceUpdateDialog.cpp @@ -5,7 +5,6 @@ #include "ProgressDialog.h" #include "ScrollMessageBox.h" #include "StringUtils.h" -#include "UpdateCheckFailedDialog.h" #include "minecraft/mod/tasks/GetModDependenciesTask.h" #include "modplatform/ModIndex.h" #include "modplatform/flame/FlameAPI.h" @@ -176,7 +175,10 @@ void ResourceUpdateDialog::checkCandidates() text += "
"; } - UpdateCheckFailedDialog message_dialog(m_parent, text); + ScrollMessageBox message_dialog(m_parent, tr("Failed to check for updates"), + tr("Could not check or get the following resources for updates:
" + "Do you wish to proceed without those resources?"), + text, "Disable unavailable mods"); message_dialog.setModal(true); if (message_dialog.exec() == QDialog::Rejected) { m_aborted = true; @@ -184,7 +186,7 @@ void ResourceUpdateDialog::checkCandidates() return; } - // Disable incompatible mods + // Disable unavailable mods if (message_dialog.isOptionChecked()) { for (const auto& failed : m_failedCheckUpdate) { const auto& mod = std::get<0>(failed); diff --git a/launcher/ui/dialogs/ScrollMessageBox.cpp b/launcher/ui/dialogs/ScrollMessageBox.cpp index d2652b0c9..361b610be 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.cpp +++ b/launcher/ui/dialogs/ScrollMessageBox.cpp @@ -2,7 +2,7 @@ #include #include "ui_ScrollMessageBox.h" -ScrollMessageBox::ScrollMessageBox(QWidget* parent, const QString& title, const QString& text, const QString& body) +ScrollMessageBox::ScrollMessageBox(QWidget* parent, const QString& title, const QString& text, const QString& body, const QString& option) : QDialog(parent), ui(new Ui::ScrollMessageBox) { ui->setupUi(this); @@ -10,6 +10,11 @@ ScrollMessageBox::ScrollMessageBox(QWidget* parent, const QString& title, const ui->label->setText(text); ui->textBrowser->setText(body); + if (!option.isEmpty()) { + ui->optionCheckBox->setVisible(true); + ui->optionCheckBox->setText(option); + } + ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel")); ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK")); } diff --git a/launcher/ui/dialogs/ScrollMessageBox.h b/launcher/ui/dialogs/ScrollMessageBox.h index 774dd2cbc..0dfadff33 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.h +++ b/launcher/ui/dialogs/ScrollMessageBox.h @@ -12,7 +12,7 @@ class ScrollMessageBox : public QDialog { Q_OBJECT public: - ScrollMessageBox(QWidget* parent, const QString& title, const QString& text, const QString& body); + ScrollMessageBox(QWidget* parent, const QString& title, const QString& text, const QString& body, const QString& option = QString()); ~ScrollMessageBox() override; diff --git a/launcher/ui/dialogs/UpdateCheckFailedDialog.cpp b/launcher/ui/dialogs/UpdateCheckFailedDialog.cpp deleted file mode 100644 index 7b97fad21..000000000 --- a/launcher/ui/dialogs/UpdateCheckFailedDialog.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "UpdateCheckFailedDialog.h" -#include "ui_ScrollMessageBox.h" - -UpdateCheckFailedDialog::UpdateCheckFailedDialog(QWidget* parent, const QString& body) - : ScrollMessageBox(parent, - tr("Failed to check for updates"), - tr("Could not check or get the following resources for updates:
" - "Do you wish to proceed without those resources?"), - body) -{ - ui->optionCheckBox->setVisible(true); - ui->optionCheckBox->setText(tr("Disable unavailable mods")); -} \ No newline at end of file diff --git a/launcher/ui/dialogs/UpdateCheckFailedDialog.h b/launcher/ui/dialogs/UpdateCheckFailedDialog.h deleted file mode 100644 index 570821c5b..000000000 --- a/launcher/ui/dialogs/UpdateCheckFailedDialog.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "ScrollMessageBox.h" - -class UpdateCheckFailedDialog final : public ScrollMessageBox { - Q_OBJECT - - public: - explicit UpdateCheckFailedDialog(QWidget* parent, const QString& body); -}; \ No newline at end of file From d0a296208adcdcf9539128e469f81136ccc1dbeb Mon Sep 17 00:00:00 2001 From: Dylan <60893964+dsch7705@users.noreply.github.com> Date: Mon, 10 Nov 2025 06:46:34 -0500 Subject: [PATCH 3/4] Update launcher/ui/dialogs/ScrollMessageBox.h Co-authored-by: Alexandru Ionut Tripon Signed-off-by: Dylan <60893964+dsch7705@users.noreply.github.com> --- launcher/ui/dialogs/ScrollMessageBox.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/dialogs/ScrollMessageBox.h b/launcher/ui/dialogs/ScrollMessageBox.h index 0dfadff33..bd121108f 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.h +++ b/launcher/ui/dialogs/ScrollMessageBox.h @@ -12,7 +12,7 @@ class ScrollMessageBox : public QDialog { Q_OBJECT public: - ScrollMessageBox(QWidget* parent, const QString& title, const QString& text, const QString& body, const QString& option = QString()); + ScrollMessageBox(QWidget* parent, const QString& title, const QString& text, const QString& body, const QString& option = {}); ~ScrollMessageBox() override; From efe302b1971e2c7a3f01822cff5ce6aac48a8c88 Mon Sep 17 00:00:00 2001 From: Dylan Schooner Date: Tue, 11 Nov 2025 08:31:41 -0500 Subject: [PATCH 4/4] Change visibility of ui ptr back to private Signed-off-by: Dylan Schooner --- launcher/ui/dialogs/ScrollMessageBox.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/dialogs/ScrollMessageBox.h b/launcher/ui/dialogs/ScrollMessageBox.h index bd121108f..f91c90273 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.h +++ b/launcher/ui/dialogs/ScrollMessageBox.h @@ -18,6 +18,6 @@ class ScrollMessageBox : public QDialog { bool isOptionChecked() const; - protected: + private: Ui::ScrollMessageBox* ui; };