1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-24 13:34:27 +00:00

Fix qbittorrent-nox compilation errors

Silent a compilation warning in qbtsession when using libtorrent v0.14.x
This commit is contained in:
Christophe Dumez 2010-11-18 18:36:45 +00:00
parent a58d5c0f32
commit 299b0f90bc
3 changed files with 14 additions and 2 deletions

View File

@ -37,7 +37,9 @@
#include "downloadthread.h" #include "downloadthread.h"
#include "preferences.h" #include "preferences.h"
#ifndef DISABLE_GUI
#include "rsssettings.h" #include "rsssettings.h"
#endif
#include "qinisettings.h" #include "qinisettings.h"
/** Download Thread **/ /** Download Thread **/
@ -99,6 +101,7 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
reply->deleteLater(); reply->deleteLater();
} }
#ifndef DISABLE_GUI
void downloadThread::loadCookies(const QString &host_name, QString url) { void downloadThread::loadCookies(const QString &host_name, QString url) {
const QList<QByteArray> raw_cookies = RssSettings().getHostNameCookies(host_name); const QList<QByteArray> raw_cookies = RssSettings().getHostNameCookies(host_name);
QNetworkCookieJar *cookie_jar = networkManager.cookieJar(); QNetworkCookieJar *cookie_jar = networkManager.cookieJar();
@ -114,12 +117,15 @@ void downloadThread::loadCookies(const QString &host_name, QString url) {
cookie_jar->setCookiesFromUrl(cookies, url); cookie_jar->setCookiesFromUrl(cookies, url);
networkManager.setCookieJar(cookie_jar); networkManager.setCookieJar(cookie_jar);
} }
#endif
void downloadThread::downloadTorrentUrl(QString url) { void downloadThread::downloadTorrentUrl(QString url) {
#ifndef DISABLE_GUI
// Load cookies // Load cookies
QString host_name = QUrl::fromEncoded(url.toLocal8Bit()).host(); QString host_name = QUrl::fromEncoded(url.toLocal8Bit()).host();
if(!host_name.isEmpty()) if(!host_name.isEmpty())
loadCookies(host_name, url); loadCookies(host_name, url);
#endif
// Process request // Process request
QNetworkReply *reply = downloadUrl(url); QNetworkReply *reply = downloadUrl(url);
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(checkDownloadSize(qint64,qint64))); 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){ QNetworkReply* downloadThread::downloadUrl(QString url){
// Update proxy settings // Update proxy settings
applyProxySettings(); applyProxySettings();
#ifndef DISABLE_GUI
// Load cookies // Load cookies
QString host_name = QUrl::fromEncoded(url.toLocal8Bit()).host(); QString host_name = QUrl::fromEncoded(url.toLocal8Bit()).host();
if(!host_name.isEmpty()) if(!host_name.isEmpty())
loadCookies(host_name, url); loadCookies(host_name, url);
#endif
// Process download request // Process download request
qDebug("url is %s", qPrintable(url)); qDebug("url is %s", qPrintable(url));
const QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit()); const QUrl qurl = QUrl::fromEncoded(url.toLocal8Bit());

View File

@ -58,7 +58,9 @@ public:
protected: protected:
QString errorCodeToString(QNetworkReply::NetworkError status); QString errorCodeToString(QNetworkReply::NetworkError status);
void applyProxySettings(); void applyProxySettings();
#ifndef DISABLE_GUI
void loadCookies(const QString &host_name, QString url); void loadCookies(const QString &host_name, QString url);
#endif
protected slots: protected slots:
void processDlFinished(QNetworkReply* reply); void processDlFinished(QNetworkReply* reply);

View File

@ -1185,6 +1185,8 @@ add_torrent_params QBtSession::initializeAddTorrentParams(QString hash) {
p.seed_mode=true; p.seed_mode=true;
else else
p.seed_mode=false; p.seed_mode=false;
#else
Q_UNUSED(hash);
#endif #endif
// Preallocation mode // Preallocation mode