Browse Source

Fix save/load of interface address setting.

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
7bf06cd6e6
  1. 10
      src/base/preferences.cpp
  2. 2
      src/base/preferences.h
  3. 1
      src/base/settingsstorage.cpp
  4. 6
      src/gui/advancedsettings.cpp

10
src/base/preferences.cpp

@ -711,16 +711,6 @@ void Preferences::setNetworkInterfaceName(const QString& iface)
setValue("Preferences/Connection/InterfaceName", iface); setValue("Preferences/Connection/InterfaceName", iface);
} }
void Preferences::setNetworkInterfaceAddress(const QString& addr)
{
setValue("Preferences/Connection/InterfaceAddress", addr);
}
QString Preferences::getNetworkInterfaceAddress() const
{
return value("Preferences/Connection/InterfaceAddress").toString();
}
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
bool Preferences::useSystemIconTheme() const bool Preferences::useSystemIconTheme() const
{ {

2
src/base/preferences.h

@ -228,8 +228,6 @@ public:
void resolvePeerHostNames(bool resolve); void resolvePeerHostNames(bool resolve);
QString getNetworkInterfaceName() const; QString getNetworkInterfaceName() const;
void setNetworkInterfaceName(const QString& iface); void setNetworkInterfaceName(const QString& iface);
QString getNetworkInterfaceAddress() const;
void setNetworkInterfaceAddress(const QString& addr);
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
bool useSystemIconTheme() const; bool useSystemIconTheme() const;
void useSystemIconTheme(bool enabled); void useSystemIconTheme(bool enabled);

1
src/base/settingsstorage.cpp

@ -118,6 +118,7 @@ namespace
{"BitTorrent/Session/UseRandomPort", "Preferences/General/UseRandomPort"}, {"BitTorrent/Session/UseRandomPort", "Preferences/General/UseRandomPort"},
{"BitTorrent/Session/IPv6Enabled", "Preferences/Connection/InterfaceListenIPv6"}, {"BitTorrent/Session/IPv6Enabled", "Preferences/Connection/InterfaceListenIPv6"},
{"BitTorrent/Session/Interface", "Preferences/Connection/Interface"}, {"BitTorrent/Session/Interface", "Preferences/Connection/Interface"},
{"BitTorrent/Session/InterfaceAddress", "Preferences/Connection/InterfaceAddress"},
{"BitTorrent/Session/SaveResumeDataInterval", "Preferences/Downloads/SaveResumeDataInterval"}, {"BitTorrent/Session/SaveResumeDataInterval", "Preferences/Downloads/SaveResumeDataInterval"},
{"BitTorrent/Session/Encryption", "Preferences/Bittorrent/Encryption"}, {"BitTorrent/Session/Encryption", "Preferences/Bittorrent/Encryption"},
{"BitTorrent/Session/ForceProxy", "Preferences/Connection/ProxyForce"}, {"BitTorrent/Session/ForceProxy", "Preferences/Connection/ProxyForce"},

6
src/gui/advancedsettings.cpp

@ -156,11 +156,11 @@ void AdvancedSettings::saveAdvancedSettings()
// Interface address // Interface address
if (combo_iface_address.currentIndex() == 0) { if (combo_iface_address.currentIndex() == 0) {
// All addresses (default) // All addresses (default)
pref->setNetworkInterfaceAddress(QString::null); session->setNetworkInterfaceAddress(QString::null);
} }
else { else {
QHostAddress ifaceAddr(combo_iface_address.currentText().trimmed()); QHostAddress ifaceAddr(combo_iface_address.currentText().trimmed());
ifaceAddr.isNull() ? pref->setNetworkInterfaceAddress(QString::null) : pref->setNetworkInterfaceAddress(ifaceAddr.toString()); ifaceAddr.isNull() ? session->setNetworkInterfaceAddress(QString::null) : session->setNetworkInterfaceAddress(ifaceAddr.toString());
} }
session->setIPv6Enabled(cb_listen_ipv6.isChecked()); session->setIPv6Enabled(cb_listen_ipv6.isChecked());
// Announce IP // Announce IP
@ -200,7 +200,7 @@ void AdvancedSettings::updateInterfaceAddressCombo()
{ {
// Try to get the currently selected interface name // Try to get the currently selected interface name
const QString ifaceName = combo_iface.itemData(combo_iface.currentIndex()).toString(); // Empty string for the first element const QString ifaceName = combo_iface.itemData(combo_iface.currentIndex()).toString(); // Empty string for the first element
const QString currentAddress = Preferences::instance()->getNetworkInterfaceAddress(); const QString currentAddress = BitTorrent::Session::instance()->networkInterfaceAddress();
//Clear all items and reinsert them, default to all //Clear all items and reinsert them, default to all
combo_iface_address.clear(); combo_iface_address.clear();

Loading…
Cancel
Save