diff --git a/launcher/ui/dialogs/ResourceUpdateDialog.cpp b/launcher/ui/dialogs/ResourceUpdateDialog.cpp index 49a6ce562..99b01c35d 100644 --- a/launcher/ui/dialogs/ResourceUpdateDialog.cpp +++ b/launcher/ui/dialogs/ResourceUpdateDialog.cpp @@ -178,13 +178,21 @@ void ResourceUpdateDialog::checkCandidates() 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); + text, "Disable unavailable mods"); message_dialog.setModal(true); if (message_dialog.exec() == QDialog::Rejected) { m_aborted = true; QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection); return; } + + // Disable unavailable 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..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")); } @@ -18,3 +23,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..f91c90273 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.h +++ b/launcher/ui/dialogs/ScrollMessageBox.h @@ -12,10 +12,12 @@ 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 = {}); ~ScrollMessageBox() override; + bool isOptionChecked() const; + private: 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