From f885c6375a297536f7f4bb1fc0b88dfd6e11c4d8 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Mon, 31 Oct 2016 01:22:11 +0200 Subject: [PATCH] Use better variable names for tracker announce IP setting. --- src/base/bittorrent/session.cpp | 16 ++++++++-------- src/base/bittorrent/session.h | 6 +++--- src/base/settingsstorage.cpp | 2 +- src/gui/advancedsettings.cpp | 14 +++++++------- src/gui/advancedsettings.h | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 758ef3663..1644e00aa 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -262,7 +262,7 @@ Session::Session(QObject *parent) , m_outgoingPortsMax(BITTORRENT_SESSION_KEY("OutgoingPortsMax"), 0) , m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY("IgnoreLimitsOnLAN"), true) , m_includeOverheadInLimits(BITTORRENT_SESSION_KEY("IncludeOverheadInLimits"), false) - , m_networkAddress(BITTORRENT_SESSION_KEY("NetworkAddress")) + , m_announceIP(BITTORRENT_SESSION_KEY("AnnounceIP")) , m_isSuperSeedingEnabled(BITTORRENT_SESSION_KEY("SuperSeedingEnabled"), false) , m_maxConnections(BITTORRENT_SESSION_KEY("MaxConnections"), 500, lowerLimited(0, -1)) , m_maxHalfOpenConnections(BITTORRENT_SESSION_KEY("MaxHalfOpenConnections"), 20, lowerLimited(0, -1)) @@ -1103,7 +1103,7 @@ void Session::configure(libtorrent::settings_pack &settingsPack) // Include overhead in transfer limits settingsPack.set_bool(libt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits()); // IP address to announce to trackers - settingsPack.set_str(libt::settings_pack::announce_ip, Utils::String::toStdString(networkAddress())); + settingsPack.set_str(libt::settings_pack::announce_ip, Utils::String::toStdString(announceIP())); // Super seeding settingsPack.set_bool(libt::settings_pack::strict_super_seeding, isSuperSeedingEnabled()); // * Max Half-open connections @@ -1243,7 +1243,7 @@ void Session::configure(libtorrent::session_settings &sessionSettings) // Include overhead in transfer limits sessionSettings.rate_limit_ip_overhead = includeOverheadInLimits(); // IP address to announce to trackers - sessionSettings.announce_ip = Utils::String::toStdString(networkAddress()); + sessionSettings.announce_ip = Utils::String::toStdString(announceIP()); // Super seeding sessionSettings.strict_super_seeding = isSuperSeedingEnabled(); // * Max Half-open connections @@ -2619,15 +2619,15 @@ void Session::setIncludeOverheadInLimits(bool include) } } -QString Session::networkAddress() const +QString Session::announceIP() const { - return m_networkAddress; + return m_announceIP; } -void Session::setNetworkAddress(const QString &addr) +void Session::setAnnounceIP(const QString &ip) { - if (addr != m_networkAddress) { - m_networkAddress = addr; + if (ip != m_announceIP) { + m_announceIP = ip; configureDeferred(); } } diff --git a/src/base/bittorrent/session.h b/src/base/bittorrent/session.h index 82fd6f00c..8ddc47efc 100644 --- a/src/base/bittorrent/session.h +++ b/src/base/bittorrent/session.h @@ -300,8 +300,8 @@ namespace BitTorrent void setIgnoreLimitsOnLAN(bool ignore); bool includeOverheadInLimits() const; void setIncludeOverheadInLimits(bool include); - QString networkAddress() const; - void setNetworkAddress(const QString &addr); + QString announceIP() const; + void setAnnounceIP(const QString &ip); bool isSuperSeedingEnabled() const; void setSuperSeedingEnabled(bool enabled); int maxConnections() const; @@ -523,7 +523,7 @@ namespace BitTorrent CachedSettingValue m_outgoingPortsMax; CachedSettingValue m_ignoreLimitsOnLAN; CachedSettingValue m_includeOverheadInLimits; - CachedSettingValue m_networkAddress; + CachedSettingValue m_announceIP; CachedSettingValue m_isSuperSeedingEnabled; CachedSettingValue m_maxConnections; CachedSettingValue m_maxHalfOpenConnections; diff --git a/src/base/settingsstorage.cpp b/src/base/settingsstorage.cpp index d9b3fe8f9..a896e5084 100644 --- a/src/base/settingsstorage.cpp +++ b/src/base/settingsstorage.cpp @@ -150,7 +150,7 @@ namespace {"BitTorrent/Session/OutgoingPortsMax", "Preferences/Advanced/OutgoingPortsMax"}, {"BitTorrent/Session/IgnoreLimitsOnLAN", "Preferences/Advanced/IgnoreLimitsLAN"}, {"BitTorrent/Session/IncludeOverheadInLimits", "Preferences/Advanced/IncludeOverhead"}, - {"BitTorrent/Session/NetworkAddress", "Preferences/Connection/InetAddress"}, + {"BitTorrent/Session/AnnounceIP", "Preferences/Connection/InetAddress"}, {"BitTorrent/Session/SuperSeedingEnabled", "Preferences/Advanced/SuperSeeding"}, {"BitTorrent/Session/MaxHalfOpenConnections", "Preferences/Connection/MaxHalfOpenConnec"}, {"BitTorrent/Session/uTPEnabled", "Preferences/Bittorrent/uTP"}, diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index c0a359b06..1af7807f3 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -88,7 +88,7 @@ enum AdvSettingsRows // tracker TRACKER_EXCHANGE, ANNOUNCE_ALL_TRACKERS, - NETWORK_ADDRESS, + ANNOUNCE_IP, ROW_COUNT }; @@ -163,9 +163,9 @@ void AdvancedSettings::saveAdvancedSettings() ifaceAddr.isNull() ? pref->setNetworkInterfaceAddress(QString::null) : pref->setNetworkInterfaceAddress(ifaceAddr.toString()); } session->setIPv6Enabled(cb_listen_ipv6.isChecked()); - // Network address - QHostAddress addr(txt_network_address.text().trimmed()); - session->setNetworkAddress(addr.isNull() ? "" : addr.toString()); + // Announce IP + QHostAddress addr(txtAnnounceIP.text().trimmed()); + session->setAnnounceIP(addr.isNull() ? "" : addr.toString()); // Program notification MainWindow * const mainWindow = static_cast(QCoreApplication::instance())->mainWindow(); @@ -343,9 +343,9 @@ void AdvancedSettings::loadAdvancedSettings() // Listen on IPv6 address cb_listen_ipv6.setChecked(session->isIPv6Enabled()); addRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6); - // Announce address - txt_network_address.setText(session->networkAddress()); - addRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address); + // Announce IP + txtAnnounceIP.setText(session->announceIP()); + addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &txtAnnounceIP); // Program notifications const MainWindow * const mainWindow = static_cast(QCoreApplication::instance())->mainWindow(); diff --git a/src/gui/advancedsettings.h b/src/gui/advancedsettings.h index 9e1c49cf6..68ac3c17c 100644 --- a/src/gui/advancedsettings.h +++ b/src/gui/advancedsettings.h @@ -64,7 +64,7 @@ private: cb_super_seeding, cb_program_notifications, cb_torrent_added_notifications, cb_tracker_status, cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6, cb_announce_all_trackers; QComboBox combo_iface, combo_iface_address; - QLineEdit txt_network_address; + QLineEdit txtAnnounceIP; // OS dependent settings #if defined(Q_OS_WIN) || defined(Q_OS_MAC)