5 #if defined(HAVE_CONFIG_H)
6 #include "config/bitcoin-config.h"
10 #include "ui_optionsdialog.h"
16 #include "validation.h"
24 #include <boost/thread.hpp>
26 #include <QDataWidgetMapper>
28 #include <QIntValidator>
30 #include <QMessageBox>
42 ui->databaseCache->setMinimum(nMinDbCache);
43 ui->databaseCache->setMaximum(nMaxDbCache);
45 ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);
49 ui->mapPortUpnp->setEnabled(
false);
52 ui->proxyIp->setEnabled(
false);
53 ui->proxyPort->setEnabled(
false);
54 ui->proxyPort->setValidator(
new QIntValidator(1, 65535,
this));
56 ui->proxyIpTor->setEnabled(
false);
57 ui->proxyPortTor->setEnabled(
false);
58 ui->proxyPortTor->setValidator(
new QIntValidator(1, 65535,
this));
60 connect(
ui->connectSocks, SIGNAL(toggled(
bool)),
ui->proxyIp, SLOT(setEnabled(
bool)));
61 connect(
ui->connectSocks, SIGNAL(toggled(
bool)),
ui->proxyPort, SLOT(setEnabled(
bool)));
64 connect(
ui->connectSocksTor, SIGNAL(toggled(
bool)),
ui->proxyIpTor, SLOT(setEnabled(
bool)));
65 connect(
ui->connectSocksTor, SIGNAL(toggled(
bool)),
ui->proxyPortTor, SLOT(setEnabled(
bool)));
71 ui->tabWidget->removeTab(
ui->tabWidget->indexOf(
ui->tabWindow));
76 ui->tabWidget->removeTab(
ui->tabWidget->indexOf(
ui->tabWallet));
80 QDir translations(
":translations");
82 ui->bitcoinAtStartup->setToolTip(
ui->bitcoinAtStartup->toolTip().arg(tr(PACKAGE_NAME)));
83 ui->bitcoinAtStartup->setText(
ui->bitcoinAtStartup->text().arg(tr(PACKAGE_NAME)));
85 ui->lang->setToolTip(
ui->lang->toolTip().arg(tr(PACKAGE_NAME)));
86 ui->lang->addItem(QString(
"(") + tr(
"default") + QString(
")"), QVariant(
""));
87 Q_FOREACH(
const QString &langStr, translations.entryList())
89 QLocale locale(langStr);
92 if(langStr.contains(
"_"))
94 #if QT_VERSION >= 0x040800
96 ui->lang->addItem(locale.nativeLanguageName() + QString(
" - ") + locale.nativeCountryName() + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
99 ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(
" - ") + QLocale::countryToString(locale.country()) + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
104 #if QT_VERSION >= 0x040800
106 ui->lang->addItem(locale.nativeLanguageName() + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
109 ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
113 #if QT_VERSION >= 0x040700
114 ui->thirdPartyTxUrls->setPlaceholderText(
"https://example.com/tx/%s");
120 mapper =
new QDataWidgetMapper(
this);
121 mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
122 mapper->setOrientation(Qt::Vertical);
140 this->
model = _model;
149 if (strLabel.isEmpty())
150 strLabel = tr(
"none");
151 ui->overriddenByCommandLineLabel->setText(strLabel);
173 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();
251 ui->minimizeToTray->setChecked(
false);
252 ui->minimizeToTray->setEnabled(
false);
256 ui->minimizeToTray->setEnabled(
true);
262 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
266 ui->statusLabel->setText(tr(
"Client restart required to activate changes."));
270 ui->statusLabel->setText(tr(
"This change would require a client restart."));
279 ui->statusLabel->clear();
289 if (pUiProxyIp->
isValid() && (!
ui->proxyPort->isEnabled() ||
ui->proxyPort->text().toInt() > 0) && (!
ui->proxyPortTor->isEnabled() ||
ui->proxyPortTor->text().toInt() > 0))
297 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
298 ui->statusLabel->setText(tr(
"The supplied proxy address is invalid."));
305 std::string strProxy;
306 QString strDefaultProxyGUI;
310 strDefaultProxyGUI =
ui->proxyIp->text() +
":" +
ui->proxyPort->text();
311 (strProxy == strDefaultProxyGUI.toStdString()) ?
ui->proxyReachIPv4->setChecked(
true) :
ui->proxyReachIPv4->setChecked(
false);
315 strDefaultProxyGUI =
ui->proxyIp->text() +
":" +
ui->proxyPort->text();
316 (strProxy == strDefaultProxyGUI.toStdString()) ?
ui->proxyReachIPv6->setChecked(
true) :
ui->proxyReachIPv6->setChecked(
false);
320 strDefaultProxyGUI =
ui->proxyIp->text() +
":" +
ui->proxyPort->text();
321 (strProxy == strDefaultProxyGUI.toStdString()) ?
ui->proxyReachTor->setChecked(
true) :
ui->proxyReachTor->setChecked(
false);
336 return QValidator::Acceptable;
338 return QValidator::Invalid;
Bitcoin unit definitions.
std::string ToStringIP() const
A combination of a network address (CNetAddr) and a (TCP) port.
std::string ToStringPort() const
void setModel(OptionsModel *model)
void on_okButton_clicked()
void updateDefaultProxyNets()
void updateProxyValidationState()
void on_hideTrayIcon_stateChanged(int fState)
void showRestartWarning(bool fPersistent=false)
void on_resetButton_clicked()
OptionsDialog(QWidget *parent, bool enableWallet)
QDataWidgetMapper * mapper
void on_cancelButton_clicked()
void setOkButtonState(bool fState)
Interface from Qt to configuration data structure for Bitcoin client.
const QString & getOverriddenByCommandLine()
Proxy address widget validator, checks for a valid proxy address.
ProxyAddressValidator(QObject *parent)
State validate(QString &input, int &pos) const
Line edit that can be marked as "invalid" to show input validation feedback.
bool GetProxy(enum Network net, proxyType &proxyInfoOut)
CService LookupNumeric(const char *pszName, int portDefault)
int GetNumCores()
Return the number of physical cores available on the current system.