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)
, m_outgoingPortsMax(BITTORRENT_SESSION_KEY("OutgoingPortsMax"), 0) , m_outgoingPortsMax(BITTORRENT_SESSION_KEY("OutgoingPortsMax"), 0)
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY("IgnoreLimitsOnLAN"), true) , m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY("IgnoreLimitsOnLAN"), true)
, m_includeOverheadInLimits(BITTORRENT_SESSION_KEY("IncludeOverheadInLimits"), false) , 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_isSuperSeedingEnabled(BITTORRENT_SESSION_KEY("SuperSeedingEnabled"), false)
, m_maxConnections(BITTORRENT_SESSION_KEY("MaxConnections"), 500, lowerLimited(0, -1)) , m_maxConnections(BITTORRENT_SESSION_KEY("MaxConnections"), 500, lowerLimited(0, -1))
, m_maxHalfOpenConnections(BITTORRENT_SESSION_KEY("MaxHalfOpenConnections"), 20, 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 // Include overhead in transfer limits
settingsPack.set_bool(libt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits()); settingsPack.set_bool(libt::settings_pack::rate_limit_ip_overhead, includeOverheadInLimits());
// IP address to announce to trackers // 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 // Super seeding
settingsPack.set_bool(libt::settings_pack::strict_super_seeding, isSuperSeedingEnabled()); settingsPack.set_bool(libt::settings_pack::strict_super_seeding, isSuperSeedingEnabled());
// * Max Half-open connections // * Max Half-open connections
@ -1243,7 +1243,7 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
// Include overhead in transfer limits // Include overhead in transfer limits
sessionSettings.rate_limit_ip_overhead = includeOverheadInLimits(); sessionSettings.rate_limit_ip_overhead = includeOverheadInLimits();
// IP address to announce to trackers // IP address to announce to trackers
sessionSettings.announce_ip = Utils::String::toStdString(networkAddress()); sessionSettings.announce_ip = Utils::String::toStdString(announceIP());
// Super seeding // Super seeding
sessionSettings.strict_super_seeding = isSuperSeedingEnabled(); sessionSettings.strict_super_seeding = isSuperSeedingEnabled();
// * Max Half-open connections // * 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) { if (ip != m_announceIP) {
m_networkAddress = addr; m_announceIP = ip;
configureDeferred(); configureDeferred();
} }
} }

6
src/base/bittorrent/session.h

@ -300,8 +300,8 @@ namespace BitTorrent
void setIgnoreLimitsOnLAN(bool ignore); void setIgnoreLimitsOnLAN(bool ignore);
bool includeOverheadInLimits() const; bool includeOverheadInLimits() const;
void setIncludeOverheadInLimits(bool include); void setIncludeOverheadInLimits(bool include);
QString networkAddress() const; QString announceIP() const;
void setNetworkAddress(const QString &addr); void setAnnounceIP(const QString &ip);
bool isSuperSeedingEnabled() const; bool isSuperSeedingEnabled() const;
void setSuperSeedingEnabled(bool enabled); void setSuperSeedingEnabled(bool enabled);
int maxConnections() const; int maxConnections() const;
@ -523,7 +523,7 @@ namespace BitTorrent
CachedSettingValue<uint> m_outgoingPortsMax; CachedSettingValue<uint> m_outgoingPortsMax;
CachedSettingValue<bool> m_ignoreLimitsOnLAN; CachedSettingValue<bool> m_ignoreLimitsOnLAN;
CachedSettingValue<bool> m_includeOverheadInLimits; CachedSettingValue<bool> m_includeOverheadInLimits;
CachedSettingValue<QString> m_networkAddress; CachedSettingValue<QString> m_announceIP;
CachedSettingValue<bool> m_isSuperSeedingEnabled; CachedSettingValue<bool> m_isSuperSeedingEnabled;
CachedSettingValue<int> m_maxConnections; CachedSettingValue<int> m_maxConnections;
CachedSettingValue<int> m_maxHalfOpenConnections; CachedSettingValue<int> m_maxHalfOpenConnections;

2
src/base/settingsstorage.cpp

@ -150,7 +150,7 @@ namespace
{"BitTorrent/Session/OutgoingPortsMax", "Preferences/Advanced/OutgoingPortsMax"}, {"BitTorrent/Session/OutgoingPortsMax", "Preferences/Advanced/OutgoingPortsMax"},
{"BitTorrent/Session/IgnoreLimitsOnLAN", "Preferences/Advanced/IgnoreLimitsLAN"}, {"BitTorrent/Session/IgnoreLimitsOnLAN", "Preferences/Advanced/IgnoreLimitsLAN"},
{"BitTorrent/Session/IncludeOverheadInLimits", "Preferences/Advanced/IncludeOverhead"}, {"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/SuperSeedingEnabled", "Preferences/Advanced/SuperSeeding"},
{"BitTorrent/Session/MaxHalfOpenConnections", "Preferences/Connection/MaxHalfOpenConnec"}, {"BitTorrent/Session/MaxHalfOpenConnections", "Preferences/Connection/MaxHalfOpenConnec"},
{"BitTorrent/Session/uTPEnabled", "Preferences/Bittorrent/uTP"}, {"BitTorrent/Session/uTPEnabled", "Preferences/Bittorrent/uTP"},

14
src/gui/advancedsettings.cpp

@ -88,7 +88,7 @@ enum AdvSettingsRows
// tracker // tracker
TRACKER_EXCHANGE, TRACKER_EXCHANGE,
ANNOUNCE_ALL_TRACKERS, ANNOUNCE_ALL_TRACKERS,
NETWORK_ADDRESS, ANNOUNCE_IP,
ROW_COUNT ROW_COUNT
}; };
@ -163,9 +163,9 @@ void AdvancedSettings::saveAdvancedSettings()
ifaceAddr.isNull() ? pref->setNetworkInterfaceAddress(QString::null) : pref->setNetworkInterfaceAddress(ifaceAddr.toString()); ifaceAddr.isNull() ? pref->setNetworkInterfaceAddress(QString::null) : pref->setNetworkInterfaceAddress(ifaceAddr.toString());
} }
session->setIPv6Enabled(cb_listen_ipv6.isChecked()); session->setIPv6Enabled(cb_listen_ipv6.isChecked());
// Network address // Announce IP
QHostAddress addr(txt_network_address.text().trimmed()); QHostAddress addr(txtAnnounceIP.text().trimmed());
session->setNetworkAddress(addr.isNull() ? "" : addr.toString()); session->setAnnounceIP(addr.isNull() ? "" : addr.toString());
// Program notification // Program notification
MainWindow * const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow(); MainWindow * const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
@ -343,9 +343,9 @@ void AdvancedSettings::loadAdvancedSettings()
// Listen on IPv6 address // Listen on IPv6 address
cb_listen_ipv6.setChecked(session->isIPv6Enabled()); cb_listen_ipv6.setChecked(session->isIPv6Enabled());
addRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6); addRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6);
// Announce address // Announce IP
txt_network_address.setText(session->networkAddress()); txtAnnounceIP.setText(session->announceIP());
addRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address); addRow(ANNOUNCE_IP, tr("IP Address to report to trackers (requires restart)"), &txtAnnounceIP);
// Program notifications // Program notifications
const MainWindow * const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow(); const MainWindow * const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();

2
src/gui/advancedsettings.h

@ -64,7 +64,7 @@ private:
cb_super_seeding, cb_program_notifications, cb_torrent_added_notifications, cb_tracker_status, 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; cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6, cb_announce_all_trackers;
QComboBox combo_iface, combo_iface_address; QComboBox combo_iface, combo_iface_address;
QLineEdit txt_network_address; QLineEdit txtAnnounceIP;
// OS dependent settings // OS dependent settings
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) #if defined(Q_OS_WIN) || defined(Q_OS_MAC)

Loading…
Cancel
Save