mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 04:54:18 +00:00
Fix save/load of interface address setting.
This commit is contained in:
parent
f885c6375a
commit
7bf06cd6e6
@ -711,16 +711,6 @@ void Preferences::setNetworkInterfaceName(const QString& 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))
|
||||
bool Preferences::useSystemIconTheme() const
|
||||
{
|
||||
|
@ -228,8 +228,6 @@ public:
|
||||
void resolvePeerHostNames(bool resolve);
|
||||
QString getNetworkInterfaceName() const;
|
||||
void setNetworkInterfaceName(const QString& iface);
|
||||
QString getNetworkInterfaceAddress() const;
|
||||
void setNetworkInterfaceAddress(const QString& addr);
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||
bool useSystemIconTheme() const;
|
||||
void useSystemIconTheme(bool enabled);
|
||||
|
@ -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/InterfaceAddress", "Preferences/Connection/InterfaceAddress"},
|
||||
{"BitTorrent/Session/SaveResumeDataInterval", "Preferences/Downloads/SaveResumeDataInterval"},
|
||||
{"BitTorrent/Session/Encryption", "Preferences/Bittorrent/Encryption"},
|
||||
{"BitTorrent/Session/ForceProxy", "Preferences/Connection/ProxyForce"},
|
||||
|
@ -156,11 +156,11 @@ void AdvancedSettings::saveAdvancedSettings()
|
||||
// Interface address
|
||||
if (combo_iface_address.currentIndex() == 0) {
|
||||
// All addresses (default)
|
||||
pref->setNetworkInterfaceAddress(QString::null);
|
||||
session->setNetworkInterfaceAddress(QString::null);
|
||||
}
|
||||
else {
|
||||
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());
|
||||
// Announce IP
|
||||
@ -200,7 +200,7 @@ void AdvancedSettings::updateInterfaceAddressCombo()
|
||||
{
|
||||
// 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 currentAddress = Preferences::instance()->getNetworkInterfaceAddress();
|
||||
const QString currentAddress = BitTorrent::Session::instance()->networkInterfaceAddress();
|
||||
|
||||
//Clear all items and reinsert them, default to all
|
||||
combo_iface_address.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user