aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2022-10-24 04:08:38 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2022-11-01 04:24:11 -0700
commit028e086960402f685e07163def36d6b5eee1b796 (patch)
tree27db4b1be6696b6f7c7abde615749aa9f783d7b6 /launcher/ui/dialogs
parent04b39294ba012721279ca9d009f99f75178fd57a (diff)
downloadPrismLauncher-028e086960402f685e07163def36d6b5eee1b796.tar.gz
PrismLauncher-028e086960402f685e07163def36d6b5eee1b796.tar.bz2
PrismLauncher-028e086960402f685e07163def36d6b5eee1b796.zip
send blocked mod info to dialog & prototype UI
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r--launcher/ui/dialogs/BlockedModsDialog.cpp42
-rw-r--r--launcher/ui/dialogs/BlockedModsDialog.h16
2 files changed, 52 insertions, 6 deletions
diff --git a/launcher/ui/dialogs/BlockedModsDialog.cpp b/launcher/ui/dialogs/BlockedModsDialog.cpp
index fe87b517..e29f8eb3 100644
--- a/launcher/ui/dialogs/BlockedModsDialog.cpp
+++ b/launcher/ui/dialogs/BlockedModsDialog.cpp
@@ -4,17 +4,22 @@
#include <QDialogButtonBox>
#include <QDesktopServices>
+#include <QDebug>
-BlockedModsDialog::BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QString &body, const QList<QUrl> &urls) :
- QDialog(parent), ui(new Ui::BlockedModsDialog), urls(urls) {
+
+BlockedModsDialog::BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QList<BlockedMod> &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() {
@@ -22,7 +27,36 @@ BlockedModsDialog::~BlockedModsDialog() {
}
void BlockedModsDialog::openAll() {
- for(auto &url : urls) {
- QDesktopServices::openUrl(url);
+ for(auto &mod : mods) {
+ QDesktopServices::openUrl(mod.websiteUrl);
}
}
+
+void BlockedModsDialog::update() {
+ QString text;
+ QString span;
+
+ for (auto &mod : mods) {
+ if (mod.matched) {
+ // &#x2714; -> html for HEAVY CHECK MARK : ✔
+ span = QString("<span style=\"color:green\"> &#x2714; Found at %1 </span>").arg(mod.localPath);
+ } else {
+ // &#x2718; -> html for HEAVY BALLOT X : ✘
+ span = QString("<span style=\"color:red\"> &#x2718; Not Found </span>");
+ }
+ text += QString("%1: <a href='%2'>%2</a> <p>Hash: %3 %4</p> <br/>").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;
+} \ No newline at end of file
diff --git a/launcher/ui/dialogs/BlockedModsDialog.h b/launcher/ui/dialogs/BlockedModsDialog.h
index 5f5bd61b..4be020ec 100644
--- a/launcher/ui/dialogs/BlockedModsDialog.h
+++ b/launcher/ui/dialogs/BlockedModsDialog.h
@@ -3,6 +3,15 @@
#include <QDialog>
+struct BlockedMod {
+ QString name;
+ QString websiteUrl;
+ QString hash;
+ bool matched;
+ QString localPath;
+
+};
+
QT_BEGIN_NAMESPACE
namespace Ui { class BlockedModsDialog; }
QT_END_NAMESPACE
@@ -11,12 +20,15 @@ class BlockedModsDialog : public QDialog {
Q_OBJECT
public:
- BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QString &body, const QList<QUrl> &urls);
+ BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QList<BlockedMod> &mods);
~BlockedModsDialog() override;
+
private:
Ui::BlockedModsDialog *ui;
- const QList<QUrl> &urls;
+ const QList<BlockedMod> &mods;
void openAll();
+ void update();
};
+