annotate src/qt/optionsdialog.cpp @ 3679:1e67262f9a28 draft default tip master

Mention that Qt3 tools can cause build problems
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 23 Oct 2012 13:17:23 -0400
parents ac8d4b1e089a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
1 #include "optionsdialog.h"
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
2 #include "ui_optionsdialog.h"
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
3
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
4 #include "bitcoinunits.h"
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
5 #include "monitoreddatamapper.h"
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
6 #include "netbase.h"
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
7 #include "optionsmodel.h"
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
8
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
9 #include <QDir>
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
10 #include <QIntValidator>
3103
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
11 #include <QLocale>
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
12 #include <QMessageBox>
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
13 #include <QRegExp>
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
14 #include <QRegExpValidator>
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
15
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
16 OptionsDialog::OptionsDialog(QWidget *parent) :
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
17 QDialog(parent),
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
18 ui(new Ui::OptionsDialog),
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
19 model(0),
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
20 mapper(0),
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
21 fRestartWarningDisplayed_Proxy(false),
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
22 fRestartWarningDisplayed_Lang(false),
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
23 fProxyIpValid(true)
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
24 {
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
25 ui->setupUi(this);
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
26
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
27 /* Network elements init */
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
28 #ifndef USE_UPNP
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
29 ui->mapPortUpnp->setEnabled(false);
1406
f5bfde96d9c3 Improved Mac experience; QDoubleSpinBox for BitcoinAmountField
p2k <patrick.p2k.schneider@gmail.com>
parents: 1339
diff changeset
30 #endif
1213
b76439e5e887 preparations for multiple unit (uBTC, mBTC, BTC) support, fix amount entry issue
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 1096
diff changeset
31
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
32 ui->proxyIp->setEnabled(false);
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
33 ui->proxyPort->setEnabled(false);
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
34 ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
35
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
36 ui->socksVersion->setEnabled(false);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
37 ui->socksVersion->addItem("5", 5);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
38 ui->socksVersion->addItem("4", 4);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
39 ui->socksVersion->setCurrentIndex(0);
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
40
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
41 connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
42 connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
43 connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
44 connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy()));
1213
b76439e5e887 preparations for multiple unit (uBTC, mBTC, BTC) support, fix amount entry issue
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 1096
diff changeset
45
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
46 ui->proxyIp->installEventFilter(this);
1339
904c43af509f put Q_OBJECT everywhere it should be (removes warnings when running lupdate)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 1258
diff changeset
47
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
48 /* Window elements init */
3526
ba853f68e2c6 enhance Qt5 compatibility
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3281
diff changeset
49 #ifdef Q_OS_MAC
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
50 ui->tabWindow->setVisible(false);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
51 #endif
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
52
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
53 /* Display elements init */
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
54 QDir translations(":translations");
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
55 ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
56 foreach(const QString &langStr, translations.entryList())
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
57 {
3103
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
58 QLocale locale(langStr);
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
59
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
60 /** check if the locale name consists of 2 parts (language_country) */
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
61 if(langStr.contains("_"))
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
62 {
3198
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
63 #if QT_VERSION >= 0x040800
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
64 /** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
65 ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
66 #else
3103
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
67 /** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
68 ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
3198
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
69 #endif
3103
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
70 }
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
71 else
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
72 {
3198
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
73 #if QT_VERSION >= 0x040800
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
74 /** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
75 ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
76 #else
3103
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
77 /** display language strings as "language (locale name)", e.g. "German (de)" */
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
78 ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
3198
c4d7950c8790 enhance lang-selection in OptionsDialog, when compiling with Qt >= 4.8
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3103
diff changeset
79 #endif
3103
2e1808aa6010 GUI: change language selection format
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2759
diff changeset
80 }
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
81 }
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
82
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
83 ui->unit->setModel(new BitcoinUnits(this));
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
84
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
85 /* Widget-to-option mapper */
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
86 mapper = new MonitoredDataMapper(this);
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
87 mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
88 mapper->setOrientation(Qt::Vertical);
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
89
3281
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
90 /* enable apply button when data modified */
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
91 connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton()));
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
92 /* disable apply button when new data loaded */
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
93 connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton()));
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
94 /* setup/change UI elements when proxy IP is invalid/valid */
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
95 connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool)));
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
96 }
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
97
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
98 OptionsDialog::~OptionsDialog()
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
99 {
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
100 delete ui;
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
101 }
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
102
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
103 void OptionsDialog::setModel(OptionsModel *model)
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
104 {
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
105 this->model = model;
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
106
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
107 if(model)
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
108 {
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
109 connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
110
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
111 mapper->setModel(model);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
112 setMapper();
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
113 mapper->toFirst();
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
114 }
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
115
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
116 /* update the display unit, to not use the default ("BTC") */
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
117 updateDisplayUnit();
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
118
3281
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
119 /* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
120 connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang()));
3281
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
121
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
122 /* disable apply button after settings are loaded as there is nothing to save */
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
123 disableApplyButton();
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
124 }
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
125
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
126 void OptionsDialog::setMapper()
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
127 {
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
128 /* Main */
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
129 mapper->addMapping(ui->transactionFee, OptionsModel::Fee);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
130 mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
131 mapper->addMapping(ui->detachDatabases, OptionsModel::DetachDatabases);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
132
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
133 /* Network */
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
134 mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
135
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
136 mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
137 mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
138 mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
139 mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
140
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
141 /* Window */
3600
ac8d4b1e089a change Q_WS_MAC -> Q_OS_MAC (Qt5 compatibility)
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3526
diff changeset
142 #ifndef Q_OS_MAC
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
143 mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
144 mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
145 #endif
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
146
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
147 /* Display */
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
148 mapper->addMapping(ui->lang, OptionsModel::Language);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
149 mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
150 mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
151 }
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
152
3281
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
153 void OptionsDialog::enableApplyButton()
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
154 {
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
155 ui->applyButton->setEnabled(true);
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
156 }
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
157
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
158 void OptionsDialog::disableApplyButton()
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
159 {
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
160 ui->applyButton->setEnabled(false);
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
161 }
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
162
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
163 void OptionsDialog::enableSaveButtons()
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
164 {
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
165 /* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
166 if(fProxyIpValid)
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
167 setSaveButtonState(true);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
168 }
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
169
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
170 void OptionsDialog::disableSaveButtons()
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
171 {
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
172 setSaveButtonState(false);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
173 }
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
174
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
175 void OptionsDialog::setSaveButtonState(bool fState)
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
176 {
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
177 ui->applyButton->setEnabled(fState);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
178 ui->okButton->setEnabled(fState);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
179 }
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
180
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
181 void OptionsDialog::on_okButton_clicked()
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
182 {
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
183 mapper->submit();
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
184 accept();
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
185 }
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
186
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
187 void OptionsDialog::on_cancelButton_clicked()
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
188 {
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
189 reject();
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
190 }
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
191
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
192 void OptionsDialog::on_applyButton_clicked()
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
193 {
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
194 mapper->submit();
3281
958f0e408a89 small UX update for optionsdialog
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3240
diff changeset
195 disableApplyButton();
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
196 }
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
197
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
198 void OptionsDialog::showRestartWarning_Proxy()
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
199 {
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
200 if(!fRestartWarningDisplayed_Proxy)
2426
58abdd7d008b Make it possible to set user interface language from options dialog
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2425
diff changeset
201 {
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
202 QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting Bitcoin."), QMessageBox::Ok);
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
203 fRestartWarningDisplayed_Proxy = true;
2426
58abdd7d008b Make it possible to set user interface language from options dialog
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2425
diff changeset
204 }
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
205 }
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
206
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
207 void OptionsDialog::showRestartWarning_Lang()
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
208 {
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
209 if(!fRestartWarningDisplayed_Lang)
2426
58abdd7d008b Make it possible to set user interface language from options dialog
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2425
diff changeset
210 {
58abdd7d008b Make it possible to set user interface language from options dialog
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2425
diff changeset
211 QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting Bitcoin."), QMessageBox::Ok);
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
212 fRestartWarningDisplayed_Lang = true;
2426
58abdd7d008b Make it possible to set user interface language from options dialog
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2425
diff changeset
213 }
58abdd7d008b Make it possible to set user interface language from options dialog
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2425
diff changeset
214 }
58abdd7d008b Make it possible to set user interface language from options dialog
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2425
diff changeset
215
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
216 void OptionsDialog::updateDisplayUnit()
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
217 {
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
218 if(model)
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
219 {
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
220 /* Update transactionFee with the current unit */
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
221 ui->transactionFee->setDisplayUnit(model->getDisplayUnit());
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
222 }
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
223 }
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
224
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
225 void OptionsDialog::handleProxyIpValid(QValidatedLineEdit *object, bool fState)
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
226 {
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
227 // this is used in a check before re-enabling the save buttons
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
228 fProxyIpValid = fState;
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
229
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
230 if(fProxyIpValid)
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
231 {
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
232 enableSaveButtons();
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
233 ui->statusLabel->clear();
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
234 }
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
235 else
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
236 {
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
237 disableSaveButtons();
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
238 object->setValid(fProxyIpValid);
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
239 ui->statusLabel->setStyleSheet("QLabel { color: red; }");
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
240 ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
241 }
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
242 }
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
243
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
244 bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
2425
aa46239b5b09 Organize optionsdialog (split off Window and Network page)
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2423
diff changeset
245 {
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
246 if(event->type() == QEvent::FocusOut)
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
247 {
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
248 if(object == ui->proxyIp)
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
249 {
3240
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
250 CService addr;
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
251 /* Check proxyIp for a valid IPv4/IPv6 address and emit the proxyIpValid signal */
3623795e16dc optionsdialog cleanup
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 3198
diff changeset
252 emit proxyIpValid(ui->proxyIp, LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr));
2759
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
253 }
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
254 }
1d95bb62c8a3 re-work optionsdialog to a tabbed UI based on an ui-file
Philip Kaufmann <phil.kaufmann@t-online.de>
parents: 2706
diff changeset
255 return QDialog::eventFilter(object, event);
1049
e5518d9b9f05 move back to original directory structure
Wladimir J. van der Laan <laanwj@gmail.com>
parents:
diff changeset
256 }