mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Disable options when force proxy is enabled
This commit is contained in:
parent
387f9b1230
commit
afd4069eb4
3 changed files with 24 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -162,7 +162,7 @@
|
|||
<label for="use_peer_proxy_checkbox">QBT_TR(Use proxy for peer connections)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<input type="checkbox" id="force_proxy_checkbox"/>
|
||||
<input type="checkbox" id="force_proxy_checkbox" onclick="updateForceProxySettings();"/>
|
||||
<label for="force_proxy_checkbox">QBT_TR(Disable connections not supported by proxies)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
</div>
|
||||
<div class="formRow">
|
||||
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue