mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-04 22:27:50 -04:00
40 lines
943 B
C++
40 lines
943 B
C++
|
#ifndef WSJTX_FILEDOWNLOAD_H
|
||
|
#define WSJTX_FILEDOWNLOAD_H
|
||
|
|
||
|
#include <QObject>
|
||
|
#include <QString>
|
||
|
#include <QtNetwork/QNetworkAccessManager>
|
||
|
#include <QtNetwork/QNetworkReply>
|
||
|
#include <QTemporaryFile>
|
||
|
|
||
|
class FileDownload : public QObject {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit FileDownload();
|
||
|
~FileDownload();
|
||
|
|
||
|
void configure(const QString& source_url, const QString& destination_filename);
|
||
|
|
||
|
private:
|
||
|
QNetworkAccessManager *manager_;
|
||
|
QString source_url_;
|
||
|
QString destination_filename_;
|
||
|
QNetworkReply *reply_;
|
||
|
QNetworkRequest *request_;
|
||
|
QTemporaryFile *tmpfile_;
|
||
|
QDir *tmpdir_;
|
||
|
signals:
|
||
|
void complete(QString filename);
|
||
|
|
||
|
public slots:
|
||
|
void download();
|
||
|
void store();
|
||
|
void downloadComplete(QNetworkReply* data);
|
||
|
void downloadProgress(qint64 recieved, qint64 total);
|
||
|
void errorOccurred(QNetworkReply::NetworkError code);
|
||
|
void replyComplete();
|
||
|
};
|
||
|
|
||
|
#endif //WSJTX_FILEDOWNLOAD_H
|