summaryrefslogtreecommitdiffstats
path: root/src/filedownloader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/filedownloader.h')
-rw-r--r--src/filedownloader.h40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/filedownloader.h b/src/filedownloader.h
index ec49c23..b20c6a8 100644
--- a/src/filedownloader.h
+++ b/src/filedownloader.h
@@ -1,51 +1,15 @@
-/*
- * filedownloader.h
- *
- * Created on: Mar 7, 2014
- * Author: nils
- */
-
#ifndef FILEDOWNLOADER_H_
#define FILEDOWNLOADER_H_
#include <QObject>
#include <QByteArray>
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
#include <QNetworkReply>
-class FileDownloader : public QObject
+class FileDownloader
{
- Q_OBJECT
-
public:
- explicit FileDownloader(const QUrl& fileUrl, QObject *parent = nullptr);
-
- virtual ~FileDownloader();
-
- bool downloadFile();
-
-signals:
-
- /**
- * Triggered when the download has finished.
- * On error, downloadedData will be empty.
- */
- void downloaded(const QUrl& url, const QByteArray& downloadedData);
-
-private slots:
-
- void fileDownloaded();
- void downloadFailed(QNetworkReply::NetworkError code);
- void downloadProgress(qint64 received, qint64 totalSize);
-
-private:
-
- void killReply(QNetworkReply *reply);
-
- bool started;
- QUrl url;
+ static bool download(const QUrl& fileUrl, const std::function <void (QNetworkReply::NetworkError, const QByteArray&)>& f);
};