aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-02-21 23:00:50 -0300
committerflow <thiagodonato300@gmail.com>2022-02-21 23:09:14 -0300
commit0102e9194075a53c2816966afb9d12b84ed4c276 (patch)
tree3884e052c88224752c9cda70442171fd2fcdc0d3
parent1004211a66370f2f39b81fdfc05e0e3645e91b90 (diff)
downloadPrismLauncher-0102e9194075a53c2816966afb9d12b84ed4c276.tar.gz
PrismLauncher-0102e9194075a53c2816966afb9d12b84ed4c276.tar.bz2
PrismLauncher-0102e9194075a53c2816966afb9d12b84ed4c276.zip
feat: add confirm dialog for installing mods
When selecting multiple mods at once, it can become hard to keep track of which ones you selected. To address this, a dialog is now displayed when you finish selecting the mods to download, showing you which ones you selected and their filenames. From there, you can either accept it and download the mods, or you can cancel it and go back to the mod selection dialog.
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.cpp28
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.h1
2 files changed, 28 insertions, 1 deletions
diff --git a/launcher/ui/dialogs/ModDownloadDialog.cpp b/launcher/ui/dialogs/ModDownloadDialog.cpp
index c2bf2d6f..6240ecdc 100644
--- a/launcher/ui/dialogs/ModDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ModDownloadDialog.cpp
@@ -5,6 +5,7 @@
#include <InstanceList.h>
#include "ProgressDialog.h"
+#include "CustomMessageBox.h"
#include <QLayout>
#include <QPushButton>
@@ -41,7 +42,7 @@ ModDownloadDialog::ModDownloadDialog(const std::shared_ptr<ModFolderModel> &mods
auto OkButton = m_buttons->button(QDialogButtonBox::Ok);
OkButton->setDefault(true);
OkButton->setAutoDefault(true);
- connect(OkButton, &QPushButton::clicked, this, &ModDownloadDialog::accept);
+ connect(OkButton, &QPushButton::clicked, this, &ModDownloadDialog::confirm);
auto CancelButton = m_buttons->button(QDialogButtonBox::Cancel);
CancelButton->setDefault(false);
@@ -68,6 +69,31 @@ void ModDownloadDialog::reject()
QDialog::reject();
}
+void ModDownloadDialog::confirm()
+{
+ auto info = QString("You're about to download the following mods:\n\n");
+ for(auto task : modTask.keys()){
+ info.append(task);
+ info.append("\n --> File name: ");
+ info.append(modTask.find(task).value()->getFilename());
+ info.append('\n');
+ }
+
+ auto confirm_dialog = CustomMessageBox::selectable(
+ this,
+ tr("Confirm mods to download"),
+ info,
+ QMessageBox::NoIcon,
+ {QMessageBox::Cancel, QMessageBox::Ok},
+ QMessageBox::Ok
+ );
+
+ auto AcceptButton = confirm_dialog->button(QMessageBox::Ok);
+ connect(AcceptButton, &QPushButton::clicked, this, &ModDownloadDialog::accept);
+
+ confirm_dialog->open();
+}
+
void ModDownloadDialog::accept()
{
QDialog::accept();
diff --git a/launcher/ui/dialogs/ModDownloadDialog.h b/launcher/ui/dialogs/ModDownloadDialog.h
index 02870c6c..309d89d0 100644
--- a/launcher/ui/dialogs/ModDownloadDialog.h
+++ b/launcher/ui/dialogs/ModDownloadDialog.h
@@ -37,6 +37,7 @@ public:
const std::shared_ptr<ModFolderModel> &mods;
public slots:
+ void confirm();
void accept() override;
void reject() override;