mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Add optionCheckBox to ScrollMessageBox ui
Add 'Disable unavailable mods' option on check update failure Signed-off-by: Dylan Schooner <dschooner05@gmail.com>
This commit is contained in:
parent
b070ffaf72
commit
55dc9e6a84
7 changed files with 63 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 += "<br>";
|
||||
}
|
||||
|
||||
ScrollMessageBox message_dialog(m_parent, tr("Failed to check for updates"),
|
||||
tr("Could not check or get the following resources for updates:<br>"
|
||||
"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
|
||||
|
|
|
|||
|
|
@ -18,3 +18,8 @@ ScrollMessageBox::~ScrollMessageBox()
|
|||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool ScrollMessageBox::isOptionChecked() const
|
||||
{
|
||||
return ui->optionCheckBox->isChecked();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ class ScrollMessageBox : public QDialog {
|
|||
|
||||
~ScrollMessageBox() override;
|
||||
|
||||
private:
|
||||
bool isOptionChecked() const;
|
||||
|
||||
protected:
|
||||
Ui::ScrollMessageBox* ui;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,14 +25,25 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="bottomHBoxLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="optionCheckBox">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser">
|
||||
|
|
@ -81,4 +92,4 @@
|
|||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
</ui>
|
||||
13
launcher/ui/dialogs/UpdateCheckFailedDialog.cpp
Normal file
13
launcher/ui/dialogs/UpdateCheckFailedDialog.cpp
Normal file
|
|
@ -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:<br>"
|
||||
"Do you wish to proceed without those resources?"),
|
||||
body)
|
||||
{
|
||||
ui->optionCheckBox->setVisible(true);
|
||||
ui->optionCheckBox->setText(tr("Disable unavailable mods"));
|
||||
}
|
||||
10
launcher/ui/dialogs/UpdateCheckFailedDialog.h
Normal file
10
launcher/ui/dialogs/UpdateCheckFailedDialog.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "ScrollMessageBox.h"
|
||||
|
||||
class UpdateCheckFailedDialog final : public ScrollMessageBox {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UpdateCheckFailedDialog(QWidget* parent, const QString& body);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue