Add "Use proxy only for torrents" option to webui

This commit is contained in:
Thomas Piccirello 2018-02-12 00:56:05 -05:00
parent 98a1c111b9
commit 0d55599e02
2 changed files with 11 additions and 0 deletions

View file

@ -134,6 +134,7 @@ void AppController::preferencesAction()
data["proxy_peer_connections"] = session->isProxyPeerConnectionsEnabled();
data["force_proxy"] = session->isForceProxyEnabled();
data["proxy_torrents_only"] = proxyManager->isProxyOnlyForTorrents();
// IP Filtering
data["ip_filter_enabled"] = session->isIPFilteringEnabled();
@ -344,6 +345,8 @@ void AppController::setPreferencesAction()
session->setProxyPeerConnectionsEnabled(m["proxy_peer_connections"].toBool());
if (m.contains("force_proxy"))
session->setForceProxyEnabled(m["force_proxy"].toBool());
if (m.contains("proxy_torrents_only"))
proxyManager->setProxyOnlyForTorrents(m["proxy_torrents_only"].toBool());
// IP Filtering
if (m.contains("ip_filter_enabled"))

View file

@ -165,6 +165,10 @@
<input type="checkbox" id="force_proxy_checkbox"/>
<label for="force_proxy_checkbox">QBT_TR(Disable connections not supported by proxies)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<div class="formRow">
<input type="checkbox" id="proxy_only_for_torrents_checkbox"/>
<label for="proxy_only_for_torrents_checkbox">QBT_TR(Use proxy only for torrents)QBT_TR[CONTEXT=OptionsDialog]</label>
</div>
<fieldset class="settings">
<legend><input type="checkbox" id="peer_proxy_auth_checkbox" onclick="updatePeerProxyAuthSettings();"/>
<label for="peer_proxy_auth_checkbox">QBT_TR(Authentication)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
@ -648,6 +652,7 @@ updatePeerProxySettings = function() {
$('peer_proxy_port_value').setProperty('disabled', false);
$('use_peer_proxy_checkbox').setProperty('disabled', false);
$('force_proxy_checkbox').setProperty('disabled', false);
$('proxy_only_for_torrents_checkbox').setProperty('disabled', false);
if($('peer_proxy_type_select').getProperty('value') != "socks5") {
$('peer_proxy_auth_checkbox').setProperty('checked', false);
$('peer_proxy_auth_checkbox').setProperty('disabled', true);
@ -660,6 +665,7 @@ updatePeerProxySettings = function() {
$('peer_proxy_port_value').setProperty('disabled', true);
$('use_peer_proxy_checkbox').setProperty('disabled', true);
$('force_proxy_checkbox').setProperty('disabled', true);
$('proxy_only_for_torrents_checkbox').setProperty('disabled', true);
$('peer_proxy_auth_checkbox').setProperty('disabled', true);
$('peer_proxy_auth_checkbox').setProperty('checked', false);
updatePeerProxyAuthSettings();
@ -956,6 +962,7 @@ loadPreferences = function() {
$('peer_proxy_port_value').setProperty('value', pref.proxy_port);
$('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections);
$('force_proxy_checkbox').setProperty('checked', pref.force_proxy);
$('proxy_only_for_torrents_checkbox').setProperty('checked', pref.proxy_torrents_only);
$('peer_proxy_auth_checkbox').setProperty('checked', pref.proxy_auth_enabled);
updatePeerProxyAuthSettings();
$('peer_proxy_username_text').setProperty('value', pref.proxy_username);
@ -1203,6 +1210,7 @@ applyPreferences = function() {
settings.set('proxy_port', $('peer_proxy_port_value').getProperty('value').toInt());
settings.set('proxy_peer_connections', $('use_peer_proxy_checkbox').getProperty('checked'));
settings.set('force_proxy', $('force_proxy_checkbox').getProperty('checked'));
settings.set('proxy_torrents_only', $('proxy_only_for_torrents_checkbox').getProperty('checked'));
settings.set('proxy_username', $('peer_proxy_username_text').getProperty('value'));
settings.set('proxy_password', $('peer_proxy_password_text').getProperty('value'));