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