#include "ihttpdownload.h"
#include
#include "defines.h"
iHttpDownload::iHttpDownload(QObject *parent, QProgressBar *bar) :
QObject(parent), _progressBar(bar)
{
connect(&_http, SIGNAL(dataReadProgress (int, int)), this, SLOT(getDownloadProgress(int, int))); /* downloading... */
connect(&_http, SIGNAL(done(bool)), this, SLOT(finishDownload(bool))); /* finish download */
}
bool iHttpDownload::getFileFromURL(const QUrl &url, const QString &filePath)
{
if (!url.isValid())
{
setErrorMessage(QString("Error:URL has specify a invalid name."));
return false;
}
if (url.scheme() != "http")
{
setErrorMessage(QString("Error:URL must start with 'http:'"));
return false;
}
if (url.