diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -44,8 +44,8 @@ ui->pruneWarning->setStyleSheet("QLabel { color: red; }"); ui->pruneSize->setEnabled(false); - connect(ui->prune, SIGNAL(toggled(bool)), ui->pruneSize, - SLOT(setEnabled(bool))); + connect(ui->prune, &QPushButton::toggled, ui->pruneSize, + &QWidget::setEnabled); /* Network elements init */ #ifndef USE_UPNP @@ -60,21 +60,21 @@ ui->proxyPortTor->setEnabled(false); ui->proxyPortTor->setValidator(new QIntValidator(1, 65535, this)); - 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 */ + connect(ui->connectSocks, &QPushButton::toggled, ui->proxyIp, + &QWidget::setEnabled); + connect(ui->connectSocks, &QPushButton::toggled, ui->proxyPort, + &QWidget::setEnabled); + connect(ui->connectSocks, &QPushButton::toggled, this, + &OptionsDialog::updateProxyValidationState); + + connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyIpTor, + &QWidget::setEnabled); + connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyPortTor, + &QWidget::setEnabled); + connect(ui->connectSocksTor, &QPushButton::toggled, this, + &OptionsDialog::updateProxyValidationState); + + /* Window elements init */ #ifdef Q_OS_MAC /* remove Window tab on Mac */ ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); @@ -130,14 +130,14 @@ /* 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())); - 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())); + connect(ui->proxyIp, &QValidatedLineEdit::validationDidChange, this, + &OptionsDialog::updateProxyValidationState); + connect(ui->proxyIpTor, &QValidatedLineEdit::validationDidChange, this, + &OptionsDialog::updateProxyValidationState); + connect(ui->proxyPort, &QLineEdit::textChanged, this, + &OptionsDialog::updateProxyValidationState); + connect(ui->proxyPortTor, &QLineEdit::textChanged, this, + &OptionsDialog::updateProxyValidationState); } OptionsDialog::~OptionsDialog() { @@ -166,29 +166,36 @@ * here so init via mapper doesn't trigger them) */ /* Main */ - connect(ui->prune, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); - connect(ui->prune, SIGNAL(clicked(bool)), this, - SLOT(togglePruneWarning(bool))); - connect(ui->pruneSize, SIGNAL(valueChanged(int)), this, - SLOT(showRestartWarning())); - connect(ui->databaseCache, SIGNAL(valueChanged(int)), this, - SLOT(showRestartWarning())); - connect(ui->threadsScriptVerif, SIGNAL(valueChanged(int)), this, - SLOT(showRestartWarning())); + connect(ui->prune, &QCheckBox::clicked, this, + &OptionsDialog::showRestartWarning); + connect(ui->prune, &QCheckBox::clicked, this, + &OptionsDialog::togglePruneWarning); + connect(ui->pruneSize, + static_cast(&QSpinBox::valueChanged), this, + &OptionsDialog::showRestartWarning); + connect(ui->databaseCache, + static_cast(&QSpinBox::valueChanged), this, + &OptionsDialog::showRestartWarning); + connect(ui->threadsScriptVerif, + static_cast(&QSpinBox::valueChanged), this, + &OptionsDialog::showRestartWarning); /* Wallet */ - connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, - SLOT(showRestartWarning())); + connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, + &OptionsDialog::showRestartWarning); /* Network */ - connect(ui->allowIncoming, SIGNAL(clicked(bool)), this, - SLOT(showRestartWarning())); - connect(ui->connectSocks, SIGNAL(clicked(bool)), this, - SLOT(showRestartWarning())); - connect(ui->connectSocksTor, SIGNAL(clicked(bool)), this, - SLOT(showRestartWarning())); + connect(ui->allowIncoming, &QCheckBox::clicked, this, + &OptionsDialog::showRestartWarning); + connect(ui->connectSocks, &QCheckBox::clicked, this, + &OptionsDialog::showRestartWarning); + connect(ui->connectSocksTor, &QCheckBox::clicked, this, + &OptionsDialog::showRestartWarning); /* Display */ - connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); - connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, - SLOT(showRestartWarning())); + connect( + ui->lang, + static_cast(&QValueComboBox::valueChanged), + [this] { showRestartWarning(); }); + connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, + [this] { showRestartWarning(); }); } void OptionsDialog::setCurrentTab(OptionsDialog::Tab tab) { @@ -316,7 +323,7 @@ // clear non-persistent status label after 10 seconds // TODO: should perhaps be a class attribute, if we extend the use of // statusLabel - QTimer::singleShot(10000, this, SLOT(clearStatusLabel())); + QTimer::singleShot(10000, this, &OptionsDialog::clearStatusLabel); } }