Browse Source

Migrate last setting related to interfaces to the new system.

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
f391b24b1d
  1. 11
      src/base/bittorrent/session.cpp
  2. 3
      src/base/bittorrent/session.h
  3. 10
      src/base/preferences.cpp
  4. 2
      src/base/preferences.h
  5. 1
      src/base/settingsstorage.cpp
  6. 6
      src/gui/advancedsettings.cpp

11
src/base/bittorrent/session.cpp

@ -290,6 +290,7 @@ Session::Session(QObject *parent) @@ -290,6 +290,7 @@ Session::Session(QObject *parent)
, m_port(BITTORRENT_SESSION_KEY("Port"), 8999)
, m_useRandomPort(BITTORRENT_SESSION_KEY("UseRandomPort"), false)
, m_networkInterface(BITTORRENT_SESSION_KEY("Interface"))
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
, m_isIPv6Enabled(BITTORRENT_SESSION_KEY("IPv6Enabled"), false)
, m_encryption(BITTORRENT_SESSION_KEY("Encryption"), 0)
@ -2251,6 +2252,16 @@ void Session::setNetworkInterface(const QString &interface) @@ -2251,6 +2252,16 @@ void Session::setNetworkInterface(const QString &interface)
}
}
QString Session::networkInterfaceName() const
{
return m_networkInterfaceName;
}
void Session::setNetworkInterfaceName(const QString &name)
{
m_networkInterfaceName = name;
}
QString Session::networkInterfaceAddress() const
{
return m_networkInterfaceAddress;

3
src/base/bittorrent/session.h

@ -260,6 +260,8 @@ namespace BitTorrent @@ -260,6 +260,8 @@ namespace BitTorrent
void setUseRandomPort(bool value);
QString networkInterface() const;
void setNetworkInterface(const QString &interface);
QString networkInterfaceName() const;
void setNetworkInterfaceName(const QString &name);
QString networkInterfaceAddress() const;
void setNetworkInterfaceAddress(const QString &address);
bool isIPv6Enabled() const;
@ -551,6 +553,7 @@ namespace BitTorrent @@ -551,6 +553,7 @@ namespace BitTorrent
CachedSettingValue<int> m_port;
CachedSettingValue<bool> m_useRandomPort;
CachedSettingValue<QString> m_networkInterface;
CachedSettingValue<QString> m_networkInterfaceName;
CachedSettingValue<QString> m_networkInterfaceAddress;
CachedSettingValue<bool> m_isIPv6Enabled;
CachedSettingValue<int> m_encryption;

10
src/base/preferences.cpp

@ -701,16 +701,6 @@ void Preferences::resolvePeerHostNames(bool resolve) @@ -701,16 +701,6 @@ void Preferences::resolvePeerHostNames(bool resolve)
setValue("Preferences/Connection/ResolvePeerHostNames", resolve);
}
QString Preferences::getNetworkInterfaceName() const
{
return value("Preferences/Connection/InterfaceName").toString();
}
void Preferences::setNetworkInterfaceName(const QString& iface)
{
setValue("Preferences/Connection/InterfaceName", iface);
}
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
bool Preferences::useSystemIconTheme() const
{

2
src/base/preferences.h

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

1
src/base/settingsstorage.cpp

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

6
src/gui/advancedsettings.cpp

@ -146,11 +146,11 @@ void AdvancedSettings::saveAdvancedSettings() @@ -146,11 +146,11 @@ void AdvancedSettings::saveAdvancedSettings()
if (combo_iface.currentIndex() == 0) {
// All interfaces (default)
session->setNetworkInterface(QString());
pref->setNetworkInterfaceName(QString());
session->setNetworkInterfaceName(QString());
}
else {
session->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
pref->setNetworkInterfaceName(combo_iface.currentText());
session->setNetworkInterfaceName(combo_iface.currentText());
}
// Interface address
@ -333,7 +333,7 @@ void AdvancedSettings::loadAdvancedSettings() @@ -333,7 +333,7 @@ void AdvancedSettings::loadAdvancedSettings()
}
// Saved interface does not exist, show it anyway
if (!interface_exists) {
combo_iface.addItem(pref->getNetworkInterfaceName(), current_iface);
combo_iface.addItem(session->networkInterfaceName(), current_iface);
combo_iface.setCurrentIndex(i);
}
addRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface);

Loading…
Cancel
Save