Browse Source

Started to fix compilation with libtorrent v0.16

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

21
src/qtlibtorrent/qbtsession.cpp

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

19
src/qtlibtorrent/qtorrenthandle.cpp

@ -107,11 +107,21 @@ QString QTorrentHandle::current_tracker() const {
} }
bool QTorrentHandle::is_paused() 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(); return torrent_handle::is_paused() && !torrent_handle::is_auto_managed();
#endif
} }
bool QTorrentHandle::is_queued() const { 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(); return torrent_handle::is_paused() && torrent_handle::is_auto_managed();
#endif
} }
size_type QTorrentHandle::total_size() const { size_type QTorrentHandle::total_size() const {
@ -422,6 +432,15 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const {
return; 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 // Setters
// //

1
src/qtlibtorrent/qtorrenthandle.h

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

Loading…
Cancel
Save