Dash Core  0.12.2.1
P2P Digital Currency
optionsmodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 The Bitcoin Core 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 
22 class OptionsModel : public QAbstractListModel
23 {
24  Q_OBJECT
25 
26 public:
27  explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
28 
29  enum OptionID {
30  StartAtStartup, // bool
31  HideTrayIcon, // bool
32  MinimizeToTray, // bool
33  MapPortUPnP, // bool
34  MinimizeOnClose, // bool
35  ProxyUse, // bool
36  ProxyIP, // QString
37  ProxyPort, // int
38  ProxyUseTor, // bool
39  ProxyIPTor, // QString
40  ProxyPortTor, // int
41  DisplayUnit, // BitcoinUnits::Unit
42  ThirdPartyTxUrls, // QString
43  Digits, // QString
44  Theme, // QString
45  Language, // QString
48  DatabaseCache, // int
52  LowKeysWarning, // bool
56  Listen, // bool
58  };
59 
60  void Init(bool resetSettings = false);
61  void Reset();
62 
63  int rowCount(const QModelIndex & parent = QModelIndex()) const;
64  QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
65  bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
67  void setDisplayUnit(const QVariant &value);
68 
69  /* Explicit getters */
70  bool getHideTrayIcon() { return fHideTrayIcon; }
73  int getDisplayUnit() { return nDisplayUnit; }
75  bool getProxySettings(QNetworkProxy& proxy) const;
79 
80  /* Restart flag helper */
81  void setRestartRequired(bool fRequired);
82  bool isRestartRequired();
84 
85 private:
86  /* Qt-only settings */
90  QString language;
95  /* settings that were overriden by command-line */
97 
99  void addOverriddenOption(const std::string &option);
100 
101 Q_SIGNALS:
102  void displayUnitChanged(int unit);
105  void advancedPSUIChanged(bool);
106  void coinControlFeaturesChanged(bool);
107  void hideTrayIconChanged(bool);
108 };
109 
110 #endif // BITCOIN_QT_OPTIONSMODEL_H
bool getHideTrayIcon()
Definition: optionsmodel.h:70
bool fMinimizeToTray
Definition: optionsmodel.h:88
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
bool getCoinControlFeatures()
Definition: optionsmodel.h:76
bool resetSettings
Definition: optionsmodel.h:83
bool isRestartRequired()
OptionsModel(QObject *parent=0, bool resetSettings=false)
QString language
Definition: optionsmodel.h:90
void addOverriddenOption(const std::string &option)
Add option to list of GUI options overridden through command line/config file.
void setRestartRequired(bool fRequired)
bool fMinimizeOnClose
Definition: optionsmodel.h:89
bool fCoinControlFeatures
Definition: optionsmodel.h:93
QString strThirdPartyTxUrls
Definition: optionsmodel.h:92
void displayUnitChanged(int unit)
int rowCount(const QModelIndex &parent=QModelIndex()) const
void coinControlFeaturesChanged(bool)
bool getMinimizeToTray()
Definition: optionsmodel.h:71
bool getMinimizeOnClose()
Definition: optionsmodel.h:72
void setDisplayUnit(const QVariant &value)
bool getProxySettings(QNetworkProxy &proxy) const
bool getShowAdvancedPSUI()
Definition: optionsmodel.h:77
QString getThirdPartyTxUrls()
Definition: optionsmodel.h:74
QString strOverriddenByCommandLine
Definition: optionsmodel.h:96
bool fShowAdvancedPSUI
Definition: optionsmodel.h:94
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
bool fHideTrayIcon
Definition: optionsmodel.h:87
const QString & getOverriddenByCommandLine()
Definition: optionsmodel.h:78
void privateSendRoundsChanged()
void advancedPSUIChanged(bool)
int getDisplayUnit()
Definition: optionsmodel.h:73
void Init(bool resetSettings=false)
void hideTrayIconChanged(bool)
void privateSentAmountChanged()