Adds a small class to download files from the Qt frontend

This commit is contained in:
Xawotihs
2011-12-20 22:37:32 +00:00
parent 3803d126bc
commit c74f22dae3
2 changed files with 81 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#include "filedownloader.h"
FileDownloader::FileDownloader(QUrl url, QString localPath, QObject *parent) :
QObject(parent), m_received(0), m_localPath(localPath), m_OK(false), m_done(false)
{
QFile local(m_localPath);
if(local.exists()) {
m_done = true;
return;
}
connect(&m_WebCtrl, SIGNAL(finished(QNetworkReply*)),
SLOT(fileDownloaded(QNetworkReply*)));
QNetworkRequest request(url);
QNetworkReply* reply = m_WebCtrl.get(request);
connect(reply, SIGNAL(downloadProgress(qint64, qint64)),
SLOT(downloadProgress(qint64, qint64)));
m_OK = m_tmp.open();
}
FileDownloader::~FileDownloader()
{
}