Anoncoin  0.9.4
P2P Digital Currency
optionsmodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2013-2014 The Anoncoin 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 #ifndef OPTIONSMODEL_H
6 #define OPTIONSMODEL_H
7 
8 // Many builder specific things set in the config file, for any source files where we rely on moc_xxx files being generated
9 // it is best to include the anoncoin-config.h in the header file itself. Not the .cpp src file, because otherwise any
10 // conditional compilation guidelines, which rely on the build configuration, will not be present in the moc_xxx files.
11 #if defined(HAVE_CONFIG_H)
12 #include "config/anoncoin-config.h"
13 #endif
14 
15 #include <QAbstractListModel>
16 
17 QT_BEGIN_NAMESPACE
18 class QNetworkProxy;
19 QT_END_NAMESPACE
20 
27 class OptionsModel : public QAbstractListModel
28 {
29  Q_OBJECT
30 
31 public:
32  explicit OptionsModel(QObject *parent = 0);
33 
34  enum OptionID {
35  StartAtStartup, // bool
36  MinimizeToTray, // bool
37  MapPortUPnP, // bool
38  MinimizeOnClose, // bool
39  ProxyUse, // bool
40  ProxyIP, // QString
41  ProxyPort, // int
43  Fee, // qint64
44  DisplayUnit, // AnoncoinUnits::Unit
45  ThirdPartyTxUrls, // QString
46  Language, // QString
49  DatabaseCache, // int
51 #ifdef ENABLE_I2PSAM
52  eI2PUseI2POnly, // bool
53  eI2PSAMHost, // QString
54  eI2PSAMPort, // int
55  eI2PSessionName, // QString
56 
57  I2PInboundQuantity, // int
58  I2PInboundLength, // int
59  I2PInboundLengthVariance, // int
60  I2PInboundBackupQuantity, // int
61  I2PInboundAllowZeroHop, // bool
62  I2PInboundIPRestriction, // int
63 
64  I2POutboundQuantity, // int
65  I2POutboundLength, // int
66  I2POutboundLengthVariance, // int
67  I2POutboundBackupQuantity, // int
68  I2POutboundAllowZeroHop, // bool
69  I2POutboundIPRestriction, // int
70  I2POutboundPriority, // int
71 #endif // ENABLE_I2PSAM
73  };
74 
75  void Init();
76  void Reset();
77 
78  int rowCount(const QModelIndex & parent = QModelIndex()) const;
79  QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
80  bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
82  void setDisplayUnit(const QVariant &value);
83 
84  /* Explicit getters */
87  int getDisplayUnit() { return nDisplayUnit; }
89  bool getProxySettings(QNetworkProxy& proxy) const;
92 
93  /* Restart flag helper */
94  void setRestartRequired(bool fRequired);
95  bool isRestartRequired();
96 
97 private:
98  /* Qt-only settings */
101  QString language;
105  /* settings that were overriden by command-line */
107 
109  void addOverriddenOption(const std::string &option);
110 
111 #ifdef ENABLE_I2PSAM
112  bool I2PUseI2POnly;
113  QString I2PSAMHost;
114  int I2PSAMPort;
115  QString I2PSessionName;
116  int i2pInboundQuantity;
117  int i2pInboundLength;
118  int i2pInboundLengthVariance;
119  int i2pInboundBackupQuantity;
120  bool i2pInboundAllowZeroHop;
121  int i2pInboundIPRestriction;
122  int i2pOutboundQuantity;
123  int i2pOutboundLength;
124  int i2pOutboundLengthVariance;
125  int i2pOutboundBackupQuantity;
126  bool i2pOutboundAllowZeroHop;
127  int i2pOutboundIPRestriction;
128  int i2pOutboundPriority;
129 #endif // ENABLE_I2PSAM
130 
131 signals:
132  void displayUnitChanged(int unit);
133  void transactionFeeChanged(qint64);
134  void coinControlFeaturesChanged(bool);
135 };
136 
137 #endif // OPTIONSMODEL_H
bool getMinimizeOnClose()
Definition: optionsmodel.h:86
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
void addOverriddenOption(const std::string &option)
Add option to list of GUI options overridden through command line/config file.
void transactionFeeChanged(qint64)
const QString & getOverriddenByCommandLine()
Definition: optionsmodel.h:91
QString language
Definition: optionsmodel.h:101
void coinControlFeaturesChanged(bool)
OptionsModel(QObject *parent=0)
bool fMinimizeOnClose
Definition: optionsmodel.h:100
bool getCoinControlFeatures()
Definition: optionsmodel.h:90
void setDisplayUnit(const QVariant &value)
Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal.
int rowCount(const QModelIndex &parent=QModelIndex()) const
bool getProxySettings(QNetworkProxy &proxy) const
bool fMinimizeToTray
Definition: optionsmodel.h:99
int getDisplayUnit()
Definition: optionsmodel.h:87
void displayUnitChanged(int unit)
bool fCoinControlFeatures
Definition: optionsmodel.h:104
void setRestartRequired(bool fRequired)
Interface from Qt to configuration data structure for Anoncoin client.
Definition: optionsmodel.h:27
QString strThirdPartyTxUrls
Definition: optionsmodel.h:103
bool isRestartRequired()
bool getMinimizeToTray()
Definition: optionsmodel.h:85
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QString strOverriddenByCommandLine
Definition: optionsmodel.h:106
QString getThirdPartyTxUrls()
Definition: optionsmodel.h:88