2022-03-13 20:20:18 +05:30
|
|
|
#include "ReviewMessageBox.h"
|
|
|
|
#include "ui_ReviewMessageBox.h"
|
|
|
|
|
2022-06-17 06:52:14 +05:30
|
|
|
#include <QPushButton>
|
|
|
|
|
2022-03-13 20:20:18 +05:30
|
|
|
ReviewMessageBox::ReviewMessageBox(QWidget* parent, QString const& title, QString const& icon)
|
|
|
|
: QDialog(parent), ui(new Ui::ReviewMessageBox)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2022-04-22 21:50:31 +05:30
|
|
|
|
2022-06-17 06:52:14 +05:30
|
|
|
auto back_button = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
|
|
|
back_button->setText(tr("Back"));
|
|
|
|
|
2022-04-22 21:50:31 +05:30
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ReviewMessageBox::accept);
|
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ReviewMessageBox::reject);
|
2022-03-13 20:20:18 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
ReviewMessageBox::~ReviewMessageBox()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ReviewMessageBox::create(QWidget* parent, QString&& title, QString&& icon) -> ReviewMessageBox*
|
|
|
|
{
|
|
|
|
return new ReviewMessageBox(parent, title, icon);
|
|
|
|
}
|
|
|
|
|
2022-11-25 17:53:46 +05:30
|
|
|
void ReviewMessageBox::appendResource(ResourceInformation&& info)
|
2022-03-13 20:20:18 +05:30
|
|
|
{
|
|
|
|
auto itemTop = new QTreeWidgetItem(ui->modTreeWidget);
|
2022-04-22 21:50:31 +05:30
|
|
|
itemTop->setCheckState(0, Qt::CheckState::Checked);
|
|
|
|
itemTop->setText(0, info.name);
|
2022-03-13 20:20:18 +05:30
|
|
|
|
|
|
|
auto filenameItem = new QTreeWidgetItem(itemTop);
|
2022-04-22 21:50:31 +05:30
|
|
|
filenameItem->setText(0, tr("Filename: %1").arg(info.filename));
|
2022-03-13 20:20:18 +05:30
|
|
|
|
|
|
|
itemTop->insertChildren(0, { filenameItem });
|
|
|
|
|
|
|
|
ui->modTreeWidget->addTopLevelItem(itemTop);
|
|
|
|
}
|
2022-04-22 21:50:31 +05:30
|
|
|
|
2022-11-25 17:53:46 +05:30
|
|
|
auto ReviewMessageBox::deselectedResources() -> QStringList
|
2022-04-22 21:50:31 +05:30
|
|
|
{
|
|
|
|
QStringList list;
|
|
|
|
|
|
|
|
auto* item = ui->modTreeWidget->topLevelItem(0);
|
|
|
|
|
2022-06-11 01:10:39 +05:30
|
|
|
for (int i = 1; item != nullptr; ++i) {
|
2022-04-22 21:50:31 +05:30
|
|
|
if (item->checkState(0) == Qt::CheckState::Unchecked) {
|
|
|
|
list.append(item->text(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
item = ui->modTreeWidget->topLevelItem(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
2023-01-08 20:58:55 +05:30
|
|
|
|
|
|
|
void ReviewMessageBox::retranslateUi(QString resources_name)
|
|
|
|
{
|
|
|
|
setWindowTitle(tr("Confirm %1 selection").arg(resources_name));
|
|
|
|
|
|
|
|
ui->explainLabel->setText(tr("You're about to download the following %1:").arg(resources_name));
|
|
|
|
ui->onlyCheckedLabel->setText(tr("Only %1 with a check will be downloaded!").arg(resources_name));
|
|
|
|
}
|