- Make everything compile back with libtorrent v0.14

- Fix crash in search engine destructor if downloads are running
This commit is contained in:
Christophe Dumez 2009-11-18 10:29:20 +00:00
commit 4ca2d060ea
11 changed files with 54 additions and 23 deletions

View file

@ -43,7 +43,9 @@
#include "geoip.h"
#include "torrentPersistentData.h"
#include <libtorrent/extensions/ut_metadata.hpp>
#include <libtorrent/extensions/lt_trackers.hpp>
#ifdef LIBTORRENT_0_15
#include <libtorrent/extensions/lt_trackers.hpp>
#endif
#include <libtorrent/extensions/ut_pex.hpp>
#include <libtorrent/extensions/smart_ban.hpp>
//#include <libtorrent/extensions/metadata_transfer.hpp>
@ -81,7 +83,9 @@ bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(
// Enabling plugins
//s->add_extension(&create_metadata_plugin);
s->add_extension(&create_ut_metadata_plugin);
#ifdef LIBTORRENT_0_15
s->add_extension(create_lt_trackers_plugin);
#endif
s->add_extension(&create_ut_pex_plugin);
s->add_extension(&create_smart_ban_plugin);
timerAlerts = new QTimer();
@ -831,13 +835,14 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
p.save_path = defaultTempPath.toLocal8Bit().data();
}
#ifdef LIBTORRENT_0_15
// Skip checking and directly start seeding (new in libtorrent v0.15)
if(TorrentTempData::isSeedingMode(hash)){
p.seed_mode=true;
} else {
p.seed_mode=false;
}
#endif
// TODO: Remove in v1.6.0: For backward compatibility only
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished")) {
p.save_path = savePath.toLocal8Bit().data();

View file

@ -43,7 +43,9 @@ downloadThread::downloadThread(QObject* parent) : QObject(parent) {
}
downloadThread::~downloadThread(){
qDebug("Deleting network manager");
delete networkManager;
qDebug("Deleted network manager");
}
void downloadThread::processDlFinished(QNetworkReply* reply) {

View file

@ -179,10 +179,12 @@ QString QTorrentHandle::save_path() const {
return misc::toQString(h.save_path().string());
}
#ifdef LIBTORRENT_0_15
bool QTorrentHandle::super_seeding() const {
Q_ASSERT(h.is_valid());
return h.super_seeding();
}
#endif
QStringList QTorrentHandle::url_seeds() const {
Q_ASSERT(h.is_valid());
@ -493,10 +495,12 @@ void QTorrentHandle::file_priority(int index, int priority) const {
h.file_priority(index, priority);
}
#ifdef LIBTORRENT_0_15
void QTorrentHandle::super_seeding(bool on) const {
Q_ASSERT(h.is_valid());
h.super_seeding(on);
}
#endif
void QTorrentHandle::resolve_countries(bool r) {
Q_ASSERT(h.is_valid());

View file

@ -115,7 +115,9 @@ class QTorrentHandle {
qlonglong seeding_time() const;
std::vector<int> file_priorities() const;
bool is_sequential_download() const;
#ifdef LIBTORRENT_0_15
bool super_seeding() const;
#endif
QString creation_date() const;
void get_peer_info(std::vector<peer_info>&) const;
bool resolve_countries() const;
@ -144,7 +146,9 @@ class QTorrentHandle {
void auto_managed(bool) const;
void force_recheck() const;
void move_storage(QString path) const;
#ifdef LIBTORRENT_0_15
void super_seeding(bool on) const;
#endif
void resolve_countries(bool r);
void connect_peer(asio::ip::tcp::endpoint const& adr, int source = 0) const;
void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const;

View file

@ -108,7 +108,7 @@ SearchEngine::~SearchEngine(){
foreach(QProcess *downloader, downloaders) {
downloader->kill();
downloader->waitForFinished();
delete downloader;
//delete downloader;
}
delete searchTimeout;
delete searchProcess;
@ -336,7 +336,7 @@ void SearchEngine::downloadFinished(int exitcode, QProcess::ExitStatus) {
}
}
qDebug("Deleting downloadProcess");
downloaders.removeAll(downloadProcess);
downloaders.removeOne(downloadProcess);
delete downloadProcess;
}

View file

@ -97,6 +97,9 @@ public:
addInPause->setChecked(true);
addInPause->setEnabled(false);
}
#ifndef LIBTORRENT_0_15
addInSeed->setEnabled(false);
#endif
}
~torrentAdditionDialog() {
@ -297,6 +300,7 @@ public slots:
settings.setValue(QString::fromUtf8("LastDirTorrentAdd"), savePathTxt->text());
// Create .incremental file if necessary
TorrentTempData::setSequential(hash, checkIncrementalDL->isChecked());
#ifdef LIBTORRENT_0_15
// Skip file checking and directly start seeding
if(addInSeed->isChecked()) {
// Check if local file(s) actually exist
@ -307,6 +311,7 @@ public slots:
return;
}
}
#endif
// Check if there is at least one selected file
if(allFiltered()){
QMessageBox::warning(0, tr("Invalid file selection"), tr("You must select at least one file in the torrent"));

View file

@ -99,6 +99,7 @@ public:
}
#ifdef LIBTORRENT_0_15
static void setSeedingMode(QString hash,bool seed){
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
QHash<QString, QVariant> all_data = settings.value("torrents-tmp", QHash<QString, QVariant>()).toHash();
@ -116,7 +117,7 @@ public:
return data["seeding"].toBool();
return false;
}
#endif
static QString getSavePath(QString hash) {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));