-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMudletBootstrap.h
48 lines (38 loc) · 1.04 KB
/
MudletBootstrap.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
#ifndef MUDLETDOWNLOADER_H
#define MUDLETDOWNLOADER_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QWidget>
#include <QProgressBar>
#include <QLabel>
struct DownloadInfo {
QString url;
QString appName;
QString sha256;
};
class MudletBootstrap : public QObject {
Q_OBJECT
public:
explicit MudletBootstrap(QObject *parent = nullptr);
void start();
private slots:
void onFetchPlatformFeedFinished();
void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
void onDownloadFinished();
void onDownloadError(QNetworkReply::NetworkError error);
private:
QNetworkAccessManager networkManager;
QNetworkReply *currentReply;
void fetchPlatformFeed();
void downloadFile(const QString &url, const QString &outputFile);
void installApplication(const QString &filePath);
QWidget *progressWindow;
QProgressBar *progressBar;
QLabel *statusLabel;
QString fetchedHtml;
QString downloadLink;
QString outputFile;
DownloadInfo info;
};
#endif