6 #if defined(HAVE_CONFIG_H) 11 #include "ui_optionsdialog.h" 17 #include "validation.h" 21 #include <QDataWidgetMapper> 23 #include <QIntValidator> 25 #include <QMessageBox> 37 ui->databaseCache->setMinimum(nMinDbCache);
38 ui->databaseCache->setMaximum(nMaxDbCache);
40 ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);
44 ui->mapPortUpnp->setEnabled(
false);
47 ui->proxyIp->setEnabled(
false);
48 ui->proxyPort->setEnabled(
false);
49 ui->proxyPort->setValidator(
new QIntValidator(1, 65535,
this));
51 ui->proxyIpTor->setEnabled(
false);
52 ui->proxyPortTor->setEnabled(
false);
53 ui->proxyPortTor->setValidator(
new QIntValidator(1, 65535,
this));
55 connect(
ui->connectSocks, SIGNAL(toggled(
bool)),
ui->proxyIp, SLOT(setEnabled(
bool)));
56 connect(
ui->connectSocks, SIGNAL(toggled(
bool)),
ui->proxyPort, SLOT(setEnabled(
bool)));
59 connect(
ui->connectSocksTor, SIGNAL(toggled(
bool)),
ui->proxyIpTor, SLOT(setEnabled(
bool)));
60 connect(
ui->connectSocksTor, SIGNAL(toggled(
bool)),
ui->proxyPortTor, SLOT(setEnabled(
bool)));
66 ui->tabWidget->removeTab(
ui->tabWidget->indexOf(
ui->tabWindow));
71 ui->tabWidget->removeTab(
ui->tabWidget->indexOf(
ui->tabWallet));
75 QDir translations(
":translations");
77 ui->ravenAtStartup->setToolTip(
ui->ravenAtStartup->toolTip().arg(tr(
PACKAGE_NAME)));
78 ui->ravenAtStartup->setText(
ui->ravenAtStartup->text().arg(tr(
PACKAGE_NAME)));
80 ui->openRavenConfButton->setToolTip(
ui->openRavenConfButton->toolTip().arg(tr(
PACKAGE_NAME)));
83 ui->lang->addItem(QString(
"(") + tr(
"default") + QString(
")"), QVariant(
""));
84 for (
const QString &langStr : translations.entryList())
86 QLocale locale(langStr);
89 if(langStr.contains(
"_"))
91 #if QT_VERSION >= 0x040800 93 ui->lang->addItem(locale.nativeLanguageName() + QString(
" - ") + locale.nativeCountryName() + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
96 ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(
" - ") + QLocale::countryToString(locale.country()) + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
101 #if QT_VERSION >= 0x040800 103 ui->lang->addItem(locale.nativeLanguageName() + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
106 ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
110 #if QT_VERSION >= 0x040700 111 ui->thirdPartyTxUrls->setPlaceholderText(
"https://example.com/tx/%s");
117 mapper =
new QDataWidgetMapper(
this);
118 mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
119 mapper->setOrientation(Qt::Vertical);
137 this->
model = _model;
146 if (strLabel.isEmpty())
147 strLabel = tr(
"none");
148 ui->overriddenByCommandLineLabel->setText(strLabel);
170 connect(
ui->thirdPartyTxUrls, SIGNAL(textChanged(
const QString &)),
this, SLOT(
showRestartWarning()));
214 ui->okButton->setEnabled(fState);
222 QMessageBox::StandardButton btnRetVal = QMessageBox::question(
this, tr(
"Confirm options reset"),
223 tr(
"Client restart required to activate changes.") +
"<br><br>" + tr(
"Client will be shut down. Do you want to proceed?"),
224 QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
226 if(btnRetVal == QMessageBox::Cancel)
231 QApplication::quit();
238 QMessageBox::information(
this, tr(
"Configuration options"),
239 tr(
"The configuration file is used to specify advanced user options which override GUI settings. " 240 "Additionally, any command-line options will override this configuration file."));
244 QMessageBox::critical(
this, tr(
"Error"), tr(
"The configuration file could not be opened."));
263 ui->minimizeToTray->setChecked(
false);
264 ui->minimizeToTray->setEnabled(
false);
268 ui->minimizeToTray->setEnabled(
true);
274 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
278 ui->statusLabel->setText(tr(
"Client restart required to activate changes."));
282 ui->statusLabel->setText(tr(
"This change would require a client restart."));
291 ui->statusLabel->clear();
301 if (pUiProxyIp->
isValid() && (!
ui->proxyPort->isEnabled() ||
ui->proxyPort->text().toInt() > 0) && (!
ui->proxyPortTor->isEnabled() ||
ui->proxyPortTor->text().toInt() > 0))
309 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
310 ui->statusLabel->setText(tr(
"The supplied proxy address is invalid."));
317 std::string strProxy;
318 QString strDefaultProxyGUI;
322 strDefaultProxyGUI =
ui->proxyIp->text() +
":" +
ui->proxyPort->text();
323 (strProxy == strDefaultProxyGUI.toStdString()) ?
ui->proxyReachIPv4->setChecked(
true) :
ui->proxyReachIPv4->setChecked(
false);
327 strDefaultProxyGUI =
ui->proxyIp->text() +
":" +
ui->proxyPort->text();
328 (strProxy == strDefaultProxyGUI.toStdString()) ?
ui->proxyReachIPv6->setChecked(
true) :
ui->proxyReachIPv6->setChecked(
false);
332 strDefaultProxyGUI =
ui->proxyIp->text() +
":" +
ui->proxyPort->text();
333 (strProxy == strDefaultProxyGUI.toStdString()) ?
ui->proxyReachTor->setChecked(
true) :
ui->proxyReachTor->setChecked(
false);
348 return QValidator::Acceptable;
350 return QValidator::Invalid;
std::string ToStringPort() const
OptionsDialog(QWidget *parent, bool enableWallet)
Proxy address widget validator, checks for a valid proxy address.
CService LookupNumeric(const char *pszName, int portDefault)
void setOkButtonState(bool fState)
const QString & getOverriddenByCommandLine()
void on_resetButton_clicked()
Line edit that can be marked as "invalid" to show input validation feedback.
bool isRestartRequired() const
std::string ToStringIP() const
A combination of a network address (CNetAddr) and a (TCP) port.
State validate(QString &input, int &pos) const
void setModel(OptionsModel *model)
QDataWidgetMapper * mapper
void on_okButton_clicked()
void updateDefaultProxyNets()
void on_hideTrayIcon_stateChanged(int fState)
Interface from Qt to configuration data structure for Raven client.
void on_openRavenConfButton_clicked()
void showRestartWarning(bool fPersistent=false)
void on_cancelButton_clicked()
bool GetProxy(enum Network net, proxyType &proxyInfoOut)
int GetNumCores()
Return the number of physical cores available on the current system.
void updateProxyValidationState()
ProxyAddressValidator(QObject *parent)