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.
This commit is contained in:
parent
1004211a66
commit
0102e91940
@ -5,6 +5,7 @@
|
|||||||
#include <InstanceList.h>
|
#include <InstanceList.h>
|
||||||
|
|
||||||
#include "ProgressDialog.h"
|
#include "ProgressDialog.h"
|
||||||
|
#include "CustomMessageBox.h"
|
||||||
|
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -41,7 +42,7 @@ ModDownloadDialog::ModDownloadDialog(const std::shared_ptr<ModFolderModel> &mods
|
|||||||
auto OkButton = m_buttons->button(QDialogButtonBox::Ok);
|
auto OkButton = m_buttons->button(QDialogButtonBox::Ok);
|
||||||
OkButton->setDefault(true);
|
OkButton->setDefault(true);
|
||||||
OkButton->setAutoDefault(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);
|
auto CancelButton = m_buttons->button(QDialogButtonBox::Cancel);
|
||||||
CancelButton->setDefault(false);
|
CancelButton->setDefault(false);
|
||||||
@ -68,6 +69,31 @@ void ModDownloadDialog::reject()
|
|||||||
QDialog::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()
|
void ModDownloadDialog::accept()
|
||||||
{
|
{
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
const std::shared_ptr<ModFolderModel> &mods;
|
const std::shared_ptr<ModFolderModel> &mods;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void confirm();
|
||||||
void accept() override;
|
void accept() override;
|
||||||
void reject() override;
|
void reject() override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user