mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
Merge pull request #12528 from thalieht/proxycheckbox
Don't uncheck Authentication checkbox when changing proxy type
This commit is contained in:
commit
8ed63d69de
@ -882,7 +882,6 @@ Net::ProxyType OptionsDialog::getProxyType() const
|
|||||||
switch (m_ui->comboProxyType->currentIndex()) {
|
switch (m_ui->comboProxyType->currentIndex()) {
|
||||||
case 1:
|
case 1:
|
||||||
return Net::ProxyType::SOCKS4;
|
return Net::ProxyType::SOCKS4;
|
||||||
break;
|
|
||||||
case 2:
|
case 2:
|
||||||
if (isProxyAuthEnabled())
|
if (isProxyAuthEnabled())
|
||||||
return Net::ProxyType::SOCKS5_PW;
|
return Net::ProxyType::SOCKS5_PW;
|
||||||
@ -1443,28 +1442,27 @@ void OptionsDialog::toggleComboRatioLimitAct()
|
|||||||
m_ui->comboRatioLimitAct->setEnabled(m_ui->checkMaxRatio->isChecked() || m_ui->checkMaxSeedingMinutes->isChecked());
|
m_ui->comboRatioLimitAct->setEnabled(m_ui->checkMaxRatio->isChecked() || m_ui->checkMaxSeedingMinutes->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::enableProxy(int index)
|
void OptionsDialog::enableProxy(const int index)
|
||||||
{
|
{
|
||||||
if (index) {
|
if (index >= 1) { // Any proxy type is used
|
||||||
//enable
|
//enable
|
||||||
m_ui->lblProxyIP->setEnabled(true);
|
m_ui->lblProxyIP->setEnabled(true);
|
||||||
m_ui->textProxyIP->setEnabled(true);
|
m_ui->textProxyIP->setEnabled(true);
|
||||||
m_ui->lblProxyPort->setEnabled(true);
|
m_ui->lblProxyPort->setEnabled(true);
|
||||||
m_ui->spinProxyPort->setEnabled(true);
|
m_ui->spinProxyPort->setEnabled(true);
|
||||||
m_ui->checkProxyPeerConnecs->setEnabled(true);
|
m_ui->checkProxyPeerConnecs->setEnabled(true);
|
||||||
if (index > 1) {
|
if (index >= 2) { // SOCKS5 or HTTP
|
||||||
m_ui->checkProxyAuth->setEnabled(true);
|
m_ui->checkProxyAuth->setEnabled(true);
|
||||||
m_ui->isProxyOnlyForTorrents->setEnabled(true);
|
m_ui->isProxyOnlyForTorrents->setEnabled(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->checkProxyAuth->setEnabled(false);
|
m_ui->checkProxyAuth->setEnabled(false);
|
||||||
m_ui->checkProxyAuth->setChecked(false);
|
|
||||||
m_ui->isProxyOnlyForTorrents->setEnabled(false);
|
m_ui->isProxyOnlyForTorrents->setEnabled(false);
|
||||||
m_ui->isProxyOnlyForTorrents->setChecked(true);
|
m_ui->isProxyOnlyForTorrents->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else { // No proxy
|
||||||
//disable
|
// disable
|
||||||
m_ui->lblProxyIP->setEnabled(false);
|
m_ui->lblProxyIP->setEnabled(false);
|
||||||
m_ui->textProxyIP->setEnabled(false);
|
m_ui->textProxyIP->setEnabled(false);
|
||||||
m_ui->lblProxyPort->setEnabled(false);
|
m_ui->lblProxyPort->setEnabled(false);
|
||||||
@ -1472,7 +1470,6 @@ void OptionsDialog::enableProxy(int index)
|
|||||||
m_ui->checkProxyPeerConnecs->setEnabled(false);
|
m_ui->checkProxyPeerConnecs->setEnabled(false);
|
||||||
m_ui->isProxyOnlyForTorrents->setEnabled(false);
|
m_ui->isProxyOnlyForTorrents->setEnabled(false);
|
||||||
m_ui->checkProxyAuth->setEnabled(false);
|
m_ui->checkProxyAuth->setEnabled(false);
|
||||||
m_ui->checkProxyAuth->setChecked(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class OptionsDialog final : public QDialog
|
|||||||
public:
|
public:
|
||||||
// Constructor / Destructor
|
// Constructor / Destructor
|
||||||
OptionsDialog(QWidget *parent = nullptr);
|
OptionsDialog(QWidget *parent = nullptr);
|
||||||
~OptionsDialog();
|
~OptionsDialog() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showConnectionTab();
|
void showConnectionTab();
|
||||||
|
@ -1292,26 +1292,19 @@
|
|||||||
$('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected);
|
$('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected);
|
||||||
$('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected);
|
$('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected);
|
||||||
$('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
$('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
||||||
$('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
const isPeerProxyAuthenticatable = ($('peer_proxy_type_select').getProperty('value') === "socks5" || $('peer_proxy_type_select').getProperty('value') === "http");
|
||||||
|
$('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyAuthenticatable);
|
||||||
|
|
||||||
if (isPeerProxyTypeSelected) {
|
if ($('peer_proxy_type_select').getProperty('value') === "socks4")
|
||||||
const isPeerProxyTypeSocks5 = $('peer_proxy_type_select').getProperty('value') == "socks5";
|
$('proxy_only_for_torrents_checkbox').setProperty('checked', true);
|
||||||
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSocks5);
|
|
||||||
|
|
||||||
if (!isPeerProxyTypeSocks5) {
|
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyAuthenticatable);
|
||||||
$('peer_proxy_auth_checkbox').setProperty('checked', isPeerProxyTypeSocks5);
|
|
||||||
updatePeerProxyAuthSettings();
|
updatePeerProxyAuthSettings();
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
|
|
||||||
$('peer_proxy_auth_checkbox').setProperty('checked', isPeerProxyTypeSelected);
|
|
||||||
updatePeerProxyAuthSettings();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const updatePeerProxyAuthSettings = function() {
|
const updatePeerProxyAuthSettings = function() {
|
||||||
const isPeerProxyAuthEnabled = $('peer_proxy_auth_checkbox').getProperty('checked');
|
const isPeerProxyAuthEnabled = (!$('peer_proxy_auth_checkbox').getProperty('disabled') && $('peer_proxy_auth_checkbox').getProperty('checked'));
|
||||||
$('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
$('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
||||||
$('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
$('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user