From 299b0f90bc801fc5085d2e2d88017dec44aade26 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 18 Nov 2010 18:36:45 +0000 Subject: [PATCH] Fix qbittorrent-nox compilation errors Silent a compilation warning in qbtsession when using libtorrent v0.14.x --- src/downloadthread.cpp | 12 ++++++++++-- src/downloadthread.h | 2 ++ src/qtlibtorrent/qbtsession.cpp | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/downloadthread.cpp b/src/downloadthread.cpp index a3d705339..c17b5b651 100644 --- a/src/downloadthread.cpp +++ b/src/downloadthread.cpp @@ -37,7 +37,9 @@ #include "downloadthread.h" #include "preferences.h" -#include "rsssettings.h" +#ifndef DISABLE_GUI + #include "rsssettings.h" +#endif #include "qinisettings.h" /** Download Thread **/ @@ -99,6 +101,7 @@ void downloadThread::processDlFinished(QNetworkReply* reply) { reply->deleteLater(); } +#ifndef DISABLE_GUI void downloadThread::loadCookies(const QString &host_name, QString url) { const QList raw_cookies = RssSettings().getHostNameCookies(host_name); QNetworkCookieJar *cookie_jar = networkManager.cookieJar(); @@ -114,12 +117,15 @@ void downloadThread::loadCookies(const QString &host_name, QString url) { cookie_jar->setCookiesFromUrl(cookies, url); networkManager.setCookieJar(cookie_jar); } +#endif -void downloadThread::downloadTorrentUrl(QString url){ +void downloadThread::downloadTorrentUrl(QString url) { +#ifndef DISABLE_GUI // Load cookies QString host_name = QUrl::fromEncoded(url.toLocal8Bit()).host(); if(!host_name.isEmpty()) loadCookies(host_name, url); +#endif // Process request QNetworkReply *reply = downloadUrl(url); connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64))); @@ -128,10 +134,12 @@ void downloadThread::downloadTorrentUrl(QString url){ QNetworkReply* downloadThread::downloadUrl(QString url){ // Update proxy settings applyProxySettings(); +#ifndef DISABLE_GUI // Load cookies QString host_name = QUrl::fromEncoded(url.toLocal8Bit()).host(); if(!host_name.isEmpty()) loadCookies(host_name, url); +#endif // Process download request qDebug("url is %s", qPrintable(url)); const QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit()); diff --git a/src/downloadthread.h b/src/downloadthread.h index 3d114c2a8..012f44268 100644 --- a/src/downloadthread.h +++ b/src/downloadthread.h @@ -58,7 +58,9 @@ public: protected: QString errorCodeToString(QNetworkReply::NetworkError status); void applyProxySettings(); +#ifndef DISABLE_GUI void loadCookies(const QString &host_name, QString url); +#endif protected slots: void processDlFinished(QNetworkReply* reply); diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index cd66f270e..f0fe86a5e 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1185,6 +1185,8 @@ add_torrent_params QBtSession::initializeAddTorrentParams(QString hash) { p.seed_mode=true; else p.seed_mode=false; +#else + Q_UNUSED(hash); #endif // Preallocation mode