diff options
author | kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> | 2022-07-16 19:14:54 -0400 |
---|---|---|
committer | kumquat-ir <66188216+kumquat-ir@users.noreply.github.com> | 2022-07-16 19:14:54 -0400 |
commit | 33e34ebb83bdf423a4a60b373559f5923929c216 (patch) | |
tree | c3fa604029a8d8727228bd19c0eb17d8d7171ee2 /launcher/ui | |
parent | dce435c882b3370d04ff9c0af9e690a703007628 (diff) | |
download | PrismLauncher-33e34ebb83bdf423a4a60b373559f5923929c216.tar.gz PrismLauncher-33e34ebb83bdf423a4a60b373559f5923929c216.tar.bz2 PrismLauncher-33e34ebb83bdf423a4a60b373559f5923929c216.zip |
Add "Open All" button to blocked mods dialog
Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
Diffstat (limited to 'launcher/ui')
-rw-r--r-- | launcher/ui/dialogs/BlockedModsDialog.cpp | 28 | ||||
-rw-r--r-- | launcher/ui/dialogs/BlockedModsDialog.h | 22 | ||||
-rw-r--r-- | launcher/ui/dialogs/BlockedModsDialog.ui (renamed from launcher/ui/dialogs/ScrollMessageBox.ui) | 10 | ||||
-rw-r--r-- | launcher/ui/dialogs/ScrollMessageBox.cpp | 15 | ||||
-rw-r--r-- | launcher/ui/dialogs/ScrollMessageBox.h | 20 |
5 files changed, 55 insertions, 40 deletions
diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp new file mode 100644 index 00000000..de698509 --- /dev/null +++ b/launcher/ui/dialogs/BlockedModsDialog.cpp @@ -0,0 +1,28 @@ +#include "BlockedModsDialog.h" +#include "ui_BlockedModsDialog.h" +#include "qpushbutton.h" +#include <QDialogButtonBox> +#include <QDesktopServices> + + +BlockedModsDialog::BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QString &body, const QList<QUrl> &urls) : + QDialog(parent), ui(new Ui::BlockedModsDialog), urls(urls) { + ui->setupUi(this); + + auto openAllButton = ui->buttonBox->addButton(tr("Open All"), QDialogButtonBox::ActionRole); + connect(openAllButton, &QPushButton::clicked, this, &BlockedModsDialog::openAll); + + this->setWindowTitle(title); + ui->label->setText(text); + ui->textBrowser->setText(body); +} + +BlockedModsDialog::~BlockedModsDialog() { + delete ui; +} + +void BlockedModsDialog::openAll() { + for(auto &url : urls) { + QDesktopServices::openUrl(url); + } +} diff --git a/launcher/ui/dialogs/BlockedModsDialog.h b/launcher/ui/dialogs/BlockedModsDialog.h new file mode 100644 index 00000000..5f5bd61b --- /dev/null +++ b/launcher/ui/dialogs/BlockedModsDialog.h @@ -0,0 +1,22 @@ +#pragma once + +#include <QDialog> + + +QT_BEGIN_NAMESPACE +namespace Ui { class BlockedModsDialog; } +QT_END_NAMESPACE + +class BlockedModsDialog : public QDialog { +Q_OBJECT + +public: + BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QString &body, const QList<QUrl> &urls); + + ~BlockedModsDialog() override; + +private: + Ui::BlockedModsDialog *ui; + const QList<QUrl> &urls; + void openAll(); +}; diff --git a/launcher/ui/dialogs/ScrollMessageBox.ui b/launcher/ui/dialogs/BlockedModsDialog.ui index 299d2ecc..f4ae95b6 100644 --- a/launcher/ui/dialogs/ScrollMessageBox.ui +++ b/launcher/ui/dialogs/BlockedModsDialog.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>ScrollMessageBox</class> - <widget class="QDialog" name="ScrollMessageBox"> + <class>BlockedModsDialog</class> + <widget class="QDialog" name="BlockedModsDialog"> <property name="geometry"> <rect> <x>0</x> @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string notr="true">ScrollMessageBox</string> + <string notr="true">BlockedModsDialog</string> </property> <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> @@ -51,7 +51,7 @@ <connection> <sender>buttonBox</sender> <signal>accepted()</signal> - <receiver>ScrollMessageBox</receiver> + <receiver>BlockedModsDialog</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> @@ -67,7 +67,7 @@ <connection> <sender>buttonBox</sender> <signal>rejected()</signal> - <receiver>ScrollMessageBox</receiver> + <receiver>BlockedModsDialog</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> diff --git a/launcher/ui/dialogs/ScrollMessageBox.cpp b/launcher/ui/dialogs/ScrollMessageBox.cpp deleted file mode 100644 index afdc4bae..00000000 --- a/launcher/ui/dialogs/ScrollMessageBox.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "ScrollMessageBox.h" -#include "ui_ScrollMessageBox.h" - - -ScrollMessageBox::ScrollMessageBox(QWidget *parent, const QString &title, const QString &text, const QString &body) : - QDialog(parent), ui(new Ui::ScrollMessageBox) { - ui->setupUi(this); - this->setWindowTitle(title); - ui->label->setText(text); - ui->textBrowser->setText(body); -} - -ScrollMessageBox::~ScrollMessageBox() { - delete ui; -} diff --git a/launcher/ui/dialogs/ScrollMessageBox.h b/launcher/ui/dialogs/ScrollMessageBox.h deleted file mode 100644 index 84aa253a..00000000 --- a/launcher/ui/dialogs/ScrollMessageBox.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include <QDialog> - - -QT_BEGIN_NAMESPACE -namespace Ui { class ScrollMessageBox; } -QT_END_NAMESPACE - -class ScrollMessageBox : public QDialog { -Q_OBJECT - -public: - ScrollMessageBox(QWidget *parent, const QString &title, const QString &text, const QString &body); - - ~ScrollMessageBox() override; - -private: - Ui::ScrollMessageBox *ui; -}; |