2013-09-08 01:15:20 +01:00
|
|
|
#pragma once
|
2013-10-26 18:55:48 +01:00
|
|
|
#include "NetAction.h"
|
2013-09-08 01:15:20 +01:00
|
|
|
|
2013-10-26 18:55:48 +01:00
|
|
|
typedef std::shared_ptr<class ByteArrayDownload> ByteArrayDownloadPtr;
|
|
|
|
class ByteArrayDownload : public NetAction
|
2013-09-08 01:15:20 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ByteArrayDownload(QUrl url);
|
2013-10-26 18:55:48 +01:00
|
|
|
static ByteArrayDownloadPtr make(QUrl url)
|
|
|
|
{
|
|
|
|
return ByteArrayDownloadPtr(new ByteArrayDownload(url));
|
|
|
|
}
|
|
|
|
|
2013-09-08 01:15:20 +01:00
|
|
|
public:
|
|
|
|
/// if not saving to file, downloaded data is placed here
|
|
|
|
QByteArray m_data;
|
2013-10-26 18:55:48 +01:00
|
|
|
|
|
|
|
public
|
|
|
|
slots:
|
2013-09-08 01:15:20 +01:00
|
|
|
virtual void start();
|
2013-10-26 18:55:48 +01:00
|
|
|
|
|
|
|
protected
|
|
|
|
slots:
|
2013-09-08 01:15:20 +01:00
|
|
|
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
|
|
|
void downloadError(QNetworkReply::NetworkError error);
|
|
|
|
void downloadFinished();
|
|
|
|
void downloadReadyRead();
|
|
|
|
};
|