2022-07-17 04:44:54 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDialog>
|
2022-10-25 13:49:19 +05:30
|
|
|
#include <QString>
|
|
|
|
#include <QList>
|
2022-07-17 04:44:54 +05:30
|
|
|
|
2022-10-25 13:49:19 +05:30
|
|
|
#include <QFileSystemWatcher>
|
|
|
|
|
|
|
|
#include "modplatform/helpers/HashUtils.h"
|
|
|
|
|
|
|
|
#include "tasks/ConcurrentTask.h"
|
2022-07-17 04:44:54 +05:30
|
|
|
|
2022-10-24 16:38:38 +05:30
|
|
|
struct BlockedMod {
|
|
|
|
QString name;
|
|
|
|
QString websiteUrl;
|
|
|
|
QString hash;
|
|
|
|
bool matched;
|
|
|
|
QString localPath;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-07-17 04:44:54 +05:30
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
namespace Ui { class BlockedModsDialog; }
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
class BlockedModsDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-10-25 13:49:19 +05:30
|
|
|
BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, QList<BlockedMod> &mods);
|
2022-07-17 04:44:54 +05:30
|
|
|
|
|
|
|
~BlockedModsDialog() override;
|
|
|
|
|
2022-10-24 16:38:38 +05:30
|
|
|
|
2022-07-17 04:44:54 +05:30
|
|
|
private:
|
|
|
|
Ui::BlockedModsDialog *ui;
|
2022-10-25 13:49:19 +05:30
|
|
|
QList<BlockedMod> &mods;
|
|
|
|
QFileSystemWatcher watcher;
|
|
|
|
shared_qobject_ptr<ConcurrentTask> hashing_task;
|
|
|
|
|
2022-07-17 04:44:54 +05:30
|
|
|
void openAll();
|
2022-10-24 16:38:38 +05:30
|
|
|
void update();
|
2022-10-25 13:49:19 +05:30
|
|
|
void directoryChanged(QString path);
|
|
|
|
void setupWatch();
|
2022-10-26 08:48:14 +05:30
|
|
|
void scanPaths();
|
|
|
|
void scanPath(QString path);
|
2022-10-25 13:49:19 +05:30
|
|
|
void checkMatchHash(QString hash, QString path);
|
|
|
|
|
|
|
|
bool checkValidPath(QString path);
|
|
|
|
bool allModsMatched();
|
2022-07-17 04:44:54 +05:30
|
|
|
};
|
2022-10-24 16:38:38 +05:30
|
|
|
|
2022-10-31 11:09:12 +05:30
|
|
|
QDebug operator<<(QDebug debug, const BlockedMod &m);
|