diff --git a/src/gui/optionsdlg.cpp b/src/gui/optionsdlg.cpp index 360b664d4..a5bed8654 100644 --- a/src/gui/optionsdlg.cpp +++ b/src/gui/optionsdlg.cpp @@ -192,6 +192,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) void (QComboBox::*qComboBoxCurrentIndexChanged)(int) = &QComboBox::currentIndexChanged; void (QSpinBox::*qSpinBoxValueChanged)(int) = &QSpinBox::valueChanged; + connect(m_ui->checkForceProxy, &QAbstractButton::toggled, this, &ThisType::enableForceProxy); connect(m_ui->comboProxyType, qComboBoxCurrentIndexChanged, this, &ThisType::enableProxy); connect(m_ui->checkRandomPort, &QAbstractButton::toggled, m_ui->spinPort, &ThisType::setDisabled); @@ -948,6 +949,7 @@ void OptionsDialog::loadOptions() m_ui->checkProxyPeerConnecs->setChecked(session->isProxyPeerConnectionsEnabled()); m_ui->checkForceProxy->setChecked(session->isForceProxyEnabled()); + enableForceProxy(session->isForceProxyEnabled()); m_ui->isProxyOnlyForTorrents->setChecked(proxyConfigManager->isProxyOnlyForTorrents()); enableProxy(m_ui->comboProxyType->currentIndex()); @@ -1300,6 +1302,13 @@ void OptionsDialog::toggleComboRatioLimitAct() m_ui->comboRatioLimitAct->setEnabled(m_ui->checkMaxRatio->isChecked() || m_ui->checkMaxSeedingMinutes->isChecked()); } +void OptionsDialog::enableForceProxy(bool enable) +{ + m_ui->checkUPnP->setEnabled(!enable); + m_ui->checkDHT->setEnabled(!enable); + m_ui->checkLSD->setEnabled(!enable); +} + void OptionsDialog::enableProxy(int index) { if (index) { @@ -1320,6 +1329,7 @@ void OptionsDialog::enableProxy(int index) m_ui->isProxyOnlyForTorrents->setEnabled(false); m_ui->isProxyOnlyForTorrents->setChecked(true); } + enableForceProxy(m_ui->checkForceProxy->isChecked()); } else { //disable @@ -1332,6 +1342,7 @@ void OptionsDialog::enableProxy(int index) m_ui->isProxyOnlyForTorrents->setEnabled(false); m_ui->checkProxyAuth->setEnabled(false); m_ui->checkProxyAuth->setChecked(false); + enableForceProxy(false); } } diff --git a/src/gui/optionsdlg.h b/src/gui/optionsdlg.h index d5ca2e30b..d503dc8ec 100644 --- a/src/gui/optionsdlg.h +++ b/src/gui/optionsdlg.h @@ -84,6 +84,7 @@ public slots: void showConnectionTab(); private slots: + void enableForceProxy(bool enable); void enableProxy(int index); void on_buttonBox_accepted(); void closeEvent(QCloseEvent *e); diff --git a/src/webui/www/private/preferences_content.html b/src/webui/www/private/preferences_content.html index 0af671376..20494225f 100644 --- a/src/webui/www/private/preferences_content.html +++ b/src/webui/www/private/preferences_content.html @@ -162,7 +162,7 @@
- +
@@ -670,7 +670,16 @@ updatePeerProxySettings = function() { $('peer_proxy_auth_checkbox').setProperty('checked', false); updatePeerProxyAuthSettings(); } -} + + updateForceProxySettings(); +}; + +updateForceProxySettings = function() { + var isForceProxyEnabled = (!$('force_proxy_checkbox').getProperty('disabled')) && ($('force_proxy_checkbox').getProperty('checked')); + $('upnp_checkbox').setProperty('disabled', isForceProxyEnabled); + $('dht_checkbox').setProperty('disabled', isForceProxyEnabled); + $('lsd_checkbox').setProperty('disabled', isForceProxyEnabled); +}; updatePeerProxyAuthSettings = function() { if($('peer_proxy_auth_checkbox').getProperty('checked')) { @@ -962,6 +971,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); + updateForceProxySettings(); $('proxy_only_for_torrents_checkbox').setProperty('checked', pref.proxy_torrents_only); $('peer_proxy_auth_checkbox').setProperty('checked', pref.proxy_auth_enabled); updatePeerProxyAuthSettings();