diff options
Diffstat (limited to 'src/downloadManager.h')
| -rw-r--r-- | src/downloadManager.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/downloadManager.h b/src/downloadManager.h new file mode 100644 index 0000000..461d31a --- /dev/null +++ b/src/downloadManager.h @@ -0,0 +1,52 @@ +#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; + int currentProgress; + static int downloaded; + +signals: + void finished(); + void updateProgress(QString current, int i); + void downloadQueueEmpty(); + +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 |
