1 // Copyright (c) 2011-2013 The Bitcoin 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);
30 StartAtStartup, // bool
31 MinimizeToTray, // bool
33 MinimizeOnClose, // bool
37 DisplayUnit, // BitcoinUnits::Unit
38 ThirdPartyTxUrls, // QString
40 CoinControlFeatures, // bool
41 ThreadsScriptVerif, // int
43 SpendZeroConfChange, // bool
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);
54 /** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */
55 void setDisplayUnit(const QVariant &value);
57 /* Explicit getters */
58 bool getMinimizeToTray() { return fMinimizeToTray; }
59 bool getMinimizeOnClose() { return fMinimizeOnClose; }
60 int getDisplayUnit() { return nDisplayUnit; }
61 QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; }
62 bool getProxySettings(QNetworkProxy& proxy) const;
63 bool getCoinControlFeatures() { return fCoinControlFeatures; }
64 const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
66 /* Restart flag helper */
67 void setRestartRequired(bool fRequired);
68 bool isRestartRequired();
71 /* Qt-only settings */
73 bool fMinimizeOnClose;
76 QString strThirdPartyTxUrls;
77 bool fCoinControlFeatures;
78 /* settings that were overriden by command-line */
79 QString strOverriddenByCommandLine;
81 /// Add option to list of GUI options overridden through command line/config file
82 void addOverriddenOption(const std::string &option);
85 void displayUnitChanged(int unit);
86 void coinControlFeaturesChanged(bool);
89 #endif // BITCOIN_QT_OPTIONSMODEL_H