PIVX Core  5.6.99
P2P Digital Currency
optionsmodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2017-2021 The PIVX Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef PIVX_QT_OPTIONSMODEL_H
7 #define PIVX_QT_OPTIONSMODEL_H
8 
9 #include "amount.h"
10 #include <cstdint>
11 
12 #include <QAbstractListModel>
13 #include <QSettings>
14 
21 class OptionsModel : public QAbstractListModel
22 {
23  Q_OBJECT
24 
25 public:
26  explicit OptionsModel(QObject* parent = 0);
27 
28  enum OptionID {
29  StartAtStartup, // bool
30  MinimizeToTray, // bool
31  MapPortUPnP, // bool
32  MapPortNatpmp, // bool
33  MinimizeOnClose, // bool
34  ProxyUse, // bool
35  ProxyIP, // QString
36  ProxyPort, // int
37  DisplayUnit, // BitcoinUnits::Unit
38  ThirdPartyTxUrls, // QString
39  Digits, // QString
40  Theme, // QString
41  Language, // QString
44  DatabaseCache, // int
46  ZeromintEnable, // bool
50  HideCharts, // bool
52  HideOrphans, // bool
55  Listen, // bool
58  };
59 
60  void Init();
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);
66  void refreshDataView();
68  void setDisplayUnit(const QVariant& value);
69 
70  /* Explicit getters */
71  bool isHideCharts() { return fHideCharts; }
74  int getDisplayUnit() { return nDisplayUnit; }
78  const QString& getLang() { return language; }
79 
80  /* Restart flag helper */
81  void setRestartRequired(bool fRequired);
82  bool isRestartRequired();
84 
87  setData(
88  createIndex(ShowColdStakingScreen, 0),
90  Qt::EditRole
91  );
92  return showColdStakingScreen;
93  }
94 
95  // Reset
96  void setMainDefaultOptions(QSettings& settings, bool reset = false);
97  void setWalletDefaultOptions(QSettings& settings, bool reset = false);
98  void setNetworkDefaultOptions(QSettings& settings, bool reset = false);
99  void setWindowDefaultOptions(QSettings& settings, bool reset = false);
100  void setDisplayDefaultOptions(QSettings& settings, bool reset = false);
101 
102 private:
103  /* Qt-only settings */
106  QString language;
114  /* settings that were overridden by command-line */
116 
118  void addOverriddenOption(const std::string& option);
119 
120 Q_SIGNALS:
121  void displayUnitChanged(int unit);
124  void hideChartsChanged(bool);
126  void hideOrphansChanged(bool);
127 };
128 
129 #endif // PIVX_QT_OPTIONSMODEL_H
Interface from Qt to configuration data structure for PIVX client.
Definition: optionsmodel.h:22
QString strOverriddenByCommandLine
Definition: optionsmodel.h:115
void hideChartsChanged(bool)
OptionsModel(QObject *parent=0)
void hideZeroBalancesChanged(bool)
void setWalletDefaultOptions(QSettings &settings, bool reset=false)
void hideOrphansChanged(bool)
bool fCoinControlFeatures
Definition: optionsmodel.h:109
bool invertColdStakingScreenStatus()
Definition: optionsmodel.h:86
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
int getDisplayUnit()
Definition: optionsmodel.h:74
void setDisplayUnit(const QVariant &value)
Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal.
void coinControlFeaturesChanged(bool)
void setNetworkDefaultOptions(QSettings &settings, bool reset=false)
QString strThirdPartyTxUrls
Definition: optionsmodel.h:108
bool resetSettings
Definition: optionsmodel.h:83
@ ShowColdStakingScreen
Definition: optionsmodel.h:56
void setMainDefaultOptions(QSettings &settings, bool reset=false)
void setWindowDefaultOptions(QSettings &settings, bool reset=false)
QString getThirdPartyTxUrls()
Definition: optionsmodel.h:75
const QString & getLang()
Definition: optionsmodel.h:78
bool isRestartRequired()
void displayUnitChanged(int unit)
void showHideColdStakingScreen(bool)
bool getMinimizeOnClose()
Definition: optionsmodel.h:73
void refreshDataView()
bool fHideZeroBalances
Definition: optionsmodel.h:112
bool fMinimizeToTray
Definition: optionsmodel.h:104
bool isHideCharts()
Definition: optionsmodel.h:71
bool isColdStakingScreenEnabled()
Definition: optionsmodel.h:85
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
const QString & getOverriddenByCommandLine()
Definition: optionsmodel.h:77
void setDisplayDefaultOptions(QSettings &settings, bool reset=false)
int rowCount(const QModelIndex &parent=QModelIndex()) const
bool getCoinControlFeatures()
Definition: optionsmodel.h:76
QString language
Definition: optionsmodel.h:106
void addOverriddenOption(const std::string &option)
Add option to list of GUI options overridden through command line/config file.
bool getMinimizeToTray()
Definition: optionsmodel.h:72
bool fMinimizeOnClose
Definition: optionsmodel.h:105
void setRestartRequired(bool fRequired)
bool showColdStakingScreen
Definition: optionsmodel.h:110
QSettings * settings
Definition: qtutils.cpp:197