-
Notifications
You must be signed in to change notification settings - Fork 0
/
patcher.h
70 lines (57 loc) · 1.34 KB
/
patcher.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
61
62
63
64
65
66
67
68
69
70
#ifndef PATCHER_H
#define PATCHER_H
#include <QObject>
#include <QJsonDocument>
#include <QMutex>
#include <QMap>
class QNetworkAccessManager;
class Patcher : public QObject
{
Q_OBJECT
public:
Patcher(QObject* parent = 0);
~Patcher();
void setInstallPath(QString install_path) {mInstallPath = install_path;}
void setDownloadUrl(QString url) {mDownloadUrl = url;}
void giveJsonData(QByteArray data);
QByteArray getFile(QString filename);
private:
struct file_entry_t
{
int i;
QString checksum;
QString filename;
ulong size;
ulong sizeZ;
bool operator<(file_entry_t const& b) const { return checksum < b.checksum; }
};
QJsonDocument mDocument;
QString mInstallPath;
QString mDownloadUrl;
QByteArray *mRawJsonData;
QMutex mHardDriveAccessMutex;
QNetworkAccessManager *mNetworkAccessManager;
qint64 mBytesDownloaded;
qint64 mBytesToDownload;
int mNumBundles;
int mBundlesVerified;
int mBundlesFinished;
QMap<QString,QString> mSymLinkLater;
void startVerifying();
void processSymLinks();
signals:
void error(QString);
void progress(int);
void done();
void stateChange(QString state);
private slots:
void bundleDownloadMe();
void bundleDownloadProgress(qint64);
void bundleVerifyDone();
void bundleFinished();
void bundleError(QString error);
void findSymlinks();
public slots:
void parseManifest();
};
#endif // PATCHER_H