#ifndef INCLUDEILEDOWNLOADER_H #define INCLUDEILEDOWNLOADER_H #include #include #include #include #include #include class NetworkDownloader : public QObject { Q_OBJECT public: explicit NetworkDownloader(QObject *parent = 0); virtual ~NetworkDownloader(); QUrl getUrl(); void setUrl(const QUrl& _url); void waitForDownloaded(); signals: void downloadFinished(); void progressChanged(qint64 bytesReceived, qint64 bytesTotal); public slots: void start(); void updateDownloadSpeedLimit(int bytes_per_sec); void stop(); private slots: void onDownloadFinished(QNetworkReply* pReply); void onReadyRead(); public: QFile* targetFile {nullptr}; QByteArray* targetBytearray {nullptr}; private: bool busy; QUrl url; QNetworkReply* m_CurrentReply {nullptr}; QNetworkAccessManager m_WebCtrl; unsigned download_speed_limit {0}; }; #endif // INCLUDEILEDOWNLOADER_H