fixed issues in comic vine dialog

This commit is contained in:
Luis Ángel San Martín
2013-11-16 00:00:55 +01:00
parent f75d0abef0
commit 9b3085f8d1
11 changed files with 91 additions and 28 deletions

View File

@ -13,7 +13,7 @@
#define PREVIOUS_VERSION "6.0.0"
HttpWorker::HttpWorker(const QString & urlString)
:QThread(),url(urlString)
:QThread(),url(urlString),_error(false),_timeout(false)
{
}
@ -28,6 +28,16 @@ QByteArray HttpWorker::getResult()
return result;
}
bool HttpWorker::wasValid()
{
return !_error;
}
bool HttpWorker::wasTimeout()
{
return _timeout;
}
void HttpWorker::run()
{
QNetworkAccessManager manager;
@ -44,10 +54,12 @@ void HttpWorker::run()
if(tT.isActive()){
// download complete
_error = !(reply->error() == QNetworkReply::NoError);
result = reply->readAll();
emit dataReady(result);
tT.stop();
} else {
_timeout = true;
emit timeout();
}
}

View File

@ -15,11 +15,15 @@
public slots:
void get();
QByteArray getResult();
bool wasValid();
bool wasTimeout();
private:
void run();
QUrl url;
int httpGetId;
QByteArray result;
bool _error;
bool _timeout;
signals:
void dataReady(const QByteArray &);
void timeout();