Add "Open All" button to blocked mods dialog
Signed-off-by: kumquat-ir <66188216+kumquat-ir@users.noreply.github.com>
This commit is contained in:
parent
dce435c882
commit
33e34ebb83
@ -834,8 +834,8 @@ SET(LAUNCHER_SOURCES
|
|||||||
ui/dialogs/SkinUploadDialog.h
|
ui/dialogs/SkinUploadDialog.h
|
||||||
ui/dialogs/ModDownloadDialog.cpp
|
ui/dialogs/ModDownloadDialog.cpp
|
||||||
ui/dialogs/ModDownloadDialog.h
|
ui/dialogs/ModDownloadDialog.h
|
||||||
ui/dialogs/ScrollMessageBox.cpp
|
ui/dialogs/BlockedModsDialog.cpp
|
||||||
ui/dialogs/ScrollMessageBox.h
|
ui/dialogs/BlockedModsDialog.h
|
||||||
|
|
||||||
# GUI - widgets
|
# GUI - widgets
|
||||||
ui/widgets/Common.cpp
|
ui/widgets/Common.cpp
|
||||||
@ -940,7 +940,7 @@ qt_wrap_ui(LAUNCHER_UI
|
|||||||
ui/dialogs/LoginDialog.ui
|
ui/dialogs/LoginDialog.ui
|
||||||
ui/dialogs/EditAccountDialog.ui
|
ui/dialogs/EditAccountDialog.ui
|
||||||
ui/dialogs/ReviewMessageBox.ui
|
ui/dialogs/ReviewMessageBox.ui
|
||||||
ui/dialogs/ScrollMessageBox.ui
|
ui/dialogs/BlockedModsDialog.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_resources(LAUNCHER_RESOURCES
|
qt_add_resources(LAUNCHER_RESOURCES
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
#include "net/ChecksumValidator.h"
|
#include "net/ChecksumValidator.h"
|
||||||
|
|
||||||
#include "ui/dialogs/CustomMessageBox.h"
|
#include "ui/dialogs/CustomMessageBox.h"
|
||||||
#include "ui/dialogs/ScrollMessageBox.h"
|
#include "ui/dialogs/BlockedModsDialog.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -396,21 +396,24 @@ void InstanceImportTask::processFlame()
|
|||||||
auto results = m_modIdResolver->getResults();
|
auto results = m_modIdResolver->getResults();
|
||||||
//first check for blocked mods
|
//first check for blocked mods
|
||||||
QString text;
|
QString text;
|
||||||
|
QList<QUrl> urls;
|
||||||
auto anyBlocked = false;
|
auto anyBlocked = false;
|
||||||
for(const auto& result: results.files.values()) {
|
for(const auto& result: results.files.values()) {
|
||||||
if (!result.resolved || result.url.isEmpty()) {
|
if (!result.resolved || result.url.isEmpty()) {
|
||||||
text += QString("%1: <a href='%2'>%2</a><br/>").arg(result.fileName, result.websiteUrl);
|
text += QString("%1: <a href='%2'>%2</a><br/>").arg(result.fileName, result.websiteUrl);
|
||||||
|
urls.append(QUrl(result.websiteUrl));
|
||||||
anyBlocked = true;
|
anyBlocked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(anyBlocked) {
|
if(anyBlocked) {
|
||||||
qWarning() << "Blocked mods found, displaying mod list";
|
qWarning() << "Blocked mods found, displaying mod list";
|
||||||
|
|
||||||
auto message_dialog = new ScrollMessageBox(m_parent,
|
auto message_dialog = new BlockedModsDialog(m_parent,
|
||||||
tr("Blocked mods found"),
|
tr("Blocked mods found"),
|
||||||
tr("The following mods were blocked on third party launchers.<br/>"
|
tr("The following mods were blocked on third party launchers.<br/>"
|
||||||
"You will need to manually download them and add them to the modpack"),
|
"You will need to manually download them and add them to the modpack"),
|
||||||
text);
|
text,
|
||||||
|
urls);
|
||||||
message_dialog->setModal(true);
|
message_dialog->setModal(true);
|
||||||
|
|
||||||
if (message_dialog->exec()) {
|
if (message_dialog->exec()) {
|
||||||
|
28
launcher/ui/dialogs/BlockedModsDialog.cpp
Normal file
28
launcher/ui/dialogs/BlockedModsDialog.cpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
22
launcher/ui/dialogs/BlockedModsDialog.h
Normal file
22
launcher/ui/dialogs/BlockedModsDialog.h
Normal file
@ -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();
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ScrollMessageBox</class>
|
<class>BlockedModsDialog</class>
|
||||||
<widget class="QDialog" name="ScrollMessageBox">
|
<widget class="QDialog" name="BlockedModsDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string notr="true">ScrollMessageBox</string>
|
<string notr="true">BlockedModsDialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
@ -51,7 +51,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>ScrollMessageBox</receiver>
|
<receiver>BlockedModsDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@ -67,7 +67,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>ScrollMessageBox</receiver>
|
<receiver>BlockedModsDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
@ -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;
|
|
||||||
}
|
|
@ -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;
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user