Browse Source

- Ok, Now I'm pretty sure I fixed the compilation problem on FreeBSD

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
abcd2b7600
  1. 25
      src/downloadThread.cpp
  2. 6
      src/downloadThread.h

25
src/downloadThread.cpp

@ -21,28 +21,29 @@ @@ -21,28 +21,29 @@
#include "downloadThread.h"
#include <iostream>
#include <cc++/common.h>
QString subDownloadThread::errorCodeToString(ost::URLStream::Error status) {
QString subDownloadThread::errorCodeToString(int status) {
switch(status){
case ost::URLStream::errUnreachable:
case 1://ost::URLStream::errUnreachable:
return tr("Host is unreachable");
case ost::URLStream::errMissing:
case 2://ost::URLStream::errMissing:
return tr("File was not found (404)");
case ost::URLStream::errDenied:
case 3://ost::URLStream::errDenied:
return tr("Connection was denied");
case ost::URLStream::errInvalid:
case 4://ost::URLStream::errInvalid:
return tr("Url is invalid");
case ost::URLStream::errForbidden:
case 5://ost::URLStream::errForbidden:
return tr("Connection forbidden (403)");
case ost::URLStream::errUnauthorized:
case 6://ost::URLStream::errUnauthorized:
return tr("Connection was not authorized (401)");
case ost::URLStream::errRelocated:
case 7://ost::URLStream::errRelocated:
return tr("Content has moved (301)");
case ost::URLStream::errFailure:
case 8://ost::URLStream::errFailure:
return tr("Connection failure");
case ost::URLStream::errTimeout:
case 9://ost::URLStream::errTimeout:
return tr("Connection was timed out");
case ost::URLStream::errInterface:
case 10://ost::URLStream::errInterface:
return tr("Incorrect network interface");
default:
return tr("Unknown error");
@ -75,7 +76,7 @@ void subDownloadThread::run(){ @@ -75,7 +76,7 @@ void subDownloadThread::run(){
ost::URLStream::Error status = url_stream->get((const char*)url.toUtf8());
if(status){
// Failure
QString error_msg = errorCodeToString(status);
QString error_msg = errorCodeToString((int)status);
qDebug("Download failed for %s, reason: %s", (const char*)url.toUtf8(), (const char*)error_msg.toUtf8());
url_stream->close();
emit downloadFailureST(this, url, error_msg);

6
src/downloadThread.h

@ -30,7 +30,9 @@ @@ -30,7 +30,9 @@
#include <QWaitCondition>
#include <QStringList>
#include <cc++/common.h>
namespace ost {
class URLStream;
}
class subDownloadThread : public QThread {
Q_OBJECT
@ -42,7 +44,7 @@ class subDownloadThread : public QThread { @@ -42,7 +44,7 @@ class subDownloadThread : public QThread {
public:
subDownloadThread(QObject *parent, QString url);
~subDownloadThread();
QString errorCodeToString(ost::URLStream::Error status);
QString errorCodeToString(int status);
signals:
// For subthreads

Loading…
Cancel
Save