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
2 changed files with 28 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue