mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 14:12:30 -06:00
Correctly detect libtorrent version.
This commit is contained in:
@@ -69,12 +69,12 @@
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
#include <libtorrent/upnp.hpp>
|
||||
#include <libtorrent/natpmp.hpp>
|
||||
#if LIBTORRENT_VERSION_NUM < 001600
|
||||
#if LIBTORRENT_VERSION_NUM < 1600
|
||||
#include <boost/filesystem/exception.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#endif
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#endif
|
||||
#include <queue>
|
||||
@@ -120,7 +120,7 @@ QBtSession::QBtSession()
|
||||
BigRatioTimer->setInterval(10000);
|
||||
connect(BigRatioTimer, SIGNAL(timeout()), SLOT(processBigRatios()));
|
||||
Preferences pref;
|
||||
#if LIBTORRENT_VERSION_NUM < 001600
|
||||
#if LIBTORRENT_VERSION_NUM < 1600
|
||||
// To avoid some exceptions
|
||||
boost::filesystem::path::default_name_check(boost::filesystem::no_check);
|
||||
#endif
|
||||
@@ -398,7 +398,7 @@ void QBtSession::configureSession() {
|
||||
|
||||
sessionSettings.upnp_ignore_nonrouters = true;
|
||||
sessionSettings.use_dht_as_fallback = false;
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
// Disable support for SSL torrents for now
|
||||
sessionSettings.ssl_listen = 0;
|
||||
#endif
|
||||
@@ -414,11 +414,11 @@ void QBtSession::configureSession() {
|
||||
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
|
||||
int cache_size = pref.diskCacheSize();
|
||||
sessionSettings.cache_size = cache_size ? cache_size * 64 : -1;
|
||||
#if LIBTORRENT_VERSION_NUM >= 001610
|
||||
#if LIBTORRENT_VERSION_NUM >= 1610
|
||||
sessionSettings.cache_expiry = pref.diskCacheTTL();
|
||||
#endif
|
||||
qDebug() << "Using a disk cache size of" << cache_size << "MiB";
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
|
||||
if (sessionSettings.anonymous_mode) {
|
||||
addConsoleMessage(tr("Anonymous mode [ON]"), "blue");
|
||||
@@ -457,7 +457,7 @@ void QBtSession::configureSession() {
|
||||
// IP address to announce to trackers
|
||||
QString announce_ip = pref.getNetworkAddress();
|
||||
if (!announce_ip.isEmpty()) {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
sessionSettings.announce_ip = announce_ip.toStdString();
|
||||
#else
|
||||
boost::system::error_code ec;
|
||||
@@ -470,7 +470,7 @@ void QBtSession::configureSession() {
|
||||
}
|
||||
// Super seeding
|
||||
sessionSettings.strict_super_seeding = pref.isSuperSeedingEnabled();
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
// * Max Half-open connections
|
||||
sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections();
|
||||
// * Max connections limit
|
||||
@@ -485,7 +485,7 @@ void QBtSession::configureSession() {
|
||||
// * Global max upload slots
|
||||
s->set_max_uploads(pref.getMaxUploads());
|
||||
#endif
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
// uTP
|
||||
sessionSettings.enable_incoming_utp = pref.isuTPEnabled();
|
||||
sessionSettings.enable_outgoing_utp = pref.isuTPEnabled();
|
||||
@@ -1137,7 +1137,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
qDebug("Successfully loaded fast resume data");
|
||||
}
|
||||
}
|
||||
#if LIBTORRENT_VERSION_NUM < 001600
|
||||
#if LIBTORRENT_VERSION_NUM < 1600
|
||||
else {
|
||||
// Generate fake resume data to make sure unwanted files
|
||||
// are not allocated
|
||||
@@ -1273,7 +1273,7 @@ add_torrent_params QBtSession::initializeAddTorrentParams(const QString &hash) {
|
||||
p.storage_mode = storage_mode_sparse;
|
||||
|
||||
// Priorities
|
||||
/*#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
/*#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
if (TorrentTempData::hasTempData(hash)) {
|
||||
std::vector<int> fp;
|
||||
TorrentTempData::getFilesPriority(hash, fp);
|
||||
@@ -1390,7 +1390,7 @@ void QBtSession::mergeTorrents(QTorrentHandle &h_ex, boost::intrusive_ptr<torren
|
||||
|
||||
bool urlseeds_added = false;
|
||||
const QStringList old_urlseeds = h_ex.url_seeds();
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
std::vector<web_seed_entry> new_urlseeds = t->web_seeds();
|
||||
|
||||
std::vector<web_seed_entry>::iterator it = new_urlseeds.begin();
|
||||
@@ -1460,7 +1460,7 @@ void QBtSession::exportTorrentFiles(QString path) {
|
||||
|
||||
// Set the maximum number of opened connections
|
||||
void QBtSession::setMaxConnections(int maxConnec) {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
Q_UNUSED(maxConnec);
|
||||
Q_ASSERT(0); // Should not be used
|
||||
#else
|
||||
@@ -1559,7 +1559,7 @@ void QBtSession::loadSessionState() {
|
||||
state_file.read(&in[0], content_size);
|
||||
// bdecode
|
||||
lazy_entry e;
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
libtorrent::error_code ec;
|
||||
lazy_bdecode(&in[0], &in[0] + in.size(), e, ec);
|
||||
if (!ec) {
|
||||
@@ -1649,7 +1649,7 @@ void QBtSession::saveTempFastResumeData() {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
try {
|
||||
if (!h.is_valid() || !h.has_metadata() /*|| h.is_seed() || h.is_paused()*/) continue;
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
if (!h.need_save_resume_data()) continue;
|
||||
#endif
|
||||
if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking || h.has_error()) continue;
|
||||
@@ -1944,13 +1944,13 @@ void QBtSession::setListeningPort(int port) {
|
||||
qDebug() << Q_FUNC_INFO << port;
|
||||
Preferences pref;
|
||||
std::pair<int,int> ports(port, port);
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
libtorrent::error_code ec;
|
||||
#endif
|
||||
const QString iface_name = pref.getNetworkInterface();
|
||||
if (iface_name.isEmpty()) {
|
||||
addConsoleMessage(tr("qBittorrent is trying to listen on any interface port: TCP/%1", "e.g: qBittorrent is trying to listen on any interface port: TCP/6881").arg(QString::number(port)), "blue");
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
s->listen_on(ports, ec, 0, session::listen_no_system_port);
|
||||
#else
|
||||
s->listen_on(ports);
|
||||
@@ -1968,7 +1968,7 @@ void QBtSession::setListeningPort(int port) {
|
||||
qDebug("This network interface has %d IP addresses", network_iface.addressEntries().size());
|
||||
foreach (const QNetworkAddressEntry &entry, network_iface.addressEntries()) {
|
||||
qDebug("Trying to listen on IP %s (%s)", qPrintable(entry.ip().toString()), qPrintable(iface_name));
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
s->listen_on(ports, ec, entry.ip().toString().toAscii().constData(), session::listen_no_system_port);
|
||||
if (!ec) {
|
||||
#else
|
||||
@@ -1986,7 +1986,7 @@ void QBtSession::setListeningPort(int port) {
|
||||
void QBtSession::setDownloadRateLimit(long rate) {
|
||||
qDebug() << Q_FUNC_INFO << rate;
|
||||
Q_ASSERT(rate == -1 || rate >= 0);
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
session_settings settings = s->settings();
|
||||
settings.download_rate_limit = rate;
|
||||
s->set_settings(settings);
|
||||
@@ -2000,7 +2000,7 @@ void QBtSession::setDownloadRateLimit(long rate) {
|
||||
void QBtSession::setUploadRateLimit(long rate) {
|
||||
qDebug() << Q_FUNC_INFO << rate;
|
||||
Q_ASSERT(rate == -1 || rate >= 0);
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
session_settings settings = s->settings();
|
||||
settings.upload_rate_limit = rate;
|
||||
s->set_settings(settings);
|
||||
@@ -2108,7 +2108,7 @@ void QBtSession::setSessionSettings(const session_settings &sessionSettings) {
|
||||
void QBtSession::setProxySettings(proxy_settings proxySettings) {
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
proxySettings.proxy_peer_connections = Preferences().proxyPeerConnections();
|
||||
s->set_proxy(proxySettings);
|
||||
#else
|
||||
@@ -2956,7 +2956,7 @@ void QBtSession::recoverPersistentData(const QString &hash, const std::vector<ch
|
||||
return;
|
||||
|
||||
libtorrent::lazy_entry fast;
|
||||
#if LIBTORRENT_VERSION_NUM < 001600
|
||||
#if LIBTORRENT_VERSION_NUM < 1600
|
||||
try {
|
||||
libtorrent::lazy_bdecode(&(buf.front()), &(buf.back()), fast);
|
||||
} catch (std::exception&) {
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/entry.hpp>
|
||||
#if LIBTORRENT_VERSION_NUM < 001600
|
||||
#if LIBTORRENT_VERSION_NUM < 1600
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#endif
|
||||
|
||||
@@ -93,7 +93,7 @@ QString QTorrentHandle::name() const {
|
||||
}
|
||||
|
||||
QString QTorrentHandle::creation_date() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
boost::optional<time_t> t = torrent_handle::get_torrent_info().creation_date();
|
||||
return t ? misc::toQString(*t) : "";
|
||||
#else
|
||||
@@ -103,7 +103,7 @@ QString QTorrentHandle::creation_date() const {
|
||||
}
|
||||
|
||||
QString QTorrentHandle::next_announce() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return misc::userFriendlyDuration(torrent_handle::status(0x0).next_announce.total_seconds());
|
||||
#else
|
||||
return misc::userFriendlyDuration(torrent_handle::status().next_announce.total_seconds());
|
||||
@@ -111,7 +111,7 @@ QString QTorrentHandle::next_announce() const {
|
||||
}
|
||||
|
||||
qlonglong QTorrentHandle::next_announce_s() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).next_announce.total_seconds();
|
||||
#else
|
||||
return torrent_handle::status().next_announce.total_seconds();
|
||||
@@ -119,7 +119,7 @@ qlonglong QTorrentHandle::next_announce_s() const {
|
||||
}
|
||||
|
||||
float QTorrentHandle::progress() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status st = torrent_handle::status(query_accurate_download_counters);
|
||||
#else
|
||||
torrent_status st = torrent_handle::status();
|
||||
@@ -134,7 +134,7 @@ float QTorrentHandle::progress() const {
|
||||
}
|
||||
|
||||
bitfield QTorrentHandle::pieces() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(torrent_handle::query_pieces).pieces;
|
||||
#else
|
||||
return torrent_handle::status().pieces;
|
||||
@@ -142,7 +142,7 @@ bitfield QTorrentHandle::pieces() const {
|
||||
}
|
||||
|
||||
QString QTorrentHandle::current_tracker() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return misc::toQString(torrent_handle::status(0x0).current_tracker);
|
||||
#else
|
||||
return misc::toQString(torrent_handle::status().current_tracker);
|
||||
@@ -150,7 +150,7 @@ QString QTorrentHandle::current_tracker() const {
|
||||
}
|
||||
|
||||
bool QTorrentHandle::is_paused() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status st = torrent_handle::status(0x0);
|
||||
return st.paused && !st.auto_managed;
|
||||
#else
|
||||
@@ -159,7 +159,7 @@ bool QTorrentHandle::is_paused() const {
|
||||
}
|
||||
|
||||
bool QTorrentHandle::is_queued() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status st = torrent_handle::status(0x0);
|
||||
return st.paused && st.auto_managed;
|
||||
#else
|
||||
@@ -185,7 +185,7 @@ bool QTorrentHandle::first_last_piece_first() const {
|
||||
// Get int first media file
|
||||
int index = 0;
|
||||
for (index = 0; index < t.num_files(); ++index) {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
QString path = misc::toQStringU(t.file_at(index).path);
|
||||
#else
|
||||
QString path = misc::toQStringU(t.file_at(index).path.string());
|
||||
@@ -206,7 +206,7 @@ bool QTorrentHandle::first_last_piece_first() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_wanted_done() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(query_accurate_download_counters).total_wanted_done;
|
||||
#else
|
||||
return torrent_handle::status().total_wanted_done;
|
||||
@@ -214,7 +214,7 @@ size_type QTorrentHandle::total_wanted_done() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_wanted() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).total_wanted;
|
||||
#else
|
||||
return torrent_handle::status().total_wanted;
|
||||
@@ -222,7 +222,7 @@ size_type QTorrentHandle::total_wanted() const {
|
||||
}
|
||||
|
||||
qreal QTorrentHandle::download_payload_rate() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).download_payload_rate;
|
||||
#else
|
||||
return torrent_handle::status().download_payload_rate;
|
||||
@@ -230,7 +230,7 @@ qreal QTorrentHandle::download_payload_rate() const {
|
||||
}
|
||||
|
||||
qreal QTorrentHandle::upload_payload_rate() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).upload_payload_rate;
|
||||
#else
|
||||
return torrent_handle::status().upload_payload_rate;
|
||||
@@ -238,7 +238,7 @@ qreal QTorrentHandle::upload_payload_rate() const {
|
||||
}
|
||||
|
||||
int QTorrentHandle::num_peers() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).num_peers;
|
||||
#else
|
||||
return torrent_handle::status().num_peers;
|
||||
@@ -246,7 +246,7 @@ int QTorrentHandle::num_peers() const {
|
||||
}
|
||||
|
||||
int QTorrentHandle::num_seeds() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).num_seeds;
|
||||
#else
|
||||
return torrent_handle::status().num_seeds;
|
||||
@@ -254,7 +254,7 @@ int QTorrentHandle::num_seeds() const {
|
||||
}
|
||||
|
||||
int QTorrentHandle::num_complete() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).num_complete;
|
||||
#else
|
||||
return torrent_handle::status().num_complete;
|
||||
@@ -262,7 +262,7 @@ int QTorrentHandle::num_complete() const {
|
||||
}
|
||||
|
||||
int QTorrentHandle::num_incomplete() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).num_incomplete;
|
||||
#else
|
||||
return torrent_handle::status().num_incomplete;
|
||||
@@ -270,7 +270,7 @@ int QTorrentHandle::num_incomplete() const {
|
||||
}
|
||||
|
||||
QString QTorrentHandle::save_path() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return misc::toQStringU(torrent_handle::save_path()).replace("\\", "/");
|
||||
#else
|
||||
return misc::toQStringU(torrent_handle::save_path().string()).replace("\\", "/");
|
||||
@@ -311,7 +311,7 @@ QStringList QTorrentHandle::url_seeds() const {
|
||||
|
||||
// get the size of the torrent without the filtered files
|
||||
size_type QTorrentHandle::actual_size() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(query_accurate_download_counters).total_wanted;
|
||||
#else
|
||||
return torrent_handle::status().total_wanted;
|
||||
@@ -333,7 +333,7 @@ int QTorrentHandle::num_files() const {
|
||||
|
||||
QString QTorrentHandle::filename_at(unsigned int index) const {
|
||||
Q_ASSERT(index < (unsigned int)torrent_handle::get_torrent_info().num_files());
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return fsutils::fileName(filepath_at(index));
|
||||
#else
|
||||
return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.leaf());
|
||||
@@ -346,7 +346,7 @@ size_type QTorrentHandle::filesize_at(unsigned int index) const {
|
||||
}
|
||||
|
||||
QString QTorrentHandle::filepath_at(unsigned int index) const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path);
|
||||
#else
|
||||
return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.string());
|
||||
@@ -354,7 +354,7 @@ QString QTorrentHandle::filepath_at(unsigned int index) const {
|
||||
}
|
||||
|
||||
QString QTorrentHandle::orig_filepath_at(unsigned int index) const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path);
|
||||
#else
|
||||
return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path.string());
|
||||
@@ -362,7 +362,7 @@ QString QTorrentHandle::orig_filepath_at(unsigned int index) const {
|
||||
}
|
||||
|
||||
torrent_status::state_t QTorrentHandle::state() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).state;
|
||||
#else
|
||||
return torrent_handle::status().state;
|
||||
@@ -378,7 +378,7 @@ QString QTorrentHandle::comment() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_failed_bytes() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).total_failed_bytes;
|
||||
#else
|
||||
return torrent_handle::status().total_failed_bytes;
|
||||
@@ -386,7 +386,7 @@ size_type QTorrentHandle::total_failed_bytes() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_redundant_bytes() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).total_redundant_bytes;
|
||||
#else
|
||||
return torrent_handle::status().total_redundant_bytes;
|
||||
@@ -394,7 +394,7 @@ size_type QTorrentHandle::total_redundant_bytes() const {
|
||||
}
|
||||
|
||||
bool QTorrentHandle::is_checking() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status st = torrent_handle::status(0x0);
|
||||
#else
|
||||
torrent_status st = torrent_handle::status();
|
||||
@@ -403,7 +403,7 @@ bool QTorrentHandle::is_checking() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_done() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(query_accurate_download_counters).total_done;
|
||||
#else
|
||||
return torrent_handle::status().total_done;
|
||||
@@ -411,7 +411,7 @@ size_type QTorrentHandle::total_done() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::all_time_download() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).all_time_download;
|
||||
#else
|
||||
return torrent_handle::status().all_time_download;
|
||||
@@ -419,7 +419,7 @@ size_type QTorrentHandle::all_time_download() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::all_time_upload() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).all_time_upload;
|
||||
#else
|
||||
return torrent_handle::status().all_time_upload;
|
||||
@@ -427,7 +427,7 @@ size_type QTorrentHandle::all_time_upload() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_payload_download() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).total_payload_download;
|
||||
#else
|
||||
return torrent_handle::status().total_payload_download;
|
||||
@@ -435,7 +435,7 @@ size_type QTorrentHandle::total_payload_download() const {
|
||||
}
|
||||
|
||||
size_type QTorrentHandle::total_payload_upload() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).total_payload_upload;
|
||||
#else
|
||||
return torrent_handle::status().total_payload_upload;
|
||||
@@ -482,7 +482,7 @@ int QTorrentHandle::queue_position() const {
|
||||
}
|
||||
|
||||
int QTorrentHandle::num_uploads() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).num_uploads;
|
||||
#else
|
||||
return torrent_handle::status().num_uploads;
|
||||
@@ -500,7 +500,7 @@ bool QTorrentHandle::is_seed() const {
|
||||
}
|
||||
|
||||
bool QTorrentHandle::is_auto_managed() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status status = torrent_handle::status(0x0);
|
||||
return status.auto_managed;
|
||||
#else
|
||||
@@ -509,7 +509,7 @@ bool QTorrentHandle::is_auto_managed() const {
|
||||
}
|
||||
|
||||
bool QTorrentHandle::is_sequential_download() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status status = torrent_handle::status(0x0);
|
||||
return status.sequential_download;
|
||||
#else
|
||||
@@ -518,7 +518,7 @@ bool QTorrentHandle::is_sequential_download() const {
|
||||
}
|
||||
|
||||
qlonglong QTorrentHandle::active_time() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).active_time;
|
||||
#else
|
||||
return torrent_handle::status().active_time;
|
||||
@@ -526,7 +526,7 @@ qlonglong QTorrentHandle::active_time() const {
|
||||
}
|
||||
|
||||
qlonglong QTorrentHandle::seeding_time() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).seeding_time;
|
||||
#else
|
||||
return torrent_handle::status().seeding_time;
|
||||
@@ -534,7 +534,7 @@ qlonglong QTorrentHandle::seeding_time() const {
|
||||
}
|
||||
|
||||
int QTorrentHandle::num_connections() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).num_connections;
|
||||
#else
|
||||
return torrent_handle::status().num_connections;
|
||||
@@ -542,7 +542,7 @@ int QTorrentHandle::num_connections() const {
|
||||
}
|
||||
|
||||
int QTorrentHandle::connections_limit() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).connections_limit;
|
||||
#else
|
||||
return torrent_handle::status().connections_limit;
|
||||
@@ -580,7 +580,7 @@ QString QTorrentHandle::root_path() const
|
||||
}
|
||||
|
||||
bool QTorrentHandle::has_error() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status st = torrent_handle::status(0x0);
|
||||
return st.paused && !st.error.empty();
|
||||
#else
|
||||
@@ -589,7 +589,7 @@ bool QTorrentHandle::has_error() const {
|
||||
}
|
||||
|
||||
QString QTorrentHandle::error() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return misc::toQString(torrent_handle::status(0x0).error);
|
||||
#else
|
||||
return misc::toQString(torrent_handle::status().error);
|
||||
@@ -609,7 +609,7 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const {
|
||||
}
|
||||
|
||||
bool QTorrentHandle::has_metadata() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(0x0).has_metadata;
|
||||
#else
|
||||
return torrent_handle::has_metadata();
|
||||
@@ -617,7 +617,7 @@ bool QTorrentHandle::has_metadata() const {
|
||||
}
|
||||
|
||||
float QTorrentHandle::distributed_copies() const {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
return torrent_handle::status(query_distributed_copies).distributed_copies;
|
||||
#else
|
||||
return torrent_handle::status().distributed_copies;
|
||||
|
||||
@@ -175,7 +175,7 @@ void TorrentSpeedMonitor::getSamples()
|
||||
std::vector<torrent_handle>::const_iterator itend = torrents.end();
|
||||
for ( ; it != itend; ++it) {
|
||||
try {
|
||||
#if LIBTORRENT_VERSION_NUM >= 001600
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
torrent_status st = it->status(0x0);
|
||||
#else
|
||||
torrent_status st = it->status();
|
||||
|
||||
Reference in New Issue
Block a user