mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 02:36:10 +03:00
parent
488464731d
commit
f08556be30
2 changed files with 12 additions and 5 deletions
|
@ -320,8 +320,10 @@ void AppController::preferencesAction()
|
|||
data[u"memory_working_set_limit"_s] = app()->memoryWorkingSetLimit();
|
||||
// Current network interface
|
||||
data[u"current_network_interface"_s] = session->networkInterface();
|
||||
// Current network interface name
|
||||
data[u"current_interface_name"_s] = session->networkInterfaceName();
|
||||
// Current network interface address
|
||||
data[u"current_interface_address"_s] = BitTorrent::Session::instance()->networkInterfaceAddress();
|
||||
data[u"current_interface_address"_s] = session->networkInterfaceAddress();
|
||||
// Save resume data interval
|
||||
data[u"save_resume_data_interval"_s] = session->saveResumeDataInterval();
|
||||
// Recheck completed torrents
|
||||
|
@ -845,7 +847,8 @@ void AppController::setPreferencesAction()
|
|||
const QString ifaceName = (ifacesIter != ifaces.cend()) ? ifacesIter->humanReadableName() : QString {};
|
||||
|
||||
session->setNetworkInterface(ifaceValue);
|
||||
session->setNetworkInterfaceName(ifaceName);
|
||||
if (!ifaceName.isEmpty() || ifaceValue.isEmpty())
|
||||
session->setNetworkInterfaceName(ifaceName);
|
||||
}
|
||||
// Current network interface address
|
||||
if (hasKey(u"current_interface_address"_s))
|
||||
|
|
|
@ -1749,7 +1749,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
};
|
||||
|
||||
// Advanced Tab
|
||||
const updateNetworkInterfaces = function(default_iface) {
|
||||
const updateNetworkInterfaces = function(default_iface, default_iface_name) {
|
||||
const url = 'api/v2/app/networkInterfaceList';
|
||||
$('networkInterface').empty();
|
||||
new Request.JSON({
|
||||
|
@ -1760,9 +1760,13 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
alert("Could not contact qBittorrent");
|
||||
},
|
||||
onSuccess: function(ifaces) {
|
||||
if (!ifaces)
|
||||
if (!Array.isArray(ifaces))
|
||||
return;
|
||||
|
||||
// add the current network interface to the options if needed
|
||||
if (default_iface && !ifaces.some((item) => item.value === default_iface))
|
||||
ifaces.push({ name: default_iface_name || default_iface, value: default_iface });
|
||||
|
||||
$('networkInterface').options.add(new Option('QBT_TR(Any interface)QBT_TR[CONTEXT=OptionsDialog]', ''));
|
||||
ifaces.forEach(function(item, index) {
|
||||
$('networkInterface').options.add(new Option(item.name, item.value));
|
||||
|
@ -2144,7 +2148,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
// qBittorrent section
|
||||
$('resumeDataStorageType').setProperty('value', pref.resume_data_storage_type);
|
||||
$('memoryWorkingSetLimit').setProperty('value', pref.memory_working_set_limit);
|
||||
updateNetworkInterfaces(pref.current_network_interface);
|
||||
updateNetworkInterfaces(pref.current_network_interface, pref.current_interface_name);
|
||||
updateInterfaceAddresses(pref.current_network_interface, pref.current_interface_address);
|
||||
$('saveResumeDataInterval').setProperty('value', pref.save_resume_data_interval);
|
||||
$('recheckTorrentsOnCompletion').setProperty('checked', pref.recheck_completed_torrents);
|
||||
|
|
Loading…
Reference in a new issue