Changeset View
Changeset View
Standalone View
Standalone View
src/qt/optionsdialog.cpp
Show All 38 Lines | static const uint64_t nMinDiskSpace = | ||||
: 0; | : 0; | ||||
ui->pruneSize->setMinimum(nMinDiskSpace); | ui->pruneSize->setMinimum(nMinDiskSpace); | ||||
ui->threadsScriptVerif->setMinimum(-GetNumCores()); | ui->threadsScriptVerif->setMinimum(-GetNumCores()); | ||||
ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS); | ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS); | ||||
ui->pruneWarning->setVisible(false); | ui->pruneWarning->setVisible(false); | ||||
ui->pruneWarning->setStyleSheet("QLabel { color: red; }"); | ui->pruneWarning->setStyleSheet("QLabel { color: red; }"); | ||||
ui->pruneSize->setEnabled(false); | ui->pruneSize->setEnabled(false); | ||||
connect(ui->prune, SIGNAL(toggled(bool)), ui->pruneSize, | connect(ui->prune, &QPushButton::toggled, ui->pruneSize, | ||||
SLOT(setEnabled(bool))); | &QWidget::setEnabled); | ||||
/* Network elements init */ | /* Network elements init */ | ||||
#ifndef USE_UPNP | #ifndef USE_UPNP | ||||
ui->mapPortUpnp->setEnabled(false); | ui->mapPortUpnp->setEnabled(false); | ||||
#endif | #endif | ||||
ui->proxyIp->setEnabled(false); | ui->proxyIp->setEnabled(false); | ||||
ui->proxyPort->setEnabled(false); | ui->proxyPort->setEnabled(false); | ||||
ui->proxyPort->setValidator(new QIntValidator(1, 65535, this)); | ui->proxyPort->setValidator(new QIntValidator(1, 65535, this)); | ||||
ui->proxyIpTor->setEnabled(false); | ui->proxyIpTor->setEnabled(false); | ||||
ui->proxyPortTor->setEnabled(false); | ui->proxyPortTor->setEnabled(false); | ||||
ui->proxyPortTor->setValidator(new QIntValidator(1, 65535, this)); | ui->proxyPortTor->setValidator(new QIntValidator(1, 65535, this)); | ||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, | connect(ui->connectSocks, &QPushButton::toggled, ui->proxyIp, | ||||
SLOT(setEnabled(bool))); | &QWidget::setEnabled); | ||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, | connect(ui->connectSocks, &QPushButton::toggled, ui->proxyPort, | ||||
SLOT(setEnabled(bool))); | &QWidget::setEnabled); | ||||
connect(ui->connectSocks, SIGNAL(toggled(bool)), this, | connect(ui->connectSocks, &QPushButton::toggled, this, | ||||
SLOT(updateProxyValidationState())); | &OptionsDialog::updateProxyValidationState); | ||||
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyIpTor, | connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyIpTor, | ||||
SLOT(setEnabled(bool))); | &QWidget::setEnabled); | ||||
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyPortTor, | connect(ui->connectSocksTor, &QPushButton::toggled, ui->proxyPortTor, | ||||
SLOT(setEnabled(bool))); | &QWidget::setEnabled); | ||||
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, | connect(ui->connectSocksTor, &QPushButton::toggled, this, | ||||
SLOT(updateProxyValidationState())); | &OptionsDialog::updateProxyValidationState); | ||||
/* Window elements init */ | /* Window elements init */ | ||||
#ifdef Q_OS_MAC | #ifdef Q_OS_MAC | ||||
/* remove Window tab on Mac */ | /* remove Window tab on Mac */ | ||||
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); | ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); | ||||
#endif | #endif | ||||
/* remove Wallet tab in case of -disablewallet */ | /* remove Wallet tab in case of -disablewallet */ | ||||
if (!enableWallet) { | if (!enableWallet) { | ||||
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWallet)); | ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWallet)); | ||||
Show All 39 Lines | #endif | ||||
/* Widget-to-option mapper */ | /* Widget-to-option mapper */ | ||||
mapper = new QDataWidgetMapper(this); | mapper = new QDataWidgetMapper(this); | ||||
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); | mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); | ||||
mapper->setOrientation(Qt::Vertical); | mapper->setOrientation(Qt::Vertical); | ||||
/* setup/change UI elements when proxy IPs are invalid/valid */ | /* setup/change UI elements when proxy IPs are invalid/valid */ | ||||
ui->proxyIp->setCheckValidator(new ProxyAddressValidator(parent)); | ui->proxyIp->setCheckValidator(new ProxyAddressValidator(parent)); | ||||
ui->proxyIpTor->setCheckValidator(new ProxyAddressValidator(parent)); | ui->proxyIpTor->setCheckValidator(new ProxyAddressValidator(parent)); | ||||
connect(ui->proxyIp, SIGNAL(validationDidChange(QValidatedLineEdit *)), | connect(ui->proxyIp, &QValidatedLineEdit::validationDidChange, this, | ||||
this, SLOT(updateProxyValidationState())); | &OptionsDialog::updateProxyValidationState); | ||||
connect(ui->proxyIpTor, SIGNAL(validationDidChange(QValidatedLineEdit *)), | connect(ui->proxyIpTor, &QValidatedLineEdit::validationDidChange, this, | ||||
this, SLOT(updateProxyValidationState())); | &OptionsDialog::updateProxyValidationState); | ||||
connect(ui->proxyPort, SIGNAL(textChanged(const QString &)), this, | connect(ui->proxyPort, &QLineEdit::textChanged, this, | ||||
SLOT(updateProxyValidationState())); | &OptionsDialog::updateProxyValidationState); | ||||
connect(ui->proxyPortTor, SIGNAL(textChanged(const QString &)), this, | connect(ui->proxyPortTor, &QLineEdit::textChanged, this, | ||||
SLOT(updateProxyValidationState())); | &OptionsDialog::updateProxyValidationState); | ||||
} | } | ||||
OptionsDialog::~OptionsDialog() { | OptionsDialog::~OptionsDialog() { | ||||
delete ui; | delete ui; | ||||
} | } | ||||
void OptionsDialog::setModel(OptionsModel *_model) { | void OptionsDialog::setModel(OptionsModel *_model) { | ||||
this->model = _model; | this->model = _model; | ||||
Show All 12 Lines | if (_model) { | ||||
updateDefaultProxyNets(); | updateDefaultProxyNets(); | ||||
} | } | ||||
/* warn when one of the following settings changes by user action (placed | /* warn when one of the following settings changes by user action (placed | ||||
* here so init via mapper doesn't trigger them) */ | * here so init via mapper doesn't trigger them) */ | ||||
/* Main */ | /* Main */ | ||||
connect(ui->prune, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning())); | connect(ui->prune, &QCheckBox::clicked, this, | ||||
connect(ui->prune, SIGNAL(clicked(bool)), this, | &OptionsDialog::showRestartWarning); | ||||
SLOT(togglePruneWarning(bool))); | connect(ui->prune, &QCheckBox::clicked, this, | ||||
connect(ui->pruneSize, SIGNAL(valueChanged(int)), this, | &OptionsDialog::togglePruneWarning); | ||||
SLOT(showRestartWarning())); | connect(ui->pruneSize, | ||||
connect(ui->databaseCache, SIGNAL(valueChanged(int)), this, | static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, | ||||
SLOT(showRestartWarning())); | &OptionsDialog::showRestartWarning); | ||||
connect(ui->threadsScriptVerif, SIGNAL(valueChanged(int)), this, | connect(ui->databaseCache, | ||||
SLOT(showRestartWarning())); | static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, | ||||
&OptionsDialog::showRestartWarning); | |||||
connect(ui->threadsScriptVerif, | |||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, | |||||
&OptionsDialog::showRestartWarning); | |||||
/* Wallet */ | /* Wallet */ | ||||
connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, | connect(ui->spendZeroConfChange, &QCheckBox::clicked, this, | ||||
SLOT(showRestartWarning())); | &OptionsDialog::showRestartWarning); | ||||
/* Network */ | /* Network */ | ||||
connect(ui->allowIncoming, SIGNAL(clicked(bool)), this, | connect(ui->allowIncoming, &QCheckBox::clicked, this, | ||||
SLOT(showRestartWarning())); | &OptionsDialog::showRestartWarning); | ||||
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, | connect(ui->connectSocks, &QCheckBox::clicked, this, | ||||
SLOT(showRestartWarning())); | &OptionsDialog::showRestartWarning); | ||||
connect(ui->connectSocksTor, SIGNAL(clicked(bool)), this, | connect(ui->connectSocksTor, &QCheckBox::clicked, this, | ||||
SLOT(showRestartWarning())); | &OptionsDialog::showRestartWarning); | ||||
/* Display */ | /* Display */ | ||||
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning())); | connect( | ||||
connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, | ui->lang, | ||||
SLOT(showRestartWarning())); | static_cast<void (QValueComboBox::*)()>(&QValueComboBox::valueChanged), | ||||
[this] { showRestartWarning(); }); | |||||
connect(ui->thirdPartyTxUrls, &QLineEdit::textChanged, | |||||
[this] { showRestartWarning(); }); | |||||
} | } | ||||
void OptionsDialog::setCurrentTab(OptionsDialog::Tab tab) { | void OptionsDialog::setCurrentTab(OptionsDialog::Tab tab) { | ||||
QWidget *tab_widget = nullptr; | QWidget *tab_widget = nullptr; | ||||
if (tab == OptionsDialog::Tab::TAB_NETWORK) { | if (tab == OptionsDialog::Tab::TAB_NETWORK) { | ||||
tab_widget = ui->tabNetwork; | tab_widget = ui->tabNetwork; | ||||
} | } | ||||
if (tab == OptionsDialog::Tab::TAB_MAIN) { | if (tab == OptionsDialog::Tab::TAB_MAIN) { | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | if (fPersistent) { | ||||
ui->statusLabel->setText( | ui->statusLabel->setText( | ||||
tr("Client restart required to activate changes.")); | tr("Client restart required to activate changes.")); | ||||
} else { | } else { | ||||
ui->statusLabel->setText( | ui->statusLabel->setText( | ||||
tr("This change would require a client restart.")); | tr("This change would require a client restart.")); | ||||
// clear non-persistent status label after 10 seconds | // clear non-persistent status label after 10 seconds | ||||
// TODO: should perhaps be a class attribute, if we extend the use of | // TODO: should perhaps be a class attribute, if we extend the use of | ||||
// statusLabel | // statusLabel | ||||
QTimer::singleShot(10000, this, SLOT(clearStatusLabel())); | QTimer::singleShot(10000, this, &OptionsDialog::clearStatusLabel); | ||||
} | } | ||||
} | } | ||||
void OptionsDialog::clearStatusLabel() { | void OptionsDialog::clearStatusLabel() { | ||||
ui->statusLabel->clear(); | ui->statusLabel->clear(); | ||||
if (model && model->isRestartRequired()) { | if (model && model->isRestartRequired()) { | ||||
showRestartWarning(true); | showRestartWarning(true); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |