5 #if defined(HAVE_CONFIG_H)
10 #include "ui_optionsdialog.h"
24 #include <boost/thread.hpp>
26 #include <QDataWidgetMapper>
28 #include <QIntValidator>
30 #include <QMessageBox>
33 OptionsDialog::OptionsDialog(QWidget* parent,
bool enableWallet) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
43 ui->databaseCache->setMinimum(nMinDbCache);
44 ui->databaseCache->setMaximum(nMaxDbCache);
45 ui->threadsScriptVerif->setMinimum(-(
int)boost::thread::hardware_concurrency());
46 ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);
50 ui->mapPortUpnp->setEnabled(
false);
53 ui->proxyIp->setEnabled(
false);
54 ui->proxyPort->setEnabled(
false);
55 ui->proxyPort->setValidator(
new QIntValidator(1, 65535,
this));
57 connect(
ui->connectSocks, SIGNAL(toggled(
bool)),
ui->proxyIp, SLOT(setEnabled(
bool)));
58 connect(
ui->connectSocks, SIGNAL(toggled(
bool)),
ui->proxyPort, SLOT(setEnabled(
bool)));
60 ui->proxyIp->installEventFilter(
this);
61 ui->proxyPort->installEventFilter(
this);
66 ui->tabWidget->removeTab(
ui->tabWidget->indexOf(
ui->tabWindow));
71 ui->tabWidget->removeTab(
ui->tabWidget->indexOf(
ui->tabWallet));
78 for (
int index = 2; index <= 8; index++) {
80 ui->digits->addItem(digits, digits);
84 QDir translations(
":translations");
85 ui->lang->addItem(QString(
"(") + tr(
"default") + QString(
")"), QVariant(
""));
86 Q_FOREACH (
const QString& langStr, translations.entryList()) {
87 QLocale locale(langStr);
90 if(langStr.contains(
"_"))
93 ui->lang->addItem(locale.nativeLanguageName() + QString(
" - ") + locale.nativeCountryName() + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
98 ui->lang->addItem(locale.nativeLanguageName() + QString(
" (") + langStr + QString(
")"), QVariant(langStr));
101 ui->thirdPartyTxUrls->setPlaceholderText(
"https://example.com/tx/%s");
106 mapper =
new QDataWidgetMapper(
this);
107 mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
108 mapper->setOrientation(Qt::Vertical);
130 if (strLabel.isEmpty())
131 strLabel = tr(
"none");
132 ui->overriddenByCommandLineLabel->setText(strLabel);
156 connect(
ui->thirdPartyTxUrls, SIGNAL(textChanged(
const QString&)),
this, SLOT(
showRestartWarning()));
211 ui->okButton->setEnabled(fState);
218 QMessageBox::StandardButton btnRetVal = QMessageBox::question(
this, tr(
"Confirm options reset"),
219 tr(
"Client restart required to activate changes.") +
"<br><br>" + tr(
"Client will be shutdown, do you want to proceed?"),
220 QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
222 if (btnRetVal == QMessageBox::Cancel)
227 QApplication::quit();
245 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
248 ui->statusLabel->setText(tr(
"Client restart required to activate changes."));
250 ui->statusLabel->setText(tr(
"This change would require a client restart."));
259 ui->statusLabel->clear();
264 if (
ui->checkBoxHideOrphans->isChecked() != fHide)
265 ui->checkBoxHideOrphans->setChecked(fHide);
270 const std::string strAddrProxy = pUiProxyIp->text().toStdString();
271 const int nProxyPort = pUiProxyPort->text().toInt();
278 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
279 ui->statusLabel->setText(tr(
"The supplied proxy address is invalid."));
283 if (!pUiProxyPort->hasAcceptableInput()) {
285 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
286 ui->statusLabel->setText(tr(
"The supplied proxy port is invalid."));
293 ui->statusLabel->setStyleSheet(
"QLabel { color: red; }");
294 ui->statusLabel->setText(tr(
"The supplied proxy settings are invalid."));
299 ui->statusLabel->clear();
304 if (event->type() == QEvent::FocusOut) {
305 if (
object ==
ui->proxyIp ||
object ==
ui->proxyPort) {
309 return QDialog::eventFilter(
object, event);