e3f73b257d5caca23a704edbef6c95891c206dc6
[novacoin.git] / src / qt / optionsmodel.h
1 #ifndef OPTIONSMODEL_H
2 #define OPTIONSMODEL_H
3
4 #include <QAbstractListModel>
5
6 /** Interface from Qt to configuration data structure for Bitcoin client.
7    To Qt, the options are presented as a list with the different options
8    laid out vertically.
9    This can be changed to a tree once the settings become sufficiently
10    complex.
11  */
12 class OptionsModel : public QAbstractListModel
13 {
14     Q_OBJECT
15
16 public:
17     explicit OptionsModel(QObject *parent = 0);
18
19     enum OptionID {
20         StartAtStartup,    // bool
21         MinimizeToTray,    // bool
22         MapPortUPnP,       // bool
23         MinimizeOnClose,   // bool
24         ProxyUse,          // bool
25         ProxyIP,           // QString
26         ProxyPort,         // int
27         ProxySocksVersion, // int
28         Fee,               // qint64
29         DisplayUnit,       // BitcoinUnits::Unit
30         DisplayAddresses,  // bool
31         ThirdPartyTxUrls,  // QString
32         DetachDatabases,   // bool
33         Language,          // QString
34         CoinControlFeatures, // bool
35         OptionIDRowCount,
36     };
37
38     void Init();
39
40     /* Migrate settings from wallet.dat after app initialization */
41     bool Upgrade(); /* returns true if settings upgraded */
42
43     int rowCount(const QModelIndex & parent = QModelIndex()) const;
44     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
45     bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
46
47     /* Explicit getters */
48     qint64 getTransactionFee();
49     bool getMinimizeToTray();
50     bool getMinimizeOnClose();
51     int getDisplayUnit();
52     bool getDisplayAddresses();
53     bool getCoinControlFeatures();
54     QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; }
55     QString getLanguage() { return language; }
56
57 private:
58     int nDisplayUnit;
59     bool bDisplayAddresses;
60     bool fMinimizeToTray;
61     bool fMinimizeOnClose;
62     bool fCoinControlFeatures;
63     QString language;
64     QString strThirdPartyTxUrls;
65
66 signals:
67     void displayUnitChanged(int unit);
68     void transactionFeeChanged(qint64);
69     void coinControlFeaturesChanged(bool);
70 };
71
72 #endif // OPTIONSMODEL_H