Reorder code to match UI

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

View File

@ -348,6 +348,10 @@ 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();
// Ignore SSL errors
data[u"ignore_ssl_errors"_s] = pref->isIgnoreSSLErrors();
@ -412,10 +416,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();
// Choking algorithm
data[u"upload_slots_behavior"_s] = static_cast<int>(session->chokingAlgorithm());
// Seed choking algorithm
@ -917,6 +917,13 @@ 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());
// Ignore SLL errors
if (hasKey(u"ignore_ssl_errors"_s))
pref->setIgnoreSSLErrors(it.value().toBool());
@ -1014,13 +1021,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());
// Choking algorithm
if (hasKey(u"upload_slots_behavior"_s))
session->setChokingAlgorithm(static_cast<BitTorrent::ChokingAlgorithm>(it.value().toInt()));

View File

@ -2276,6 +2276,9 @@ 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);
$('ignoreSSLErrors').setProperty('checked', pref.ignore_ssl_errors);
// libtorrent section
$('bdecodeDepthLimit').setProperty('value', pref.bdecode_depth_limit);
@ -2310,9 +2313,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);
$('uploadSlotsBehavior').setProperty('value', pref.upload_slots_behavior);
$('uploadChokingAlgorithm').setProperty('value', pref.upload_choking_algorithm);
$('announceAllTrackers').setProperty('checked', pref.announce_to_all_trackers);
@ -2718,6 +2718,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
settings.set('refresh_interval', $('refreshInterval').getProperty('value'));
settings.set('resolve_peer_countries', $('resolvePeerCountries').getProperty('checked'));
settings.set('reannounce_when_address_changed', $('reannounceWhenAddressChanged').getProperty('checked'));
settings.set('enable_embedded_tracker', $('enableEmbeddedTracker').getProperty('checked'));
settings.set('embedded_tracker_port', $('embeddedTrackerPort').getProperty('value'));
settings.set('embedded_tracker_port_forwarding', $('embeddedTrackerPortForwarding').getProperty('checked'));
settings.set('ignore_ssl_errors', $('ignoreSSLErrors').getProperty('checked'));
// libtorrent section
@ -2753,9 +2756,6 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
settings.set('validate_https_tracker_certificate', $('validateHTTPSTrackerCertificate').getProperty('checked'));
settings.set('ssrf_mitigation', $('mitigateSSRF').getProperty('checked'));
settings.set('block_peers_on_privileged_ports', $('blockPeersOnPrivilegedPorts').getProperty('checked'));
settings.set('enable_embedded_tracker', $('enableEmbeddedTracker').getProperty('checked'));
settings.set('embedded_tracker_port', $('embeddedTrackerPort').getProperty('value'));
settings.set('embedded_tracker_port_forwarding', $('embeddedTrackerPortForwarding').getProperty('checked'));
settings.set('upload_slots_behavior', $('uploadSlotsBehavior').getProperty('value'));
settings.set('upload_choking_algorithm', $('uploadChokingAlgorithm').getProperty('value'));
settings.set('announce_to_all_trackers', $('announceAllTrackers').getProperty('checked'));