Reorder code to match UI

This commit is contained in:
sledgehammer999 2024-09-26 18:49:42 +03:00
parent 6981217369
commit e309148147
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2
2 changed files with 31 additions and 31 deletions

View file

@ -378,8 +378,16 @@ void AppController::preferencesAction()
data[u"resolve_peer_countries"_s] = pref->resolvePeerCountries();
// Reannounce to all trackers when ip/port changed
data[u"reannounce_when_address_changed"_s] = session->isReannounceWhenAddressChangedEnabled();
// Embedded tracker
data[u"enable_embedded_tracker"_s] = session->isTrackerEnabled();
data[u"embedded_tracker_port"_s] = pref->getTrackerPort();
data[u"embedded_tracker_port_forwarding"_s] = pref->isTrackerPortForwardingEnabled();
// Mark-of-the-Web
data[u"mark_of_the_web"_s] = pref->isMarkOfTheWebEnabled();
// Ignore SSL errors
data[u"ignore_ssl_errors"_s] = pref->isIgnoreSSLErrors();
// Python executable path
data[u"python_executable_path"_s] = pref->getPythonExecutablePath().toString();
// libtorrent preferences
// Bdecode depth limit
@ -442,14 +450,6 @@ void AppController::preferencesAction()
data[u"ssrf_mitigation"_s] = session->isSSRFMitigationEnabled();
// Disallow connection to peers on privileged ports
data[u"block_peers_on_privileged_ports"_s] = session->blockPeersOnPrivilegedPorts();
// Embedded tracker
data[u"enable_embedded_tracker"_s] = session->isTrackerEnabled();
data[u"embedded_tracker_port"_s] = pref->getTrackerPort();
data[u"embedded_tracker_port_forwarding"_s] = pref->isTrackerPortForwardingEnabled();
// Mark-of-the-Web
data[u"mark_of_the_web"_s] = pref->isMarkOfTheWebEnabled();
// Python executable path
data[u"python_executable_path"_s] = pref->getPythonExecutablePath().toString();
// Choking algorithm
data[u"upload_slots_behavior"_s] = static_cast<int>(session->chokingAlgorithm());
// Seed choking algorithm
@ -994,9 +994,22 @@ void AppController::setPreferencesAction()
// Reannounce to all trackers when ip/port changed
if (hasKey(u"reannounce_when_address_changed"_s))
session->setReannounceWhenAddressChangedEnabled(it.value().toBool());
// Embedded tracker
if (hasKey(u"embedded_tracker_port"_s))
pref->setTrackerPort(it.value().toInt());
if (hasKey(u"embedded_tracker_port_forwarding"_s))
pref->setTrackerPortForwardingEnabled(it.value().toBool());
if (hasKey(u"enable_embedded_tracker"_s))
session->setTrackerEnabled(it.value().toBool());
// Mark-of-the-Web
if (hasKey(u"mark_of_the_web"_s))
pref->setMarkOfTheWebEnabled(it.value().toBool());
// Ignore SLL errors
if (hasKey(u"ignore_ssl_errors"_s))
pref->setIgnoreSSLErrors(it.value().toBool());
// Python executable path
if (hasKey(u"python_executable_path"_s))
pref->setPythonExecutablePath(Path(it.value().toString()));
// libtorrent preferences
// Bdecode depth limit
@ -1091,19 +1104,6 @@ void AppController::setPreferencesAction()
// Disallow connection to peers on privileged ports
if (hasKey(u"block_peers_on_privileged_ports"_s))
session->setBlockPeersOnPrivilegedPorts(it.value().toBool());
// Embedded tracker
if (hasKey(u"embedded_tracker_port"_s))
pref->setTrackerPort(it.value().toInt());
if (hasKey(u"embedded_tracker_port_forwarding"_s))
pref->setTrackerPortForwardingEnabled(it.value().toBool());
if (hasKey(u"enable_embedded_tracker"_s))
session->setTrackerEnabled(it.value().toBool());
// Mark-of-the-Web
if (hasKey(u"mark_of_the_web"_s))
pref->setMarkOfTheWebEnabled(it.value().toBool());
// Python executable path
if (hasKey(u"python_executable_path"_s))
pref->setPythonExecutablePath(Path(it.value().toString()));
// Choking algorithm
if (hasKey(u"upload_slots_behavior"_s))
session->setChokingAlgorithm(static_cast<BitTorrent::ChokingAlgorithm>(it.value().toInt()));

View file

@ -2477,7 +2477,12 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
$("refreshInterval").value = pref.refresh_interval;
$("resolvePeerCountries").checked = pref.resolve_peer_countries;
$("reannounceWhenAddressChanged").checked = pref.reannounce_when_address_changed;
$("enableEmbeddedTracker").checked = pref.enable_embedded_tracker;
$("embeddedTrackerPort").value = pref.embedded_tracker_port;
$("embeddedTrackerPortForwarding").checked = pref.embedded_tracker_port_forwarding;
$("markOfTheWeb").checked = pref.mark_of_the_web;
$("ignoreSSLErrors").checked = pref.ignore_ssl_errors;
$("pythonExecutablePath").value = pref.python_executable_path;
// libtorrent section
$("bdecodeDepthLimit").value = pref.bdecode_depth_limit;
$("bdecodeTokenLimit").value = pref.bdecode_token_limit;
@ -2511,11 +2516,6 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
$("validateHTTPSTrackerCertificate").checked = pref.validate_https_tracker_certificate;
$("mitigateSSRF").checked = pref.ssrf_mitigation;
$("blockPeersOnPrivilegedPorts").checked = pref.block_peers_on_privileged_ports;
$("enableEmbeddedTracker").checked = pref.enable_embedded_tracker;
$("embeddedTrackerPort").value = pref.embedded_tracker_port;
$("embeddedTrackerPortForwarding").checked = pref.embedded_tracker_port_forwarding;
$("markOfTheWeb").checked = pref.mark_of_the_web;
$("pythonExecutablePath").value = pref.python_executable_path;
$("uploadSlotsBehavior").value = pref.upload_slots_behavior;
$("uploadChokingAlgorithm").value = pref.upload_choking_algorithm;
$("announceAllTrackers").checked = pref.announce_to_all_trackers;
@ -2934,7 +2934,12 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
settings["refresh_interval"] = Number($("refreshInterval").value);
settings["resolve_peer_countries"] = $("resolvePeerCountries").checked;
settings["reannounce_when_address_changed"] = $("reannounceWhenAddressChanged").checked;
settings["enable_embedded_tracker"] = $("enableEmbeddedTracker").checked;
settings["embedded_tracker_port"] = Number($("embeddedTrackerPort").value);
settings["embedded_tracker_port_forwarding"] = $("embeddedTrackerPortForwarding").checked;
settings["mark_of_the_web"] = $("markOfTheWeb").checked;
settings["ignore_ssl_errors"] = $("ignoreSSLErrors").checked;
settings["python_executable_path"] = $("pythonExecutablePath").value;
// libtorrent section
settings["bdecode_depth_limit"] = Number($("bdecodeDepthLimit").value);
@ -2969,11 +2974,6 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
settings["validate_https_tracker_certificate"] = $("validateHTTPSTrackerCertificate").checked;
settings["ssrf_mitigation"] = $("mitigateSSRF").checked;
settings["block_peers_on_privileged_ports"] = $("blockPeersOnPrivilegedPorts").checked;
settings["enable_embedded_tracker"] = $("enableEmbeddedTracker").checked;
settings["embedded_tracker_port"] = Number($("embeddedTrackerPort").value);
settings["embedded_tracker_port_forwarding"] = $("embeddedTrackerPortForwarding").checked;
settings["mark_of_the_web"] = $("markOfTheWeb").checked;
settings["python_executable_path"] = $("pythonExecutablePath").value;
settings["upload_slots_behavior"] = Number($("uploadSlotsBehavior").value);
settings["upload_choking_algorithm"] = Number($("uploadChokingAlgorithm").value);
settings["announce_to_all_trackers"] = $("announceAllTrackers").checked;