#include "BlockedModsDialog.h" #include "ui_BlockedModsDialog.h" #include #include #include #include BlockedModsDialog::BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QList &mods) : QDialog(parent), ui(new Ui::BlockedModsDialog), mods(mods) { ui->setupUi(this); auto openAllButton = ui->buttonBox->addButton(tr("Open All"), QDialogButtonBox::ActionRole); connect(openAllButton, &QPushButton::clicked, this, &BlockedModsDialog::openAll); qDebug() << "Mods List: " << mods; this->setWindowTitle(title); ui->label->setText(text); ui->textBrowser->setText(body); update(); } BlockedModsDialog::~BlockedModsDialog() { delete ui; } void BlockedModsDialog::openAll() { for(auto &mod : mods) { QDesktopServices::openUrl(mod.websiteUrl); } } void BlockedModsDialog::update() { QString text; QString span; for (auto &mod : mods) { if (mod.matched) { // ✔ -> html for HEAVY CHECK MARK : ✔ span = QString(" ✔ Found at %1 ").arg(mod.localPath); } else { // ✘ -> html for HEAVY BALLOT X : ✘ span = QString(" ✘ Not Found "); } text += QString("%1: %2

Hash: %3 %4


").arg(mod.name, mod.websiteUrl, mod.hash, span); } ui->textBrowser->setText(text); } QDebug operator<<(QDebug debug, const BlockedMod &m) { QDebugStateSaver saver(debug); debug.nospace() << "{ name: " << m.name << ", websiteUrl: " << m.websiteUrl << ", hash: " << m.hash << ", matched: " << m.matched << ", localPath: " << m.localPath <<"}"; return debug; }