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.
8 #include <QAbstractListModel>
14 /** Interface from Qt to configuration data structure for Bitcoin client.
15 To Qt, the options are presented as a list with the different options
17 This can be changed to a tree once the settings become sufficiently
20 class OptionsModel : public QAbstractListModel
25 explicit OptionsModel(QObject *parent = 0);
28 StartAtStartup, // bool
29 MinimizeToTray, // bool
31 MinimizeOnClose, // bool
36 DisplayUnit, // BitcoinUnits::Unit
37 ThirdPartyTxUrls, // QString
39 CoinControlFeatures, // bool
40 ThreadsScriptVerif, // int
42 SpendZeroConfChange, // bool
50 int rowCount(const QModelIndex & parent = QModelIndex()) const;
51 QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
52 bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
53 /** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */
54 void setDisplayUnit(const QVariant &value);
56 /* Explicit getters */
57 bool getMinimizeToTray() { return fMinimizeToTray; }
58 bool getMinimizeOnClose() { return fMinimizeOnClose; }
59 int getDisplayUnit() { return nDisplayUnit; }
60 QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; }
61 bool getProxySettings(QNetworkProxy& proxy) const;
62 bool getCoinControlFeatures() { return fCoinControlFeatures; }
63 const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
65 /* Restart flag helper */
66 void setRestartRequired(bool fRequired);
67 bool isRestartRequired();
70 /* Qt-only settings */
72 bool fMinimizeOnClose;
75 QString strThirdPartyTxUrls;
76 bool fCoinControlFeatures;
77 /* settings that were overriden by command-line */
78 QString strOverriddenByCommandLine;
80 /// Add option to list of GUI options overridden through command line/config file
81 void addOverriddenOption(const std::string &option);
84 void displayUnitChanged(int unit);
85 void transactionFeeChanged(qint64);
86 void coinControlFeaturesChanged(bool);
89 #endif // OPTIONSMODEL_H