Browse Source

Allow to specify if announcing to all tiers is desired.

adaptive-webui-19844
sledgehammer999 7 years ago
parent
commit
3a5c0d9818
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 24
      src/base/bittorrent/session.cpp
  2. 3
      src/base/bittorrent/session.h
  3. 10
      src/gui/advancedsettings.cpp
  4. 4
      src/gui/advancedsettings.h

24
src/base/bittorrent/session.cpp

@ -275,6 +275,7 @@ Session::Session(QObject *parent) @@ -275,6 +275,7 @@ Session::Session(QObject *parent)
, m_isTrackerFilteringEnabled(BITTORRENT_SESSION_KEY("TrackerFilteringEnabled"), false)
, m_IPFilterFile(BITTORRENT_SESSION_KEY("IPFilter"))
, m_announceToAllTrackers(BITTORRENT_SESSION_KEY("AnnounceToAllTrackers"), true)
, m_announceToAllTiers(BITTORRENT_SESSION_KEY("AnnounceToAllTiers"), true)
, m_diskCacheSize(BITTORRENT_SESSION_KEY("DiskCacheSize"), 64)
, m_diskCacheTTL(BITTORRENT_SESSION_KEY("DiskCacheTTL"), 60)
, m_useOSCache(BITTORRENT_SESSION_KEY("UseOSCache"), true)
@ -1286,9 +1287,8 @@ void Session::configure(libtorrent::settings_pack &settingsPack) @@ -1286,9 +1287,8 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
}
settingsPack.set_bool(libt::settings_pack::force_proxy, m_useProxy ? isForceProxyEnabled() : false);
const bool announceToAll = announceToAllTrackers();
settingsPack.set_bool(libt::settings_pack::announce_to_all_trackers, announceToAll);
settingsPack.set_bool(libt::settings_pack::announce_to_all_tiers, announceToAll);
settingsPack.set_bool(libt::settings_pack::announce_to_all_trackers, announceToAllTrackers());
settingsPack.set_bool(libt::settings_pack::announce_to_all_tiers, announceToAllTiers());
const int cacheSize = (diskCacheSize() > -1) ? diskCacheSize() * 64 : -1;
settingsPack.set_int(libt::settings_pack::cache_size, cacheSize);
@ -1569,9 +1569,8 @@ void Session::configure(libtorrent::session_settings &sessionSettings) @@ -1569,9 +1569,8 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
}
sessionSettings.force_proxy = m_useProxy ? isForceProxyEnabled() : false;
bool announceToAll = announceToAllTrackers();
sessionSettings.announce_to_all_trackers = announceToAll;
sessionSettings.announce_to_all_tiers = announceToAll;
sessionSettings.announce_to_all_trackers = announceToAllTrackers();
sessionSettings.announce_to_all_tiers = announceToAllTiers();
const int cacheSize = (diskCacheSize() > -1) ? diskCacheSize() * 64 : -1;
sessionSettings.cache_size = cacheSize;
sessionSettings.cache_expiry = diskCacheTTL();
@ -2968,6 +2967,19 @@ void Session::setAnnounceToAllTrackers(bool val) @@ -2968,6 +2967,19 @@ void Session::setAnnounceToAllTrackers(bool val)
}
}
bool Session::announceToAllTiers() const
{
return m_announceToAllTiers;
}
void Session::setAnnounceToAllTiers(bool val)
{
if (val != m_announceToAllTiers) {
m_announceToAllTiers = val;
configureDeferred();
}
}
int Session::diskCacheSize() const
{
int size = m_diskCacheSize;

3
src/base/bittorrent/session.h

@ -372,6 +372,8 @@ namespace BitTorrent @@ -372,6 +372,8 @@ namespace BitTorrent
void setIPFilterFile(QString path);
bool announceToAllTrackers() const;
void setAnnounceToAllTrackers(bool val);
bool announceToAllTiers() const;
void setAnnounceToAllTiers(bool val);
int diskCacheSize() const;
void setDiskCacheSize(int size);
int diskCacheTTL() const;
@ -639,6 +641,7 @@ namespace BitTorrent @@ -639,6 +641,7 @@ namespace BitTorrent
CachedSettingValue<bool> m_isTrackerFilteringEnabled;
CachedSettingValue<QString> m_IPFilterFile;
CachedSettingValue<bool> m_announceToAllTrackers;
CachedSettingValue<bool> m_announceToAllTiers;
CachedSettingValue<int> m_diskCacheSize;
CachedSettingValue<int> m_diskCacheTTL;
CachedSettingValue<bool> m_useOSCache;

10
src/gui/advancedsettings.cpp

@ -99,6 +99,7 @@ enum AdvSettingsRows @@ -99,6 +99,7 @@ enum AdvSettingsRows
SUPER_SEEDING,
// tracker
ANNOUNCE_ALL_TRACKERS,
ANNOUNCE_ALL_TIERS,
ANNOUNCE_IP,
ROW_COUNT
@ -217,6 +218,7 @@ void AdvancedSettings::saveAdvancedSettings() @@ -217,6 +218,7 @@ void AdvancedSettings::saveAdvancedSettings()
pref->setConfirmRemoveAllTags(cb_confirm_remove_all_tags.isChecked());
session->setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked());
session->setAnnounceToAllTiers(cb_announce_all_tiers.isChecked());
}
void AdvancedSettings::updateCacheSpinSuffix(int value)
@ -452,9 +454,13 @@ void AdvancedSettings::loadAdvancedSettings() @@ -452,9 +454,13 @@ void AdvancedSettings::loadAdvancedSettings()
cb_confirm_remove_all_tags.setChecked(pref->confirmRemoveAllTags());
addRow(CONFIRM_REMOVE_ALL_TAGS, tr("Confirm removal of all tags"), &cb_confirm_remove_all_tags);
// Announce to all trackers
// Announce to all trackers in a tier
cb_announce_all_trackers.setChecked(session->announceToAllTrackers());
addRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers);
addRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers in a tier"), &cb_announce_all_trackers);
// Announce to all tiers
cb_announce_all_tiers.setChecked(session->announceToAllTiers());
addRow(ANNOUNCE_ALL_TIERS, tr("Always announce to all tiers"), &cb_announce_all_tiers);
}
template <typename T>

4
src/gui/advancedsettings.h

@ -79,8 +79,8 @@ private: @@ -79,8 +79,8 @@ private:
spinSendBufferWatermark, spinSendBufferLowWatermark, spinSendBufferWatermarkFactor;
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, cb_super_seeding,
cb_program_notifications, cb_torrent_added_notifications, cb_tracker_favicon, cb_tracker_status,
cb_confirm_torrent_recheck, cb_confirm_remove_all_tags, cb_listen_ipv6, cb_announce_all_trackers, cbGuidedReadCache, cbMultiConnectionsPerIp,
cbSuggestMode;
cb_confirm_torrent_recheck, cb_confirm_remove_all_tags, cb_listen_ipv6, cb_announce_all_trackers, cb_announce_all_tiers,
cbGuidedReadCache, cbMultiConnectionsPerIp, cbSuggestMode;
QComboBox combo_iface, combo_iface_address, comboUtpMixedMode, comboChokingAlgorithm, comboSeedChokingAlgorithm;
QLineEdit txtAnnounceIP;

Loading…
Cancel
Save