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