optionsmodel.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // ECOin - Copyright (c) - 2014/2021 - GPLv3 - epsylon@riseup.net (https://03c8.net)
  2. #ifndef OPTIONSMODEL_H
  3. #define OPTIONSMODEL_H
  4. #include <QAbstractListModel>
  5. class OptionsModel : public QAbstractListModel
  6. {
  7. Q_OBJECT
  8. public:
  9. explicit OptionsModel(QObject *parent = 0);
  10. enum OptionID {
  11. StartAtStartup, // bool
  12. MinimizeToTray, // bool
  13. MapPortUPnP, // bool
  14. MinimizeOnClose, // bool
  15. ProxyUse, // bool
  16. ProxyIP, // QString
  17. ProxyPort, // int
  18. ProxySocksVersion, // int
  19. Fee, // qint64
  20. DisplayUnit, // EcoinUnits::Unit
  21. DisplayAddresses, // bool
  22. DetachDatabases, // bool
  23. Language, // QString
  24. CoinControlFeatures, // bool
  25. OptionIDRowCount,
  26. };
  27. void Init();
  28. /* Migrate settings from wallet.dat after app initialization */
  29. bool Upgrade(); /* returns true if settings upgraded */
  30. int rowCount(const QModelIndex & parent = QModelIndex()) const;
  31. QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
  32. bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
  33. /* Explicit getters */
  34. qint64 getTransactionFee();
  35. bool getMinimizeToTray();
  36. bool getMinimizeOnClose();
  37. int getDisplayUnit();
  38. bool getDisplayAddresses();
  39. bool getCoinControlFeatures();
  40. QString getLanguage() { return language; }
  41. private:
  42. int nDisplayUnit;
  43. bool bDisplayAddresses;
  44. bool fMinimizeToTray;
  45. bool fMinimizeOnClose;
  46. bool fCoinControlFeatures;
  47. QString language;
  48. signals:
  49. void displayUnitChanged(int unit);
  50. void transactionFeeChanged(qint64);
  51. void coinControlFeaturesChanged(bool);
  52. };
  53. #endif // OPTIONSMODEL_H