]> Git Repo - VerusCoin.git/blob - src/qt/optionsmodel.h
Merge pull request #4460
[VerusCoin.git] / src / qt / optionsmodel.h
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.
4
5 #ifndef OPTIONSMODEL_H
6 #define OPTIONSMODEL_H
7
8 #include <QAbstractListModel>
9
10 QT_BEGIN_NAMESPACE
11 class QNetworkProxy;
12 QT_END_NAMESPACE
13
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
16    laid out vertically.
17    This can be changed to a tree once the settings become sufficiently
18    complex.
19  */
20 class OptionsModel : public QAbstractListModel
21 {
22     Q_OBJECT
23
24 public:
25     explicit OptionsModel(QObject *parent = 0);
26
27     enum OptionID {
28         StartAtStartup,         // bool
29         MinimizeToTray,         // bool
30         MapPortUPnP,            // bool
31         MinimizeOnClose,        // bool
32         ProxyUse,               // bool
33         ProxyIP,                // QString
34         ProxyPort,              // int
35         Fee,                    // qint64
36         DisplayUnit,            // BitcoinUnits::Unit
37         ThirdPartyTxUrls,       // QString
38         Language,               // QString
39         CoinControlFeatures,    // bool
40         ThreadsScriptVerif,     // int
41         DatabaseCache,          // int
42         SpendZeroConfChange,    // bool
43         Listen,                 // bool
44         OptionIDRowCount,
45     };
46
47     void Init();
48     void Reset();
49
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);
55
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; }
64
65     /* Restart flag helper */
66     void setRestartRequired(bool fRequired);
67     bool isRestartRequired();
68
69 private:
70     /* Qt-only settings */
71     bool fMinimizeToTray;
72     bool fMinimizeOnClose;
73     QString language;
74     int nDisplayUnit;
75     QString strThirdPartyTxUrls;
76     bool fCoinControlFeatures;
77     /* settings that were overriden by command-line */
78     QString strOverriddenByCommandLine;
79
80     /// Add option to list of GUI options overridden through command line/config file
81     void addOverriddenOption(const std::string &option);
82
83 signals:
84     void displayUnitChanged(int unit);
85     void transactionFeeChanged(qint64);
86     void coinControlFeaturesChanged(bool);
87 };
88
89 #endif // OPTIONSMODEL_H
This page took 0.030224 seconds and 4 git commands to generate.