2022-03-13 20:20:18 +05:30
|
|
|
#include "ReviewMessageBox.h"
|
|
|
|
#include "ui_ReviewMessageBox.h"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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-04-22 21:50:31 +05:30
|
|
|
void ReviewMessageBox::appendMod(ModInformation&& 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
|
|
|
|
|
|
|
auto ReviewMessageBox::deselectedMods() -> QStringList
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|