optionsdialog.h raw
1 // Copyright (c) 2011-present The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5 #ifndef BITCOIN_QT_OPTIONSDIALOG_H
6 #define BITCOIN_QT_OPTIONSDIALOG_H
7
8 #include <QDialog>
9 #include <QValidator>
10
11 class ClientModel;
12 class OptionsModel;
13 class QValidatedLineEdit;
14
15 QT_BEGIN_NAMESPACE
16 class QDataWidgetMapper;
17 QT_END_NAMESPACE
18
19 namespace Ui {
20 class OptionsDialog;
21 }
22
23 /** Proxy address widget validator, checks for a valid proxy address.
24 */
25 class ProxyAddressValidator : public QValidator
26 {
27 Q_OBJECT
28
29 public:
30 explicit ProxyAddressValidator(QObject *parent);
31
32 State validate(QString &input, int &pos) const override;
33 };
34
35 /** Preferences dialog. */
36 class OptionsDialog : public QDialog
37 {
38 Q_OBJECT
39
40 public:
41 explicit OptionsDialog(QWidget *parent, bool enableWallet);
42 ~OptionsDialog();
43
44 enum Tab {
45 TAB_MAIN,
46 TAB_NETWORK,
47 };
48
49 void setClientModel(ClientModel* client_model);
50 void setModel(OptionsModel *model);
51 void setMapper();
52 void setCurrentTab(OptionsDialog::Tab tab);
53
54 private Q_SLOTS:
55 /* set OK button state (enabled / disabled) */
56 void setOkButtonState(bool fState);
57 void on_resetButton_clicked();
58 void on_openBitcoinConfButton_clicked();
59 void on_okButton_clicked();
60 void on_cancelButton_clicked();
61
62 void on_showTrayIcon_stateChanged(int state);
63
64 void togglePruneWarning(bool enabled);
65 void showRestartWarning(bool fPersistent = false);
66 void clearStatusLabel();
67 void updateProxyValidationState();
68 /* query the networks, for which the default proxy is used */
69 void updateDefaultProxyNets();
70
71 Q_SIGNALS:
72 void proxyIpChecks(QValidatedLineEdit *pUiProxyIp, uint16_t nProxyPort);
73 void quitOnReset();
74
75 private:
76 Ui::OptionsDialog *ui;
77 ClientModel* m_client_model{nullptr};
78 OptionsModel* model{nullptr};
79 QDataWidgetMapper* mapper{nullptr};
80 };
81
82 #endif // BITCOIN_QT_OPTIONSDIALOG_H
83