Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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 
16 extern const char *DEFAULT_GUI_PROXY_HOST;
17 static constexpr unsigned short DEFAULT_GUI_PROXY_PORT = 9050;
18 
25 class OptionsModel : public QAbstractListModel
26 {
27  Q_OBJECT
28 
29 public:
30  explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
31 
32  enum OptionID {
33  StartAtStartup, // bool
34  HideTrayIcon, // bool
35  MinimizeToTray, // bool
36  MapPortUPnP, // bool
37  MinimizeOnClose, // bool
38  ProxyUse, // bool
39  ProxyIP, // QString
40  ProxyPort, // int
41  ProxyUseTor, // bool
42  ProxyIPTor, // QString
43  ProxyPortTor, // int
44  DisplayUnit, // BitcoinUnits::Unit
45  ThirdPartyTxUrls, // QString
46  Digits, // QString
47  Theme, // QString
48  FontFamily, // int
49  FontScale, // int
52  Language, // QString
55  DatabaseCache, // int
61  LowKeysWarning, // bool
65  Listen, // bool
67  };
68 
69  void Init(bool resetSettings = false);
70  void Reset();
71 
72  int rowCount(const QModelIndex & parent = QModelIndex()) const;
73  QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
74  bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
76  void setDisplayUnit(const QVariant &value);
77 
78  /* Explicit getters */
79  bool getHideTrayIcon() const { return fHideTrayIcon; }
80  bool getMinimizeToTray() const { return fMinimizeToTray; }
81  bool getMinimizeOnClose() const { return fMinimizeOnClose; }
82  int getDisplayUnit() const { return nDisplayUnit; }
83  QString getThirdPartyTxUrls() const { return strThirdPartyTxUrls; }
84  bool getProxySettings(QNetworkProxy& proxy) const;
89 
90  /* Restart flag helper */
91  void setRestartRequired(bool fRequired);
92  bool isRestartRequired() const;
94 
95 private:
96  /* Qt-only settings */
100  QString language;
105  /* settings that were overridden by command-line */
107 
108  // Add option to list of GUI options overridden through command line/config file
109  void addOverriddenOption(const std::string &option);
110 
111  // Check settings version and upgrade default values if required
112  void checkAndMigrate();
113 Q_SIGNALS:
114  void displayUnitChanged(int unit);
118  void advancedPSUIChanged(bool);
119  void coinControlFeaturesChanged(bool);
120  void hideTrayIconChanged(bool);
121 };
122 
123 #endif // BITCOIN_QT_OPTIONSMODEL_H
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
void addOverriddenOption(const std::string &option)
void hideTrayIconChanged(bool)
bool getProxySettings(QNetworkProxy &proxy) const
const QString & getOverriddenByCommandLine()
Definition: optionsmodel.h:87
QString language
Definition: optionsmodel.h:100
void coinControlFeaturesChanged(bool)
bool fShowAdvancedPSUI
Definition: optionsmodel.h:104
bool fMinimizeOnClose
Definition: optionsmodel.h:99
int getDisplayUnit() const
Definition: optionsmodel.h:82
void privateSentAmountChanged()
bool isRestartRequired() const
void setDisplayUnit(const QVariant &value)
Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal.
bool fHideTrayIcon
Definition: optionsmodel.h:97
OptionsModel(QObject *parent=0, bool resetSettings=false)
bool fMinimizeToTray
Definition: optionsmodel.h:98
void privateSendEnabledChanged()
void Init(bool resetSettings=false)
void displayUnitChanged(int unit)
QString getThirdPartyTxUrls() const
Definition: optionsmodel.h:83
bool fCoinControlFeatures
Definition: optionsmodel.h:103
bool getCoinControlFeatures() const
Definition: optionsmodel.h:85
void checkAndMigrate()
void advancedPSUIChanged(bool)
bool getMinimizeOnClose() const
Definition: optionsmodel.h:81
QT_END_NAMESPACE const char * DEFAULT_GUI_PROXY_HOST
void setRestartRequired(bool fRequired)
bool getShowAdvancedPSUI()
Definition: optionsmodel.h:86
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:25
QString strThirdPartyTxUrls
Definition: optionsmodel.h:102
bool getMinimizeToTray() const
Definition: optionsmodel.h:80
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
void emitPrivateSendEnabledChanged()
bool resetSettingsOnShutdown
Definition: optionsmodel.h:93
int rowCount(const QModelIndex &parent=QModelIndex()) const
void privateSendRoundsChanged()
static constexpr unsigned short DEFAULT_GUI_PROXY_PORT
Definition: optionsmodel.h:17
bool getHideTrayIcon() const
Definition: optionsmodel.h:79
QString strOverriddenByCommandLine
Definition: optionsmodel.h:106
Released under the MIT license