forked from LRFLEW/OpenRCT2Launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
updater.h
46 lines (37 loc) · 872 Bytes
/
updater.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
#ifndef UPDATER_H
#define UPDATER_H
#include <QObject>
#include <QByteArray>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QSettings>
#include <QUrl>
class Updater : public QObject
{
Q_OBJECT
public:
explicit Updater(QObject *parent = 0);
QSettings settings;
signals:
void installed();
void error(QString error);
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
public slots:
void download();
private slots:
void receivedUpdate();
void receivedAPI();
void receivedBundle();
private:
bool extract(QByteArray &data, QDir &bin);
QUrl url;
QNetworkAccessManager net;
int size;
QByteArray hash;
QByteArray githash;
QString version;
QNetworkReply *update = nullptr;
QNetworkReply *api = nullptr;
QNetworkReply *bundle = nullptr;
};
#endif // UPDATER_H