Raven Core  3.0.0
P2P Digital Currency
optionsmodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2016 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_QT_OPTIONSMODEL_H
7 #define RAVEN_QT_OPTIONSMODEL_H
8 
9 #include "amount.h"
10 
11 #include <QAbstractListModel>
12 
13 QT_BEGIN_NAMESPACE
14 class QNetworkProxy;
15 QT_END_NAMESPACE
16 
23 class OptionsModel : public QAbstractListModel
24 {
25  Q_OBJECT
26 
27 public:
28  explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
29 
30  enum OptionID {
31  StartAtStartup, // bool
32  HideTrayIcon, // bool
33  MinimizeToTray, // bool
34  MapPortUPnP, // bool
35  MinimizeOnClose, // bool
36  ProxyUse, // bool
37  ProxyIP, // QString
38  ProxyPort, // int
39  ProxyUseTor, // bool
40  ProxyIPTor, // QString
41  ProxyPortTor, // int
42  DisplayUnit, // RavenUnits::Unit
43  ThirdPartyTxUrls, // QString
44  Language, // QString
47  DatabaseCache, // int
49  Listen, // bool
51  DarkModeEnabled, // bool
53  };
54 
55  void Init(bool resetSettings = false);
56  void Reset();
57 
58  int rowCount(const QModelIndex & parent = QModelIndex()) const;
59  QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
60  bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
62  void setDisplayUnit(const QVariant &value);
63 
64  /* Explicit getters */
65  bool getHideTrayIcon() const { return fHideTrayIcon; }
66  bool getMinimizeToTray() const { return fMinimizeToTray; }
67  bool getMinimizeOnClose() const { return fMinimizeOnClose; }
68  int getDisplayUnit() const { return nDisplayUnit; }
69  QString getThirdPartyTxUrls() const { return strThirdPartyTxUrls; }
70  bool getProxySettings(QNetworkProxy& proxy) const;
72  bool getCustomFeeFeatures() const { return fCustomFeeFeatures; }
73  bool getDarkModeEnabled() const { return fDarkModeEnabled; }
75 
76  /* Restart flag helper */
77  void setRestartRequired(bool fRequired);
78  bool isRestartRequired() const;
79 
80 private:
81  /* Qt-only settings */
85  QString language;
93  /* settings that were overridden by command-line */
95 
96  // Add option to list of GUI options overridden through command line/config file
97  void addOverriddenOption(const std::string &option);
98 
99  // Check settings version and upgrade default values if required
100  void checkAndMigrate();
101 Q_SIGNALS:
102  void displayUnitChanged(int unit);
103  void coinControlFeaturesChanged(bool);
104  void customFeeFeaturesChanged(bool);
105  void hideTrayIconChanged(bool);
106 };
107 
108 #endif // RAVEN_QT_OPTIONSMODEL_H
bool fDarkModeEnabled
Definition: optionsmodel.h:91
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:74
QString language
Definition: optionsmodel.h:85
void coinControlFeaturesChanged(bool)
void customFeeFeaturesChanged(bool)
bool fMinimizeOnClose
Definition: optionsmodel.h:84
int getDisplayUnit() const
Definition: optionsmodel.h:68
bool isRestartRequired() const
void setDisplayUnit(const QVariant &value)
Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal.
bool fHideTrayIcon
Definition: optionsmodel.h:82
OptionsModel(QObject *parent=0, bool resetSettings=false)
bool fMinimizeToTray
Definition: optionsmodel.h:83
void Init(bool resetSettings=false)
void displayUnitChanged(int unit)
QString getThirdPartyTxUrls() const
Definition: optionsmodel.h:69
bool fCoinControlFeatures
Definition: optionsmodel.h:88
bool getCoinControlFeatures() const
Definition: optionsmodel.h:71
void checkAndMigrate()
bool fCustomFeeFeatures
RVN START.
Definition: optionsmodel.h:90
bool getMinimizeOnClose() const
Definition: optionsmodel.h:67
void setRestartRequired(bool fRequired)
Interface from Qt to configuration data structure for Raven client.
Definition: optionsmodel.h:23
QString strThirdPartyTxUrls
Definition: optionsmodel.h:87
bool getMinimizeToTray() const
Definition: optionsmodel.h:66
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
bool getDarkModeEnabled() const
Definition: optionsmodel.h:73
int rowCount(const QModelIndex &parent=QModelIndex()) const
bool getCustomFeeFeatures() const
Definition: optionsmodel.h:72
bool getHideTrayIcon() const
Definition: optionsmodel.h:65
QString strOverriddenByCommandLine
RVN END.
Definition: optionsmodel.h:94