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
10 #include <QAbstractListModel>
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
19 This can be changed to a tree once the settings become sufficiently
22 class OptionsModel
: public QAbstractListModel
27 explicit OptionsModel(QObject
*parent
= 0, bool resetSettings
= false);
30 StartAtStartup
, // bool
32 MinimizeToTray
, // bool
34 MinimizeOnClose
, // bool
39 ProxyIPTor
, // QString
41 DisplayUnit
, // BitcoinUnits::Unit
42 ThirdPartyTxUrls
, // QString
44 CoinControlFeatures
, // bool
45 ThreadsScriptVerif
, // int
47 SpendZeroConfChange
, // bool
52 void Init(bool resetSettings
= false);
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;
76 /* Qt-only settings */
79 bool fMinimizeOnClose
;
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();
93 void displayUnitChanged(int unit
);
94 void coinControlFeaturesChanged(bool);
95 void hideTrayIconChanged(bool);
98 #endif // BITCOIN_QT_OPTIONSMODEL_H