[tests] Add -blocknotify functional test
[bitcoinplatinum.git] / src / qt / optionsmodel.h
blob0ac82a4148b41494b1148fd683b6daa91737c878
1 // Copyright (c) 2011-2016 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.
5 #ifndef BITCOIN_QT_OPTIONSMODEL_H
6 #define BITCOIN_QT_OPTIONSMODEL_H
8 #include "amount.h"
10 #include <QAbstractListModel>
12 QT_BEGIN_NAMESPACE
13 class QNetworkProxy;
14 QT_END_NAMESPACE
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
18 laid out vertically.
19 This can be changed to a tree once the settings become sufficiently
20 complex.
22 class OptionsModel : public QAbstractListModel
24 Q_OBJECT
26 public:
27 explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
29 enum OptionID {
30 StartAtStartup, // bool
31 HideTrayIcon, // bool
32 MinimizeToTray, // bool
33 MapPortUPnP, // bool
34 MinimizeOnClose, // bool
35 ProxyUse, // bool
36 ProxyIP, // QString
37 ProxyPort, // int
38 ProxyUseTor, // bool
39 ProxyIPTor, // QString
40 ProxyPortTor, // int
41 DisplayUnit, // BitcoinUnits::Unit
42 ThirdPartyTxUrls, // QString
43 Language, // QString
44 CoinControlFeatures, // bool
45 ThreadsScriptVerif, // int
46 DatabaseCache, // int
47 SpendZeroConfChange, // bool
48 Listen, // bool
49 OptionIDRowCount,
52 void Init(bool resetSettings = false);
53 void Reset();
55 int rowCount(const QModelIndex & parent = QModelIndex()) const;
56 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
57 bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
58 /** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */
59 void setDisplayUnit(const QVariant &value);
61 /* Explicit getters */
62 bool getHideTrayIcon() const { return fHideTrayIcon; }
63 bool getMinimizeToTray() const { return fMinimizeToTray; }
64 bool getMinimizeOnClose() const { return fMinimizeOnClose; }
65 int getDisplayUnit() const { return nDisplayUnit; }
66 QString getThirdPartyTxUrls() const { return strThirdPartyTxUrls; }
67 bool getProxySettings(QNetworkProxy& proxy) const;
68 bool getCoinControlFeatures() const { return fCoinControlFeatures; }
69 const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
71 /* Restart flag helper */
72 void setRestartRequired(bool fRequired);
73 bool isRestartRequired() const;
75 private:
76 /* Qt-only settings */
77 bool fHideTrayIcon;
78 bool fMinimizeToTray;
79 bool fMinimizeOnClose;
80 QString language;
81 int nDisplayUnit;
82 QString strThirdPartyTxUrls;
83 bool fCoinControlFeatures;
84 /* settings that were overridden by command-line */
85 QString strOverriddenByCommandLine;
87 // Add option to list of GUI options overridden through command line/config file
88 void addOverriddenOption(const std::string &option);
90 // Check settings version and upgrade default values if required
91 void checkAndMigrate();
92 Q_SIGNALS:
93 void displayUnitChanged(int unit);
94 void coinControlFeaturesChanged(bool);
95 void hideTrayIconChanged(bool);
98 #endif // BITCOIN_QT_OPTIONSMODEL_H