Fabcoin Core  0.16.2
P2P Digital Currency
optionsmodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2017 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 FABCOIN_QT_OPTIONSMODEL_H
6 #define FABCOIN_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, // FabcoinUnits::Unit
42  ThirdPartyTxUrls, // QString
43  Language, // QString
46  DatabaseCache, // int
47  LogEvents, // bool
50  Listen, // bool
52  CheckForUpdates, // bool
53  ReserveBalance, // CAmount
55  };
56 
57  void Init(bool resetSettings = false);
58  void Reset();
59 
60  int rowCount(const QModelIndex & parent = QModelIndex()) const;
61  QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
62  bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
64  void setDisplayUnit(const QVariant &value);
65 
66  /* Explicit getters */
67  bool getHideTrayIcon() { return fHideTrayIcon; }
70  int getDisplayUnit() { return nDisplayUnit; }
72  bool getProxySettings(QNetworkProxy& proxy) const;
75 
76  /* Restart flag helper */
77  void setRestartRequired(bool fRequired);
78  bool isRestartRequired();
79 
80 private:
81  /* Qt-only settings */
85  QString language;
89  /* settings that were overridden by command-line */
91 
92  // Add option to list of GUI options overridden through command line/config file
93  void addOverriddenOption(const std::string &option);
94 
95  // Check settings version and upgrade default values if required
96  void checkAndMigrate();
97 Q_SIGNALS:
98  void displayUnitChanged(int unit);
99  void coinControlFeaturesChanged(bool);
100  void hideTrayIconChanged(bool);
103 };
104 
105 #endif // FABCOIN_QT_OPTIONSMODEL_H
bool getMinimizeOnClose()
Definition: optionsmodel.h:69
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
void addOverriddenOption(const std::string &option)
void hideTrayIconChanged(bool)
const QString & getOverriddenByCommandLine()
Definition: optionsmodel.h:74
QString language
Definition: optionsmodel.h:85
void coinControlFeaturesChanged(bool)
bool getHideTrayIcon()
Definition: optionsmodel.h:67
bool fMinimizeOnClose
Definition: optionsmodel.h:84
bool getCoinControlFeatures()
Definition: optionsmodel.h:73
int64_t CAmount
Amount in lius (Can be negative)
Definition: amount.h:15
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)
int rowCount(const QModelIndex &parent=QModelIndex()) const
bool getProxySettings(QNetworkProxy &proxy) const
bool fMinimizeToTray
Definition: optionsmodel.h:83
void zeroBalanceAddressTokenChanged(bool)
int getDisplayUnit()
Definition: optionsmodel.h:70
void Init(bool resetSettings=false)
void displayUnitChanged(int unit)
bool fCoinControlFeatures
Definition: optionsmodel.h:88
void checkAndMigrate()
void setRestartRequired(bool fRequired)
void reserveBalanceChanged(CAmount)
Interface from Qt to configuration data structure for Fabcoin client.
Definition: optionsmodel.h:22
QString strThirdPartyTxUrls
Definition: optionsmodel.h:87
bool isRestartRequired()
bool getMinimizeToTray()
Definition: optionsmodel.h:68
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QString strOverriddenByCommandLine
Definition: optionsmodel.h:90
QString getThirdPartyTxUrls()
Definition: optionsmodel.h:71