Browse Source

Use better variable names for tracker announce IP setting.

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
f885c6375a
  1. 16
      src/base/bittorrent/session.cpp
  2. 6
      src/base/bittorrent/session.h
  3. 2
      src/base/settingsstorage.cpp
  4. 14
      src/gui/advancedsettings.cpp
  5. 2
      src/gui/advancedsettings.h

16
src/base/bittorrent/session.cpp

@ -262,7 +262,7 @@ Session::Session(QObject *parent) @@ -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) @@ -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) @@ -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) @@ -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();
}
}

6
src/base/bittorrent/session.h

@ -300,8 +300,8 @@ namespace BitTorrent @@ -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 @@ -523,7 +523,7 @@ namespace BitTorrent
CachedSettingValue<uint> m_outgoingPortsMax;
CachedSettingValue<bool> m_ignoreLimitsOnLAN;
CachedSettingValue<bool> m_includeOverheadInLimits;
CachedSettingValue<QString> m_networkAddress;
CachedSettingValue<QString> m_announceIP;
CachedSettingValue<bool> m_isSuperSeedingEnabled;
CachedSettingValue<int> m_maxConnections;
CachedSettingValue<int> m_maxHalfOpenConnections;

2
src/base/settingsstorage.cpp

@ -150,7 +150,7 @@ namespace @@ -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"},

14
src/gui/advancedsettings.cpp

@ -88,7 +88,7 @@ enum AdvSettingsRows @@ -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() @@ -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<Application*>(QCoreApplication::instance())->mainWindow();
@ -343,9 +343,9 @@ void AdvancedSettings::loadAdvancedSettings() @@ -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<Application*>(QCoreApplication::instance())->mainWindow();

2
src/gui/advancedsettings.h

@ -64,7 +64,7 @@ private: @@ -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)

Loading…
Cancel
Save