Browse Source

Drop support of libtorrent < 1.1.10

adaptive-webui-19844
Vladimir Golovnev (Glassez) 6 years ago
parent
commit
302c99d7d5
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 18
      configure
  2. 2
      configure.ac
  3. 426
      src/base/bittorrent/session.cpp
  4. 38
      src/base/bittorrent/session.h
  5. 11
      src/base/bittorrent/torrentcreatorthread.cpp
  6. 87
      src/base/bittorrent/torrenthandle.cpp
  7. 9
      src/base/bittorrent/torrenthandle.h
  8. 6
      src/base/bittorrent/torrentinfo.cpp
  9. 6
      src/base/bittorrent/torrentinfo.h
  10. 5
      src/base/bittorrent/trackerentry.h
  11. 11
      src/base/net/portforwarder.cpp
  12. 3
      src/gui/CMakeLists.txt
  13. 10
      src/gui/advancedsettings.cpp
  14. 3
      src/gui/gui.pri
  15. 23
      src/gui/mainwindow.cpp
  16. 4
      src/gui/mainwindow.h
  17. 78
      src/gui/trackerlogindialog.cpp
  18. 60
      src/gui/trackerlogindialog.h
  19. 167
      src/gui/trackerlogindialog.ui
  20. 5
      src/gui/transferlistdelegate.cpp
  21. 6
      src/gui/transferlistmodel.cpp
  22. 4
      src/webui/api/serialize/serialize_torrent.cpp

18
configure vendored

@ -5320,12 +5320,12 @@ if test -n "$libtorrent_CFLAGS"; then @@ -5320,12 +5320,12 @@ if test -n "$libtorrent_CFLAGS"; then
pkg_cv_libtorrent_CFLAGS="$libtorrent_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.0.6\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.0.6") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.1.10\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.1.10") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 1.0.6" 2>/dev/null`
pkg_cv_libtorrent_CFLAGS=`$PKG_CONFIG --cflags "libtorrent-rasterbar >= 1.1.10" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -5337,12 +5337,12 @@ if test -n "$libtorrent_LIBS"; then @@ -5337,12 +5337,12 @@ if test -n "$libtorrent_LIBS"; then
pkg_cv_libtorrent_LIBS="$libtorrent_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.0.6\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.0.6") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtorrent-rasterbar >= 1.1.10\""; } >&5
($PKG_CONFIG --exists --print-errors "libtorrent-rasterbar >= 1.1.10") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 1.0.6" 2>/dev/null`
pkg_cv_libtorrent_LIBS=`$PKG_CONFIG --libs "libtorrent-rasterbar >= 1.1.10" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -5363,14 +5363,14 @@ else @@ -5363,14 +5363,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 1.0.6" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtorrent-rasterbar >= 1.1.10" 2>&1`
else
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.0.6" 2>&1`
libtorrent_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtorrent-rasterbar >= 1.1.10" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$libtorrent_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 1.0.6) were not met:
as_fn_error $? "Package requirements (libtorrent-rasterbar >= 1.1.10) were not met:
$libtorrent_PKG_ERRORS

2
configure.ac

@ -195,7 +195,7 @@ AS_CASE(["x$with_qtsingleapplication"], @@ -195,7 +195,7 @@ AS_CASE(["x$with_qtsingleapplication"],
AC_MSG_ERROR([Unknown option "$with_qtsingleapplication". Use either "system" or "shipped".])])
PKG_CHECK_MODULES(libtorrent,
[libtorrent-rasterbar >= 1.0.6],
[libtorrent-rasterbar >= 1.1.10],
[CXXFLAGS="$libtorrent_CFLAGS $CXXFLAGS"
LIBS="$libtorrent_LIBS $LIBS"])

426
src/base/bittorrent/session.cpp

@ -48,6 +48,7 @@ @@ -48,6 +48,7 @@
#include <QUuid>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/bdecode.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/disk_io_thread.hpp>
#include <libtorrent/error_code.hpp>
@ -58,16 +59,10 @@ @@ -58,16 +59,10 @@
#include <libtorrent/ip_filter.hpp>
#include <libtorrent/magnet_uri.hpp>
#include <libtorrent/session.hpp>
#include <libtorrent/session_stats.hpp>
#include <libtorrent/session_status.hpp>
#include <libtorrent/torrent_info.hpp>
#if LIBTORRENT_VERSION_NUM < 10100
#include <libtorrent/lazy_entry.hpp>
#else
#include <libtorrent/bdecode.hpp>
#include <libtorrent/session_stats.hpp>
#endif
#include "base/algorithm.h"
#include "base/exceptions.h"
#include "base/global.h"
@ -155,17 +150,6 @@ namespace @@ -155,17 +150,6 @@ namespace
return output;
}
#if LIBTORRENT_VERSION_NUM < 10100
bool isList(const libt::lazy_entry *entry)
{
return entry && (entry->type() == libt::lazy_entry::list_t);
}
QSet<QString> entryListToSet(const libt::lazy_entry *entry)
{
return entry ? entryListToSetImpl(*entry) : QSet<QString>();
}
#else
bool isList(const libt::bdecode_node &entry)
{
return entry.type() == libt::bdecode_node::list_t;
@ -175,7 +159,6 @@ namespace @@ -175,7 +159,6 @@ namespace
{
return entryListToSetImpl(entry);
}
#endif
QString normalizePath(const QString &path)
{
@ -265,9 +248,7 @@ Session::Session(QObject *parent) @@ -265,9 +248,7 @@ Session::Session(QObject *parent)
: QObject(parent)
, m_deferredConfigureScheduled(false)
, m_IPFilteringChanged(false)
#if LIBTORRENT_VERSION_NUM >= 10100
, m_listenInterfaceChanged(true)
#endif
, m_isDHTEnabled(BITTORRENT_SESSION_KEY("DHTEnabled"), true)
, m_isLSDEnabled(BITTORRENT_SESSION_KEY("LSDEnabled"), true)
, m_isPeXEnabled(BITTORRENT_SESSION_KEY("PeXEnabled"), true)
@ -395,47 +376,9 @@ Session::Session(QObject *parent) @@ -395,47 +376,9 @@ Session::Session(QObject *parent)
| libt::alert::tracker_notification
| libt::alert::status_notification
| libt::alert::ip_block_notification
#if LIBTORRENT_VERSION_NUM < 10110
| libt::alert::progress_notification
#else
| libt::alert::file_progress_notification
#endif
| libt::alert::stats_notification;
#if LIBTORRENT_VERSION_NUM < 10100
libt::fingerprint fingerprint(PEER_ID, QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD);
std::string peerId = fingerprint.to_string();
const ushort port = this->port();
std::pair<int, int> ports(port, port);
const QString ip = getListeningIPs().first();
m_nativeSession = new libt::session(fingerprint, ports, ip.isEmpty() ? 0 : ip.toLatin1().constData(), 0, alertMask);
libt::session_settings sessionSettings = m_nativeSession->settings();
sessionSettings.user_agent = USER_AGENT;
sessionSettings.upnp_ignore_nonrouters = true;
sessionSettings.use_dht_as_fallback = false;
// Disable support for SSL torrents for now
sessionSettings.ssl_listen = 0;
// To prevent ISPs from blocking seeding
sessionSettings.lazy_bitfields = true;
// Speed up exit
sessionSettings.stop_tracker_timeout = 1;
sessionSettings.auto_scrape_interval = 1200; // 20 minutes
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
sessionSettings.connection_speed = 20; // default is 10
sessionSettings.no_connect_privileged_ports = false;
// Disk cache pool is rarely tested in libtorrent and doesn't free buffers
// Soon to be deprecated there
// More info: https://github.com/arvidn/libtorrent/issues/2251
sessionSettings.use_disk_cache_pool = false;
configure(sessionSettings);
m_nativeSession->set_settings(sessionSettings);
configureListeningInterface();
m_nativeSession->set_alert_dispatch([this](std::auto_ptr<libt::alert> alertPtr)
{
dispatchAlerts(alertPtr.release());
});
#else
const std::string peerId = libt::generate_fingerprint(PEER_ID, QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD);
libt::settings_pack pack;
pack.set_int(libt::settings_pack::alert_mask, alertMask);
@ -471,7 +414,6 @@ Session::Session(QObject *parent) @@ -471,7 +414,6 @@ Session::Session(QObject *parent)
});
configurePeerClasses();
#endif // LIBTORRENT_VERSION_NUM < 10100
// Enabling plugins
//m_nativeSession->add_extension(&libt::create_metadata_plugin);
@ -552,10 +494,8 @@ Session::Session(QObject *parent) @@ -552,10 +494,8 @@ Session::Session(QObject *parent)
// initialize PortForwarder instance
Net::PortForwarder::initInstance(m_nativeSession);
#if LIBTORRENT_VERSION_NUM >= 10100
initMetrics();
m_statsUpdateTimer.start();
#endif
qDebug("* BitTorrent Session constructed");
}
@ -1032,45 +972,27 @@ Session *Session::instance() @@ -1032,45 +972,27 @@ Session *Session::instance()
void Session::adjustLimits()
{
if (isQueueingSystemEnabled()) {
#if LIBTORRENT_VERSION_NUM < 10100
libt::session_settings sessionSettings(m_nativeSession->settings());
adjustLimits(sessionSettings);
m_nativeSession->set_settings(sessionSettings);
#else
libt::settings_pack settingsPack = m_nativeSession->get_settings();
adjustLimits(settingsPack);
m_nativeSession->apply_settings(settingsPack);
#endif
}
}
void Session::applyBandwidthLimits()
{
#if LIBTORRENT_VERSION_NUM < 10100
libt::session_settings sessionSettings(m_nativeSession->settings());
applyBandwidthLimits(sessionSettings);
m_nativeSession->set_settings(sessionSettings);
#else
libt::settings_pack settingsPack = m_nativeSession->get_settings();
applyBandwidthLimits(settingsPack);
m_nativeSession->apply_settings(settingsPack);
#endif
}
// Set BitTorrent session configuration
void Session::configure()
{
qDebug("Configuring session");
#if LIBTORRENT_VERSION_NUM < 10100
libt::session_settings sessionSettings = m_nativeSession->settings();
configure(sessionSettings);
m_nativeSession->set_settings(sessionSettings);
#else
libt::settings_pack settingsPack = m_nativeSession->get_settings();
configure(settingsPack);
m_nativeSession->apply_settings(settingsPack);
configurePeerClasses();
#endif
if (m_IPFilteringChanged) {
if (isIPFilteringEnabled())
@ -1096,7 +1018,6 @@ void Session::processBannedIPs(libt::ip_filter &filter) @@ -1096,7 +1018,6 @@ void Session::processBannedIPs(libt::ip_filter &filter)
}
}
#if LIBTORRENT_VERSION_NUM >= 10100
void Session::adjustLimits(libt::settings_pack &settingsPack)
{
// Internally increase the queue limits to ensure that the magnet is started
@ -1523,225 +1444,6 @@ void Session::configurePeerClasses() @@ -1523,225 +1444,6 @@ void Session::configurePeerClasses()
m_nativeSession->set_peer_class_type_filter(peerClassTypeFilter);
}
#else // LIBTORRENT_VERSION_NUM >= 10100
void Session::adjustLimits(libt::session_settings &sessionSettings)
{
// Internally increase the queue limits to ensure that the magnet is started
int maxDownloads = maxActiveDownloads();
int maxActive = maxActiveTorrents();
sessionSettings.active_downloads = (maxDownloads > -1) ? (maxDownloads + m_extraLimit) : maxDownloads;
sessionSettings.active_limit = (maxActive > -1) ? (maxActive + m_extraLimit) : maxActive;
}
void Session::applyBandwidthLimits(libt::session_settings &sessionSettings)
{
const bool altSpeedLimitEnabled = isAltGlobalSpeedLimitEnabled();
sessionSettings.download_rate_limit = altSpeedLimitEnabled ? altGlobalDownloadSpeedLimit() : globalDownloadSpeedLimit();
sessionSettings.upload_rate_limit = altSpeedLimitEnabled ? altGlobalUploadSpeedLimit() : globalUploadSpeedLimit();
}
void Session::configure(libtorrent::session_settings &sessionSettings)
{
applyBandwidthLimits(sessionSettings);
// The most secure, rc4 only so that all streams are encrypted
libt::pe_settings encryptionSettings;
encryptionSettings.allowed_enc_level = libt::pe_settings::rc4;
encryptionSettings.prefer_rc4 = true;
switch (encryption()) {
case 0: // Enabled
encryptionSettings.out_enc_policy = libt::pe_settings::enabled;
encryptionSettings.in_enc_policy = libt::pe_settings::enabled;
break;
case 1: // Forced
encryptionSettings.out_enc_policy = libt::pe_settings::forced;
encryptionSettings.in_enc_policy = libt::pe_settings::forced;
break;
default: // Disabled
encryptionSettings.out_enc_policy = libt::pe_settings::disabled;
encryptionSettings.in_enc_policy = libt::pe_settings::disabled;
}
m_nativeSession->set_pe_settings(encryptionSettings);
auto proxyManager = Net::ProxyConfigurationManager::instance();
Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
if (m_useProxy || (proxyConfig.type != Net::ProxyType::None)) {
libt::proxy_settings proxySettings;
if (proxyConfig.type != Net::ProxyType::None) {
proxySettings.hostname = proxyConfig.ip.toStdString();
proxySettings.port = proxyConfig.port;
if (proxyManager->isAuthenticationRequired()) {
proxySettings.username = proxyConfig.username.toStdString();
proxySettings.password = proxyConfig.password.toStdString();
}
proxySettings.proxy_peer_connections = isProxyPeerConnectionsEnabled();
}
switch (proxyConfig.type) {
case Net::ProxyType::HTTP:
proxySettings.type = libt::proxy_settings::http;
break;
case Net::ProxyType::HTTP_PW:
proxySettings.type = libt::proxy_settings::http_pw;
break;
case Net::ProxyType::SOCKS4:
proxySettings.type = libt::proxy_settings::socks4;
break;
case Net::ProxyType::SOCKS5:
proxySettings.type = libt::proxy_settings::socks5;
break;
case Net::ProxyType::SOCKS5_PW:
proxySettings.type = libt::proxy_settings::socks5_pw;
break;
default:
proxySettings.type = libt::proxy_settings::none;
}
m_nativeSession->set_proxy(proxySettings);
m_useProxy = (proxyConfig.type != Net::ProxyType::None);
}
sessionSettings.force_proxy = m_useProxy ? isForceProxyEnabled() : false;
sessionSettings.announce_to_all_trackers = announceToAllTrackers();
sessionSettings.announce_to_all_tiers = announceToAllTiers();
const int cacheSize = (diskCacheSize() > -1) ? (diskCacheSize() * 64) : -1;
sessionSettings.cache_size = cacheSize;
sessionSettings.cache_expiry = diskCacheTTL();
qDebug() << "Using a disk cache size of" << cacheSize << "MiB";
libt::session_settings::io_buffer_mode_t mode = useOSCache() ? libt::session_settings::enable_os_cache
: libt::session_settings::disable_os_cache;
sessionSettings.disk_io_read_mode = mode;
sessionSettings.disk_io_write_mode = mode;
sessionSettings.guided_read_cache = isGuidedReadCacheEnabled();
sessionSettings.suggest_mode = isSuggestModeEnabled()
? libt::session_settings::suggest_read_cache : libt::session_settings::no_piece_suggestions;
sessionSettings.send_buffer_watermark = sendBufferWatermark() * 1024;
sessionSettings.send_buffer_low_watermark = sendBufferLowWatermark() * 1024;
sessionSettings.send_buffer_watermark_factor = sendBufferWatermarkFactor();
sessionSettings.anonymous_mode = isAnonymousModeEnabled();
// Queueing System
if (isQueueingSystemEnabled()) {
adjustLimits(sessionSettings);
sessionSettings.active_seeds = maxActiveUploads();
sessionSettings.dont_count_slow_torrents = ignoreSlowTorrentsForQueueing();
}
else {
sessionSettings.active_downloads = -1;
sessionSettings.active_seeds = -1;
sessionSettings.active_limit = -1;
}
sessionSettings.active_tracker_limit = -1;
sessionSettings.active_dht_limit = -1;
sessionSettings.active_lsd_limit = -1;
sessionSettings.alert_queue_size = std::numeric_limits<int>::max() / 2;
// Outgoing ports
sessionSettings.outgoing_ports = std::make_pair(outgoingPortsMin(), outgoingPortsMax());
// Ignore limits on LAN
sessionSettings.ignore_limits_on_local_network = ignoreLimitsOnLAN();
// Include overhead in transfer limits
sessionSettings.rate_limit_ip_overhead = includeOverheadInLimits();
// IP address to announce to trackers
sessionSettings.announce_ip = announceIP().toStdString();
// Super seeding
sessionSettings.strict_super_seeding = isSuperSeedingEnabled();
// * Max Half-open connections
sessionSettings.half_open_limit = maxHalfOpenConnections();
// * Max connections limit
sessionSettings.connections_limit = maxConnections();
// * Global max upload slots
sessionSettings.unchoke_slots_limit = maxUploads();
// uTP
switch (btProtocol()) {
case BTProtocol::Both:
default:
sessionSettings.enable_incoming_tcp = true;
sessionSettings.enable_outgoing_tcp = true;
sessionSettings.enable_incoming_utp = true;
sessionSettings.enable_outgoing_utp = true;
break;
case BTProtocol::TCP:
sessionSettings.enable_incoming_tcp = true;
sessionSettings.enable_outgoing_tcp = true;
sessionSettings.enable_incoming_utp = false;
sessionSettings.enable_outgoing_utp = false;
break;
case BTProtocol::UTP:
sessionSettings.enable_incoming_tcp = false;
sessionSettings.enable_outgoing_tcp = false;
sessionSettings.enable_incoming_utp = true;
sessionSettings.enable_outgoing_utp = true;
break;
}
// uTP rate limiting
sessionSettings.rate_limit_utp = isUTPRateLimited();
switch (utpMixedMode()) {
case MixedModeAlgorithm::TCP:
default:
sessionSettings.mixed_mode_algorithm = libt::session_settings::prefer_tcp;
break;
case MixedModeAlgorithm::Proportional:
sessionSettings.mixed_mode_algorithm = libt::session_settings::peer_proportional;
break;
}
sessionSettings.allow_multiple_connections_per_ip = multiConnectionsPerIpEnabled();
sessionSettings.apply_ip_filter_to_trackers = isTrackerFilteringEnabled();
if (isDHTEnabled()) {
// Add first the routers and then start DHT.
m_nativeSession->add_dht_router(std::make_pair(std::string("dht.libtorrent.org"), 25401));
m_nativeSession->add_dht_router(std::make_pair(std::string("router.bittorrent.com"), 6881));
m_nativeSession->add_dht_router(std::make_pair(std::string("router.utorrent.com"), 6881));
m_nativeSession->add_dht_router(std::make_pair(std::string("dht.transmissionbt.com"), 6881));
m_nativeSession->add_dht_router(std::make_pair(std::string("dht.aelitis.com"), 6881)); // Vuze
m_nativeSession->start_dht();
}
else {
m_nativeSession->stop_dht();
}
if (isLSDEnabled())
m_nativeSession->start_lsd();
else
m_nativeSession->stop_lsd();
switch (chokingAlgorithm()) {
case ChokingAlgorithm::FixedSlots:
default:
sessionSettings.choking_algorithm = libt::session_settings::fixed_slots_choker;
break;
case ChokingAlgorithm::RateBased:
sessionSettings.choking_algorithm = libt::session_settings::rate_based_choker;
break;
}
switch (seedChokingAlgorithm()) {
case SeedChokingAlgorithm::RoundRobin:
sessionSettings.seed_choking_algorithm = libt::session_settings::round_robin;
break;
case SeedChokingAlgorithm::FastestUpload:
default:
sessionSettings.seed_choking_algorithm = libt::session_settings::fastest_upload;
break;
case SeedChokingAlgorithm::AntiLeech:
sessionSettings.seed_choking_algorithm = libt::session_settings::anti_leech;
break;
}
}
#endif // LIBTORRENT_VERSION_NUM >= 10100
void Session::enableTracker(bool enable)
{
Logger *const logger = Logger::instance();
@ -1934,11 +1636,7 @@ bool Session::deleteTorrent(const QString &hash, bool deleteLocalFiles) @@ -1934,11 +1636,7 @@ bool Session::deleteTorrent(const QString &hash, bool deleteLocalFiles)
QStringList unwantedFiles;
if (torrent->hasMetadata())
unwantedFiles = torrent->absoluteFilePathsUnwanted();
#if LIBTORRENT_VERSION_NUM < 10100
m_nativeSession->remove_torrent(torrent->nativeHandle());
#else
m_nativeSession->remove_torrent(torrent->nativeHandle(), libt::session::delete_partfile);
#endif
// Remove unwanted and incomplete files
for (const QString &unwantedFile : asConst(unwantedFiles)) {
qDebug("Removing unwanted file: %s", qUtf8Printable(unwantedFile));
@ -2412,9 +2110,6 @@ void Session::saveResumeData() @@ -2412,9 +2110,6 @@ void Session::saveResumeData()
dispatchTorrentAlert(a);
break;
}
#if LIBTORRENT_VERSION_NUM < 10100
delete a;
#endif
}
}
}
@ -2576,37 +2271,8 @@ const QStringList Session::getListeningIPs() @@ -2576,37 +2271,8 @@ const QStringList Session::getListeningIPs()
// the BitTorrent session will listen to
void Session::configureListeningInterface()
{
#if LIBTORRENT_VERSION_NUM < 10100
const ushort port = this->port();
qDebug() << Q_FUNC_INFO << port;
Logger *const logger = Logger::instance();
std::pair<int, int> ports(port, port);
libt::error_code ec;
const QStringList IPs = getListeningIPs();
for (const QString ip : IPs) {
if (ip.isEmpty()) {
logger->addMessage(tr("qBittorrent is trying to listen on any interface port: %1", "e.g: qBittorrent is trying to listen on any interface port: TCP/6881").arg(QString::number(port)), Log::INFO);
m_nativeSession->listen_on(ports, ec, 0, libt::session::listen_no_system_port);
if (ec)
logger->addMessage(tr("qBittorrent failed to listen on any interface port: %1. Reason: %2.", "e.g: qBittorrent failed to listen on any interface port: TCP/6881. Reason: no such interface" ).arg(QString::number(port)).arg(QString::fromLocal8Bit(ec.message().c_str())), Log::CRITICAL);
return;
}
m_nativeSession->listen_on(ports, ec, ip.toLatin1().constData(), libt::session::listen_no_system_port);
if (!ec) {
logger->addMessage(tr("qBittorrent is trying to listen on interface %1 port: %2", "e.g: qBittorrent is trying to listen on interface 192.168.0.1 port: TCP/6881").arg(ip).arg(port), Log::INFO);
return;
}
}
#else
m_listenInterfaceChanged = true;
configureDeferred();
#endif // LIBTORRENT_VERSION_NUM < 10100
}
int Session::globalDownloadSpeedLimit() const
@ -4043,9 +3709,7 @@ quint64 Session::getAlltimeUL() const @@ -4043,9 +3709,7 @@ quint64 Session::getAlltimeUL() const
void Session::refresh()
{
m_nativeSession->post_torrent_updates();
#if LIBTORRENT_VERSION_NUM >= 10100
m_nativeSession->post_session_stats();
#endif
}
void Session::handleIPFilterParsed(int ruleCount)
@ -4069,38 +3733,13 @@ void Session::handleIPFilterError() @@ -4069,38 +3733,13 @@ void Session::handleIPFilterError()
emit IPFilterParsed(true, 0);
}
#if LIBTORRENT_VERSION_NUM < 10100
void Session::dispatchAlerts(libt::alert *alertPtr)
{
QMutexLocker lock(&m_alertsMutex);
bool wasEmpty = m_alerts.empty();
m_alerts.push_back(alertPtr);
if (wasEmpty) {
m_alertsWaitCondition.wakeAll();
QMetaObject::invokeMethod(this, "readAlerts", Qt::QueuedConnection);
}
}
#endif
void Session::getPendingAlerts(std::vector<libt::alert *> &out, ulong time)
{
Q_ASSERT(out.empty());
#if LIBTORRENT_VERSION_NUM < 10100
QMutexLocker lock(&m_alertsMutex);
if (m_alerts.empty())
m_alertsWaitCondition.wait(&m_alertsMutex, time);
m_alerts.swap(out);
#else
if (time > 0)
m_nativeSession->wait_for_alert(libt::milliseconds(time));
m_nativeSession->pop_alerts(&out);
#endif
}
bool Session::isCreateTorrentSubfolder() const
@ -4119,12 +3758,8 @@ void Session::readAlerts() @@ -4119,12 +3758,8 @@ void Session::readAlerts()
std::vector<libt::alert *> alerts;
getPendingAlerts(alerts);
for (const auto a : alerts) {
for (const auto a : alerts)
handleAlert(a);
#if LIBTORRENT_VERSION_NUM < 10100
delete a;
#endif
}
}
void Session::handleAlert(libt::alert *a)
@ -4155,11 +3790,9 @@ void Session::handleAlert(libt::alert *a) @@ -4155,11 +3790,9 @@ void Session::handleAlert(libt::alert *a)
case libt::state_update_alert::alert_type:
handleStateUpdateAlert(static_cast<libt::state_update_alert*>(a));
break;
#if LIBTORRENT_VERSION_NUM >= 10100
case libt::session_stats_alert::alert_type:
handleSessionStatsAlert(static_cast<libt::session_stats_alert*>(a));
break;
#endif
case libt::file_error_alert::alert_type:
handleFileErrorAlert(static_cast<libt::file_error_alert*>(a));
break;
@ -4407,11 +4040,7 @@ void Session::handlePeerBanAlert(libt::peer_ban_alert *p) @@ -4407,11 +4040,7 @@ void Session::handlePeerBanAlert(libt::peer_ban_alert *p)
void Session::handleUrlSeedAlert(libt::url_seed_alert *p)
{
Logger::instance()->addMessage(tr("URL seed lookup failed for URL: '%1', message: %2")
#if LIBTORRENT_VERSION_NUM >= 10100
.arg(QString::fromStdString(p->server_url()))
#else
.arg(QString::fromStdString(p->url))
#endif
.arg(QString::fromStdString(p->message())), Log::CRITICAL);
}
@ -4467,7 +4096,6 @@ void Session::handleExternalIPAlert(libt::external_ip_alert *p) @@ -4467,7 +4096,6 @@ void Session::handleExternalIPAlert(libt::external_ip_alert *p)
Logger::instance()->addMessage(tr("External IP: %1", "e.g. External IP: 192.168.0.1").arg(p->external_address.to_string(ec).c_str()), Log::INFO);
}
#if LIBTORRENT_VERSION_NUM >= 10100
void Session::handleSessionStatsAlert(libt::session_stats_alert *p)
{
qreal interval = m_statsUpdateTimer.restart() / 1000.;
@ -4532,51 +4160,9 @@ void Session::handleSessionStatsAlert(libt::session_stats_alert *p) @@ -4532,51 +4160,9 @@ void Session::handleSessionStatsAlert(libt::session_stats_alert *p)
emit statsUpdated();
}
#else // LIBTORRENT_VERSION_NUM >= 10100
void Session::updateStats()
{
libt::session_status ss = m_nativeSession->status();
m_status.hasIncomingConnections = ss.has_incoming_connections;
m_status.payloadDownloadRate = ss.payload_download_rate;
m_status.payloadUploadRate = ss.payload_upload_rate;
m_status.downloadRate = ss.download_rate;
m_status.uploadRate = ss.upload_rate;
m_status.ipOverheadDownloadRate = ss.ip_overhead_download_rate;
m_status.ipOverheadUploadRate = ss.ip_overhead_upload_rate;
m_status.dhtDownloadRate = ss.dht_download_rate;
m_status.dhtUploadRate = ss.dht_upload_rate;
m_status.trackerDownloadRate = ss.tracker_download_rate;
m_status.trackerUploadRate = ss.tracker_upload_rate;
m_status.totalDownload = ss.total_download;
m_status.totalUpload = ss.total_upload;
m_status.totalPayloadDownload = ss.total_payload_download;
m_status.totalPayloadUpload = ss.total_payload_upload;
m_status.totalWasted = ss.total_redundant_bytes + ss.total_failed_bytes;
m_status.diskReadQueue = ss.disk_read_queue;
m_status.diskWriteQueue = ss.disk_write_queue;
m_status.dhtNodes = ss.dht_nodes;
m_status.peersCount = ss.num_peers;
libt::cache_status cs = m_nativeSession->get_cache_status();
m_cacheStatus.totalUsedBuffers = cs.total_used_buffers;
m_cacheStatus.readRatio = cs.blocks_read > 0
? static_cast<qreal>(cs.blocks_read_hit) / cs.blocks_read
: -1;
m_cacheStatus.jobQueueLength = cs.job_queue_length;
m_cacheStatus.averageJobTime = cs.average_job_time;
m_cacheStatus.queuedBytes = cs.queued_bytes; // it seems that it is constantly equal to zero
emit statsUpdated();
}
#endif // LIBTORRENT_VERSION_NUM >= 10100
void Session::handleStateUpdateAlert(libt::state_update_alert *p)
{
#if LIBTORRENT_VERSION_NUM < 10100
updateStats();
#endif
for (const libt::torrent_status &status : p->status) {
TorrentHandle *const torrent = m_torrents.value(status.info_hash);
if (torrent)
@ -4627,15 +4213,9 @@ namespace @@ -4627,15 +4213,9 @@ namespace
torrentParams.skipChecking = false;
libt::error_code ec;
#if LIBTORRENT_VERSION_NUM < 10100
libt::lazy_entry fast;
libt::lazy_bdecode(data.constData(), data.constData() + data.size(), fast, ec);
if (ec || (fast.type() != libt::lazy_entry::dict_t)) return false;
#else
libt::bdecode_node fast;
libt::bdecode(data.constData(), data.constData() + data.size(), fast, ec);
if (ec || (fast.type() != libt::bdecode_node::dict_t)) return false;
#endif
torrentParams.savePath = Profile::instance().fromPortablePath(
Utils::Fs::fromNativePath(QString::fromStdString(fast.dict_find_string_value("qBt-savePath"))));

38
src/base/bittorrent/session.h

@ -30,10 +30,9 @@ @@ -30,10 +30,9 @@
#ifndef BITTORRENT_SESSION_H
#define BITTORRENT_SESSION_H
#include <libtorrent/version.hpp>
#include <vector>
#include <QElapsedTimer>
#include <QFile>
#include <QHash>
#include <QList>
@ -45,12 +44,6 @@ @@ -45,12 +44,6 @@
#include <QVector>
#include <QWaitCondition>
#if LIBTORRENT_VERSION_NUM < 10100
#include <QMutex>
#else
#include <QElapsedTimer>
#endif
#include "base/settingvalue.h"
#include "base/tristatebool.h"
#include "base/types.h"
@ -65,11 +58,7 @@ namespace libtorrent @@ -65,11 +58,7 @@ namespace libtorrent
struct torrent_handle;
class entry;
struct ip_filter;
#if LIBTORRENT_VERSION_NUM < 10100
struct session_settings;
#else
struct settings_pack;
#endif
class alert;
struct torrent_alert;
@ -103,9 +92,7 @@ namespace libtorrent @@ -103,9 +92,7 @@ namespace libtorrent
struct listen_succeeded_alert;
struct listen_failed_alert;
struct external_ip_alert;
#if LIBTORRENT_VERSION_NUM >= 10100
struct session_stats_alert;
#endif
}
class QThread;
@ -193,7 +180,6 @@ namespace BitTorrent @@ -193,7 +180,6 @@ namespace BitTorrent
using MixedModeAlgorithm = SessionSettingsEnums::MixedModeAlgorithm;
using BTProtocol = SessionSettingsEnums::BTProtocol;
#if LIBTORRENT_VERSION_NUM >= 10100
struct SessionMetricIndices
{
struct
@ -237,7 +223,6 @@ namespace BitTorrent @@ -237,7 +223,6 @@ namespace BitTorrent
int diskJobTime = 0;
} disk;
};
#endif // LIBTORRENT_VERSION_NUM >= 10100
class Session : public QObject
{
@ -579,17 +564,11 @@ namespace BitTorrent @@ -579,17 +564,11 @@ namespace BitTorrent
// Session configuration
Q_INVOKABLE void configure();
#if LIBTORRENT_VERSION_NUM < 10100
void configure(libtorrent::session_settings &sessionSettings);
void adjustLimits(libtorrent::session_settings &sessionSettings);
void applyBandwidthLimits(libtorrent::session_settings &sessionSettings);
#else
void configure(libtorrent::settings_pack &settingsPack);
void configurePeerClasses();
void adjustLimits(libtorrent::settings_pack &settingsPack);
void applyBandwidthLimits(libtorrent::settings_pack &settingsPack);
void initMetrics();
#endif
void adjustLimits();
void applyBandwidthLimits();
void processBannedIPs(libtorrent::ip_filter &filter);
@ -627,9 +606,7 @@ namespace BitTorrent @@ -627,9 +606,7 @@ namespace BitTorrent
void handleListenSucceededAlert(libtorrent::listen_succeeded_alert *p);
void handleListenFailedAlert(libtorrent::listen_failed_alert *p);
void handleExternalIPAlert(libtorrent::external_ip_alert *p);
#if LIBTORRENT_VERSION_NUM >= 10100
void handleSessionStatsAlert(libtorrent::session_stats_alert *p);
#endif
void createTorrentHandle(const libtorrent::torrent_handle &nativeHandle);
@ -637,10 +614,6 @@ namespace BitTorrent @@ -637,10 +614,6 @@ namespace BitTorrent
void saveTorrentsQueue();
void removeTorrentsQueue();
#if LIBTORRENT_VERSION_NUM < 10100
void dispatchAlerts(libtorrent::alert *alertPtr);
void updateStats();
#endif
void getPendingAlerts(std::vector<libtorrent::alert *> &out, ulong time = 0);
// BitTorrent
@ -648,9 +621,8 @@ namespace BitTorrent @@ -648,9 +621,8 @@ namespace BitTorrent
bool m_deferredConfigureScheduled;
bool m_IPFilteringChanged;
#if LIBTORRENT_VERSION_NUM >= 10100
bool m_listenInterfaceChanged; // optimization
#endif
CachedSettingValue<bool> m_isDHTEnabled;
CachedSettingValue<bool> m_isLSDEnabled;
CachedSettingValue<bool> m_isPeXEnabled;
@ -775,14 +747,8 @@ namespace BitTorrent @@ -775,14 +747,8 @@ namespace BitTorrent
QSet<InfoHash> m_recentErroredTorrents;
QTimer *m_recentErroredTorrentsTimer;
#if LIBTORRENT_VERSION_NUM < 10100
QMutex m_alertsMutex;
QWaitCondition m_alertsWaitCondition;
std::vector<libtorrent::alert *> m_alerts;
#else
SessionMetricIndices m_metricIndices;
QElapsedTimer m_statsUpdateTimer;
#endif
SessionStatus m_status;
CacheStatus m_cacheStatus;

11
src/base/bittorrent/torrentcreatorthread.cpp

@ -34,7 +34,6 @@ @@ -34,7 +34,6 @@
#include <libtorrent/create_torrent.hpp>
#include <libtorrent/storage.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/version.hpp>
#include <QDirIterator>
#include <QFile>
@ -131,13 +130,8 @@ void TorrentCreatorThread::run() @@ -131,13 +130,8 @@ void TorrentCreatorThread::run()
if (isInterruptionRequested()) return;
#if LIBTORRENT_VERSION_NUM < 10100
libt::create_torrent newTorrent(fs, m_params.pieceSize, -1
, (m_params.isAlignmentOptimized ? libt::create_torrent::optimize : 0));
#else
libt::create_torrent newTorrent(fs, m_params.pieceSize, -1
, (m_params.isAlignmentOptimized ? libt::create_torrent::optimize_alignment : 0));
#endif
// Add url seeds
for (QString seed : asConst(m_params.urlSeeds)) {
@ -208,11 +202,6 @@ int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const i @@ -208,11 +202,6 @@ int TorrentCreatorThread::calculateTotalPieces(const QString &inputPath, const i
libt::file_storage fs;
libt::add_files(fs, Utils::Fs::toNativePath(inputPath).toStdString(), fileFilter);
#if LIBTORRENT_VERSION_NUM < 10100
return libt::create_torrent(fs, pieceSize, -1
, (isAlignmentOptimized ? libt::create_torrent::optimize : 0)).num_pieces();
#else
return libt::create_torrent(fs, pieceSize, -1
, (isAlignmentOptimized ? libt::create_torrent::optimize_alignment : 0)).num_pieces();
#endif
}

87
src/base/bittorrent/torrenthandle.cpp

@ -45,9 +45,7 @@ @@ -45,9 +45,7 @@
#include <libtorrent/create_torrent.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/magnet_uri.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100
#include <libtorrent/time.hpp>
#endif
#ifdef Q_OS_WIN
#include <windows.h>
@ -145,31 +143,6 @@ const int TorrentHandle::NO_SEEDING_TIME_LIMIT = -1; @@ -145,31 +143,6 @@ const int TorrentHandle::NO_SEEDING_TIME_LIMIT = -1;
const qreal TorrentHandle::MAX_RATIO = 9999.;
const int TorrentHandle::MAX_SEEDING_TIME = 525600;
// The new libtorrent::create_torrent constructor appeared after 1.0.11 in RC_1_0
// and after 1.1.1 in RC_1_1. Since it fixed an ABI incompatibility with previous versions
// distros might choose to backport it onto 1.0.11 and 1.1.1 respectively.
// So we need a way to detect its presence without relying solely on the LIBTORRENT_VERSION_NUM.
// Relevant links:
// 1. https://github.com/arvidn/libtorrent/issues/1696
// 2. https://github.com/qbittorrent/qBittorrent/issues/6406
// The following can be removed after one or two libtorrent releases on each branch.
namespace
{
// new constructor is available
template<typename T, typename std::enable_if<std::is_constructible<T, libt::torrent_info, bool>::value, int>::type = 0>
T makeTorrentCreator(const libtorrent::torrent_info &ti)
{
return T(ti, true);
}
// new constructor isn't available
template<typename T, typename std::enable_if<!std::is_constructible<T, libt::torrent_info, bool>::value, int>::type = 0>
T makeTorrentCreator(const libtorrent::torrent_info &ti)
{
return T(ti);
}
}
TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle &nativeHandle,
const CreateTorrentParams &params)
: QObject(session)
@ -694,11 +667,7 @@ bool TorrentHandle::isQueued() const @@ -694,11 +667,7 @@ bool TorrentHandle::isQueued() const
bool TorrentHandle::isChecking() const
{
return ((m_nativeStatus.state == libt::torrent_status::checking_files)
|| (m_nativeStatus.state == libt::torrent_status::checking_resume_data)
#if LIBTORRENT_VERSION_NUM < 10100
|| (m_nativeStatus.state == libt::torrent_status::queued_for_checking)
#endif
);
|| (m_nativeStatus.state == libt::torrent_status::checking_resume_data));
}
bool TorrentHandle::isDownloading() const
@ -834,11 +803,6 @@ void TorrentHandle::updateState() @@ -834,11 +803,6 @@ void TorrentHandle::updateState()
case libt::torrent_status::allocating:
m_state = TorrentState::Allocating;
break;
#if LIBTORRENT_VERSION_NUM < 10100
case libt::torrent_status::queued_for_checking:
m_state = TorrentState::QueuedForChecking;
break;
#endif
case libt::torrent_status::checking_files:
m_state = m_hasSeedStatus ? TorrentState::CheckingUploading : TorrentState::CheckingDownloading;
break;
@ -871,11 +835,7 @@ bool TorrentHandle::hasMissingFiles() const @@ -871,11 +835,7 @@ bool TorrentHandle::hasMissingFiles() const
bool TorrentHandle::hasError() const
{
#if LIBTORRENT_VERSION_NUM < 10100
return (m_nativeStatus.paused && !m_nativeStatus.error.empty());
#else
return (m_nativeStatus.paused && m_nativeStatus.errc);
#endif
}
bool TorrentHandle::hasFilteredPieces() const
@ -897,11 +857,7 @@ int TorrentHandle::queuePosition() const @@ -897,11 +857,7 @@ int TorrentHandle::queuePosition() const
QString TorrentHandle::error() const
{
#if LIBTORRENT_VERSION_NUM < 10100
return QString::fromStdString(m_nativeStatus.error);
#else
return QString::fromStdString(m_nativeStatus.errc.message());
#endif
}
qlonglong TorrentHandle::totalDownload() const
@ -1190,11 +1146,7 @@ int TorrentHandle::connectionsLimit() const @@ -1190,11 +1146,7 @@ int TorrentHandle::connectionsLimit() const
qlonglong TorrentHandle::nextAnnounce() const
{
#if LIBTORRENT_VERSION_NUM < 10100
return m_nativeStatus.next_announce.total_seconds();
#else
return libt::duration_cast<libt::seconds>(m_nativeStatus.next_announce).count();
#endif
}
void TorrentHandle::setName(const QString &name)
@ -1391,14 +1343,6 @@ void TorrentHandle::moveStorage(const QString &newPath, bool overwrite) @@ -1391,14 +1343,6 @@ void TorrentHandle::moveStorage(const QString &newPath, bool overwrite)
}
}
#if LIBTORRENT_VERSION_NUM < 10100
void TorrentHandle::setTrackerLogin(const QString &username, const QString &password)
{
m_nativeHandle.set_tracker_login(std::string(username.toLocal8Bit().constData())
, std::string(password.toLocal8Bit().constData()));
}
#endif
void TorrentHandle::renameFile(int index, const QString &name)
{
++m_renameCount;
@ -1410,7 +1354,7 @@ bool TorrentHandle::saveTorrentFile(const QString &path) @@ -1410,7 +1354,7 @@ bool TorrentHandle::saveTorrentFile(const QString &path)
{
if (!m_torrentInfo.isValid()) return false;
libt::create_torrent torrentCreator = makeTorrentCreator<libt::create_torrent>(*(m_torrentInfo.nativeInfo()));
libt::create_torrent torrentCreator = libt::create_torrent(*(m_torrentInfo.nativeInfo()), true);
libt::entry torrentEntry = torrentCreator.generate();
QVector<char> out;
@ -1434,11 +1378,7 @@ void TorrentHandle::handleStorageMovedAlert(const libtorrent::storage_moved_aler @@ -1434,11 +1378,7 @@ void TorrentHandle::handleStorageMovedAlert(const libtorrent::storage_moved_aler
return;
}
#if LIBTORRENT_VERSION_NUM < 10100
const QString newPath = QString::fromStdString(p->path);
#else
const QString newPath(p->storage_path());
#endif
if (newPath != m_moveStorageInfo.newPath) {
qWarning() << Q_FUNC_INFO << ": New path doesn't match a path in a queue.";
return;
@ -1496,11 +1436,7 @@ void TorrentHandle::handleStorageMovedFailedAlert(const libtorrent::storage_move @@ -1496,11 +1436,7 @@ void TorrentHandle::handleStorageMovedFailedAlert(const libtorrent::storage_move
void TorrentHandle::handleTrackerReplyAlert(const libtorrent::tracker_reply_alert *p)
{
#if LIBTORRENT_VERSION_NUM < 10100
QString trackerUrl = QString::fromStdString(p->url);
#else
QString trackerUrl(p->tracker_url());
#endif
qDebug("Received a tracker reply from %s (Num_peers = %d)", qUtf8Printable(trackerUrl), p->num_peers);
// Connection was successful now. Remove possible old errors
m_trackerInfos[trackerUrl].lastMessage.clear(); // Reset error/warning message
@ -1511,13 +1447,8 @@ void TorrentHandle::handleTrackerReplyAlert(const libtorrent::tracker_reply_aler @@ -1511,13 +1447,8 @@ void TorrentHandle::handleTrackerReplyAlert(const libtorrent::tracker_reply_aler
void TorrentHandle::handleTrackerWarningAlert(const libtorrent::tracker_warning_alert *p)
{
#if LIBTORRENT_VERSION_NUM < 10100
const QString trackerUrl = QString::fromStdString(p->url);
const QString message = QString::fromStdString(p->msg);
#else
const QString trackerUrl = p->tracker_url();
const QString message = p->warning_message();
#endif
// Connection was successful now but there is a warning message
m_trackerInfos[trackerUrl].lastMessage = message; // Store warning message
@ -1527,13 +1458,8 @@ void TorrentHandle::handleTrackerWarningAlert(const libtorrent::tracker_warning_ @@ -1527,13 +1458,8 @@ void TorrentHandle::handleTrackerWarningAlert(const libtorrent::tracker_warning_
void TorrentHandle::handleTrackerErrorAlert(const libtorrent::tracker_error_alert *p)
{
#if LIBTORRENT_VERSION_NUM < 10100
const QString trackerUrl = QString::fromStdString(p->url);
const QString message = QString::fromStdString(p->msg);
#else
const QString trackerUrl = p->tracker_url();
const QString message = p->error_message();
#endif
m_trackerInfos[trackerUrl].lastMessage = message;
@ -1684,11 +1610,7 @@ void TorrentHandle::handleFastResumeRejectedAlert(const libtorrent::fastresume_r @@ -1684,11 +1610,7 @@ void TorrentHandle::handleFastResumeRejectedAlert(const libtorrent::fastresume_r
void TorrentHandle::handleFileRenamedAlert(const libtorrent::file_renamed_alert *p)
{
#if LIBTORRENT_VERSION_NUM < 10100
QString newName = Utils::Fs::fromNativePath(QString::fromStdString(p->name));
#else
QString newName = Utils::Fs::fromNativePath(p->new_name());
#endif
// TODO: Check this!
if (filesCount() > 1) {
@ -1916,11 +1838,8 @@ libtorrent::torrent_handle TorrentHandle::nativeHandle() const @@ -1916,11 +1838,8 @@ libtorrent::torrent_handle TorrentHandle::nativeHandle() const
void TorrentHandle::updateTorrentInfo()
{
if (!hasMetadata()) return;
#if LIBTORRENT_VERSION_NUM < 10100
m_torrentInfo = TorrentInfo(m_nativeStatus.torrent_file);
#else
m_torrentInfo = TorrentInfo(m_nativeStatus.torrent_file.lock());
#endif
}
bool TorrentHandle::isMoveInProgress() const

9
src/base/bittorrent/torrenthandle.h

@ -41,10 +41,7 @@ @@ -41,10 +41,7 @@
#include <QVector>
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100
#include <libtorrent/torrent_status.hpp>
#endif
#include "base/tristatebool.h"
#include "private/speedmonitor.h"
@ -136,9 +133,6 @@ namespace BitTorrent @@ -136,9 +133,6 @@ namespace BitTorrent
Uploading,
StalledUploading,
#if LIBTORRENT_VERSION_NUM < 10100
QueuedForChecking,
#endif
CheckingResumeData,
QueuedDownloading,
QueuedUploading,
@ -342,9 +336,6 @@ namespace BitTorrent @@ -342,9 +336,6 @@ namespace BitTorrent
void forceReannounce(int index = -1);
void forceDHTAnnounce();
void forceRecheck();
#if LIBTORRENT_VERSION_NUM < 10100
void setTrackerLogin(const QString &username, const QString &password);
#endif
void renameFile(int index, const QString &name);
bool saveTorrentFile(const QString &path);
void prioritizeFiles(const QVector<int> &priorities);

6
src/base/bittorrent/torrentinfo.cpp

@ -68,15 +68,9 @@ TorrentInfo TorrentInfo::load(const QByteArray &data, QString *error) noexcept @@ -68,15 +68,9 @@ TorrentInfo TorrentInfo::load(const QByteArray &data, QString *error) noexcept
const int tokenLimit = 10000000;
libt::error_code ec;
#if LIBTORRENT_VERSION_NUM < 10100
libt::lazy_entry node;
libt::lazy_bdecode(data.constData(), (data.constData() + data.size()), node, ec
, nullptr, depthLimit, tokenLimit);
#else
libt::bdecode_node node;
bdecode(data.constData(), (data.constData() + data.size()), node, ec
, nullptr, depthLimit, tokenLimit);
#endif
if (ec) {
if (error)
*error = QString::fromStdString(ec.message());

6
src/base/bittorrent/torrentinfo.h

@ -30,7 +30,6 @@ @@ -30,7 +30,6 @@
#define BITTORRENT_TORRENTINFO_H
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/version.hpp>
#include <QCoreApplication>
#include <QList>
@ -55,13 +54,8 @@ namespace BitTorrent @@ -55,13 +54,8 @@ namespace BitTorrent
Q_DECLARE_TR_FUNCTIONS(TorrentInfo)
public:
#if LIBTORRENT_VERSION_NUM < 10100
typedef boost::intrusive_ptr<const libtorrent::torrent_info> NativeConstPtr;
typedef boost::intrusive_ptr<libtorrent::torrent_info> NativePtr;
#else
typedef boost::shared_ptr<const libtorrent::torrent_info> NativeConstPtr;
typedef boost::shared_ptr<libtorrent::torrent_info> NativePtr;
#endif
explicit TorrentInfo(NativeConstPtr nativeInfo = NativeConstPtr());
TorrentInfo(const TorrentInfo &other);

5
src/base/bittorrent/trackerentry.h

@ -29,11 +29,8 @@ @@ -29,11 +29,8 @@
#ifndef BITTORRENT_TRACKERENTRY_H
#define BITTORRENT_TRACKERENTRY_H
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_NUM >= 10100
#include <libtorrent/announce_entry.hpp>
#endif
#include <libtorrent/torrent_info.hpp>
class QString;

11
src/base/net/portforwarder.cpp

@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
#include <QDebug>
#include <libtorrent/session.hpp>
#include <libtorrent/version.hpp>
#include "base/logger.h"
#include "base/settingsstorage.h"
@ -112,15 +111,10 @@ void PortForwarder::deletePort(quint16 port) @@ -112,15 +111,10 @@ void PortForwarder::deletePort(quint16 port)
void PortForwarder::start()
{
qDebug("Enabling UPnP / NAT-PMP");
#if LIBTORRENT_VERSION_NUM < 10100
m_provider->start_upnp();
m_provider->start_natpmp();
#else
libt::settings_pack settingsPack = m_provider->get_settings();
settingsPack.set_bool(libt::settings_pack::enable_upnp, true);
settingsPack.set_bool(libt::settings_pack::enable_natpmp, true);
m_provider->apply_settings(settingsPack);
#endif
for (auto i = m_mappedPorts.begin(); i != m_mappedPorts.end(); ++i) {
// quint16 port = i.key();
i.value() = m_provider->add_port_mapping(libt::session::tcp, i.key(), i.key());
@ -132,15 +126,10 @@ void PortForwarder::start() @@ -132,15 +126,10 @@ void PortForwarder::start()
void PortForwarder::stop()
{
qDebug("Disabling UPnP / NAT-PMP");
#if LIBTORRENT_VERSION_NUM < 10100
m_provider->stop_upnp();
m_provider->stop_natpmp();
#else
libt::settings_pack settingsPack = m_provider->get_settings();
settingsPack.set_bool(libt::settings_pack::enable_upnp, false);
settingsPack.set_bool(libt::settings_pack::enable_natpmp, false);
m_provider->apply_settings(settingsPack);
#endif
m_active = false;
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [OFF]"), Log::INFO);
}

3
src/gui/CMakeLists.txt

@ -52,7 +52,6 @@ torrentcontentmodelfolder.h @@ -52,7 +52,6 @@ torrentcontentmodelfolder.h
torrentcontentmodelitem.h
torrentcontenttreeview.h
torrentcreatordialog.h
trackerlogindialog.h
transferlistdelegate.h
transferlistfilterswidget.h
transferlistmodel.h
@ -98,7 +97,6 @@ torrentcontentmodelfolder.cpp @@ -98,7 +97,6 @@ torrentcontentmodelfolder.cpp
torrentcontentmodelitem.cpp
torrentcontenttreeview.cpp
torrentcreatordialog.cpp
trackerlogindialog.cpp
transferlistdelegate.cpp
transferlistfilterswidget.cpp
transferlistmodel.cpp
@ -125,7 +123,6 @@ speedlimitdialog.ui @@ -125,7 +123,6 @@ speedlimitdialog.ui
statsdialog.ui
torrentcategorydialog.ui
torrentcreatordialog.ui
trackerlogindialog.ui
updownratiodialog.ui
)

10
src/gui/advancedsettings.cpp

@ -81,18 +81,14 @@ enum AdvSettingsRows @@ -81,18 +81,14 @@ enum AdvSettingsRows
// libtorrent section
LIBTORRENT_HEADER,
#if LIBTORRENT_VERSION_NUM >= 10100
ASYNC_IO_THREADS,
#endif
CHECKING_MEM_USAGE,
// cache
DISK_CACHE,
DISK_CACHE_TTL,
OS_CACHE,
GUIDED_READ_CACHE,
#if LIBTORRENT_VERSION_NUM >= 10107
COALESCE_RW,
#endif
SUGGEST_MODE,
SEND_BUF_WATERMARK,
SEND_BUF_LOW_WATERMARK,
@ -150,10 +146,8 @@ void AdvancedSettings::saveAdvancedSettings() @@ -150,10 +146,8 @@ void AdvancedSettings::saveAdvancedSettings()
Preferences *const pref = Preferences::instance();
BitTorrent::Session *const session = BitTorrent::Session::instance();
#if LIBTORRENT_VERSION_NUM >= 10100
// Async IO threads
session->setAsyncIOThreads(spinBoxAsyncIOThreads.value());
#endif
// Checking Memory Usage
session->setCheckingMemUsage(spinBoxCheckingMemUsage.value());
// Disk write cache
@ -322,13 +316,11 @@ void AdvancedSettings::loadAdvancedSettings() @@ -322,13 +316,11 @@ void AdvancedSettings::loadAdvancedSettings()
labelLibtorrentLink.setText(QString("<a href=\"%1\">%2</a>").arg("https://www.libtorrent.org/reference.html", tr("Open documentation")));
labelLibtorrentLink.setOpenExternalLinks(true);
#if LIBTORRENT_VERSION_NUM >= 10100
// Async IO threads
spinBoxAsyncIOThreads.setMinimum(1);
spinBoxAsyncIOThreads.setMaximum(1024);
spinBoxAsyncIOThreads.setValue(session->asyncIOThreads());
addRow(ASYNC_IO_THREADS, tr("Asynchronous I/O threads"), &spinBoxAsyncIOThreads);
#endif
// Checking Memory Usage
spinBoxCheckingMemUsage.setMinimum(1);
@ -363,9 +355,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -363,9 +355,7 @@ void AdvancedSettings::loadAdvancedSettings()
addRow(GUIDED_READ_CACHE, tr("Guided read cache"), &checkBoxGuidedReadCache);
// Coalesce reads & writes
checkBoxCoalesceRW.setChecked(session->isCoalesceReadWriteEnabled());
#if LIBTORRENT_VERSION_NUM >= 10107
addRow(COALESCE_RW, tr("Coalesce reads & writes"), &checkBoxCoalesceRW);
#endif
// Suggest mode
checkBoxSuggestMode.setChecked(session->isSuggestModeEnabled());
addRow(SUGGEST_MODE, tr("Send upload piece suggestions"), &checkBoxSuggestMode);

3
src/gui/gui.pri

@ -57,7 +57,6 @@ HEADERS += \ @@ -57,7 +57,6 @@ HEADERS += \
$$PWD/torrentcontentmodelitem.h \
$$PWD/torrentcontenttreeview.h \
$$PWD/torrentcreatordialog.h \
$$PWD/trackerlogindialog.h \
$$PWD/transferlistdelegate.h \
$$PWD/transferlistfilterswidget.h \
$$PWD/transferlistmodel.h \
@ -114,7 +113,6 @@ SOURCES += \ @@ -114,7 +113,6 @@ SOURCES += \
$$PWD/torrentcontentmodelitem.cpp \
$$PWD/torrentcontenttreeview.cpp \
$$PWD/torrentcreatordialog.cpp \
$$PWD/trackerlogindialog.cpp \
$$PWD/transferlistdelegate.cpp \
$$PWD/transferlistfilterswidget.cpp \
$$PWD/transferlistmodel.cpp \
@ -157,7 +155,6 @@ FORMS += \ @@ -157,7 +155,6 @@ FORMS += \
$$PWD/statsdialog.ui \
$$PWD/torrentcategorydialog.ui \
$$PWD/torrentcreatordialog.ui \
$$PWD/trackerlogindialog.ui \
$$PWD/updownratiodialog.ui
RESOURCES += $$PWD/about.qrc

23
src/gui/mainwindow.cpp

@ -106,9 +106,6 @@ @@ -106,9 +106,6 @@
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
#include "programupdater.h"
#endif
#if LIBTORRENT_VERSION_NUM < 10100
#include "trackerlogindialog.h"
#endif
#ifdef Q_OS_MAC
void qt_mac_set_dock_menu(QMenu *menu);
@ -214,7 +211,6 @@ MainWindow::MainWindow(QWidget *parent) @@ -214,7 +211,6 @@ MainWindow::MainWindow(QWidget *parent)
connect(BitTorrent::Session::instance(), &BitTorrent::Session::addTorrentFailed, this, &MainWindow::addTorrentFailed);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentNew,this, &MainWindow::torrentNew);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::torrentFinished, this, &MainWindow::finishedTorrent);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::trackerAuthenticationRequired, this, &MainWindow::trackerAuthenticationRequired);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::downloadFromUrlFailed, this, &MainWindow::handleDownloadFromUrlFailure);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::speedLimitModeChanged, this, &MainWindow::updateAltSpeedsBtn);
connect(BitTorrent::Session::instance(), &BitTorrent::Session::recursiveTorrentDownloadPossible, this, &MainWindow::askRecursiveTorrentDownloadConfirmation);
@ -1527,25 +1523,6 @@ void MainWindow::loadPreferences(bool configureSession) @@ -1527,25 +1523,6 @@ void MainWindow::loadPreferences(bool configureSession)
qDebug("GUI settings loaded");
}
void MainWindow::addUnauthenticatedTracker(const QPair<BitTorrent::TorrentHandle *, QString> &tracker)
{
// Trackers whose authentication was cancelled
if (m_unauthenticatedTrackers.indexOf(tracker) < 0)
m_unauthenticatedTrackers << tracker;
}
// Called when a tracker requires authentication
void MainWindow::trackerAuthenticationRequired(BitTorrent::TorrentHandle *const torrent)
{
#if LIBTORRENT_VERSION_NUM < 10100
if (m_unauthenticatedTrackers.indexOf(qMakePair(torrent, torrent->currentTracker())) < 0)
// Tracker login
new TrackerLoginDialog(this, torrent);
#else
Q_UNUSED(torrent);
#endif
}
// Check connection status and display right icon
void MainWindow::updateGUI()
{

4
src/gui/mainwindow.h

@ -124,7 +124,6 @@ private slots: @@ -124,7 +124,6 @@ private slots:
void focusSearchFilter();
void updateGUI();
void loadPreferences(bool configureSession = true);
void addUnauthenticatedTracker(const QPair<BitTorrent::TorrentHandle *, QString> &tracker);
void addTorrentFailed(const QString &error) const;
void torrentNew(BitTorrent::TorrentHandle *const torrent) const;
void finishedTorrent(BitTorrent::TorrentHandle *const torrent) const;
@ -142,7 +141,6 @@ private slots: @@ -142,7 +141,6 @@ private slots:
void addToolbarContextMenu();
void manageCookies();
void trackerAuthenticationRequired(BitTorrent::TorrentHandle *const torrent);
void downloadFromURLList(const QStringList &urlList);
void updateAltSpeedsBtn(bool alternative);
void updateNbTorrents();
@ -217,8 +215,6 @@ private: @@ -217,8 +215,6 @@ private:
Ui::MainWindow *m_ui;
QFileSystemWatcher *m_executableWatcher;
// Bittorrent
QList<QPair<BitTorrent::TorrentHandle *, QString >> m_unauthenticatedTrackers; // Still needed?
// GUI related
bool m_posInitialized;
QPointer<QTabWidget> m_tabs;

78
src/gui/trackerlogindialog.cpp

@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#include "trackerlogindialog.h"
#include <libtorrent/version.hpp>
#include <QPushButton>
#include "base/bittorrent/torrenthandle.h"
#include "guiiconprovider.h"
#include "utils.h"
TrackerLoginDialog::TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
: QDialog(parent)
, m_torrent(torrent)
{
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Log in"));
labelLoginLogo->setPixmap(Utils::Gui::scaledPixmap(GuiIconProvider::instance()->getIcon("document-encrypt"), this, 32));
labelTrackerURL->setText(torrent->currentTracker());
connect(buttonBox, &QDialogButtonBox::accepted, this, &TrackerLoginDialog::loginButtonClicked);
connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackerLoginDialog::cancelButtonClicked);
connect(linePasswd, &QLineEdit::returnPressed, this, &TrackerLoginDialog::loginButtonClicked);
connect(this, SIGNAL(trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString>)), // TODO: use Qt5 connect syntax
parent, SLOT(addUnauthenticatedTracker(QPair<BitTorrent::TorrentHandle*, QString>)));
Utils::Gui::resize(this);
show();
}
TrackerLoginDialog::~TrackerLoginDialog() {}
void TrackerLoginDialog::loginButtonClicked()
{
// login
#if LIBTORRENT_VERSION_NUM < 10100
m_torrent->setTrackerLogin(lineUsername->text(), linePasswd->text());
#endif
accept();
}
void TrackerLoginDialog::cancelButtonClicked()
{
// Emit a signal to GUI to stop asking for authentication
emit trackerLoginCancelled(qMakePair(m_torrent, m_torrent->currentTracker()));
reject();
}

60
src/gui/trackerlogindialog.h

@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#ifndef TRACKERLOGINDIALOG_H
#define TRACKERLOGINDIALOG_H
#include <QDialog>
#include "ui_trackerlogindialog.h"
namespace BitTorrent
{
class TorrentHandle;
}
class TrackerLoginDialog : public QDialog, private Ui::TrackerLoginDialog
{
Q_OBJECT
public:
TrackerLoginDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent);
~TrackerLoginDialog();
signals:
void trackerLoginCancelled(QPair<BitTorrent::TorrentHandle*, QString> tracker);
private slots:
void loginButtonClicked();
void cancelButtonClicked();
private:
BitTorrent::TorrentHandle *const m_torrent;
};
#endif // TRACKERLOGINDIALOG_H

167
src/gui/trackerlogindialog.ui

@ -1,167 +0,0 @@ @@ -1,167 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TrackerLoginDialog</class>
<widget class="QDialog" name="TrackerLoginDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>311</width>
<height>231</height>
</rect>
</property>
<property name="windowTitle">
<string>Tracker authentication</string>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="labelLoginLogo">
<property name="maximumSize">
<size>
<width>39</width>
<height>39</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="login_title">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>39</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Tracker authentication</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="lbl_tracker">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Tracker:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelTrackerURL">
<property name="minimumSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Login</string>
</property>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="lbl_username">
<property name="text">
<string>Username:</string>
</property>
<property name="buddy">
<cstring>lineUsername</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineUsername"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="lbl_passwd">
<property name="minimumSize">
<size>
<width>68</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Password:</string>
</property>
<property name="buddy">
<cstring>linePasswd</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="linePasswd">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>lineUsername</sender>
<signal>returnPressed()</signal>
<receiver>linePasswd</receiver>
<slot>setFocus()</slot>
<hints>
<hint type="sourcelabel">
<x>199</x>
<y>130</y>
</hint>
<hint type="destinationlabel">
<x>198</x>
<y>157</y>
</hint>
</hints>
</connection>
</connections>
</ui>

5
src/gui/transferlistdelegate.cpp

@ -257,11 +257,6 @@ QString TransferListDelegate::getStatusString(const BitTorrent::TorrentState sta @@ -257,11 +257,6 @@ QString TransferListDelegate::getStatusString(const BitTorrent::TorrentState sta
case BitTorrent::TorrentState::CheckingUploading:
str = tr("Checking", "Torrent local data is being checked");
break;
#if LIBTORRENT_VERSION_NUM < 10100
case BitTorrent::TorrentState::QueuedForChecking:
str = tr("Queued for checking", "i.e. torrent is queued for hash checking");
break;
#endif
case BitTorrent::TorrentState::CheckingResumeData:
str = tr("Checking resume data", "used when loading the torrents from disk after qbt is launched. It checks the correctness of the .fastresume file. Normally it is completed in a fraction of a second, unless loading many many torrents.");
break;

6
src/gui/transferlistmodel.cpp

@ -343,9 +343,6 @@ QIcon getIconByState(BitTorrent::TorrentState state) @@ -343,9 +343,6 @@ QIcon getIconByState(BitTorrent::TorrentState state)
return getQueuedIcon();
case BitTorrent::TorrentState::CheckingDownloading:
case BitTorrent::TorrentState::CheckingUploading:
#if LIBTORRENT_VERSION_NUM < 10100
case BitTorrent::TorrentState::QueuedForChecking:
#endif
case BitTorrent::TorrentState::CheckingResumeData:
case BitTorrent::TorrentState::Moving:
return getCheckingIcon();
@ -399,9 +396,6 @@ QColor getColorByState(BitTorrent::TorrentState state) @@ -399,9 +396,6 @@ QColor getColorByState(BitTorrent::TorrentState state)
case BitTorrent::TorrentState::QueuedUploading:
case BitTorrent::TorrentState::CheckingDownloading:
case BitTorrent::TorrentState::CheckingUploading:
#if LIBTORRENT_VERSION_NUM < 10100
case BitTorrent::TorrentState::QueuedForChecking:
#endif
case BitTorrent::TorrentState::CheckingResumeData:
case BitTorrent::TorrentState::Moving:
if (!dark)

4
src/webui/api/serialize/serialize_torrent.cpp

@ -70,10 +70,6 @@ namespace @@ -70,10 +70,6 @@ namespace
return QLatin1String("checkingDL");
case BitTorrent::TorrentState::ForcedDownloading:
return QLatin1String("forcedDL");
#if LIBTORRENT_VERSION_NUM < 10100
case BitTorrent::TorrentState::QueuedForChecking:
return QLatin1String("queuedForChecking");
#endif
case BitTorrent::TorrentState::CheckingResumeData:
return QLatin1String("checkingResumeData");
case BitTorrent::TorrentState::Moving:

Loading…
Cancel
Save