Files
thehub/hub-qt/optionsmodel.h
T

106 lines
3.6 KiB
C++
Raw Permalink Normal View History

2017-11-09 19:34:51 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2011-2015 The Bitcoin Core developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2013-11-04 16:20:43 +01:00
2018-01-16 10:47:52 +00:00
#ifndef FLOWEE_QT_OPTIONSMODEL_H
#define FLOWEE_QT_OPTIONSMODEL_H
2014-04-22 15:46:19 -07:00
#include "amount.h"
#include <QAbstractListModel>
QT_BEGIN_NAMESPACE
class QNetworkProxy;
QT_END_NAMESPACE
/** Interface from Qt to configuration data structure for Bitcoin client.
To Qt, the options are presented as a list with the different options
laid out vertically.
This can be changed to a tree once the settings become sufficiently
complex.
*/
class OptionsModel : public QAbstractListModel
{
Q_OBJECT
2012-07-09 13:40:22 +02:00
public:
explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
enum OptionID {
StartAtStartup, // bool
MinimizeToTray, // bool
MapPortUPnP, // bool
MinimizeOnClose, // bool
ProxyUse, // bool
ProxyIP, // QString
ProxyPort, // int
2014-07-25 18:20:40 +02:00
ProxyUseTor, // bool
ProxyIPTor, // QString
ProxyPortTor, // int
DisplayUnit, // BitcoinUnits::Unit
ThirdPartyTxUrls, // QString
Language, // QString
CoinControlFeatures, // bool
SpendZeroConfChange, // bool
2014-05-29 13:02:22 +02:00
Listen, // bool
2017-02-22 21:44:34 -08:00
BlockSizeAcceptLimit, // double
OptionIDRowCount,
};
void Init(bool resetSettings = false);
void Reset();
2012-02-16 21:09:41 -05: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);
/** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */
void setDisplayUnit(const QVariant &value);
2011-06-01 09:34:12 +02:00
/* Explicit getters */
bool getMinimizeToTray() { return fMinimizeToTray; }
bool getMinimizeOnClose() { return fMinimizeOnClose; }
int getDisplayUnit() { return nDisplayUnit; }
QString getThirdPartyTxUrls() { return strThirdPartyTxUrls; }
bool getProxySettings(QNetworkProxy& proxy) const;
bool getCoinControlFeatures() { return fCoinControlFeatures; }
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
/* Restart flag helper */
void setRestartRequired(bool fRequired);
bool isRestartRequired();
2012-07-09 13:40:22 +02:00
2011-06-26 19:23:24 +02:00
private:
/* Qt-only settings */
2012-02-16 21:09:41 -05:00
bool fMinimizeToTray;
bool fMinimizeOnClose;
QString language;
int nDisplayUnit;
QString strThirdPartyTxUrls;
2013-08-12 17:03:03 +02:00
bool fCoinControlFeatures;
/* settings that were overriden by command-line */
QString strOverriddenByCommandLine;
2012-07-09 13:40:22 +02:00
/// Add option to list of GUI options overridden through command line/config file
void addOverriddenOption(const std::string &option);
2015-07-14 13:59:05 +02:00
Q_SIGNALS:
void displayUnitChanged(int unit);
2013-08-12 17:03:03 +02:00
void coinControlFeaturesChanged(bool);
};
2018-01-16 10:47:52 +00:00
#endif