mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-04 12:26:58 +03:00
Add configurable option on ScrollMessageBox (#4335)
This commit is contained in:
commit
3270288031
4 changed files with 43 additions and 12 deletions
|
|
@ -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:<br>"
|
||||
"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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <QPushButton>
|
||||
#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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue