Changeset View
Changeset View
Standalone View
Standalone View
src/qt/optionsmodel.h
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_QT_OPTIONSMODEL_H | #ifndef BITCOIN_QT_OPTIONSMODEL_H | ||||
#define BITCOIN_QT_OPTIONSMODEL_H | #define BITCOIN_QT_OPTIONSMODEL_H | ||||
#include <amount.h> | #include <amount.h> | ||||
#include <qt/guiconstants.h> | |||||
#include <QAbstractListModel> | #include <QAbstractListModel> | ||||
#include <cassert> | #include <cassert> | ||||
namespace interfaces { | namespace interfaces { | ||||
class Node; | class Node; | ||||
} | } | ||||
QT_BEGIN_NAMESPACE | QT_BEGIN_NAMESPACE | ||||
class QNetworkProxy; | class QNetworkProxy; | ||||
QT_END_NAMESPACE | QT_END_NAMESPACE | ||||
extern const char *DEFAULT_GUI_PROXY_HOST; | extern const char *DEFAULT_GUI_PROXY_HOST; | ||||
static constexpr unsigned short DEFAULT_GUI_PROXY_PORT = 9050; | static constexpr unsigned short DEFAULT_GUI_PROXY_PORT = 9050; | ||||
/** | |||||
* Convert configured prune target MiB to displayed GB. Round up to avoid | |||||
* underestimating max disk usage. | |||||
*/ | |||||
static inline int PruneMiBtoGB(int64_t mib) { | |||||
return (mib * 1024 * 1024 + GB_BYTES - 1) / GB_BYTES; | |||||
} | |||||
/** | |||||
* Convert displayed prune target GB to configured MiB. Round down so roundtrip | |||||
* GB -> MiB -> GB conversion is stable. | |||||
*/ | |||||
static inline int64_t PruneGBtoMiB(int gb) { | |||||
return gb * GB_BYTES / 1024 / 1024; | |||||
} | |||||
/** Interface from Qt to configuration data structure for Bitcoin client. | /** Interface from Qt to configuration data structure for Bitcoin client. | ||||
To Qt, the options are presented as a list with the different options | To Qt, the options are presented as a list with the different options | ||||
laid out vertically. | laid out vertically. | ||||
This can be changed to a tree once the settings become sufficiently | This can be changed to a tree once the settings become sufficiently | ||||
complex. | complex. | ||||
*/ | */ | ||||
class OptionsModel : public QAbstractListModel { | class OptionsModel : public QAbstractListModel { | ||||
Q_OBJECT | Q_OBJECT | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |