mirror of
https://github.com/RustyRaptor/Pixelpulse2.git
synced 2026-12-03 23:45:15 -07:00
- use javascript to get the latest M1K firmware version - use QNetworkAccessManager to get the M1K firmware .bin file Signed-off-by: Dan Nechita <Dan.Nechita@analog.com>
30 lines
628 B
C++
30 lines
628 B
C++
/* From:
|
|
https://wiki.qt.io/Download_Data_from_URL
|
|
*/
|
|
#include "filedownloader.h"
|
|
|
|
FileDownloader::FileDownloader(QUrl imageUrl, QObject *parent) :
|
|
QObject(parent)
|
|
{
|
|
connect(
|
|
&m_WebCtrl, SIGNAL (finished(QNetworkReply*)),
|
|
this, SLOT (fileDownloaded(QNetworkReply*))
|
|
);
|
|
|
|
QNetworkRequest request(imageUrl);
|
|
m_WebCtrl.get(request);
|
|
}
|
|
|
|
FileDownloader::~FileDownloader() { }
|
|
|
|
void FileDownloader::fileDownloaded(QNetworkReply* pReply) {
|
|
m_DownloadedData = pReply->readAll();
|
|
//emit a signal
|
|
pReply->deleteLater();
|
|
emit downloaded();
|
|
}
|
|
|
|
QByteArray FileDownloader::downloadedData() const {
|
|
return m_DownloadedData;
|
|
}
|