mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
[Qt] don't allow to store invalid proxy ports
This commit is contained in:
parent
d16d1b72d1
commit
2a8e8c2e37
@ -59,9 +59,11 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
||||
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
|
||||
|
||||
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyIpTor, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyPortTor, SLOT(setEnabled(bool)));
|
||||
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
|
||||
|
||||
/* Window elements init */
|
||||
#ifdef Q_OS_MAC
|
||||
@ -117,8 +119,10 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
||||
/* setup/change UI elements when proxy IPs are invalid/valid */
|
||||
ui->proxyIp->setCheckValidator(new ProxyAddressValidator(parent));
|
||||
ui->proxyIpTor->setCheckValidator(new ProxyAddressValidator(parent));
|
||||
connect(ui->proxyIp, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState(QValidatedLineEdit *)));
|
||||
connect(ui->proxyIpTor, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState(QValidatedLineEdit *)));
|
||||
connect(ui->proxyIp, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState()));
|
||||
connect(ui->proxyIpTor, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState()));
|
||||
connect(ui->proxyPort, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
|
||||
connect(ui->proxyPortTor, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
|
||||
}
|
||||
|
||||
OptionsDialog::~OptionsDialog()
|
||||
@ -256,10 +260,11 @@ void OptionsDialog::clearStatusLabel()
|
||||
ui->statusLabel->clear();
|
||||
}
|
||||
|
||||
void OptionsDialog::updateProxyValidationState(QValidatedLineEdit *pUiProxyIp)
|
||||
void OptionsDialog::updateProxyValidationState()
|
||||
{
|
||||
QValidatedLineEdit *pUiProxyIp = ui->proxyIp;
|
||||
QValidatedLineEdit *otherProxyWidget = (pUiProxyIp == ui->proxyIpTor) ? ui->proxyIp : ui->proxyIpTor;
|
||||
if (pUiProxyIp->isValid())
|
||||
if (pUiProxyIp->isValid() && (!ui->proxyPort->isEnabled() || ui->proxyPort->text().toInt() > 0) && (!ui->proxyPortTor->isEnabled() || ui->proxyPortTor->text().toInt() > 0))
|
||||
{
|
||||
setOkButtonState(otherProxyWidget->isValid()); //only enable ok button if both proxys are valid
|
||||
ui->statusLabel->clear();
|
||||
|
@ -52,7 +52,7 @@ private Q_SLOTS:
|
||||
|
||||
void showRestartWarning(bool fPersistent = false);
|
||||
void clearStatusLabel();
|
||||
void updateProxyValidationState(QValidatedLineEdit *pUiProxyIp);
|
||||
void updateProxyValidationState();
|
||||
/* query the networks, for which the default proxy is used */
|
||||
void updateDefaultProxyNets();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user