Browse Source

Add "Use proxy only for torrents" option to webui

adaptive-webui-19844
Thomas Piccirello 7 years ago
parent
commit
0d55599e02
  1. 3
      src/webui/api/appcontroller.cpp
  2. 8
      src/webui/www/private/preferences_content.html

3
src/webui/api/appcontroller.cpp

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

8
src/webui/www/private/preferences_content.html

@ -165,6 +165,10 @@
<input type="checkbox" id="force_proxy_checkbox"/> <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> <label for="force_proxy_checkbox">QBT_TR(Disable connections not supported by proxies)QBT_TR[CONTEXT=OptionsDialog]</label>
</div> </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"> <fieldset class="settings">
<legend><input type="checkbox" id="peer_proxy_auth_checkbox" onclick="updatePeerProxyAuthSettings();"/> <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> <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); $('peer_proxy_port_value').setProperty('disabled', false);
$('use_peer_proxy_checkbox').setProperty('disabled', false); $('use_peer_proxy_checkbox').setProperty('disabled', false);
$('force_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") { if($('peer_proxy_type_select').getProperty('value') != "socks5") {
$('peer_proxy_auth_checkbox').setProperty('checked', false); $('peer_proxy_auth_checkbox').setProperty('checked', false);
$('peer_proxy_auth_checkbox').setProperty('disabled', true); $('peer_proxy_auth_checkbox').setProperty('disabled', true);
@ -660,6 +665,7 @@ updatePeerProxySettings = function() {
$('peer_proxy_port_value').setProperty('disabled', true); $('peer_proxy_port_value').setProperty('disabled', true);
$('use_peer_proxy_checkbox').setProperty('disabled', true); $('use_peer_proxy_checkbox').setProperty('disabled', true);
$('force_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('disabled', true);
$('peer_proxy_auth_checkbox').setProperty('checked', false); $('peer_proxy_auth_checkbox').setProperty('checked', false);
updatePeerProxyAuthSettings(); updatePeerProxyAuthSettings();
@ -956,6 +962,7 @@ loadPreferences = function() {
$('peer_proxy_port_value').setProperty('value', pref.proxy_port); $('peer_proxy_port_value').setProperty('value', pref.proxy_port);
$('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections); $('use_peer_proxy_checkbox').setProperty('checked', pref.proxy_peer_connections);
$('force_proxy_checkbox').setProperty('checked', pref.force_proxy); $('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); $('peer_proxy_auth_checkbox').setProperty('checked', pref.proxy_auth_enabled);
updatePeerProxyAuthSettings(); updatePeerProxyAuthSettings();
$('peer_proxy_username_text').setProperty('value', pref.proxy_username); $('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_port', $('peer_proxy_port_value').getProperty('value').toInt());
settings.set('proxy_peer_connections', $('use_peer_proxy_checkbox').getProperty('checked')); settings.set('proxy_peer_connections', $('use_peer_proxy_checkbox').getProperty('checked'));
settings.set('force_proxy', $('force_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_username', $('peer_proxy_username_text').getProperty('value'));
settings.set('proxy_password', $('peer_proxy_password_text').getProperty('value')); settings.set('proxy_password', $('peer_proxy_password_text').getProperty('value'));

Loading…
Cancel
Save