Correctly detect libtorrent version.

This commit is contained in:
sledgehammer999 2014-01-03 02:05:07 +02:00
commit 9f71dd2c61
21 changed files with 114 additions and 115 deletions

View file

@ -215,13 +215,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")); ui->date_lbl->setText(m_torrentInfo->creation_date() ? misc::toQString(*m_torrentInfo->creation_date()) : tr("Not available"));
updateDiskSpaceLabel(); updateDiskSpaceLabel();
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
file_storage fs = m_torrentInfo->files(); file_storage fs = m_torrentInfo->files();
#endif #endif
// Populate m_filesList // Populate m_filesList
for (int i = 0; i < m_torrentInfo->num_files(); ++i) { for (int i = 0; i < m_torrentInfo->num_files(); ++i) {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
m_filesPath << misc::toQStringU(fs.file_path(m_torrentInfo->file_at(i))); m_filesPath << misc::toQStringU(fs.file_path(m_torrentInfo->file_at(i)));
#else #else
m_filesPath << misc::toQStringU(m_torrentInfo->file_at(i).path.string()); m_filesPath << misc::toQStringU(m_torrentInfo->file_at(i).path.string());
@ -246,7 +246,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
ui->content_tree->setExpanded(m_contentModel->index(0, 0), true); ui->content_tree->setExpanded(m_contentModel->index(0, 0), true);
} else { } else {
// Update save paths (append file name to them) // Update save paths (append file name to them)
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
QString single_file_relpath = misc::toQStringU(fs.file_path(m_torrentInfo->file_at(0))); QString single_file_relpath = misc::toQStringU(fs.file_path(m_torrentInfo->file_at(0)));
#else #else
QString single_file_relpath = misc::toQStringU(m_torrentInfo->file_at(0).path.string()); QString single_file_relpath = misc::toQStringU(m_torrentInfo->file_at(0).path.string());
@ -675,13 +675,13 @@ void AddNewTorrentDialog::updateMetadata(const QTorrentHandle &h) {
ui->date_lbl->setText(m_torrentInfo->creation_date() ? misc::toQString(*m_torrentInfo->creation_date()) : tr("Not available")); ui->date_lbl->setText(m_torrentInfo->creation_date() ? misc::toQString(*m_torrentInfo->creation_date()) : tr("Not available"));
updateDiskSpaceLabel(); updateDiskSpaceLabel();
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
file_storage fs = m_torrentInfo->files(); file_storage fs = m_torrentInfo->files();
#endif #endif
// Populate m_filesList // Populate m_filesList
for (int i = 0; i < m_torrentInfo->num_files(); ++i) { for (int i = 0; i < m_torrentInfo->num_files(); ++i) {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
m_filesPath << misc::toQStringU(fs.file_path(m_torrentInfo->file_at(i))); m_filesPath << misc::toQStringU(fs.file_path(m_torrentInfo->file_at(i)));
#else #else
m_filesPath << misc::toQStringU(m_torrentInfo->file_at(i).path.string()); m_filesPath << misc::toQStringU(m_torrentInfo->file_at(i).path.string());
@ -706,7 +706,7 @@ void AddNewTorrentDialog::updateMetadata(const QTorrentHandle &h) {
ui->content_tree->setExpanded(m_contentModel->index(0, 0), true); ui->content_tree->setExpanded(m_contentModel->index(0, 0), true);
} else { } else {
// Update save paths (append file name to them) // Update save paths (append file name to them)
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
QString single_file_relpath = misc::toQStringU(fs.file_path(m_torrentInfo->file_at(0))); QString single_file_relpath = misc::toQStringU(fs.file_path(m_torrentInfo->file_at(0)));
#else #else
QString single_file_relpath = misc::toQStringU(m_torrentInfo->file_at(0).path.string()); QString single_file_relpath = misc::toQStringU(m_torrentInfo->file_at(0).path.string());

View file

@ -626,7 +626,7 @@ void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const
void MainWindow::on_actionSet_global_upload_limit_triggered() { void MainWindow::on_actionSet_global_upload_limit_triggered() {
qDebug("actionSet_global_upload_limit_triggered"); qDebug("actionSet_global_upload_limit_triggered");
bool ok; bool ok;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
int cur_limit = QBtSession::instance()->getSession()->settings().upload_rate_limit; int cur_limit = QBtSession::instance()->getSession()->settings().upload_rate_limit;
#else #else
int cur_limit = QBtSession::instance()->getSession()->upload_rate_limit(); int cur_limit = QBtSession::instance()->getSession()->upload_rate_limit();
@ -645,7 +645,7 @@ void MainWindow::on_actionSet_global_upload_limit_triggered() {
void MainWindow::on_actionSet_global_download_limit_triggered() { void MainWindow::on_actionSet_global_download_limit_triggered() {
qDebug("actionSet_global_download_limit_triggered"); qDebug("actionSet_global_download_limit_triggered");
bool ok; bool ok;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
int cur_limit = QBtSession::instance()->getSession()->settings().download_rate_limit; int cur_limit = QBtSession::instance()->getSession()->settings().download_rate_limit;
#else #else
int cur_limit = QBtSession::instance()->getSession()->download_rate_limit(); int cur_limit = QBtSession::instance()->getSession()->download_rate_limit();

View file

@ -518,7 +518,7 @@ QString misc::parseHtmlLinks(const QString &raw_text)
return result; return result;
} }
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
QString misc::toQString(const boost::posix_time::ptime& boostDate) { QString misc::toQString(const boost::posix_time::ptime& boostDate) {
if (boostDate.is_not_a_date_time()) return ""; if (boostDate.is_not_a_date_time()) return "";
struct std::tm tm; struct std::tm tm;

View file

@ -107,7 +107,7 @@ namespace misc
QList<int> intListfromStringList(const QStringList &l); QList<int> intListfromStringList(const QStringList &l);
QList<bool> boolListfromStringList(const QStringList &l); QList<bool> boolListfromStringList(const QStringList &l);
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
QString toQString(const boost::posix_time::ptime& boostDate); QString toQString(const boost::posix_time::ptime& boostDate);
#else #else
QString toQString(time_t t); QString toQString(time_t t);

View file

@ -14,7 +14,7 @@
enum AdvSettingsCols {PROPERTY, VALUE}; enum AdvSettingsCols {PROPERTY, VALUE};
enum AdvSettingsRows {DISK_CACHE, enum AdvSettingsRows {DISK_CACHE,
#if LIBTORRENT_VERSION_NUM >= 001610 #if LIBTORRENT_VERSION_NUM >= 1610
DISK_CACHE_TTL, DISK_CACHE_TTL,
#endif #endif
OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT,
@ -37,7 +37,7 @@ private:
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion, cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion,
cb_enable_tracker_ext; cb_enable_tracker_ext;
QComboBox combo_iface; QComboBox combo_iface;
#if LIBTORRENT_VERSION_NUM >= 001610 #if LIBTORRENT_VERSION_NUM >= 1610
QSpinBox spin_cache_ttl; QSpinBox spin_cache_ttl;
#endif #endif
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) #if defined(Q_WS_WIN) || defined(Q_WS_MAC)
@ -76,7 +76,7 @@ public slots:
Preferences pref; Preferences pref;
// Disk write cache // Disk write cache
pref.setDiskCacheSize(spin_cache.value()); pref.setDiskCacheSize(spin_cache.value());
#if LIBTORRENT_VERSION_NUM >= 001610 #if LIBTORRENT_VERSION_NUM >= 1610
pref.setDiskCacheTTL(spin_cache_ttl.value()); pref.setDiskCacheTTL(spin_cache_ttl.value());
#endif #endif
// Outgoing ports // Outgoing ports
@ -182,7 +182,7 @@ private slots:
spin_cache.setValue(pref.diskCacheSize()); spin_cache.setValue(pref.diskCacheSize());
updateCacheSpinSuffix(spin_cache.value()); updateCacheSpinSuffix(spin_cache.value());
setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache); setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache);
#if LIBTORRENT_VERSION_NUM >= 001610 #if LIBTORRENT_VERSION_NUM >= 1610
// Disk cache expiry // Disk cache expiry
spin_cache_ttl.setMinimum(15); spin_cache_ttl.setMinimum(15);
spin_cache_ttl.setMaximum(600); spin_cache_ttl.setMaximum(600);

View file

@ -122,7 +122,7 @@ options_imp::options_imp(QWidget *parent):
checkStartup->setVisible(false); checkStartup->setVisible(false);
groupFileAssociation->setVisible(false); groupFileAssociation->setVisible(false);
#endif #endif
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
checkAnonymousMode->setVisible(false); checkAnonymousMode->setVisible(false);
label_anonymous->setVisible(false); label_anonymous->setVisible(false);
#endif #endif
@ -208,7 +208,7 @@ options_imp::options_imp(QWidget *parent):
connect(spinMaxUploads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spinMaxUploads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spinMaxUploadsPerTorrent, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDHT, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
connect(checkAnonymousMode, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAnonymousMode, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
#endif #endif
connect(checkPeX, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkPeX, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -254,7 +254,7 @@ options_imp::options_imp(QWidget *parent):
applyButton->setEnabled(false); applyButton->setEnabled(false);
// Tab selection mecanism // Tab selection mecanism
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*))); connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
checkuTP->setVisible(false); checkuTP->setVisible(false);
checkLimituTPConnections->setVisible(false); checkLimituTPConnections->setVisible(false);
#endif #endif
@ -460,7 +460,7 @@ void options_imp::saveOptions() {
pref.setDHTPort(getDHTPort()); pref.setDHTPort(getDHTPort());
pref.setLSDEnabled(isLSDEnabled()); pref.setLSDEnabled(isLSDEnabled());
pref.setEncryptionSetting(getEncryptionSetting()); pref.setEncryptionSetting(getEncryptionSetting());
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
pref.enableAnonymousMode(checkAnonymousMode->isChecked()); pref.enableAnonymousMode(checkAnonymousMode->isChecked());
#endif #endif
pref.setGlobalMaxRatio(getMaxRatio()); pref.setGlobalMaxRatio(getMaxRatio());
@ -746,7 +746,7 @@ void options_imp::loadOptions() {
checkPeX->setChecked(pref.isPeXEnabled()); checkPeX->setChecked(pref.isPeXEnabled());
checkLSD->setChecked(pref.isLSDEnabled()); checkLSD->setChecked(pref.isLSDEnabled());
comboEncryption->setCurrentIndex(pref.getEncryptionSetting()); comboEncryption->setCurrentIndex(pref.getEncryptionSetting());
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
checkAnonymousMode->setChecked(pref.isAnonymousModeEnabled()); checkAnonymousMode->setChecked(pref.isAnonymousModeEnabled());
/* make sure ui matches options */ /* make sure ui matches options */
toggleAnonymousMode(checkAnonymousMode->isChecked()); toggleAnonymousMode(checkAnonymousMode->isChecked());

View file

@ -980,7 +980,7 @@ public:
} }
uint diskCacheSize() const { uint diskCacheSize() const {
#if LIBTORRENT_VERSION_NUM >= 001610 #if LIBTORRENT_VERSION_NUM >= 1610
return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 0).toUInt(); return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 0).toUInt();
#else #else
return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 128).toUInt(); return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 128).toUInt();
@ -991,7 +991,7 @@ public:
setValue(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), size); setValue(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), size);
} }
#if LIBTORRENT_VERSION_NUM >= 001610 #if LIBTORRENT_VERSION_NUM >= 1610
uint diskCacheTTL() const { uint diskCacheTTL() const {
return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheTTL"), 60).toUInt(); return value(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheTTL"), 60).toUInt();
} }
@ -1109,7 +1109,7 @@ public:
return value(QString::fromUtf8("Preferences/Connection/InetAddress"), QString()).toString(); return value(QString::fromUtf8("Preferences/Connection/InetAddress"), QString()).toString();
} }
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
bool isAnonymousModeEnabled() const { bool isAnonymousModeEnabled() const {
return value(QString::fromUtf8("Preferences/Advanced/AnonymousMode"), false).toBool(); return value(QString::fromUtf8("Preferences/Advanced/AnonymousMode"), false).toBool();
} }

View file

@ -239,7 +239,7 @@ void PeerListWidget::limitUpRateSelectedPeers(const QStringList& peer_ips)
bool ok = false; bool ok = false;
int cur_limit = -1; int cur_limit = -1;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
boost::asio::ip::tcp::endpoint first_ep = m_peerEndpoints.value(peer_ips.first(), boost::asio::ip::tcp::endpoint first_ep = m_peerEndpoints.value(peer_ips.first(),
boost::asio::ip::tcp::endpoint()); boost::asio::ip::tcp::endpoint());
if (first_ep != boost::asio::ip::tcp::endpoint()) if (first_ep != boost::asio::ip::tcp::endpoint())
@ -274,7 +274,7 @@ void PeerListWidget::limitDlRateSelectedPeers(const QStringList& peer_ips)
return; return;
bool ok = false; bool ok = false;
int cur_limit = -1; int cur_limit = -1;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
boost::asio::ip::tcp::endpoint first_ep = m_peerEndpoints.value(peer_ips.first(), boost::asio::ip::tcp::endpoint first_ep = m_peerEndpoints.value(peer_ips.first(),
boost::asio::ip::tcp::endpoint()); boost::asio::ip::tcp::endpoint());
if (first_ep != boost::asio::ip::tcp::endpoint()) if (first_ep != boost::asio::ip::tcp::endpoint())
@ -443,7 +443,7 @@ QString PeerListWidget::getConnectionString(int connection_type)
{ {
QString connection; QString connection;
switch(connection_type) { switch(connection_type) {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
case peer_info::bittorrent_utp: case peer_info::bittorrent_utp:
connection = "uTP"; connection = "uTP";
break; break;
@ -554,8 +554,7 @@ void PeerListWidget::getFlags(const peer_info& peer, QString& flags, QString& to
tooltip += ", "; tooltip += ", ";
} }
#if LIBTORRENT_VERSION_NUM > 001500 #if LIBTORRENT_VERSION_NUM > 1500 //P = Peer is using uTorrent uTP
//P = Peer is using uTorrent uTP
if (peer.connection_type & peer_info::bittorrent_utp) { if (peer.connection_type & peer_info::bittorrent_utp) {
flags += "P "; flags += "P ";
tooltip += QString::fromUtf8("μTP"); tooltip += QString::fromUtf8("μTP");

View file

@ -453,7 +453,7 @@ void PropertiesWidget::displayFilesListMenu(const QPoint&) {
myFilesLlistMenu.addSeparator(); myFilesLlistMenu.addSeparator();
} }
QMenu subMenu; QMenu subMenu;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
if (!h.status(0x0).is_seeding) { if (!h.status(0x0).is_seeding) {
#else #else
if (!static_cast<torrent_handle>(h).is_seed()) { if (!static_cast<torrent_handle>(h).is_seed()) {

View file

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

View file

@ -69,12 +69,12 @@
#include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_info.hpp>
#include <libtorrent/upnp.hpp> #include <libtorrent/upnp.hpp>
#include <libtorrent/natpmp.hpp> #include <libtorrent/natpmp.hpp>
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
#include <boost/filesystem/exception.hpp> #include <boost/filesystem/exception.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#endif #endif
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
#include "libtorrent/error_code.hpp" #include "libtorrent/error_code.hpp"
#endif #endif
#include <queue> #include <queue>
@ -120,7 +120,7 @@ QBtSession::QBtSession()
BigRatioTimer->setInterval(10000); BigRatioTimer->setInterval(10000);
connect(BigRatioTimer, SIGNAL(timeout()), SLOT(processBigRatios())); connect(BigRatioTimer, SIGNAL(timeout()), SLOT(processBigRatios()));
Preferences pref; Preferences pref;
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
// To avoid some exceptions // To avoid some exceptions
boost::filesystem::path::default_name_check(boost::filesystem::no_check); boost::filesystem::path::default_name_check(boost::filesystem::no_check);
#endif #endif
@ -398,7 +398,7 @@ void QBtSession::configureSession() {
sessionSettings.upnp_ignore_nonrouters = true; sessionSettings.upnp_ignore_nonrouters = true;
sessionSettings.use_dht_as_fallback = false; sessionSettings.use_dht_as_fallback = false;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
// Disable support for SSL torrents for now // Disable support for SSL torrents for now
sessionSettings.ssl_listen = 0; sessionSettings.ssl_listen = 0;
#endif #endif
@ -414,11 +414,11 @@ void QBtSession::configureSession() {
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
int cache_size = pref.diskCacheSize(); int cache_size = pref.diskCacheSize();
sessionSettings.cache_size = cache_size ? cache_size * 64 : -1; sessionSettings.cache_size = cache_size ? cache_size * 64 : -1;
#if LIBTORRENT_VERSION_NUM >= 001610 #if LIBTORRENT_VERSION_NUM >= 1610
sessionSettings.cache_expiry = pref.diskCacheTTL(); sessionSettings.cache_expiry = pref.diskCacheTTL();
#endif #endif
qDebug() << "Using a disk cache size of" << cache_size << "MiB"; qDebug() << "Using a disk cache size of" << cache_size << "MiB";
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled(); sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
if (sessionSettings.anonymous_mode) { if (sessionSettings.anonymous_mode) {
addConsoleMessage(tr("Anonymous mode [ON]"), "blue"); addConsoleMessage(tr("Anonymous mode [ON]"), "blue");
@ -457,7 +457,7 @@ void QBtSession::configureSession() {
// IP address to announce to trackers // IP address to announce to trackers
QString announce_ip = pref.getNetworkAddress(); QString announce_ip = pref.getNetworkAddress();
if (!announce_ip.isEmpty()) { if (!announce_ip.isEmpty()) {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
sessionSettings.announce_ip = announce_ip.toStdString(); sessionSettings.announce_ip = announce_ip.toStdString();
#else #else
boost::system::error_code ec; boost::system::error_code ec;
@ -470,7 +470,7 @@ void QBtSession::configureSession() {
} }
// Super seeding // Super seeding
sessionSettings.strict_super_seeding = pref.isSuperSeedingEnabled(); sessionSettings.strict_super_seeding = pref.isSuperSeedingEnabled();
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
// * Max Half-open connections // * Max Half-open connections
sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections(); sessionSettings.half_open_limit = pref.getMaxHalfOpenConnections();
// * Max connections limit // * Max connections limit
@ -485,7 +485,7 @@ void QBtSession::configureSession() {
// * Global max upload slots // * Global max upload slots
s->set_max_uploads(pref.getMaxUploads()); s->set_max_uploads(pref.getMaxUploads());
#endif #endif
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
// uTP // uTP
sessionSettings.enable_incoming_utp = pref.isuTPEnabled(); sessionSettings.enable_incoming_utp = pref.isuTPEnabled();
sessionSettings.enable_outgoing_utp = pref.isuTPEnabled(); sessionSettings.enable_outgoing_utp = pref.isuTPEnabled();
@ -1137,7 +1137,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
qDebug("Successfully loaded fast resume data"); qDebug("Successfully loaded fast resume data");
} }
} }
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
else { else {
// Generate fake resume data to make sure unwanted files // Generate fake resume data to make sure unwanted files
// are not allocated // are not allocated
@ -1273,7 +1273,7 @@ add_torrent_params QBtSession::initializeAddTorrentParams(const QString &hash) {
p.storage_mode = storage_mode_sparse; p.storage_mode = storage_mode_sparse;
// Priorities // Priorities
/*#if LIBTORRENT_VERSION_NUM >= 001600 /*#if LIBTORRENT_VERSION_NUM >= 1600
if (TorrentTempData::hasTempData(hash)) { if (TorrentTempData::hasTempData(hash)) {
std::vector<int> fp; std::vector<int> fp;
TorrentTempData::getFilesPriority(hash, fp); TorrentTempData::getFilesPriority(hash, fp);
@ -1390,7 +1390,7 @@ void QBtSession::mergeTorrents(QTorrentHandle &h_ex, boost::intrusive_ptr<torren
bool urlseeds_added = false; bool urlseeds_added = false;
const QStringList old_urlseeds = h_ex.url_seeds(); const QStringList old_urlseeds = h_ex.url_seeds();
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
std::vector<web_seed_entry> new_urlseeds = t->web_seeds(); std::vector<web_seed_entry> new_urlseeds = t->web_seeds();
std::vector<web_seed_entry>::iterator it = new_urlseeds.begin(); std::vector<web_seed_entry>::iterator it = new_urlseeds.begin();
@ -1460,7 +1460,7 @@ void QBtSession::exportTorrentFiles(QString path) {
// Set the maximum number of opened connections // Set the maximum number of opened connections
void QBtSession::setMaxConnections(int maxConnec) { void QBtSession::setMaxConnections(int maxConnec) {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
Q_UNUSED(maxConnec); Q_UNUSED(maxConnec);
Q_ASSERT(0); // Should not be used Q_ASSERT(0); // Should not be used
#else #else
@ -1559,7 +1559,7 @@ void QBtSession::loadSessionState() {
state_file.read(&in[0], content_size); state_file.read(&in[0], content_size);
// bdecode // bdecode
lazy_entry e; lazy_entry e;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
libtorrent::error_code ec; libtorrent::error_code ec;
lazy_bdecode(&in[0], &in[0] + in.size(), e, ec); lazy_bdecode(&in[0], &in[0] + in.size(), e, ec);
if (!ec) { if (!ec) {
@ -1649,7 +1649,7 @@ void QBtSession::saveTempFastResumeData() {
QTorrentHandle h = QTorrentHandle(*torrentIT); QTorrentHandle h = QTorrentHandle(*torrentIT);
try { try {
if (!h.is_valid() || !h.has_metadata() /*|| h.is_seed() || h.is_paused()*/) continue; if (!h.is_valid() || !h.has_metadata() /*|| h.is_seed() || h.is_paused()*/) continue;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
if (!h.need_save_resume_data()) continue; if (!h.need_save_resume_data()) continue;
#endif #endif
if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking || h.has_error()) continue; if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking || h.has_error()) continue;
@ -1944,13 +1944,13 @@ void QBtSession::setListeningPort(int port) {
qDebug() << Q_FUNC_INFO << port; qDebug() << Q_FUNC_INFO << port;
Preferences pref; Preferences pref;
std::pair<int,int> ports(port, port); std::pair<int,int> ports(port, port);
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
libtorrent::error_code ec; libtorrent::error_code ec;
#endif #endif
const QString iface_name = pref.getNetworkInterface(); const QString iface_name = pref.getNetworkInterface();
if (iface_name.isEmpty()) { if (iface_name.isEmpty()) {
addConsoleMessage(tr("qBittorrent is trying to listen on any interface port: TCP/%1", "e.g: qBittorrent is trying to listen on any interface port: TCP/6881").arg(QString::number(port)), "blue"); addConsoleMessage(tr("qBittorrent is trying to listen on any interface port: TCP/%1", "e.g: qBittorrent is trying to listen on any interface port: TCP/6881").arg(QString::number(port)), "blue");
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
s->listen_on(ports, ec, 0, session::listen_no_system_port); s->listen_on(ports, ec, 0, session::listen_no_system_port);
#else #else
s->listen_on(ports); s->listen_on(ports);
@ -1968,7 +1968,7 @@ void QBtSession::setListeningPort(int port) {
qDebug("This network interface has %d IP addresses", network_iface.addressEntries().size()); qDebug("This network interface has %d IP addresses", network_iface.addressEntries().size());
foreach (const QNetworkAddressEntry &entry, network_iface.addressEntries()) { foreach (const QNetworkAddressEntry &entry, network_iface.addressEntries()) {
qDebug("Trying to listen on IP %s (%s)", qPrintable(entry.ip().toString()), qPrintable(iface_name)); qDebug("Trying to listen on IP %s (%s)", qPrintable(entry.ip().toString()), qPrintable(iface_name));
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
s->listen_on(ports, ec, entry.ip().toString().toAscii().constData(), session::listen_no_system_port); s->listen_on(ports, ec, entry.ip().toString().toAscii().constData(), session::listen_no_system_port);
if (!ec) { if (!ec) {
#else #else
@ -1986,7 +1986,7 @@ void QBtSession::setListeningPort(int port) {
void QBtSession::setDownloadRateLimit(long rate) { void QBtSession::setDownloadRateLimit(long rate) {
qDebug() << Q_FUNC_INFO << rate; qDebug() << Q_FUNC_INFO << rate;
Q_ASSERT(rate == -1 || rate >= 0); Q_ASSERT(rate == -1 || rate >= 0);
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
session_settings settings = s->settings(); session_settings settings = s->settings();
settings.download_rate_limit = rate; settings.download_rate_limit = rate;
s->set_settings(settings); s->set_settings(settings);
@ -2000,7 +2000,7 @@ void QBtSession::setDownloadRateLimit(long rate) {
void QBtSession::setUploadRateLimit(long rate) { void QBtSession::setUploadRateLimit(long rate) {
qDebug() << Q_FUNC_INFO << rate; qDebug() << Q_FUNC_INFO << rate;
Q_ASSERT(rate == -1 || rate >= 0); Q_ASSERT(rate == -1 || rate >= 0);
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
session_settings settings = s->settings(); session_settings settings = s->settings();
settings.upload_rate_limit = rate; settings.upload_rate_limit = rate;
s->set_settings(settings); s->set_settings(settings);
@ -2108,7 +2108,7 @@ void QBtSession::setSessionSettings(const session_settings &sessionSettings) {
void QBtSession::setProxySettings(proxy_settings proxySettings) { void QBtSession::setProxySettings(proxy_settings proxySettings) {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
proxySettings.proxy_peer_connections = Preferences().proxyPeerConnections(); proxySettings.proxy_peer_connections = Preferences().proxyPeerConnections();
s->set_proxy(proxySettings); s->set_proxy(proxySettings);
#else #else
@ -2956,7 +2956,7 @@ void QBtSession::recoverPersistentData(const QString &hash, const std::vector<ch
return; return;
libtorrent::lazy_entry fast; libtorrent::lazy_entry fast;
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
try { try {
libtorrent::lazy_bdecode(&(buf.front()), &(buf.back()), fast); libtorrent::lazy_bdecode(&(buf.front()), &(buf.back()), fast);
} catch (std::exception&) { } catch (std::exception&) {

View file

@ -44,7 +44,7 @@
#include <libtorrent/torrent_info.hpp> #include <libtorrent/torrent_info.hpp>
#include <libtorrent/bencode.hpp> #include <libtorrent/bencode.hpp>
#include <libtorrent/entry.hpp> #include <libtorrent/entry.hpp>
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
#include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp>
#endif #endif
@ -93,7 +93,7 @@ QString QTorrentHandle::name() const {
} }
QString QTorrentHandle::creation_date() const { QString QTorrentHandle::creation_date() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
boost::optional<time_t> t = torrent_handle::get_torrent_info().creation_date(); boost::optional<time_t> t = torrent_handle::get_torrent_info().creation_date();
return t ? misc::toQString(*t) : ""; return t ? misc::toQString(*t) : "";
#else #else
@ -103,7 +103,7 @@ QString QTorrentHandle::creation_date() const {
} }
QString QTorrentHandle::next_announce() const { QString QTorrentHandle::next_announce() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return misc::userFriendlyDuration(torrent_handle::status(0x0).next_announce.total_seconds()); return misc::userFriendlyDuration(torrent_handle::status(0x0).next_announce.total_seconds());
#else #else
return misc::userFriendlyDuration(torrent_handle::status().next_announce.total_seconds()); return misc::userFriendlyDuration(torrent_handle::status().next_announce.total_seconds());
@ -111,7 +111,7 @@ QString QTorrentHandle::next_announce() const {
} }
qlonglong QTorrentHandle::next_announce_s() const { qlonglong QTorrentHandle::next_announce_s() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).next_announce.total_seconds(); return torrent_handle::status(0x0).next_announce.total_seconds();
#else #else
return torrent_handle::status().next_announce.total_seconds(); return torrent_handle::status().next_announce.total_seconds();
@ -119,7 +119,7 @@ qlonglong QTorrentHandle::next_announce_s() const {
} }
float QTorrentHandle::progress() const { float QTorrentHandle::progress() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status st = torrent_handle::status(query_accurate_download_counters); torrent_status st = torrent_handle::status(query_accurate_download_counters);
#else #else
torrent_status st = torrent_handle::status(); torrent_status st = torrent_handle::status();
@ -134,7 +134,7 @@ float QTorrentHandle::progress() const {
} }
bitfield QTorrentHandle::pieces() const { bitfield QTorrentHandle::pieces() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(torrent_handle::query_pieces).pieces; return torrent_handle::status(torrent_handle::query_pieces).pieces;
#else #else
return torrent_handle::status().pieces; return torrent_handle::status().pieces;
@ -142,7 +142,7 @@ bitfield QTorrentHandle::pieces() const {
} }
QString QTorrentHandle::current_tracker() const { QString QTorrentHandle::current_tracker() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return misc::toQString(torrent_handle::status(0x0).current_tracker); return misc::toQString(torrent_handle::status(0x0).current_tracker);
#else #else
return misc::toQString(torrent_handle::status().current_tracker); return misc::toQString(torrent_handle::status().current_tracker);
@ -150,7 +150,7 @@ QString QTorrentHandle::current_tracker() const {
} }
bool QTorrentHandle::is_paused() const { bool QTorrentHandle::is_paused() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status st = torrent_handle::status(0x0); torrent_status st = torrent_handle::status(0x0);
return st.paused && !st.auto_managed; return st.paused && !st.auto_managed;
#else #else
@ -159,7 +159,7 @@ bool QTorrentHandle::is_paused() const {
} }
bool QTorrentHandle::is_queued() const { bool QTorrentHandle::is_queued() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status st = torrent_handle::status(0x0); torrent_status st = torrent_handle::status(0x0);
return st.paused && st.auto_managed; return st.paused && st.auto_managed;
#else #else
@ -185,7 +185,7 @@ bool QTorrentHandle::first_last_piece_first() const {
// Get int first media file // Get int first media file
int index = 0; int index = 0;
for (index = 0; index < t.num_files(); ++index) { for (index = 0; index < t.num_files(); ++index) {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
QString path = misc::toQStringU(t.file_at(index).path); QString path = misc::toQStringU(t.file_at(index).path);
#else #else
QString path = misc::toQStringU(t.file_at(index).path.string()); QString path = misc::toQStringU(t.file_at(index).path.string());
@ -206,7 +206,7 @@ bool QTorrentHandle::first_last_piece_first() const {
} }
size_type QTorrentHandle::total_wanted_done() const { size_type QTorrentHandle::total_wanted_done() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(query_accurate_download_counters).total_wanted_done; return torrent_handle::status(query_accurate_download_counters).total_wanted_done;
#else #else
return torrent_handle::status().total_wanted_done; return torrent_handle::status().total_wanted_done;
@ -214,7 +214,7 @@ size_type QTorrentHandle::total_wanted_done() const {
} }
size_type QTorrentHandle::total_wanted() const { size_type QTorrentHandle::total_wanted() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).total_wanted; return torrent_handle::status(0x0).total_wanted;
#else #else
return torrent_handle::status().total_wanted; return torrent_handle::status().total_wanted;
@ -222,7 +222,7 @@ size_type QTorrentHandle::total_wanted() const {
} }
qreal QTorrentHandle::download_payload_rate() const { qreal QTorrentHandle::download_payload_rate() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).download_payload_rate; return torrent_handle::status(0x0).download_payload_rate;
#else #else
return torrent_handle::status().download_payload_rate; return torrent_handle::status().download_payload_rate;
@ -230,7 +230,7 @@ qreal QTorrentHandle::download_payload_rate() const {
} }
qreal QTorrentHandle::upload_payload_rate() const { qreal QTorrentHandle::upload_payload_rate() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).upload_payload_rate; return torrent_handle::status(0x0).upload_payload_rate;
#else #else
return torrent_handle::status().upload_payload_rate; return torrent_handle::status().upload_payload_rate;
@ -238,7 +238,7 @@ qreal QTorrentHandle::upload_payload_rate() const {
} }
int QTorrentHandle::num_peers() const { int QTorrentHandle::num_peers() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).num_peers; return torrent_handle::status(0x0).num_peers;
#else #else
return torrent_handle::status().num_peers; return torrent_handle::status().num_peers;
@ -246,7 +246,7 @@ int QTorrentHandle::num_peers() const {
} }
int QTorrentHandle::num_seeds() const { int QTorrentHandle::num_seeds() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).num_seeds; return torrent_handle::status(0x0).num_seeds;
#else #else
return torrent_handle::status().num_seeds; return torrent_handle::status().num_seeds;
@ -254,7 +254,7 @@ int QTorrentHandle::num_seeds() const {
} }
int QTorrentHandle::num_complete() const { int QTorrentHandle::num_complete() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).num_complete; return torrent_handle::status(0x0).num_complete;
#else #else
return torrent_handle::status().num_complete; return torrent_handle::status().num_complete;
@ -262,7 +262,7 @@ int QTorrentHandle::num_complete() const {
} }
int QTorrentHandle::num_incomplete() const { int QTorrentHandle::num_incomplete() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).num_incomplete; return torrent_handle::status(0x0).num_incomplete;
#else #else
return torrent_handle::status().num_incomplete; return torrent_handle::status().num_incomplete;
@ -270,7 +270,7 @@ int QTorrentHandle::num_incomplete() const {
} }
QString QTorrentHandle::save_path() const { QString QTorrentHandle::save_path() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return misc::toQStringU(torrent_handle::save_path()).replace("\\", "/"); return misc::toQStringU(torrent_handle::save_path()).replace("\\", "/");
#else #else
return misc::toQStringU(torrent_handle::save_path().string()).replace("\\", "/"); return misc::toQStringU(torrent_handle::save_path().string()).replace("\\", "/");
@ -311,7 +311,7 @@ QStringList QTorrentHandle::url_seeds() const {
// get the size of the torrent without the filtered files // get the size of the torrent without the filtered files
size_type QTorrentHandle::actual_size() const { size_type QTorrentHandle::actual_size() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(query_accurate_download_counters).total_wanted; return torrent_handle::status(query_accurate_download_counters).total_wanted;
#else #else
return torrent_handle::status().total_wanted; return torrent_handle::status().total_wanted;
@ -333,7 +333,7 @@ int QTorrentHandle::num_files() const {
QString QTorrentHandle::filename_at(unsigned int index) const { QString QTorrentHandle::filename_at(unsigned int index) const {
Q_ASSERT(index < (unsigned int)torrent_handle::get_torrent_info().num_files()); Q_ASSERT(index < (unsigned int)torrent_handle::get_torrent_info().num_files());
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return fsutils::fileName(filepath_at(index)); return fsutils::fileName(filepath_at(index));
#else #else
return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.leaf()); return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.leaf());
@ -346,7 +346,7 @@ size_type QTorrentHandle::filesize_at(unsigned int index) const {
} }
QString QTorrentHandle::filepath_at(unsigned int index) const { QString QTorrentHandle::filepath_at(unsigned int index) const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path); return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path);
#else #else
return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.string()); return misc::toQStringU(torrent_handle::get_torrent_info().file_at(index).path.string());
@ -354,7 +354,7 @@ QString QTorrentHandle::filepath_at(unsigned int index) const {
} }
QString QTorrentHandle::orig_filepath_at(unsigned int index) const { QString QTorrentHandle::orig_filepath_at(unsigned int index) const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path); return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path);
#else #else
return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path.string()); return misc::toQStringU(torrent_handle::get_torrent_info().orig_files().at(index).path.string());
@ -362,7 +362,7 @@ QString QTorrentHandle::orig_filepath_at(unsigned int index) const {
} }
torrent_status::state_t QTorrentHandle::state() const { torrent_status::state_t QTorrentHandle::state() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).state; return torrent_handle::status(0x0).state;
#else #else
return torrent_handle::status().state; return torrent_handle::status().state;
@ -378,7 +378,7 @@ QString QTorrentHandle::comment() const {
} }
size_type QTorrentHandle::total_failed_bytes() const { size_type QTorrentHandle::total_failed_bytes() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).total_failed_bytes; return torrent_handle::status(0x0).total_failed_bytes;
#else #else
return torrent_handle::status().total_failed_bytes; return torrent_handle::status().total_failed_bytes;
@ -386,7 +386,7 @@ size_type QTorrentHandle::total_failed_bytes() const {
} }
size_type QTorrentHandle::total_redundant_bytes() const { size_type QTorrentHandle::total_redundant_bytes() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).total_redundant_bytes; return torrent_handle::status(0x0).total_redundant_bytes;
#else #else
return torrent_handle::status().total_redundant_bytes; return torrent_handle::status().total_redundant_bytes;
@ -394,7 +394,7 @@ size_type QTorrentHandle::total_redundant_bytes() const {
} }
bool QTorrentHandle::is_checking() const { bool QTorrentHandle::is_checking() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status st = torrent_handle::status(0x0); torrent_status st = torrent_handle::status(0x0);
#else #else
torrent_status st = torrent_handle::status(); torrent_status st = torrent_handle::status();
@ -403,7 +403,7 @@ bool QTorrentHandle::is_checking() const {
} }
size_type QTorrentHandle::total_done() const { size_type QTorrentHandle::total_done() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(query_accurate_download_counters).total_done; return torrent_handle::status(query_accurate_download_counters).total_done;
#else #else
return torrent_handle::status().total_done; return torrent_handle::status().total_done;
@ -411,7 +411,7 @@ size_type QTorrentHandle::total_done() const {
} }
size_type QTorrentHandle::all_time_download() const { size_type QTorrentHandle::all_time_download() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).all_time_download; return torrent_handle::status(0x0).all_time_download;
#else #else
return torrent_handle::status().all_time_download; return torrent_handle::status().all_time_download;
@ -419,7 +419,7 @@ size_type QTorrentHandle::all_time_download() const {
} }
size_type QTorrentHandle::all_time_upload() const { size_type QTorrentHandle::all_time_upload() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).all_time_upload; return torrent_handle::status(0x0).all_time_upload;
#else #else
return torrent_handle::status().all_time_upload; return torrent_handle::status().all_time_upload;
@ -427,7 +427,7 @@ size_type QTorrentHandle::all_time_upload() const {
} }
size_type QTorrentHandle::total_payload_download() const { size_type QTorrentHandle::total_payload_download() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).total_payload_download; return torrent_handle::status(0x0).total_payload_download;
#else #else
return torrent_handle::status().total_payload_download; return torrent_handle::status().total_payload_download;
@ -435,7 +435,7 @@ size_type QTorrentHandle::total_payload_download() const {
} }
size_type QTorrentHandle::total_payload_upload() const { size_type QTorrentHandle::total_payload_upload() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).total_payload_upload; return torrent_handle::status(0x0).total_payload_upload;
#else #else
return torrent_handle::status().total_payload_upload; return torrent_handle::status().total_payload_upload;
@ -482,7 +482,7 @@ int QTorrentHandle::queue_position() const {
} }
int QTorrentHandle::num_uploads() const { int QTorrentHandle::num_uploads() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).num_uploads; return torrent_handle::status(0x0).num_uploads;
#else #else
return torrent_handle::status().num_uploads; return torrent_handle::status().num_uploads;
@ -500,7 +500,7 @@ bool QTorrentHandle::is_seed() const {
} }
bool QTorrentHandle::is_auto_managed() const { bool QTorrentHandle::is_auto_managed() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status status = torrent_handle::status(0x0); torrent_status status = torrent_handle::status(0x0);
return status.auto_managed; return status.auto_managed;
#else #else
@ -509,7 +509,7 @@ bool QTorrentHandle::is_auto_managed() const {
} }
bool QTorrentHandle::is_sequential_download() const { bool QTorrentHandle::is_sequential_download() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status status = torrent_handle::status(0x0); torrent_status status = torrent_handle::status(0x0);
return status.sequential_download; return status.sequential_download;
#else #else
@ -518,7 +518,7 @@ bool QTorrentHandle::is_sequential_download() const {
} }
qlonglong QTorrentHandle::active_time() const { qlonglong QTorrentHandle::active_time() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).active_time; return torrent_handle::status(0x0).active_time;
#else #else
return torrent_handle::status().active_time; return torrent_handle::status().active_time;
@ -526,7 +526,7 @@ qlonglong QTorrentHandle::active_time() const {
} }
qlonglong QTorrentHandle::seeding_time() const { qlonglong QTorrentHandle::seeding_time() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).seeding_time; return torrent_handle::status(0x0).seeding_time;
#else #else
return torrent_handle::status().seeding_time; return torrent_handle::status().seeding_time;
@ -534,7 +534,7 @@ qlonglong QTorrentHandle::seeding_time() const {
} }
int QTorrentHandle::num_connections() const { int QTorrentHandle::num_connections() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).num_connections; return torrent_handle::status(0x0).num_connections;
#else #else
return torrent_handle::status().num_connections; return torrent_handle::status().num_connections;
@ -542,7 +542,7 @@ int QTorrentHandle::num_connections() const {
} }
int QTorrentHandle::connections_limit() const { int QTorrentHandle::connections_limit() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).connections_limit; return torrent_handle::status(0x0).connections_limit;
#else #else
return torrent_handle::status().connections_limit; return torrent_handle::status().connections_limit;
@ -580,7 +580,7 @@ QString QTorrentHandle::root_path() const
} }
bool QTorrentHandle::has_error() const { bool QTorrentHandle::has_error() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status st = torrent_handle::status(0x0); torrent_status st = torrent_handle::status(0x0);
return st.paused && !st.error.empty(); return st.paused && !st.error.empty();
#else #else
@ -589,7 +589,7 @@ bool QTorrentHandle::has_error() const {
} }
QString QTorrentHandle::error() const { QString QTorrentHandle::error() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return misc::toQString(torrent_handle::status(0x0).error); return misc::toQString(torrent_handle::status(0x0).error);
#else #else
return misc::toQString(torrent_handle::status().error); return misc::toQString(torrent_handle::status().error);
@ -609,7 +609,7 @@ void QTorrentHandle::downloading_pieces(bitfield &bf) const {
} }
bool QTorrentHandle::has_metadata() const { bool QTorrentHandle::has_metadata() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(0x0).has_metadata; return torrent_handle::status(0x0).has_metadata;
#else #else
return torrent_handle::has_metadata(); return torrent_handle::has_metadata();
@ -617,7 +617,7 @@ bool QTorrentHandle::has_metadata() const {
} }
float QTorrentHandle::distributed_copies() const { float QTorrentHandle::distributed_copies() const {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
return torrent_handle::status(query_distributed_copies).distributed_copies; return torrent_handle::status(query_distributed_copies).distributed_copies;
#else #else
return torrent_handle::status().distributed_copies; return torrent_handle::status().distributed_copies;

View file

@ -175,7 +175,7 @@ void TorrentSpeedMonitor::getSamples()
std::vector<torrent_handle>::const_iterator itend = torrents.end(); std::vector<torrent_handle>::const_iterator itend = torrents.end();
for ( ; it != itend; ++it) { for ( ; it != itend; ++it) {
try { try {
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
torrent_status st = it->status(0x0); torrent_status st = it->status(0x0);
#else #else
torrent_status st = it->status(); torrent_status st = it->status();

View file

@ -37,7 +37,7 @@ StatsDialog::StatsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::StatsD
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
connect(ui->buttonOK, SIGNAL(clicked()), SLOT(close())); connect(ui->buttonOK, SIGNAL(clicked()), SLOT(close()));
#if LIBTORRENT_VERSION_NUM < 001600 #if LIBTORRENT_VERSION_NUM < 1600
ui->labelWriteStarveText->setVisible(false); ui->labelWriteStarveText->setVisible(false);
ui->labelWriteStarve->setVisible(false); ui->labelWriteStarve->setVisible(false);
ui->labelReadStarveText->setVisible(false); ui->labelReadStarveText->setVisible(false);
@ -55,7 +55,7 @@ ui->labelJobsTime->setVisible(false);
ui->labelPeers->setAlignment(Qt::AlignRight); ui->labelPeers->setAlignment(Qt::AlignRight);
ui->labelCacheHits->setAlignment(Qt::AlignRight); ui->labelCacheHits->setAlignment(Qt::AlignRight);
ui->labelTotalBuf->setAlignment(Qt::AlignRight); ui->labelTotalBuf->setAlignment(Qt::AlignRight);
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
ui->labelWriteStarve->setAlignment(Qt::AlignRight); ui->labelWriteStarve->setAlignment(Qt::AlignRight);
ui->labelReadStarve->setAlignment(Qt::AlignRight); ui->labelReadStarve->setAlignment(Qt::AlignRight);
ui->labelQueuedJobs->setAlignment(Qt::AlignRight); ui->labelQueuedJobs->setAlignment(Qt::AlignRight);
@ -104,7 +104,7 @@ void StatsDialog::updateUI() {
); );
// Buffers size // Buffers size
ui->labelTotalBuf->setText(misc::friendlyUnit(cache.total_used_buffers * 16 * 1024)); ui->labelTotalBuf->setText(misc::friendlyUnit(cache.total_used_buffers * 16 * 1024));
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
// Disk overload (100%) equivalent // Disk overload (100%) equivalent
// From lt manual: disk_write_queue and disk_read_queue are the number of peers currently waiting on a disk write or disk read // From lt manual: disk_write_queue and disk_read_queue are the number of peers currently waiting on a disk write or disk read
// to complete before it receives or sends any more data on the socket. It'a a metric of how disk bound you are. // to complete before it receives or sends any more data on the socket. It'a a metric of how disk bound you are.

View file

@ -216,7 +216,7 @@ public slots:
void capDownloadSpeed() { void capDownloadSpeed() {
bool ok = false; bool ok = false;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
int cur_limit = QBtSession::instance()->getSession()->settings().download_rate_limit; int cur_limit = QBtSession::instance()->getSession()->settings().download_rate_limit;
#else #else
int cur_limit = QBtSession::instance()->getSession()->download_rate_limit(); int cur_limit = QBtSession::instance()->getSession()->download_rate_limit();
@ -241,7 +241,7 @@ public slots:
void capUploadSpeed() { void capUploadSpeed() {
bool ok = false; bool ok = false;
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
int cur_limit = QBtSession::instance()->getSession()->settings().upload_rate_limit; int cur_limit = QBtSession::instance()->getSession()->settings().upload_rate_limit;
#else #else
int cur_limit = QBtSession::instance()->getSession()->upload_rate_limit(); int cur_limit = QBtSession::instance()->getSession()->upload_rate_limit();

View file

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

View file

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

View file

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

View file

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

View file

@ -508,7 +508,7 @@ void HttpConnection::respondCommand(const QString& command) {
if (command == "getGlobalUpLimit") { if (command == "getGlobalUpLimit") {
m_generator.setStatusLine(200, "OK"); m_generator.setStatusLine(200, "OK");
m_generator.setContentTypeByExt("html"); m_generator.setContentTypeByExt("html");
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->settings().upload_rate_limit)); m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->settings().upload_rate_limit));
#else #else
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->upload_rate_limit())); m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->upload_rate_limit()));
@ -520,7 +520,7 @@ void HttpConnection::respondCommand(const QString& command) {
if (command == "getGlobalDlLimit") { if (command == "getGlobalDlLimit") {
m_generator.setStatusLine(200, "OK"); m_generator.setStatusLine(200, "OK");
m_generator.setContentTypeByExt("html"); m_generator.setContentTypeByExt("html");
#if LIBTORRENT_VERSION_NUM >= 001600 #if LIBTORRENT_VERSION_NUM >= 1600
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->settings().download_rate_limit)); m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->settings().download_rate_limit));
#else #else
m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->download_rate_limit())); m_generator.setMessage(QByteArray::number(QBtSession::instance()->getSession()->download_rate_limit()));

View file

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