Browse Source

Started to fix compilation with libtorrent v0.16

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
4412476109
  1. 19
      src/qtlibtorrent/qbtsession.cpp
  2. 19
      src/qtlibtorrent/qtorrenthandle.cpp
  3. 1
      src/qtlibtorrent/qtorrenthandle.h

19
src/qtlibtorrent/qbtsession.cpp

@ -54,6 +54,7 @@ @@ -54,6 +54,7 @@
#include "httpserver.h"
#include "qinisettings.h"
#include "bandwidthscheduler.h"
#include <libtorrent/version.hpp>
#include <libtorrent/extensions/ut_metadata.hpp>
#include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_MINOR > 14
@ -67,7 +68,6 @@ @@ -67,7 +68,6 @@
#include <libtorrent/identify_client.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/version.hpp>
#include <libtorrent/upnp.hpp>
#include <libtorrent/natpmp.hpp>
#include <boost/filesystem/exception.hpp>
@ -427,24 +427,35 @@ void QBtSession::configureSession() { @@ -427,24 +427,35 @@ void QBtSession::configureSession() {
// IP address to announce to trackers
QString announce_ip = pref.getNetworkAddress();
if(!announce_ip.isEmpty()) {
#if LIBTORRENT_VERSION_MINOR > 15
sessionSettings.announce_ip = announce_ip.toStdString();
#else
boost::system::error_code ec;
boost::asio::ip::address addr = boost::asio::ip::address::from_string(announce_ip.toStdString(), ec);
if(!ec) {
addConsoleMessage(tr("Reporting IP address %1 to trackers...").arg(announce_ip));
sessionSettings.announce_ip = addr;
}
#endif
}
// Super seeding
#if LIBTORRENT_VERSION_MINOR > 14
sessionSettings.strict_super_seeding = pref.isSuperSeedingEnabled();
#endif
qDebug() << "Settings SessionSettings";
setSessionSettings(sessionSettings);
// Bittorrent
#if LIBTORRENT_VERSION_MINOR > 15
// * Max Half-open connections
sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections();
// * Max connections limit
sessionSettings.connections_limit = pref.getMaxConnecs();
#else
// * Max Half-open connections
s->set_max_half_open_connections(pref.getMaxHalfOpenConnections());
// * Max connections limit
setMaxConnections(pref.getMaxConnecs());
#endif
qDebug() << "Settings SessionSettings";
setSessionSettings(sessionSettings);
// Bittorrent
// * Max connections per torrent limit
setMaxConnectionsPerTorrent(pref.getMaxConnecsPerTorrent());
// * Max uploads per torrent limit

19
src/qtlibtorrent/qtorrenthandle.cpp

@ -107,11 +107,21 @@ QString QTorrentHandle::current_tracker() const { @@ -107,11 +107,21 @@ QString QTorrentHandle::current_tracker() const {
}
bool QTorrentHandle::is_paused() const {
#if LIBTORRENT_VERSION_MINOR > 15
torrent_status status = torrent_handle::status(0x0);
return status.paused && !status.auto_managed;
#else
return torrent_handle::is_paused() && !torrent_handle::is_auto_managed();
#endif
}
bool QTorrentHandle::is_queued() const {
#if LIBTORRENT_VERSION_MINOR > 15
torrent_status status = torrent_handle::status(0x0);
return status.paused && status.auto_managed;
#else
return torrent_handle::is_paused() && torrent_handle::is_auto_managed();
#endif
}
size_type QTorrentHandle::total_size() const {
@ -422,6 +432,15 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const { @@ -422,6 +432,15 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const {
return;
}
bool QTorrentHandle::has_metadata() const {
#if LIBTORRENT_VERSION_MINOR > 15
torrent_status st = torrent_handle::status(0x0);
return st.has_metadata;
#else
return torrent_handle::has_metadata();
#endif
}
//
// Setters
//

1
src/qtlibtorrent/qtorrenthandle.h

@ -117,6 +117,7 @@ public: @@ -117,6 +117,7 @@ public:
bool has_error() const;
QString error() const;
void downloading_pieces(libtorrent::bitfield &bf) const;
bool has_metadata() const;
//
// Setters

Loading…
Cancel
Save