2022-07-17 04:44:54 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDialog>
|
2022-10-25 13:49:19 +05:30
|
|
|
#include <QList>
|
2022-12-06 17:46:27 +05:30
|
|
|
#include <QString>
|
2022-07-17 04:44:54 +05:30
|
|
|
|
2022-10-25 13:49:19 +05:30
|
|
|
#include <QFileSystemWatcher>
|
|
|
|
|
|
|
|
#include "tasks/ConcurrentTask.h"
|
2022-07-17 04:44:54 +05:30
|
|
|
|
2022-11-23 18:59:23 +05:30
|
|
|
class QPushButton;
|
|
|
|
|
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
|
2022-12-06 17:46:27 +05:30
|
|
|
namespace Ui {
|
|
|
|
class BlockedModsDialog;
|
|
|
|
}
|
2022-07-17 04:44:54 +05:30
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
class BlockedModsDialog : public QDialog {
|
2022-12-06 17:46:27 +05:30
|
|
|
Q_OBJECT
|
2022-07-17 04:44:54 +05:30
|
|
|
|
2022-12-06 17:46:27 +05:30
|
|
|
public:
|
|
|
|
BlockedModsDialog(QWidget* parent, const QString& title, const QString& text, QList<BlockedMod>& mods);
|
2022-07-17 04:44:54 +05:30
|
|
|
|
|
|
|
~BlockedModsDialog() override;
|
|
|
|
|
2022-12-06 17:46:27 +05:30
|
|
|
protected:
|
|
|
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
|
|
|
void dropEvent(QDropEvent* event) override;
|
2022-10-24 16:38:38 +05:30
|
|
|
|
2022-12-06 17:46:27 +05:30
|
|
|
protected slots:
|
2022-12-06 01:57:23 +05:30
|
|
|
void done(int r) override;
|
|
|
|
|
2022-12-06 17:46:27 +05:30
|
|
|
private:
|
|
|
|
Ui::BlockedModsDialog* ui;
|
|
|
|
QList<BlockedMod>& m_mods;
|
2022-11-12 04:15:40 +05:30
|
|
|
QFileSystemWatcher m_watcher;
|
|
|
|
shared_qobject_ptr<ConcurrentTask> m_hashing_task;
|
|
|
|
QSet<QString> m_pending_hash_paths;
|
|
|
|
bool m_rehash_pending;
|
2022-11-23 18:59:23 +05:30
|
|
|
QPushButton *m_openMissingButton;
|
2022-10-25 13:49:19 +05:30
|
|
|
|
2022-11-23 18:59:23 +05:30
|
|
|
void openAll(bool missingOnly);
|
2022-11-12 02:40:45 +05:30
|
|
|
void addDownloadFolder();
|
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();
|
2022-11-12 04:15:40 +05:30
|
|
|
void scanPath(QString path, bool start_task);
|
2022-11-12 02:40:45 +05:30
|
|
|
void addHashTask(QString path);
|
2022-11-12 04:15:40 +05:30
|
|
|
void buildHashTask(QString path);
|
2022-10-25 13:49:19 +05:30
|
|
|
void checkMatchHash(QString hash, QString path);
|
2022-11-12 02:40:45 +05:30
|
|
|
void validateMatchedMods();
|
2022-11-12 04:15:40 +05:30
|
|
|
void runHashTask();
|
|
|
|
void hashTaskFinished();
|
2022-10-25 13:49:19 +05:30
|
|
|
|
|
|
|
bool checkValidPath(QString path);
|
|
|
|
bool allModsMatched();
|
2022-07-17 04:44:54 +05:30
|
|
|
};
|
2022-10-24 16:38:38 +05:30
|
|
|
|
2022-12-06 17:46:27 +05:30
|
|
|
QDebug operator<<(QDebug debug, const BlockedMod& m);
|