2013-11-04 12:20:43 -03:00
|
|
|
// Copyright (c) 2011-2013 The Bitcoin developers
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2011-05-31 16:24:53 -04:00
|
|
|
#ifndef OPTIONSMODEL_H
|
|
|
|
#define OPTIONSMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
2012-05-13 10:09:14 -04: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 08:19:57 -04:00
|
|
|
laid out vertically.
|
|
|
|
This can be changed to a tree once the settings become sufficiently
|
|
|
|
complex.
|
|
|
|
*/
|
2011-05-31 16:24:53 -04:00
|
|
|
class OptionsModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2012-07-09 07:40:22 -04:00
|
|
|
|
2011-05-31 16:24:53 -04:00
|
|
|
public:
|
2012-02-16 23:09:41 -03:00
|
|
|
explicit OptionsModel(QObject *parent = 0);
|
2011-05-31 16:24:53 -04:00
|
|
|
|
|
|
|
enum OptionID {
|
2013-11-16 13:37:31 -03:00
|
|
|
StartAtStartup, // bool
|
|
|
|
MinimizeToTray, // bool
|
|
|
|
MapPortUPnP, // bool
|
|
|
|
MinimizeOnClose, // bool
|
|
|
|
ProxyUse, // bool
|
|
|
|
ProxyIP, // QString
|
|
|
|
ProxyPort, // int
|
|
|
|
ProxySocksVersion, // int
|
|
|
|
Fee, // qint64
|
|
|
|
DisplayUnit, // BitcoinUnits::Unit
|
|
|
|
DisplayAddresses, // bool
|
|
|
|
Language, // QString
|
|
|
|
CoinControlFeatures, // bool
|
2013-12-03 05:10:10 -03:00
|
|
|
ThreadsScriptVerif, // int
|
|
|
|
DatabaseCache, // int
|
2012-04-17 18:03:24 -03:00
|
|
|
OptionIDRowCount,
|
2011-05-31 16:24:53 -04:00
|
|
|
};
|
|
|
|
|
2012-02-16 23:09:41 -03:00
|
|
|
void Init();
|
2012-08-18 09:54:39 -04:00
|
|
|
void Reset();
|
2012-02-16 23:09:41 -03:00
|
|
|
|
|
|
|
/* Migrate settings from wallet.dat after app initialization */
|
2013-12-03 05:10:10 -03:00
|
|
|
void Upgrade();
|
2012-02-16 23:09:41 -03:00
|
|
|
|
2011-05-31 16:24:53 -04: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 03:34:12 -04:00
|
|
|
/* Explicit getters */
|
2012-10-02 08:37:19 -03:00
|
|
|
bool getMinimizeToTray() { return fMinimizeToTray; }
|
|
|
|
bool getMinimizeOnClose() { return fMinimizeOnClose; }
|
|
|
|
int getDisplayUnit() { return nDisplayUnit; }
|
|
|
|
bool getDisplayAddresses() { return bDisplayAddresses; }
|
2013-07-22 02:50:39 -04:00
|
|
|
bool getProxySettings(QString& proxyIP, quint16 &proxyPort) const;
|
2013-11-16 13:37:31 -03:00
|
|
|
bool getCoinControlFeatures() { return fCoinControlFeatures; }
|
2013-12-03 05:10:10 -03:00
|
|
|
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
|
|
|
|
|
|
|
|
/* Restart flag helper */
|
|
|
|
void setRestartRequired(bool fRequired);
|
|
|
|
bool isRestartRequired();
|
2012-07-09 07:40:22 -04:00
|
|
|
|
2011-06-26 13:23:24 -04:00
|
|
|
private:
|
2013-12-03 05:10:10 -03:00
|
|
|
/* Qt-only settings */
|
2012-02-16 23:09:41 -03:00
|
|
|
bool fMinimizeToTray;
|
|
|
|
bool fMinimizeOnClose;
|
2012-05-08 17:03:41 -04:00
|
|
|
QString language;
|
2013-12-03 05:10:10 -03:00
|
|
|
int nDisplayUnit;
|
|
|
|
bool bDisplayAddresses;
|
2013-08-12 11:03:03 -04:00
|
|
|
bool fCoinControlFeatures;
|
2013-12-03 05:10:10 -03:00
|
|
|
/* settings that were overriden by command-line */
|
|
|
|
QString strOverriddenByCommandLine;
|
2012-07-09 07:40:22 -04:00
|
|
|
|
2011-05-31 16:24:53 -04:00
|
|
|
signals:
|
2011-07-29 08:36:35 -04:00
|
|
|
void displayUnitChanged(int unit);
|
2013-08-12 11:03:03 -04:00
|
|
|
void transactionFeeChanged(qint64);
|
|
|
|
void coinControlFeaturesChanged(bool);
|
2011-05-31 16:24:53 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OPTIONSMODEL_H
|