Browse Source

Fix compilation with libtorrent 1.x.x.

adaptive-webui-19844
sledgehammer999 12 years ago
parent
commit
94b58ca229
  1. 6
      src/addnewtorrentdialog.cpp
  2. 4
      src/mainwindow.cpp
  3. 2
      src/misc.cpp
  4. 2
      src/misc.h
  5. 10
      src/preferences/options_imp.cpp
  6. 2
      src/preferences/preferences.h
  7. 6
      src/properties/peerlistwidget.cpp
  8. 2
      src/properties/propertieswidget.cpp
  9. 2
      src/properties/proplistdelegate.h
  10. 40
      src/qtlibtorrent/qbtsession.cpp
  11. 86
      src/qtlibtorrent/qtorrenthandle.cpp
  12. 2
      src/qtlibtorrent/torrentspeedmonitor.cpp
  13. 4
      src/statusbar.h
  14. 2
      src/torrentcontentmodel.cpp
  15. 2
      src/torrentcontentmodelfile.cpp
  16. 8
      src/torrentcreator/torrentcreatorthread.cpp
  17. 6
      src/torrentimportdlg.cpp
  18. 4
      src/webui/httpconnection.cpp
  19. 8
      src/webui/prefjson.cpp

6
src/addnewtorrentdialog.cpp

@ -188,13 +188,13 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString @@ -188,13 +188,13 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
ui->date_lbl->setText(m_torrentInfo->creation_date() ? misc::toQString(*m_torrentInfo->creation_date()) : tr("Not available"));
updateDiskSpaceLabel();
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
file_storage fs = m_torrentInfo->files();
#endif
// Populate m_filesList
for (int i = 0; i < m_torrentInfo->num_files(); ++i) {
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
m_filesPath << misc::toQStringU(fs.file_path(m_torrentInfo->file_at(i)));
#else
m_filesPath << misc::toQStringU(m_torrentInfo->file_at(i).path.string());
@ -220,7 +220,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString @@ -220,7 +220,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
ui->content_tree->header()->setResizeMode(0, QHeaderView::Stretch);
} else {
// Update save paths (append file name to them)
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
QString single_file_relpath = misc::toQStringU(fs.file_path(m_torrentInfo->file_at(0)));
#else
QString single_file_relpath = misc::toQStringU(m_torrentInfo->file_at(0).path.string());

4
src/mainwindow.cpp

@ -619,7 +619,7 @@ void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const @@ -619,7 +619,7 @@ void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const
void MainWindow::on_actionSet_global_upload_limit_triggered() {
qDebug("actionSet_global_upload_limit_triggered");
bool ok;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
int cur_limit = QBtSession::instance()->getSession()->settings().upload_rate_limit;
#else
int cur_limit = QBtSession::instance()->getSession()->upload_rate_limit();
@ -638,7 +638,7 @@ void MainWindow::on_actionSet_global_upload_limit_triggered() { @@ -638,7 +638,7 @@ void MainWindow::on_actionSet_global_upload_limit_triggered() {
void MainWindow::on_actionSet_global_download_limit_triggered() {
qDebug("actionSet_global_download_limit_triggered");
bool ok;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
int cur_limit = QBtSession::instance()->getSession()->settings().download_rate_limit;
#else
int cur_limit = QBtSession::instance()->getSession()->download_rate_limit();

2
src/misc.cpp

@ -502,7 +502,7 @@ QString misc::parseHtmlLinks(const QString &raw_text) @@ -502,7 +502,7 @@ QString misc::parseHtmlLinks(const QString &raw_text)
return result;
}
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
QString misc::toQString(const boost::posix_time::ptime& boostDate) {
if (boostDate.is_not_a_date_time()) return "";
struct std::tm tm;

2
src/misc.h

@ -114,7 +114,7 @@ public: @@ -114,7 +114,7 @@ public:
static QList<int> intListfromStringList(const QStringList &l);
static QList<bool> boolListfromStringList(const QStringList &l);
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
static QString toQString(const boost::posix_time::ptime& boostDate);
#else
static QString toQString(time_t t);

10
src/preferences/options_imp.cpp

@ -125,7 +125,7 @@ options_imp::options_imp(QWidget *parent): @@ -125,7 +125,7 @@ options_imp::options_imp(QWidget *parent):
checkStartup->setVisible(false);
groupFileAssociation->setVisible(false);
#endif
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
checkAnonymousMode->setVisible(false);
label_anonymous->setVisible(false);
#endif
@ -206,7 +206,7 @@ options_imp::options_imp(QWidget *parent): @@ -206,7 +206,7 @@ options_imp::options_imp(QWidget *parent):
connect(spinMaxConnecPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
connect(checkAnonymousMode, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
#endif
connect(checkPeX, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -252,7 +252,7 @@ options_imp::options_imp(QWidget *parent): @@ -252,7 +252,7 @@ options_imp::options_imp(QWidget *parent):
applyButton->setEnabled(false);
// Tab selection mecanism
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
checkuTP->setVisible(false);
checkLimituTPConnections->setVisible(false);
#endif
@ -455,7 +455,7 @@ void options_imp::saveOptions() { @@ -455,7 +455,7 @@ void options_imp::saveOptions() {
pref.setDHTPort(getDHTPort());
pref.setLSDEnabled(isLSDEnabled());
pref.setEncryptionSetting(getEncryptionSetting());
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
pref.enableAnonymousMode(checkAnonymousMode->isChecked());
#endif
pref.setGlobalMaxRatio(getMaxRatio());
@ -727,7 +727,7 @@ void options_imp::loadOptions() { @@ -727,7 +727,7 @@ void options_imp::loadOptions() {
checkPeX->setChecked(pref.isPeXEnabled());
checkLSD->setChecked(pref.isLSDEnabled());
comboEncryption->setCurrentIndex(pref.getEncryptionSetting());
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
checkAnonymousMode->setChecked(pref.isAnonymousModeEnabled());
/* make sure ui matches options */
toggleAnonymousMode(checkAnonymousMode->isChecked());

2
src/preferences/preferences.h

@ -1065,7 +1065,7 @@ public: @@ -1065,7 +1065,7 @@ public:
return value(QString::fromUtf8("Preferences/Connection/InetAddress"), QString()).toString();
}
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
bool isAnonymousModeEnabled() const {
return value(QString::fromUtf8("Preferences/Advanced/AnonymousMode"), false).toBool();
}

6
src/properties/peerlistwidget.cpp

@ -221,7 +221,7 @@ void PeerListWidget::limitUpRateSelectedPeers(const QStringList& peer_ips) @@ -221,7 +221,7 @@ void PeerListWidget::limitUpRateSelectedPeers(const QStringList& peer_ips)
bool ok = false;
int cur_limit = -1;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
boost::asio::ip::tcp::endpoint first_ep = m_peerEndpoints.value(peer_ips.first(),
boost::asio::ip::tcp::endpoint());
if (first_ep != boost::asio::ip::tcp::endpoint())
@ -256,7 +256,7 @@ void PeerListWidget::limitDlRateSelectedPeers(const QStringList& peer_ips) @@ -256,7 +256,7 @@ void PeerListWidget::limitDlRateSelectedPeers(const QStringList& peer_ips)
return;
bool ok = false;
int cur_limit = -1;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
boost::asio::ip::tcp::endpoint first_ep = m_peerEndpoints.value(peer_ips.first(),
boost::asio::ip::tcp::endpoint());
if (first_ep != boost::asio::ip::tcp::endpoint())
@ -416,7 +416,7 @@ QString PeerListWidget::getConnectionString(int connection_type) @@ -416,7 +416,7 @@ QString PeerListWidget::getConnectionString(int connection_type)
{
QString connection;
switch(connection_type) {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
case peer_info::bittorrent_utp:
connection = "uTP";
break;

2
src/properties/propertieswidget.cpp

@ -459,7 +459,7 @@ void PropertiesWidget::displayFilesListMenu(const QPoint&) { @@ -459,7 +459,7 @@ void PropertiesWidget::displayFilesListMenu(const QPoint&) {
myFilesLlistMenu.addSeparator();
}
QMenu subMenu;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
if (!h.status(0x0).is_seeding) {
#else
if (!static_cast<torrent_handle>(h).is_seed()) {

2
src/properties/proplistdelegate.h

@ -161,7 +161,7 @@ public: @@ -161,7 +161,7 @@ public:
if (index.column() != PRIORITY) return 0;
if (properties) {
QTorrentHandle h = properties->getCurrentTorrent();
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
if (!h.is_valid() || !h.has_metadata() || h.status(0x0).is_seeding) return 0;
#else
if (!h.is_valid() || !h.has_metadata() || static_cast<libtorrent::torrent_handle>(h).is_seed()) return 0;

40
src/qtlibtorrent/qbtsession.cpp

@ -70,12 +70,12 @@ @@ -70,12 +70,12 @@
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/upnp.hpp>
#include <libtorrent/natpmp.hpp>
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#endif
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
#include "libtorrent/error_code.hpp"
#endif
#include <queue>
@ -116,7 +116,7 @@ QBtSession::QBtSession() @@ -116,7 +116,7 @@ QBtSession::QBtSession()
BigRatioTimer->setInterval(10000);
connect(BigRatioTimer, SIGNAL(timeout()), SLOT(processBigRatios()));
Preferences pref;
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
// To avoid some exceptions
boost::filesystem::path::default_name_check(boost::filesystem::no_check);
#endif
@ -392,7 +392,7 @@ void QBtSession::configureSession() { @@ -392,7 +392,7 @@ void QBtSession::configureSession() {
sessionSettings.upnp_ignore_nonrouters = true;
sessionSettings.use_dht_as_fallback = false;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
// Disable support for SSL torrents for now
sessionSettings.ssl_listen = 0;
#endif
@ -409,7 +409,7 @@ void QBtSession::configureSession() { @@ -409,7 +409,7 @@ void QBtSession::configureSession() {
int cache_size = pref.diskCacheSize();
sessionSettings.cache_size = cache_size ? cache_size * 64 : -1;
qDebug() << "Using a disk cache size of" << cache_size << "MiB";
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
if (sessionSettings.anonymous_mode) {
addConsoleMessage(tr("Anonymous mode [ON]"), "blue");
@ -440,7 +440,7 @@ void QBtSession::configureSession() { @@ -440,7 +440,7 @@ void QBtSession::configureSession() {
// IP address to announce to trackers
QString announce_ip = pref.getNetworkAddress();
if (!announce_ip.isEmpty()) {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
sessionSettings.announce_ip = announce_ip.toStdString();
#else
boost::system::error_code ec;
@ -453,7 +453,7 @@ void QBtSession::configureSession() { @@ -453,7 +453,7 @@ void QBtSession::configureSession() {
}
// Super seeding
sessionSettings.strict_super_seeding = pref.isSuperSeedingEnabled();
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
// * Max Half-open connections
sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections();
// * Max connections limit
@ -464,7 +464,7 @@ void QBtSession::configureSession() { @@ -464,7 +464,7 @@ void QBtSession::configureSession() {
// * Max connections limit
setMaxConnections(pref.getMaxConnecs());
#endif
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
// uTP
if (pref.isuTPEnabled()) {
sessionSettings.enable_incoming_utp = true;
@ -1096,7 +1096,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr @@ -1096,7 +1096,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
qDebug("Successfully loaded fast resume data");
}
}
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
else {
// Generate fake resume data to make sure unwanted files
// are not allocated
@ -1231,7 +1231,7 @@ add_torrent_params QBtSession::initializeAddTorrentParams(const QString &hash) { @@ -1231,7 +1231,7 @@ add_torrent_params QBtSession::initializeAddTorrentParams(const QString &hash) {
p.storage_mode = storage_mode_sparse;
// Priorities
/*#if LIBTORRENT_VERSION_MINOR > 15
/*#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
if (TorrentTempData::hasTempData(hash)) {
std::vector<int> fp;
TorrentTempData::getFilesPriority(hash, fp);
@ -1348,7 +1348,7 @@ void QBtSession::mergeTorrents(QTorrentHandle &h_ex, boost::intrusive_ptr<torren @@ -1348,7 +1348,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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
std::vector<web_seed_entry> new_urlseeds = t->web_seeds();
std::vector<web_seed_entry>::iterator it = new_urlseeds.begin();
@ -1418,7 +1418,7 @@ void QBtSession::exportTorrentFiles(QString path) { @@ -1418,7 +1418,7 @@ void QBtSession::exportTorrentFiles(QString path) {
// Set the maximum number of opened connections
void QBtSession::setMaxConnections(int maxConnec) {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
Q_UNUSED(maxConnec);
Q_ASSERT(0); // Should not be used
#else
@ -1517,7 +1517,7 @@ void QBtSession::loadSessionState() { @@ -1517,7 +1517,7 @@ void QBtSession::loadSessionState() {
state_file.read(&in[0], content_size);
// bdecode
lazy_entry e;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
libtorrent::error_code ec;
lazy_bdecode(&in[0], &in[0] + in.size(), e, ec);
if (!ec) {
@ -1607,7 +1607,7 @@ void QBtSession::saveTempFastResumeData() { @@ -1607,7 +1607,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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
if (!h.need_save_resume_data()) continue;
#endif
if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) continue;
@ -1901,12 +1901,12 @@ void QBtSession::setListeningPort(int port) { @@ -1901,12 +1901,12 @@ void QBtSession::setListeningPort(int port) {
qDebug() << Q_FUNC_INFO << port;
Preferences pref;
std::pair<int,int> ports(port, port);
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
libtorrent::error_code ec;
#endif
const QString iface_name = pref.getNetworkInterface();
if (iface_name.isEmpty()) {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
s->listen_on(ports, ec);
#else
s->listen_on(ports);
@ -1924,7 +1924,7 @@ void QBtSession::setListeningPort(int port) { @@ -1924,7 +1924,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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
s->listen_on(ports, ec, entry.ip().toString().toAscii().constData());
if (!ec) {
#else
@ -1947,7 +1947,7 @@ void QBtSession::setListeningPort(int port) { @@ -1947,7 +1947,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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
session_settings settings = s->settings();
settings.download_rate_limit = rate;
s->set_settings(settings);
@ -1961,7 +1961,7 @@ void QBtSession::setDownloadRateLimit(long rate) { @@ -1961,7 +1961,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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
session_settings settings = s->settings();
settings.upload_rate_limit = rate;
s->set_settings(settings);
@ -2069,7 +2069,7 @@ void QBtSession::setSessionSettings(const session_settings &sessionSettings) { @@ -2069,7 +2069,7 @@ void QBtSession::setSessionSettings(const session_settings &sessionSettings) {
void QBtSession::setProxySettings(proxy_settings proxySettings) {
qDebug() << Q_FUNC_INFO;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
proxySettings.proxy_peer_connections = Preferences().proxyPeerConnections();
s->set_proxy(proxySettings);
#else

86
src/qtlibtorrent/qtorrenthandle.cpp

@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/bencode.hpp>
#include <libtorrent/entry.hpp>
#if LIBTORRENT_VERSION_MINOR < 15
#if LIBTORRENT_VERSION_MINOR < 15 && LIBTORRENT_VERSION_MAJOR < 1
#include <boost/date_time/posix_time/posix_time_types.hpp>
#endif
@ -93,7 +93,7 @@ QString QTorrentHandle::name() const { @@ -93,7 +93,7 @@ QString QTorrentHandle::name() const {
}
QString QTorrentHandle::creation_date() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -103,7 +103,7 @@ QString QTorrentHandle::creation_date() const {
}
QString QTorrentHandle::next_announce() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -111,7 +111,7 @@ QString QTorrentHandle::next_announce() const {
}
qlonglong QTorrentHandle::next_announce_s() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -119,7 +119,7 @@ qlonglong QTorrentHandle::next_announce_s() const {
}
float QTorrentHandle::progress() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -134,7 +134,7 @@ float QTorrentHandle::progress() const {
}
bitfield QTorrentHandle::pieces() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(torrent_handle::query_pieces).pieces;
#else
return torrent_handle::status().pieces;
@ -142,7 +142,7 @@ bitfield QTorrentHandle::pieces() const { @@ -142,7 +142,7 @@ bitfield QTorrentHandle::pieces() const {
}
QString QTorrentHandle::current_tracker() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -150,7 +150,7 @@ QString QTorrentHandle::current_tracker() const {
}
bool QTorrentHandle::is_paused() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
torrent_status st = torrent_handle::status(0x0);
return st.paused && !st.auto_managed;
#else
@ -159,7 +159,7 @@ bool QTorrentHandle::is_paused() const { @@ -159,7 +159,7 @@ bool QTorrentHandle::is_paused() const {
}
bool QTorrentHandle::is_queued() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -206,7 +206,7 @@ bool QTorrentHandle::first_last_piece_first() const {
}
size_type QTorrentHandle::total_wanted_done() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -214,7 +214,7 @@ size_type QTorrentHandle::total_wanted_done() const {
}
size_type QTorrentHandle::total_wanted() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).total_wanted;
#else
return torrent_handle::status().total_wanted;
@ -222,7 +222,7 @@ size_type QTorrentHandle::total_wanted() const { @@ -222,7 +222,7 @@ size_type QTorrentHandle::total_wanted() const {
}
qreal QTorrentHandle::download_payload_rate() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -230,7 +230,7 @@ qreal QTorrentHandle::download_payload_rate() const {
}
qreal QTorrentHandle::upload_payload_rate() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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 { @@ -238,7 +238,7 @@ qreal QTorrentHandle::upload_payload_rate() const {
}
int QTorrentHandle::num_peers() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).num_peers;
#else
return torrent_handle::status().num_peers;
@ -246,7 +246,7 @@ int QTorrentHandle::num_peers() const { @@ -246,7 +246,7 @@ int QTorrentHandle::num_peers() const {
}
int QTorrentHandle::num_seeds() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).num_seeds;
#else
return torrent_handle::status().num_seeds;
@ -254,7 +254,7 @@ int QTorrentHandle::num_seeds() const { @@ -254,7 +254,7 @@ int QTorrentHandle::num_seeds() const {
}
int QTorrentHandle::num_complete() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).num_complete;
#else
return torrent_handle::status().num_complete;
@ -262,7 +262,7 @@ int QTorrentHandle::num_complete() const { @@ -262,7 +262,7 @@ int QTorrentHandle::num_complete() const {
}
int QTorrentHandle::num_incomplete() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).num_incomplete;
#else
return torrent_handle::status().num_incomplete;
@ -270,7 +270,7 @@ int QTorrentHandle::num_incomplete() const { @@ -270,7 +270,7 @@ int QTorrentHandle::num_incomplete() const {
}
QString QTorrentHandle::save_path() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return misc::toQStringU(torrent_handle::save_path()).replace("\\", "/");
#else
return misc::toQStringU(torrent_handle::save_path().string()).replace("\\", "/");
@ -296,7 +296,7 @@ QStringList QTorrentHandle::url_seeds() const { @@ -296,7 +296,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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(query_accurate_download_counters).total_wanted;
#else
return torrent_handle::status().total_wanted;
@ -318,7 +318,7 @@ int QTorrentHandle::num_files() const { @@ -318,7 +318,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_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return fsutils::fileName(filepath_at(index));
#else
return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.leaf());
@ -331,7 +331,7 @@ size_type QTorrentHandle::filesize_at(unsigned int index) const { @@ -331,7 +331,7 @@ size_type QTorrentHandle::filesize_at(unsigned int index) const {
}
QString QTorrentHandle::filepath_at(unsigned int index) const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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());
@ -339,7 +339,7 @@ QString QTorrentHandle::filepath_at(unsigned int index) const { @@ -339,7 +339,7 @@ QString QTorrentHandle::filepath_at(unsigned int index) const {
}
QString QTorrentHandle::orig_filepath_at(unsigned int index) const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
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());
@ -347,7 +347,7 @@ QString QTorrentHandle::orig_filepath_at(unsigned int index) const { @@ -347,7 +347,7 @@ QString QTorrentHandle::orig_filepath_at(unsigned int index) const {
}
torrent_status::state_t QTorrentHandle::state() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).state;
#else
return torrent_handle::status().state;
@ -363,7 +363,7 @@ QString QTorrentHandle::comment() const { @@ -363,7 +363,7 @@ QString QTorrentHandle::comment() const {
}
size_type QTorrentHandle::total_failed_bytes() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).total_failed_bytes;
#else
return torrent_handle::status().total_failed_bytes;
@ -371,7 +371,7 @@ size_type QTorrentHandle::total_failed_bytes() const { @@ -371,7 +371,7 @@ size_type QTorrentHandle::total_failed_bytes() const {
}
size_type QTorrentHandle::total_redundant_bytes() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).total_redundant_bytes;
#else
return torrent_handle::status().total_redundant_bytes;
@ -379,7 +379,7 @@ size_type QTorrentHandle::total_redundant_bytes() const { @@ -379,7 +379,7 @@ size_type QTorrentHandle::total_redundant_bytes() const {
}
bool QTorrentHandle::is_checking() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
torrent_status st = torrent_handle::status(0x0);
#else
torrent_status st = torrent_handle::status();
@ -388,7 +388,7 @@ bool QTorrentHandle::is_checking() const { @@ -388,7 +388,7 @@ bool QTorrentHandle::is_checking() const {
}
size_type QTorrentHandle::total_done() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).total_done;
#else
return torrent_handle::status().total_done;
@ -396,7 +396,7 @@ size_type QTorrentHandle::total_done() const { @@ -396,7 +396,7 @@ size_type QTorrentHandle::total_done() const {
}
size_type QTorrentHandle::all_time_download() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).all_time_download;
#else
return torrent_handle::status().all_time_download;
@ -404,7 +404,7 @@ size_type QTorrentHandle::all_time_download() const { @@ -404,7 +404,7 @@ size_type QTorrentHandle::all_time_download() const {
}
size_type QTorrentHandle::all_time_upload() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).all_time_upload;
#else
return torrent_handle::status().all_time_upload;
@ -412,7 +412,7 @@ size_type QTorrentHandle::all_time_upload() const { @@ -412,7 +412,7 @@ size_type QTorrentHandle::all_time_upload() const {
}
size_type QTorrentHandle::total_payload_download() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).total_payload_download;
#else
return torrent_handle::status().total_payload_download;
@ -420,7 +420,7 @@ size_type QTorrentHandle::total_payload_download() const { @@ -420,7 +420,7 @@ size_type QTorrentHandle::total_payload_download() const {
}
size_type QTorrentHandle::total_payload_upload() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).total_payload_upload;
#else
return torrent_handle::status().total_payload_upload;
@ -467,7 +467,7 @@ int QTorrentHandle::queue_position() const { @@ -467,7 +467,7 @@ int QTorrentHandle::queue_position() const {
}
int QTorrentHandle::num_uploads() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).num_uploads;
#else
return torrent_handle::status().num_uploads;
@ -485,7 +485,7 @@ bool QTorrentHandle::is_seed() const { @@ -485,7 +485,7 @@ bool QTorrentHandle::is_seed() const {
}
bool QTorrentHandle::is_auto_managed() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
torrent_status status = torrent_handle::status(0x0);
return status.auto_managed;
#else
@ -494,7 +494,7 @@ bool QTorrentHandle::is_auto_managed() const { @@ -494,7 +494,7 @@ bool QTorrentHandle::is_auto_managed() const {
}
bool QTorrentHandle::is_sequential_download() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
torrent_status status = torrent_handle::status(0x0);
return status.sequential_download;
#else
@ -503,7 +503,7 @@ bool QTorrentHandle::is_sequential_download() const { @@ -503,7 +503,7 @@ bool QTorrentHandle::is_sequential_download() const {
}
qlonglong QTorrentHandle::active_time() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).active_time;
#else
return torrent_handle::status().active_time;
@ -511,7 +511,7 @@ qlonglong QTorrentHandle::active_time() const { @@ -511,7 +511,7 @@ qlonglong QTorrentHandle::active_time() const {
}
qlonglong QTorrentHandle::seeding_time() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).seeding_time;
#else
return torrent_handle::status().seeding_time;
@ -519,7 +519,7 @@ qlonglong QTorrentHandle::seeding_time() const { @@ -519,7 +519,7 @@ qlonglong QTorrentHandle::seeding_time() const {
}
int QTorrentHandle::num_connections() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).num_connections;
#else
return torrent_handle::status().num_connections;
@ -527,7 +527,7 @@ int QTorrentHandle::num_connections() const { @@ -527,7 +527,7 @@ int QTorrentHandle::num_connections() const {
}
int QTorrentHandle::connections_limit() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).connections_limit;
#else
return torrent_handle::status().connections_limit;
@ -565,7 +565,7 @@ QString QTorrentHandle::root_path() const @@ -565,7 +565,7 @@ QString QTorrentHandle::root_path() const
}
bool QTorrentHandle::has_error() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
torrent_status st = torrent_handle::status(0x0);
return st.paused && !st.error.empty();
#else
@ -574,7 +574,7 @@ bool QTorrentHandle::has_error() const { @@ -574,7 +574,7 @@ bool QTorrentHandle::has_error() const {
}
QString QTorrentHandle::error() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return misc::toQString(torrent_handle::status(0x0).error);
#else
return misc::toQString(torrent_handle::status().error);
@ -594,7 +594,7 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const { @@ -594,7 +594,7 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const {
}
bool QTorrentHandle::has_metadata() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(0x0).has_metadata;
#else
return torrent_handle::has_metadata();
@ -602,7 +602,7 @@ bool QTorrentHandle::has_metadata() const { @@ -602,7 +602,7 @@ bool QTorrentHandle::has_metadata() const {
}
float QTorrentHandle::distributed_copies() const {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
return torrent_handle::status(query_distributed_copies).distributed_copies;
#else
return torrent_handle::status().distributed_copies;

2
src/qtlibtorrent/torrentspeedmonitor.cpp

@ -161,7 +161,7 @@ void TorrentSpeedMonitor::getSamples() @@ -161,7 +161,7 @@ void TorrentSpeedMonitor::getSamples()
std::vector<torrent_handle>::const_iterator itend = torrents.end();
for ( ; it != itend; ++it) {
try {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
torrent_status st = it->status(0x0);
if (!st.paused) {
#else

4
src/statusbar.h

@ -212,7 +212,7 @@ public slots: @@ -212,7 +212,7 @@ public slots:
void capDownloadSpeed() {
bool ok = false;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
int cur_limit = QBtSession::instance()->getSession()->settings().download_rate_limit;
#else
int cur_limit = QBtSession::instance()->getSession()->download_rate_limit();
@ -237,7 +237,7 @@ public slots: @@ -237,7 +237,7 @@ public slots:
void capUploadSpeed() {
bool ok = false;
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
int cur_limit = QBtSession::instance()->getSession()->settings().upload_rate_limit;
#else
int cur_limit = QBtSession::instance()->getSession()->upload_rate_limit();

2
src/torrentcontentmodel.cpp

@ -283,7 +283,7 @@ void TorrentContentModel::setupModelData(const libtorrent::torrent_info& t) @@ -283,7 +283,7 @@ void TorrentContentModel::setupModelData(const libtorrent::torrent_info& t)
for (int i = 0; i < t.num_files(); ++i) {
const libtorrent::file_entry& fentry = t.file_at(i);
current_parent = m_rootItem;
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
QString path = misc::toQStringU(fentry.path);
#else
QString path = misc::toQStringU(fentry.path.string());

2
src/torrentcontentmodelfile.cpp

@ -41,7 +41,7 @@ TorrentContentModelFile::TorrentContentModelFile(const libtorrent::file_entry& f @@ -41,7 +41,7 @@ TorrentContentModelFile::TorrentContentModelFile(const libtorrent::file_entry& f
{
Q_ASSERT(parent);
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
m_name = fsutils::fileName(misc::toQStringU(f.path.c_str()));
#else
m_name = misc::toQStringU(f.path.filename());

8
src/torrentcreator/torrentcreatorthread.cpp

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
#include "torrentcreatorthread.h"
#include "fs_utils.h"
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
@ -53,13 +53,13 @@ @@ -53,13 +53,13 @@
#include <fstream>
using namespace libtorrent;
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
using namespace boost::filesystem;
#endif
// do not include files and folders whose
// name starts with a .
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
bool file_filter(std::string const& f)
{
if (filename(f)[0] == '.') return false;
@ -85,7 +85,7 @@ void TorrentCreatorThread::create(QString _input_path, QString _save_path, QStri @@ -85,7 +85,7 @@ void TorrentCreatorThread::create(QString _input_path, QString _save_path, QStri
comment = _comment;
is_private = _is_private;
piece_size = _piece_size;
#if LIBTORRENT_VERSION_MINOR < 16
#if LIBTORRENT_VERSION_MINOR < 16 && LIBTORRENT_VERSION_MAJOR < 1
path::default_name_check(no_check);
#endif
abort = false;

6
src/torrentimportdlg.cpp

@ -79,7 +79,7 @@ void TorrentImportDlg::on_browseContentBtn_clicked() @@ -79,7 +79,7 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
const QString default_dir = settings.value(QString::fromUtf8("TorrentImport/LastContentDir"), QDir::homePath()).toString();
if (t->num_files() == 1) {
// Single file torrent
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
const QString file_name = fsutils::fileName(misc::toQStringU(t->file_at(0).path));
#else
const QString file_name = misc::toQStringU(t->file_at(0).path.filename());
@ -146,7 +146,7 @@ void TorrentImportDlg::on_browseContentBtn_clicked() @@ -146,7 +146,7 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
content_dir.cdUp();
// Check file sizes
for (int i=0; i<t->num_files(); ++i) {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
const QString rel_path = misc::toQStringU(t->file_at(i).path);
#else
const QString rel_path = misc::toQStringU(t->file_at(i).path.string());
@ -252,7 +252,7 @@ void TorrentImportDlg::initializeFilesPath() @@ -252,7 +252,7 @@ void TorrentImportDlg::initializeFilesPath()
m_filesPath.clear();
// Loads files path in the torrent
for (int i=0; i<t->num_files(); ++i) {
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
m_filesPath << misc::toQStringU(t->file_at(i).path).replace("\\", "/");
#else
m_filesPath << misc::toQStringU(t->file_at(i).path.string()).replace("\\", "/");

4
src/webui/httpconnection.cpp

@ -490,7 +490,7 @@ void HttpConnection::respondCommand(const QString& command) { @@ -490,7 +490,7 @@ void HttpConnection::respondCommand(const QString& command) {
if (command == "getGlobalUpLimit") {
m_generator.setStatusLine(200, "OK");
m_generator.setContentTypeByExt("html");
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->settings().upload_rate_limit));
#else
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->upload_rate_limit()));
@ -501,7 +501,7 @@ void HttpConnection::respondCommand(const QString& command) { @@ -501,7 +501,7 @@ void HttpConnection::respondCommand(const QString& command) {
if (command == "getGlobalDlLimit") {
m_generator.setStatusLine(200, "OK");
m_generator.setContentTypeByExt("html");
#if LIBTORRENT_VERSION_MINOR > 15
#if LIBTORRENT_VERSION_MINOR > 15 || LIBTORRENT_VERSION_MAJOR > 0
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->settings().download_rate_limit));
#else
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->download_rate_limit()));

8
src/webui/prefjson.cpp

@ -88,7 +88,7 @@ QString prefjson::getPreferences() @@ -88,7 +88,7 @@ QString prefjson::getPreferences()
data.add("max_connec", pref.getMaxConnecs());
data.add("max_connec_per_torrent", pref.getMaxConnecsPerTorrent());
data.add("max_uploads_per_torrent", pref.getMaxUploadsPerTorrent());
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
data.add("enable_utp", pref.isuTPEnabled());
data.add("limit_utp_rate", pref.isuTPRateLimited());
#endif
@ -110,7 +110,7 @@ QString prefjson::getPreferences() @@ -110,7 +110,7 @@ QString prefjson::getPreferences()
data.add("pex", pref.isPeXEnabled());
data.add("lsd", pref.isLSDEnabled());
data.add("encryption", pref.getEncryptionSetting());
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
data.add("anonymous_mode", pref.isAnonymousModeEnabled());
#endif
// Proxy
@ -246,7 +246,7 @@ void prefjson::setPreferences(const QString& json) @@ -246,7 +246,7 @@ void prefjson::setPreferences(const QString& json)
pref.setMaxConnecsPerTorrent(m["max_connec_per_torrent"].toInt());
if (m.contains("max_uploads_per_torrent"))
pref.setMaxUploadsPerTorrent(m["max_uploads_per_torrent"].toInt());
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
if (m.contains("enable_utp"))
pref.setuTPEnabled(m["enable_utp"].toBool());
if (m.contains("limit_utp_rate"))
@ -284,7 +284,7 @@ void prefjson::setPreferences(const QString& json) @@ -284,7 +284,7 @@ void prefjson::setPreferences(const QString& json)
pref.setLSDEnabled(m["lsd"].toBool());
if (m.contains("encryption"))
pref.setEncryptionSetting(m["encryption"].toInt());
#if LIBTORRENT_VERSION_MINOR >= 16
#if LIBTORRENT_VERSION_MINOR >= 16 || LIBTORRENT_VERSION_MAJOR > 0
if (m.contains("anonymous_mode"))
pref.enableAnonymousMode(m["anonymous_mode"].toBool());
#endif

Loading…
Cancel
Save