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