Merge coin control features
[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         DetachDatabases,   // bool
32         Language,          // QString
33         CoinControlFeatures, // bool
34         OptionIDRowCount,
35     };
36
37     void Init();
38
39     /* Migrate settings from wallet.dat after app initialization */
40     bool Upgrade(); /* returns true if settings upgraded */
41
42     int rowCount(const QModelIndex & parent = QModelIndex()) const;
43     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
44     bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
45
46     /* Explicit getters */
47     qint64 getTransactionFee();
48     bool getMinimizeToTray();
49     bool getMinimizeOnClose();
50     int getDisplayUnit();
51     bool getDisplayAddresses();
52     bool getCoinControlFeatures();
53     QString getLanguage() { return language; }
54
55 private:
56     int nDisplayUnit;
57     bool bDisplayAddresses;
58     bool fMinimizeToTray;
59     bool fMinimizeOnClose;
60     bool fCoinControlFeatures;
61     QString language;
62
63 signals:
64     void displayUnitChanged(int unit);
65     void transactionFeeChanged(qint64);
66     void coinControlFeaturesChanged(bool);
67 };
68
69 #endif // OPTIONSMODEL_H