-
Notifications
You must be signed in to change notification settings - Fork 0
/
Worker.h
61 lines (51 loc) · 1.21 KB
/
Worker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include <QObject>
#include <QThread>
#include <QString>
#include "Hasher.h"
#include <string>
#include <vector>
#include <iostream>
#include "include/sha256.h"
#include <fstream>
#include "include/JSON.h"
#include <boost/filesystem.hpp>
#include <system_error>
#define PRERELEASE
class WorkerThread : public QThread
{
Q_OBJECT
public:
WorkerThread(std::string& directoryPath, std::string& hashStorageFile);
WorkerThread(const char* directoryPath, const char* hashStorageFile);
WorkerThread(QString directoryPath, QString hashStorageFile);
std::vector<std::string> run(const bool& dumpToFile = true);
size_t size() const;
private:
std::string dirToHash;
std::string hashFile;
suon::SUON accumulator;
std::vector<std::string> privateRun(const bool& dumpToFile);
void hashSingleFile(const std::string& fp);
suon::SUON hashDirectory(const std::string& dp);
int numChanges;
public:
void run() override {
privateRun(
#ifdef PRERELEASE
false
#else
true
#endif
);
}
private:
QString scan;
QString store;
signals:
void resultReady(long long);
void totalFiles(long long);
void fileError(int);
void hashedFileCountIncrement(int);
void changedFilesReady(std::vector<std::string>);
};