2011-05-31 22:24:53 +02:00
|
|
|
#ifndef OPTIONSMODEL_H
|
|
|
|
#define OPTIONSMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
2012-05-13 16:09:14 +02:00
|
|
|
/** Interface from Qt to configuration data structure for Bitcoin client.
|
|
|
|
To Qt, the options are presented as a list with the different options
|
2011-06-05 14:19:57 +02:00
|
|
|
laid out vertically.
|
|
|
|
This can be changed to a tree once the settings become sufficiently
|
|
|
|
complex.
|
|
|
|
*/
|
2011-05-31 22:24:53 +02:00
|
|
|
class OptionsModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2012-07-09 13:40:22 +02:00
|
|
|
|
2011-05-31 22:24:53 +02:00
|
|
|
public:
|
2012-02-17 03:09:41 +01:00
|
|
|
explicit OptionsModel(QObject *parent = 0);
|
2011-05-31 22:24:53 +02:00
|
|
|
|
|
|
|
enum OptionID {
|
2012-07-09 13:40:22 +02:00
|
|
|
StartAtStartup, // bool
|
|
|
|
MinimizeToTray, // bool
|
|
|
|
MapPortUPnP, // bool
|
|
|
|
MinimizeOnClose, // bool
|
|
|
|
ProxyUse, // bool
|
|
|
|
ProxyIP, // QString
|
|
|
|
ProxyPort, // int
|
2012-05-24 19:02:21 +02:00
|
|
|
ProxySocksVersion, // int
|
2012-07-09 13:40:22 +02:00
|
|
|
Fee, // qint64
|
|
|
|
DisplayUnit, // BitcoinUnits::Unit
|
|
|
|
DisplayAddresses, // bool
|
|
|
|
DetachDatabases, // bool
|
|
|
|
Language, // QString
|
2012-04-17 23:03:24 +02:00
|
|
|
OptionIDRowCount,
|
2011-05-31 22:24:53 +02:00
|
|
|
};
|
|
|
|
|
2012-02-17 03:09:41 +01:00
|
|
|
void Init();
|
|
|
|
|
|
|
|
/* Migrate settings from wallet.dat after app initialization */
|
|
|
|
bool Upgrade(); /* returns true if settings upgraded */
|
|
|
|
|
2011-05-31 22:24:53 +02:00
|
|
|
int rowCount(const QModelIndex & parent = QModelIndex()) const;
|
|
|
|
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
|
|
|
|
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
|
|
|
|
|
2011-06-01 09:34:12 +02:00
|
|
|
/* Explicit getters */
|
|
|
|
qint64 getTransactionFee();
|
2011-06-01 14:40:06 +02:00
|
|
|
bool getMinimizeToTray();
|
|
|
|
bool getMinimizeOnClose();
|
2011-07-29 14:36:35 +02:00
|
|
|
int getDisplayUnit();
|
2011-07-30 17:42:02 +02:00
|
|
|
bool getDisplayAddresses();
|
2012-05-08 23:03:41 +02:00
|
|
|
QString getLanguage() { return language; }
|
2012-07-09 13:40:22 +02:00
|
|
|
|
2011-06-26 19:23:24 +02:00
|
|
|
private:
|
2011-07-29 14:36:35 +02:00
|
|
|
int nDisplayUnit;
|
2011-07-30 17:42:02 +02:00
|
|
|
bool bDisplayAddresses;
|
2012-02-17 03:09:41 +01:00
|
|
|
bool fMinimizeToTray;
|
|
|
|
bool fMinimizeOnClose;
|
2012-05-08 23:03:41 +02:00
|
|
|
QString language;
|
2012-07-09 13:40:22 +02:00
|
|
|
|
2011-05-31 22:24:53 +02:00
|
|
|
signals:
|
2011-07-29 14:36:35 +02:00
|
|
|
void displayUnitChanged(int unit);
|
2011-05-31 22:24:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OPTIONSMODEL_H
|