Correctly detect libtorrent version.

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

View File

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

View File

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

View File

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