You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

optionsmodel.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Copyright (c) 2011-2013 The Bitcoin developers
  2. // Distributed under the MIT/X11 software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef OPTIONSMODEL_H
  5. #define OPTIONSMODEL_H
  6. #include <QAbstractListModel>
  7. QT_BEGIN_NAMESPACE
  8. class QNetworkProxy;
  9. QT_END_NAMESPACE
  10. /** Interface from Qt to configuration data structure for Bitcoin client.
  11. To Qt, the options are presented as a list with the different options
  12. laid out vertically.
  13. This can be changed to a tree once the settings become sufficiently
  14. complex.
  15. */
  16. class OptionsModel : public QAbstractListModel
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit OptionsModel(QObject *parent = 0);
  21. enum OptionID {
  22. StartAtStartup, // bool
  23. MinimizeToTray, // bool
  24. MapPortUPnP, // bool
  25. MinimizeOnClose, // bool
  26. ProxyUse, // bool
  27. ProxyIP, // QString
  28. ProxyPort, // int
  29. ProxySocksVersion, // int
  30. Fee, // qint64
  31. DisplayUnit, // BitcoinUnits::Unit
  32. DisplayAddresses, // bool
  33. ThirdPartyTxUrls, // QString
  34. Language, // QString
  35. CoinControlFeatures, // bool
  36. ThreadsScriptVerif, // int
  37. DatabaseCache, // int
  38. SpendZeroConfChange, // bool
  39. OptionIDRowCount,
  40. };
  41. void Init();
  42. void Reset();
  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. /* Explicit getters */
  47. bool getMinimizeToTray() { return fMinimizeToTray; }
  48. bool getMinimizeOnClose() { return fMinimizeOnClose; }
  49. int getDisplayUnit() { return nDisplayUnit; }
  50. bool getDisplayAddresses() { return bDisplayAddresses; }
  51. QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; }
  52. bool getProxySettings(QNetworkProxy& proxy) const;
  53. bool getCoinControlFeatures() { return fCoinControlFeatures; }
  54. const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
  55. /* Restart flag helper */
  56. void setRestartRequired(bool fRequired);
  57. bool isRestartRequired();
  58. private:
  59. /* Qt-only settings */
  60. bool fMinimizeToTray;
  61. bool fMinimizeOnClose;
  62. QString language;
  63. int nDisplayUnit;
  64. bool bDisplayAddresses;
  65. QString strThirdPartyTxUrls;
  66. bool fCoinControlFeatures;
  67. /* settings that were overriden by command-line */
  68. QString strOverriddenByCommandLine;
  69. /// Add option to list of GUI options overridden through command line/config file
  70. void addOverriddenOption(const std::string &option);
  71. signals:
  72. void displayUnitChanged(int unit);
  73. void transactionFeeChanged(qint64);
  74. void coinControlFeaturesChanged(bool);
  75. };
  76. #endif // OPTIONSMODEL_H