Reorder code to match UI

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

View file

@ -374,8 +374,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
@ -438,14 +446,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
@ -984,9 +984,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
@ -1081,19 +1094,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

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