watch filesystem, compute and match hashes

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2022-10-25 01:19:19 -07:00
parent 028e086960
commit 1598d65824
4 changed files with 212 additions and 4 deletions

View File

@ -1,7 +1,14 @@
#pragma once
#include <QDialog>
#include <QString>
#include <QList>
#include <QFileSystemWatcher>
#include "modplatform/helpers/HashUtils.h"
#include "tasks/ConcurrentTask.h"
struct BlockedMod {
QString name;
@ -20,15 +27,27 @@ class BlockedModsDialog : public QDialog {
Q_OBJECT
public:
BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, const QList<BlockedMod> &mods);
BlockedModsDialog(QWidget *parent, const QString &title, const QString &text, QList<BlockedMod> &mods);
~BlockedModsDialog() override;
private:
Ui::BlockedModsDialog *ui;
const QList<BlockedMod> &mods;
QList<BlockedMod> &mods;
QFileSystemWatcher watcher;
shared_qobject_ptr<ConcurrentTask> hashing_task;
QSet<QString> checked_paths;
void openAll();
void update();
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();
};