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