blob: 363b426ca76291e9da6e248a603dc1e5761656ea (
plain) (
blame)
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
|
#ifndef DOWNLOADMANAGER_H
#define DOWNLOADMANAGER_H
#include "fbgui.h"
#include <QObject>
#include <QDir>
#include <QtNetwork>
extern bool debug;
extern QUrl baseURL;
extern QString binPath;
extern QString downloadPath;
class DownloadManager : public QObject
{
Q_OBJECT
public:
DownloadManager();
private:
void processDownloadRequest(QUrl& url);
// Object required for downloading.
QNetworkAccessManager* qnam;
QQueue<QUrl> dlQ;
QNetworkRequest request;
QNetworkReply* currentDownload;
QFile outfile;
QDir downloadDir;
// Download-in-progress flag.
bool dip;
static int downloaded;
signals:
void finished();
void updateProgress(QString current, int i);
public slots:
void downloadFile(QUrl& fileUrl);
void downloadFile(QString& fileUrl);
private slots:
void startNextDownload();
void downloadReady();
void downloadProgress(qint64 bytesIn, qint64 bytesTotal);
void downloadFinished();
};
#endif // DOWNLOADMANAGER_H
|