1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
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);
30 StartAtStartup, // bool
31 MinimizeToTray, // bool
33 MinimizeOnClose, // bool
38 DisplayUnit, // BitcoinUnits::Unit
39 ThirdPartyTxUrls, // QString
41 CoinControlFeatures, // bool
42 ThreadsScriptVerif, // int
44 SpendZeroConfChange, // bool
52 int rowCount(const QModelIndex & parent = QModelIndex()) const;
53 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
54 bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
55 /** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */
56 void setDisplayUnit(const QVariant &value);
58 /* Explicit getters */
59 bool getMinimizeToTray() { return fMinimizeToTray; }
60 bool getMinimizeOnClose() { return fMinimizeOnClose; }
61 int getDisplayUnit() { return nDisplayUnit; }
62 QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; }
63 bool getProxySettings(QNetworkProxy& proxy) const;
64 bool getCoinControlFeatures() { return fCoinControlFeatures; }
65 const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
67 /* Restart flag helper */
68 void setRestartRequired(bool fRequired);
69 bool isRestartRequired();
72 /* Qt-only settings */
74 bool fMinimizeOnClose;
77 QString strThirdPartyTxUrls;
78 bool fCoinControlFeatures;
79 /* settings that were overriden by command-line */
80 QString strOverriddenByCommandLine;
82 /// Add option to list of GUI options overridden through command line/config file
83 void addOverriddenOption(const std::string &option);
86 void displayUnitChanged(int unit);
87 void transactionFeeChanged(const CAmount&);
88 void coinControlFeaturesChanged(bool);
91 #endif // OPTIONSMODEL_H