]> Git Repo - VerusCoin.git/blob - src/qt/optionsmodel.h
Remove references to X11 licence
[VerusCoin.git] / src / qt / optionsmodel.h
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.
4
5 #ifndef BITCOIN_QT_OPTIONSMODEL_H
6 #define BITCOIN_QT_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         DisplayUnit,            // BitcoinUnits::Unit
38         ThirdPartyTxUrls,       // QString
39         Language,               // QString
40         CoinControlFeatures,    // bool
41         ThreadsScriptVerif,     // int
42         DatabaseCache,          // int
43         SpendZeroConfChange,    // bool
44         Listen,                 // bool
45         OptionIDRowCount,
46     };
47
48     void Init();
49     void Reset();
50
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);
56
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; }
65
66     /* Restart flag helper */
67     void setRestartRequired(bool fRequired);
68     bool isRestartRequired();
69
70 private:
71     /* Qt-only settings */
72     bool fMinimizeToTray;
73     bool fMinimizeOnClose;
74     QString language;
75     int nDisplayUnit;
76     QString strThirdPartyTxUrls;
77     bool fCoinControlFeatures;
78     /* settings that were overriden by command-line */
79     QString strOverriddenByCommandLine;
80
81     /// Add option to list of GUI options overridden through command line/config file
82     void addOverriddenOption(const std::string &option);
83
84 signals:
85     void displayUnitChanged(int unit);
86     void coinControlFeaturesChanged(bool);
87 };
88
89 #endif // BITCOIN_QT_OPTIONSMODEL_H
This page took 0.029546 seconds and 4 git commands to generate.