]>
Commit | Line | Data |
---|---|---|
f914f1a7 | 1 | // Copyright (c) 2011-2013 The Bitcoin Core developers |
78253fcb | 2 | // Distributed under the MIT software license, see the accompanying |
e592d43f WL |
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | ||
84738627 PJ |
5 | #ifndef BITCOIN_QT_OPTIONSMODEL_H |
6 | #define BITCOIN_QT_OPTIONSMODEL_H | |
92f20d53 | 7 | |
a372168e MF |
8 | #include "amount.h" |
9 | ||
92f20d53 WL |
10 | #include <QAbstractListModel> |
11 | ||
1ba3560f PK |
12 | QT_BEGIN_NAMESPACE |
13 | class QNetworkProxy; | |
14 | QT_END_NAMESPACE | |
15 | ||
ff0ee876 PK |
16 | /** Interface from Qt to configuration data structure for Bitcoin client. |
17 | To Qt, the options are presented as a list with the different options | |
352083cb WL |
18 | laid out vertically. |
19 | This can be changed to a tree once the settings become sufficiently | |
20 | complex. | |
21 | */ | |
92f20d53 WL |
22 | class OptionsModel : public QAbstractListModel |
23 | { | |
24 | Q_OBJECT | |
144bfd9c | 25 | |
92f20d53 | 26 | public: |
3f8cb2c5 | 27 | explicit OptionsModel(QObject *parent = 0); |
92f20d53 WL |
28 | |
29 | enum OptionID { | |
0689f46c PK |
30 | StartAtStartup, // bool |
31 | MinimizeToTray, // bool | |
32 | MapPortUPnP, // bool | |
33 | MinimizeOnClose, // bool | |
34 | ProxyUse, // bool | |
35 | ProxyIP, // QString | |
36 | ProxyPort, // int | |
0689f46c | 37 | DisplayUnit, // BitcoinUnits::Unit |
40c5b939 | 38 | ThirdPartyTxUrls, // QString |
0689f46c PK |
39 | Language, // QString |
40 | CoinControlFeatures, // bool | |
7e195e84 PK |
41 | ThreadsScriptVerif, // int |
42 | DatabaseCache, // int | |
29d45073 | 43 | SpendZeroConfChange, // bool |
56b07d2d | 44 | Listen, // bool |
83743ed6 | 45 | OptionIDRowCount, |
92f20d53 WL |
46 | }; |
47 | ||
3f8cb2c5 | 48 | void Init(); |
5fb445b4 | 49 | void Reset(); |
3f8cb2c5 | 50 | |
92f20d53 WL |
51 | int rowCount(const QModelIndex & parent = QModelIndex()) const; |
52 | QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; | |
53 | bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); | |
8969828d | 54 | /** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */ |
55 | void setDisplayUnit(const QVariant &value); | |
92f20d53 | 56 | |
968d55aa | 57 | /* Explicit getters */ |
7bc65ff1 PK |
58 | bool getMinimizeToTray() { return fMinimizeToTray; } |
59 | bool getMinimizeOnClose() { return fMinimizeOnClose; } | |
60 | int getDisplayUnit() { return nDisplayUnit; } | |
40c5b939 | 61 | QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; } |
1ba3560f | 62 | bool getProxySettings(QNetworkProxy& proxy) const; |
0689f46c | 63 | bool getCoinControlFeatures() { return fCoinControlFeatures; } |
7e195e84 PK |
64 | const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; } |
65 | ||
66 | /* Restart flag helper */ | |
67 | void setRestartRequired(bool fRequired); | |
68 | bool isRestartRequired(); | |
144bfd9c | 69 | |
e8ef3da7 | 70 | private: |
7e195e84 | 71 | /* Qt-only settings */ |
3f8cb2c5 GA |
72 | bool fMinimizeToTray; |
73 | bool fMinimizeOnClose; | |
5ac114c7 | 74 | QString language; |
7e195e84 | 75 | int nDisplayUnit; |
40c5b939 | 76 | QString strThirdPartyTxUrls; |
6a86c24d | 77 | bool fCoinControlFeatures; |
7e195e84 PK |
78 | /* settings that were overriden by command-line */ |
79 | QString strOverriddenByCommandLine; | |
144bfd9c | 80 | |
b40bdd65 WL |
81 | /// Add option to list of GUI options overridden through command line/config file |
82 | void addOverriddenOption(const std::string &option); | |
83 | ||
e092f229 | 84 | Q_SIGNALS: |
ee014e5b | 85 | void displayUnitChanged(int unit); |
6a86c24d | 86 | void coinControlFeaturesChanged(bool); |
92f20d53 WL |
87 | }; |
88 | ||
84738627 | 89 | #endif // BITCOIN_QT_OPTIONSMODEL_H |