Drop libtorrent 0.16.x support.

This commit is contained in:
Vladimir Golovnev (Glassez)
2015-07-25 15:40:15 +03:00
parent f9dc76928c
commit e72cc4eaf9
22 changed files with 115 additions and 498 deletions

View File

@@ -29,13 +29,7 @@
#ifndef BITTORRENT_INFOHASH_H
#define BITTORRENT_INFOHASH_H
#include <libtorrent/version.hpp>
#if LIBTORRENT_VERSION_NUM < 10000
#include <libtorrent/peer_id.hpp>
#else
#include <libtorrent/sha1_hash.hpp>
#endif
#include <QString>
namespace BitTorrent

View File

@@ -53,10 +53,8 @@ MagnetUri::MagnetUri(const QString &url)
foreach (const std::string &tracker, m_addTorrentParams.trackers)
m_trackers.append(Utils::String::fromStdString(tracker));
#if LIBTORRENT_VERSION_NUM >= 10000
foreach (const std::string &urlSeed, m_addTorrentParams.url_seeds)
m_urlSeeds.append(QUrl(urlSeed.c_str()));
#endif
}
bool MagnetUri::isValid() const

View File

@@ -26,8 +26,6 @@
* exception statement from your version.
*/
#include <libtorrent/version.hpp>
#include "core/net/geoipmanager.h"
#include "core/utils/string.h"
#include "peerinfo.h"
@@ -169,20 +167,12 @@ bool PeerInfo::useI2PSocket() const
bool PeerInfo::useUTPSocket() const
{
#if LIBTORRENT_VERSION_NUM < 10000
return (m_nativeInfo.connection_type & libt::peer_info::bittorrent_utp);
#else
return (m_nativeInfo.flags & libt::peer_info::utp_socket);
#endif
}
bool PeerInfo::useSSLSocket() const
{
#if LIBTORRENT_VERSION_NUM < 10000
return false;
#else
return (m_nativeInfo.flags & libt::peer_info::ssl_socket);
#endif
}
bool PeerInfo::isRC4Encrypted() const
@@ -239,12 +229,7 @@ QBitArray PeerInfo::pieces() const
{
QBitArray result(m_nativeInfo.pieces.size());
#if LIBTORRENT_VERSION_NUM < 10000
typedef size_t pieces_size_t;
#else
typedef int pieces_size_t;
#endif
for (pieces_size_t i = 0; i < m_nativeInfo.pieces.size(); ++i)
for (int i = 0; i < m_nativeInfo.pieces.size(); ++i)
result.setBit(i, m_nativeInfo.pieces.get_bit(i));
return result;
@@ -252,11 +237,7 @@ QBitArray PeerInfo::pieces() const
QString PeerInfo::connectionType() const
{
#if LIBTORRENT_VERSION_NUM < 10000
if (m_nativeInfo.connection_type & libt::peer_info::bittorrent_utp)
#else
if (m_nativeInfo.flags & libt::peer_info::utp_socket)
#endif
return QString::fromUtf8("μTP");
QString connection;

View File

@@ -46,7 +46,6 @@ using namespace BitTorrent;
#include <queue>
#include <vector>
#include <libtorrent/version.hpp>
#include <libtorrent/session.hpp>
#include <libtorrent/lazy_entry.hpp>
#include <libtorrent/bencode.hpp>
@@ -430,12 +429,10 @@ void Session::setSessionSettings()
else
sessionSettings.mixed_mode_algorithm = libt::session_settings::peer_proportional;
sessionSettings.connection_speed = 20; //default is 10
#if LIBTORRENT_VERSION_NUM >= 10000
if (pref->isProxyEnabled())
sessionSettings.force_proxy = pref->getForceProxy();
else
sessionSettings.force_proxy = false;
#endif
sessionSettings.no_connect_privileged_ports = false;
sessionSettings.seed_choking_algorithm = libt::session_settings::fastest_upload;
qDebug() << "Set session settings";
@@ -1070,21 +1067,13 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma
if (addData.resumed && !fromMagnetUri) {
// Set torrent fast resume data
#if LIBTORRENT_VERSION_NUM < 10000
p.resume_data = &buf;
#else
p.resume_data = buf;
p.flags |= libt::add_torrent_params::flag_use_resume_save_path;
#endif
}
else {
foreach (int prio, addData.filePriorities)
filePriorities.push_back(prio);
#if LIBTORRENT_VERSION_NUM < 10000
p.file_priorities = &filePriorities;
#else
p.file_priorities = filePriorities;
#endif
}
// We should not add torrent if it already
@@ -1118,12 +1107,10 @@ bool Session::addTorrent_impl(const AddTorrentData &addData, const MagnetUri &ma
else
p.flags &= ~libt::add_torrent_params::flag_seed_mode;
#if LIBTORRENT_VERSION_NUM >= 10000
// Limits
Preferences *const pref = Preferences::instance();
p.max_connections = pref->getMaxConnecsPerTorrent();
p.max_uploads = pref->getMaxUploadsPerTorrent();
#endif
QString savePath;
// Set actual save path (e.g. temporary folder)
@@ -1184,11 +1171,9 @@ bool Session::loadMetadata(const QString &magnetUri)
p.storage_mode = libt::storage_mode_sparse;
Preferences *const pref = Preferences::instance();
#if LIBTORRENT_VERSION_NUM >= 10000
// Limits
p.max_connections = pref->getMaxConnecsPerTorrent();
p.max_uploads = pref->getMaxUploadsPerTorrent();
#endif
QString savePath = QString("%1/%2").arg(QDir::tempPath()).arg(hash);
p.save_path = Utils::String::toStdString(Utils::Fs::toNativePath(savePath));
@@ -1207,11 +1192,6 @@ bool Session::loadMetadata(const QString &magnetUri)
libt::torrent_handle h = m_nativeSession->add_torrent(p, ec);
if (ec) return false;
#if LIBTORRENT_VERSION_NUM < 10000
h.set_max_connections(pref->getMaxConnecsPerTorrent());
h.set_max_uploads(pref->getMaxUploadsPerTorrent());
#endif
// waiting for metadata...
m_loadedMetadata.insert(h.info_hash(), TorrentInfo());
++m_extraLimit;
@@ -2079,13 +2059,6 @@ void Session::handleAddTorrentAlert(libtorrent::add_torrent_alert *p)
m_torrents.insert(torrent->hash(), torrent);
Preferences *const pref = Preferences::instance();
#if LIBTORRENT_VERSION_NUM < 10000
try {
p->handle.set_max_connections(pref->getMaxConnecsPerTorrent());
p->handle.set_max_uploads(pref->getMaxUploadsPerTorrent());
}
catch (std::exception &) {}
#endif
bool fromMagnetUri = !torrent->hasMetadata();
@@ -2158,11 +2131,7 @@ void Session::handleMetadataReceivedAlert(libt::metadata_received_alert *p)
if (m_loadedMetadata.contains(hash)) {
--m_extraLimit;
adjustLimits();
#if LIBTORRENT_VERSION_NUM < 10000
m_loadedMetadata[hash] = TorrentInfo(&p->handle.get_torrent_info());
#else
m_loadedMetadata[hash] = TorrentInfo(p->handle.torrent_file());
#endif
m_nativeSession->remove_torrent(p->handle, libt::session::delete_files);
}
}
@@ -2195,10 +2164,6 @@ void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p)
{
boost::system::error_code ec;
std::string ip = p->ip.to_string(ec);
#if LIBTORRENT_VERSION_NUM < 10000
if (!ec)
Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), true);
#else
QString reason;
switch (p->reason) {
case libt::peer_blocked_alert::ip_filter:
@@ -2223,7 +2188,6 @@ void Session::handlePeerBlockedAlert(libt::peer_blocked_alert *p)
if (!ec)
Logger::instance()->addPeer(QString::fromLatin1(ip.c_str()), true, reason);
#endif
}
void Session::handlePeerBanAlert(libt::peer_ban_alert *p)
@@ -2243,14 +2207,12 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
{
boost::system::error_code ec;
QString proto = "TCP";
#if LIBTORRENT_VERSION_NUM >= 10000
if (p->sock_type == libt::listen_succeeded_alert::udp)
proto = "UDP";
else if (p->sock_type == libt::listen_succeeded_alert::tcp)
proto = "TCP";
else if (p->sock_type == libt::listen_succeeded_alert::tcp_ssl)
proto = "TCP_SSL";
#endif
qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
Logger::instance()->addMessage(tr("qBittorrent is successfully listening on interface %1 port: %2/%3", "e.g: qBittorrent is successfully listening on interface 192.168.0.1 port: TCP/6881").arg(p->endpoint.address().to_string(ec).c_str()).arg(proto).arg(QString::number(p->endpoint.port())), Log::INFO);
@@ -2266,7 +2228,6 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
{
boost::system::error_code ec;
QString proto = "TCP";
#if LIBTORRENT_VERSION_NUM >= 10000
if (p->sock_type == libt::listen_failed_alert::udp)
proto = "UDP";
else if (p->sock_type == libt::listen_failed_alert::tcp)
@@ -2277,7 +2238,6 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
proto = "I2P";
else if (p->sock_type == libt::listen_failed_alert::socks5)
proto = "SOCKS5";
#endif
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
Logger::instance()->addMessage(
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4",

View File

@@ -28,7 +28,6 @@
* Contact : chris@qbittorrent.org
*/
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/torrent_info.hpp>

View File

@@ -34,7 +34,6 @@
#include <QByteArray>
#include <QBitArray>
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/address.hpp>
@@ -230,13 +229,8 @@ InfoHash TorrentHandle::hash() const
QString TorrentHandle::name() const
{
QString name = m_name;
if (name.isEmpty()) {
#if LIBTORRENT_VERSION_NUM < 10000
name = m_nativeName;
#else
if (name.isEmpty())
name = Utils::String::fromStdString(m_nativeStatus.name);
#endif
}
if (name.isEmpty())
name = m_hash;
@@ -319,11 +313,7 @@ QString TorrentHandle::rootPath() const
QString TorrentHandle::nativeActualSavePath() const
{
#if LIBTORRENT_VERSION_NUM < 10000
return m_nativeSavePath;
#else
return Utils::String::fromStdString(m_nativeStatus.save_path);
#endif
}
QString TorrentHandle::actualSavePath() const
@@ -1014,12 +1004,7 @@ QBitArray TorrentHandle::pieces() const
{
QBitArray result(m_nativeStatus.pieces.size());
#if LIBTORRENT_VERSION_NUM < 10000
typedef size_t pieces_size_t;
#else
typedef int pieces_size_t;
#endif
for (pieces_size_t i = 0; i < m_nativeStatus.pieces.size(); ++i)
for (int i = 0; i < m_nativeStatus.pieces.size(); ++i)
result.setBit(i, m_nativeStatus.pieces.get_bit(i));
return result;
@@ -1162,19 +1147,10 @@ void TorrentHandle::move(QString path)
}
}
#if LIBTORRENT_VERSION_NUM < 10000
void TorrentHandle::forceReannounce()
{
SAFE_CALL(force_reannounce);
}
#else
void TorrentHandle::forceReannounce(int index)
{
SAFE_CALL(force_reannounce, 0, index);
}
#endif
void TorrentHandle::forceDHTAnnounce()
{
@@ -1753,16 +1729,7 @@ void TorrentHandle::updateTorrentInfo()
{
if (!hasMetadata()) return;
#if LIBTORRENT_VERSION_NUM < 10000
try {
m_torrentInfo = TorrentInfo(&m_nativeHandle.get_torrent_info());
}
catch (std::exception &exc) {
qDebug("torrent_handle::get_torrent_info() throws exception: %s", exc.what()); \
}
#else
m_torrentInfo = TorrentInfo(m_nativeStatus.torrent_file);
#endif
}
void TorrentHandle::initialize()
@@ -1801,15 +1768,6 @@ void TorrentHandle::updateStatus()
void TorrentHandle::updateStatus(const libtorrent::torrent_status &nativeStatus)
{
m_nativeStatus = nativeStatus;
#if LIBTORRENT_VERSION_NUM < 10000
try {
m_nativeName = Utils::String::fromStdString(m_nativeHandle.name());
m_nativeSavePath = Utils::Fs::fromNativePath(Utils::String::fromStdString(m_nativeHandle.save_path()));
}
catch (std::exception &exc) {
qDebug("torrent_handle method inside TorrentHandleImpl::updateStatus() throws exception: %s", exc.what());
}
#endif
updateState();
updateTorrentInfo();

View File

@@ -272,11 +272,7 @@ namespace BitTorrent
void pause();
void resume(bool forced = false);
void move(QString path);
#if LIBTORRENT_VERSION_NUM < 10000
void forceReannounce();
#else
void forceReannounce(int index = -1);
#endif
void forceDHTAnnounce();
void forceRecheck();
void setTrackerLogin(const QString &username, const QString &password);
@@ -354,10 +350,6 @@ namespace BitTorrent
TorrentState m_state;
TorrentInfo m_torrentInfo;
SpeedMonitor m_speedMonitor;
#if LIBTORRENT_VERSION_NUM < 10000
QString m_nativeName;
QString m_nativeSavePath;
#endif
InfoHash m_hash;

View File

@@ -16,18 +16,12 @@ namespace Log
Peer::Peer() {}
#if LIBTORRENT_VERSION_NUM < 10000
Peer::Peer(int id, const QString &ip, bool blocked)
#else
Peer::Peer(int id, const QString &ip, bool blocked, const QString &reason)
#endif
: id(id)
, timestamp(QDateTime::currentMSecsSinceEpoch())
, ip(ip)
, blocked(blocked)
#if LIBTORRENT_VERSION_NUM >= 10000
, reason(reason)
#endif
{
}
@@ -76,19 +70,11 @@ void Logger::addMessage(const QString &message, const Log::MsgType &type)
emit newLogMessage(temp);
}
#if LIBTORRENT_VERSION_NUM < 10000
void Logger::addPeer(const QString &ip, bool blocked)
#else
void Logger::addPeer(const QString &ip, bool blocked, const QString &reason)
#endif
{
QWriteLocker locker(&lock);
#if LIBTORRENT_VERSION_NUM < 10000
Log::Peer temp(peerCounter++, ip, blocked);
#else
Log::Peer temp(peerCounter++, ip, blocked, reason);
#endif
m_peers.push_back(temp);
if (m_peers.size() >= MAX_LOG_MESSAGES)

View File

@@ -5,7 +5,6 @@
#include <QVector>
#include <QReadWriteLock>
#include <QObject>
#include <libtorrent/version.hpp>
const int MAX_LOG_MESSAGES = 1000;
@@ -31,19 +30,13 @@ namespace Log
struct Peer
{
#if LIBTORRENT_VERSION_NUM < 10000
Peer(int id, const QString &ip, bool blocked);
#else
Peer(int id, const QString &ip, bool blocked, const QString &reason);
#endif
Peer();
int id;
qint64 timestamp;
QString ip;
bool blocked;
#if LIBTORRENT_VERSION_NUM >= 10000
QString reason;
#endif
};
}
@@ -58,11 +51,7 @@ public:
static Logger *instance();
void addMessage(const QString &message, const Log::MsgType &type = Log::NORMAL);
#if LIBTORRENT_VERSION_NUM < 10000
void addPeer(const QString &ip, bool blocked);
#else
void addPeer(const QString &ip, bool blocked, const QString &reason = QString());
#endif
QVector<Log::Msg> getMessages(int lastKnownId = -1) const;
QVector<Log::Peer> getPeers(int lastKnownId = -1) const;

View File

@@ -29,10 +29,6 @@
#include <QDebug>
#include <libtorrent/session.hpp>
#if LIBTORRENT_VERSION_NUM < 10000
#include <libtorrent/upnp.hpp>
#include <libtorrent/natpmp.hpp>
#endif
#include "core/logger.h"
#include "core/preferences.h"
@@ -45,10 +41,6 @@ PortForwarder::PortForwarder(libtorrent::session *provider, QObject *parent)
: QObject(parent)
, m_active(false)
, m_provider(provider)
#if LIBTORRENT_VERSION_NUM < 10000
, m_upnp(0)
, m_natpmp(0)
#endif
{
configure();
connect(Preferences::instance(), SIGNAL(changed()), SLOT(configure()));
@@ -81,33 +73,17 @@ PortForwarder *PortForwarder::instance()
void PortForwarder::addPort(qint16 port)
{
if (!m_mappedPorts.contains(port)) {
#if LIBTORRENT_VERSION_NUM < 10000
m_mappedPorts.insert(port, qMakePair(0, 0));
#else
m_mappedPorts.insert(port, 0);
#endif
if (m_active) {
#if LIBTORRENT_VERSION_NUM < 10000
m_mappedPorts[port].first = m_upnp->add_mapping(libt::upnp::tcp, port, port);
m_mappedPorts[port].second = m_natpmp->add_mapping(libt::natpmp::tcp, port, port);
#else
if (m_active)
m_mappedPorts[port] = m_provider->add_port_mapping(libt::session::tcp, port, port);
#endif
}
}
}
void PortForwarder::deletePort(qint16 port)
{
if (m_mappedPorts.contains(port)) {
if (m_active) {
#if LIBTORRENT_VERSION_NUM < 10000
m_upnp->delete_mapping(m_mappedPorts[port].first);
m_natpmp->delete_mapping(m_mappedPorts[port].second);
#else
if (m_active)
m_provider->delete_port_mapping(m_mappedPorts[port]);
#endif
}
m_mappedPorts.remove(port);
}
}
@@ -126,19 +102,10 @@ void PortForwarder::configure()
void PortForwarder::start()
{
qDebug("Enabling UPnP / NAT-PMP");
#if LIBTORRENT_VERSION_NUM < 10000
m_upnp = m_provider->start_upnp();
m_natpmp = m_provider->start_natpmp();
foreach (qint16 port, m_mappedPorts.keys()) {
m_mappedPorts[port].first = m_upnp->add_mapping(libt::upnp::tcp, port, port);
m_mappedPorts[port].second = m_natpmp->add_mapping(libt::natpmp::tcp, port, port);
}
#else
m_provider->start_upnp();
m_provider->start_natpmp();
foreach (qint16 port, m_mappedPorts.keys())
m_mappedPorts[port] = m_provider->add_port_mapping(libt::session::tcp, port, port);
#endif
m_active = true;
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [ON]"), Log::INFO);
}
@@ -148,11 +115,6 @@ void PortForwarder::stop()
qDebug("Disabling UPnP / NAT-PMP");
m_provider->stop_upnp();
m_provider->stop_natpmp();
#if LIBTORRENT_VERSION_NUM < 10000
m_upnp = 0;
m_natpmp = 0;
#endif
m_active = false;
Logger::instance()->addMessage(tr("UPnP / NAT-PMP support [OFF]"), Log::INFO);
}

View File

@@ -31,14 +31,9 @@
#include <QObject>
#include <QHash>
#include <libtorrent/version.hpp>
namespace libtorrent
{
#if LIBTORRENT_VERSION_NUM < 10000
class upnp;
class natpmp;
#endif
class session;
}
@@ -69,13 +64,7 @@ namespace Net
bool m_active;
libtorrent::session *m_provider;
#if LIBTORRENT_VERSION_NUM < 10000
libtorrent::upnp *m_upnp;
libtorrent::natpmp *m_natpmp;
QHash<qint16, QPair<int, int> > m_mappedPorts;
#else
QHash<qint16, int> m_mappedPorts;
#endif
static PortForwarder *m_instance;
};

View File

@@ -822,7 +822,6 @@ void Preferences::setProxyPeerConnections(bool enabled)
setValue("Preferences/Connection/ProxyPeerConnections", enabled);
}
#if LIBTORRENT_VERSION_NUM >= 10000
bool Preferences::getForceProxy() const
{
return value("Preferences/Connection/ProxyForce", true).toBool();
@@ -832,7 +831,6 @@ void Preferences::setForceProxy(bool enabled)
{
setValue("Preferences/Connection/ProxyForce", enabled);
}
#endif
// Bittorrent options
int Preferences::getMaxConnecs() const

View File

@@ -41,8 +41,6 @@
#include <QNetworkCookie>
#include <QVariant>
#include <libtorrent/version.hpp>
#include "core/types.h"
enum scheduler_days
@@ -246,10 +244,8 @@ public:
void setProxyType(int type);
bool proxyPeerConnections() const;
void setProxyPeerConnections(bool enabled);
#if LIBTORRENT_VERSION_NUM >= 10000
bool getForceProxy() const;
void setForceProxy(bool enabled);
#endif
// Bittorrent options
int getMaxConnecs() const;

View File

@@ -98,11 +98,7 @@ void ExecutionLog::addPeerMessage(const Log::Peer& peer)
QDateTime time = QDateTime::fromMSecsSinceEpoch(peer.timestamp);
if (peer.blocked)
#if LIBTORRENT_VERSION_NUM < 10000
text = "<font color='grey'>" + time.toString(Qt::SystemLocaleShortDate) + "</font> - " + tr("<font color='red'>%1</font> was blocked", "x.y.z.w was blocked").arg(peer.ip);
#else
text = "<font color='grey'>" + time.toString(Qt::SystemLocaleShortDate) + "</font> - " + tr("<font color='red'>%1</font> was blocked %2", "x.y.z.w was blocked").arg(peer.ip).arg(peer.reason);
#endif
else
text = "<font color='grey'>" + time.toString(Qt::SystemLocaleShortDate) + "</font> - " + tr("<font color='red'>%1</font> was banned", "x.y.z.w was banned").arg(peer.ip);

View File

@@ -40,8 +40,6 @@
#include <QDesktopServices>
#include <QDebug>
#include <libtorrent/version.hpp>
#include <cstdlib>
#include "options_imp.h"
#include "core/preferences.h"
@@ -221,9 +219,7 @@ options_imp::options_imp(QWidget *parent):
connect(textProxyIP, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinProxyPort, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkProxyPeerConnecs, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
#if LIBTORRENT_VERSION_NUM >= 10000
connect(checkForceProxy, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
#endif
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textProxyUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(textProxyPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@@ -264,11 +260,6 @@ options_imp::options_imp(QWidget *parent):
scrollArea_advanced->setLayout(adv_layout);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
//Hide incompatible options
#if LIBTORRENT_VERSION_NUM < 10000
checkForceProxy->setVisible(false);
#endif
// Adapt size
show();
loadWindowState();
@@ -436,9 +427,7 @@ void options_imp::saveOptions() {
pref->setProxyIp(getProxyIp());
pref->setProxyPort(getProxyPort());
pref->setProxyPeerConnections(checkProxyPeerConnecs->isChecked());
#if LIBTORRENT_VERSION_NUM >= 10000
pref->setForceProxy(checkForceProxy->isChecked());
#endif
pref->setProxyAuthEnabled(isProxyAuthEnabled());
pref->setProxyUsername(getProxyUsername());
pref->setProxyPassword(getProxyPassword());
@@ -691,9 +680,7 @@ void options_imp::loadOptions() {
textProxyIP->setText(pref->getProxyIp());
spinProxyPort->setValue(pref->getProxyPort());
checkProxyPeerConnecs->setChecked(pref->proxyPeerConnections());
#if LIBTORRENT_VERSION_NUM >= 10000
checkForceProxy->setChecked(pref->getForceProxy());
#endif
checkProxyAuth->setChecked(pref->isProxyAuthEnabled());
textProxyUsername->setText(pref->getProxyUsername());
textProxyPassword->setText(pref->getProxyPassword());
@@ -995,9 +982,7 @@ void options_imp::enableProxy(int index) {
lblProxyPort->setEnabled(true);
spinProxyPort->setEnabled(true);
checkProxyPeerConnecs->setEnabled(true);
#if LIBTORRENT_VERSION_NUM >= 10000
checkForceProxy->setEnabled(true);
#endif
if (index > 1) {
checkProxyAuth->setEnabled(true);
} else {
@@ -1011,9 +996,7 @@ void options_imp::enableProxy(int index) {
lblProxyPort->setEnabled(false);
spinProxyPort->setEnabled(false);
checkProxyPeerConnecs->setEnabled(false);
#if LIBTORRENT_VERSION_NUM >= 10000
checkForceProxy->setEnabled(false);
#endif
checkProxyAuth->setEnabled(false);
checkProxyAuth->setChecked(false);
}

View File

@@ -399,7 +399,6 @@ void TrackerList::editSelectedTracker() {
}
}
#if LIBTORRENT_VERSION_NUM >= 10000
void TrackerList::reannounceSelected() {
QList<QTreeWidgetItem *> selected_items = selectedItems();
if (selected_items.isEmpty()) return;
@@ -427,8 +426,6 @@ void TrackerList::reannounceSelected() {
loadTrackers();
}
#endif
void TrackerList::showTrackerListMenu(QPoint) {
BitTorrent::TorrentHandle *const torrent = properties->getCurrentTorrent();
if (!torrent) return;
@@ -444,14 +441,10 @@ void TrackerList::showTrackerListMenu(QPoint) {
copyAct = menu.addAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker URL"));
editAct = menu.addAction(GuiIconProvider::instance()->getIcon("edit-rename"),tr("Edit selected tracker URL"));
}
#if LIBTORRENT_VERSION_NUM >= 10000
QAction *reannounceSelAct = NULL;
#endif
QAction *reannounceAct = NULL;
if (!torrent->isPaused()) {
#if LIBTORRENT_VERSION_NUM >= 10000
reannounceSelAct = menu.addAction(GuiIconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers"));
#endif
menu.addSeparator();
reannounceAct = menu.addAction(GuiIconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
}
@@ -469,12 +462,10 @@ void TrackerList::showTrackerListMenu(QPoint) {
deleteSelectedTrackers();
return;
}
#if LIBTORRENT_VERSION_NUM >= 10000
if (act == reannounceSelAct) {
reannounceSelected();
return;
}
#endif
if (act == reannounceAct) {
BitTorrent::TorrentHandle *h = properties->getCurrentTorrent();
h->forceReannounce();

View File

@@ -36,7 +36,6 @@
#include <QList>
#include <QClipboard>
#include <libtorrent/version.hpp>
#include "propertieswidget.h"
enum TrackerListColumn {COL_TIER, COL_URL, COL_STATUS, COL_PEERS, COL_MSG};
@@ -79,9 +78,7 @@ public slots:
void loadTrackers();
void askForTrackers();
void copyTrackerUrl();
#if LIBTORRENT_VERSION_NUM >= 10000
void reannounceSelected();
#endif
void deleteSelectedTrackers();
void editSelectedTracker();
void showTrackerListMenu(QPoint);

View File

@@ -97,9 +97,7 @@ QByteArray prefjson::getPreferences()
data["proxy_ip"] = pref->getProxyIp();
data["proxy_port"] = pref->getProxyPort();
data["proxy_peer_connections"] = pref->proxyPeerConnections();
#if LIBTORRENT_VERSION_NUM >= 10000
data["force_proxy"] = pref->getForceProxy();
#endif
data["proxy_auth_enabled"] = pref->isProxyAuthEnabled();
data["proxy_username"] = pref->getProxyUsername();
data["proxy_password"] = pref->getProxyPassword();
@@ -264,10 +262,8 @@ void prefjson::setPreferences(const QString& json)
pref->setProxyPort(m["proxy_port"].toUInt());
if (m.contains("proxy_peer_connections"))
pref->setProxyPeerConnections(m["proxy_peer_connections"].toBool());
#if LIBTORRENT_VERSION_NUM >= 10000
if (m.contains("force_proxy"))
pref->setForceProxy(m["force_proxy"].toBool());
#endif
if (m.contains("proxy_auth_enabled"))
pref->setProxyAuthEnabled(m["proxy_auth_enabled"].toBool());
if (m.contains("proxy_username"))