2022-03-13 14:50:18 +00:00
|
|
|
#include "ReviewMessageBox.h"
|
|
|
|
#include "ui_ReviewMessageBox.h"
|
|
|
|
|
2022-06-17 02:22:14 +01:00
|
|
|
#include <QPushButton>
|
|
|
|
|
2022-03-13 14:50:18 +00:00
|
|
|
ReviewMessageBox::ReviewMessageBox(QWidget* parent, QString const& title, QString const& icon)
|
|
|
|
: QDialog(parent), ui(new Ui::ReviewMessageBox)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2022-04-22 17:20:31 +01:00
|
|
|
|
2022-06-17 02:22:14 +01:00
|
|
|
auto back_button = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
|
|
|
back_button->setText(tr("Back"));
|
|
|
|
|
2022-04-22 17:20:31 +01:00
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &ReviewMessageBox::accept);
|
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &ReviewMessageBox::reject);
|
2022-03-13 14:50:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ReviewMessageBox::~ReviewMessageBox()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ReviewMessageBox::create(QWidget* parent, QString&& title, QString&& icon) -> ReviewMessageBox*
|
|
|
|
{
|
|
|
|
return new ReviewMessageBox(parent, title, icon);
|
|
|
|
}
|
|
|
|
|
2022-11-25 12:23:46 +00:00
|
|
|
void ReviewMessageBox::appendResource(ResourceInformation&& info)
|
2022-03-13 14:50:18 +00:00
|
|
|
{
|
|
|
|
auto itemTop = new QTreeWidgetItem(ui->modTreeWidget);
|
2022-04-22 17:20:31 +01:00
|
|
|
itemTop->setCheckState(0, Qt::CheckState::Checked);
|
|
|
|
itemTop->setText(0, info.name);
|
2022-03-13 14:50:18 +00:00
|
|
|
|
|
|
|
auto filenameItem = new QTreeWidgetItem(itemTop);
|
2022-04-22 17:20:31 +01:00
|
|
|
filenameItem->setText(0, tr("Filename: %1").arg(info.filename));
|
2022-03-13 14:50:18 +00:00
|
|
|
|
|
|
|
itemTop->insertChildren(0, { filenameItem });
|
|
|
|
|
|
|
|
ui->modTreeWidget->addTopLevelItem(itemTop);
|
|
|
|
}
|
2022-04-22 17:20:31 +01:00
|
|
|
|
2022-11-25 12:23:46 +00:00
|
|
|
auto ReviewMessageBox::deselectedResources() -> QStringList
|
2022-04-22 17:20:31 +01:00
|
|
|
{
|
|
|
|
QStringList list;
|
|
|
|
|
|
|
|
auto* item = ui->modTreeWidget->topLevelItem(0);
|
|
|
|
|
2022-06-10 20:40:39 +01:00
|
|
|
for (int i = 1; item != nullptr; ++i) {
|
2022-04-22 17:20:31 +01:00
|
|
|
if (item->checkState(0) == Qt::CheckState::Unchecked) {
|
|
|
|
list.append(item->text(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
item = ui->modTreeWidget->topLevelItem(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|