Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoinunits.h
Show All 35 Lines | public: | ||||
explicit BitcoinUnits(QObject *parent); | explicit BitcoinUnits(QObject *parent); | ||||
/** | /** | ||||
* Currency units | * Currency units | ||||
* Please add only sensible ones. | * Please add only sensible ones. | ||||
*/ | */ | ||||
enum Unit { base, sub }; | enum Unit { base, sub }; | ||||
enum SeparatorStyle { separatorNever, separatorStandard, separatorAlways }; | enum class SeparatorStyle { NEVER, STANDARD, ALWAYS }; | ||||
//! @name Static API | //! @name Static API | ||||
//! Unit conversion and formatting | //! Unit conversion and formatting | ||||
///@{ | ///@{ | ||||
//! Get list of units, for drop-down box | //! Get list of units, for drop-down box | ||||
static QList<Unit> availableUnits(); | static QList<Unit> availableUnits(); | ||||
//! Is unit ID valid? | //! Is unit ID valid? | ||||
static bool valid(int unit); | static bool valid(int unit); | ||||
//! Long name | //! Long name | ||||
static QString longName(int unit); | static QString longName(int unit); | ||||
//! Short name | //! Short name | ||||
static QString shortName(int unit); | static QString shortName(int unit); | ||||
//! Longer description | //! Longer description | ||||
static QString description(int unit); | static QString description(int unit); | ||||
//! Number of Satoshis (1e-8) per unit | //! Number of Satoshis (1e-8) per unit | ||||
static Amount factor(int unit); | static Amount factor(int unit); | ||||
//! Number of decimals left | //! Number of decimals left | ||||
static int decimals(int unit); | static int decimals(int unit); | ||||
//! Format as string | //! Format as string | ||||
static QString format(int unit, const Amount amount, bool plussign = false, | static QString format(int unit, const Amount amount, bool plussign = false, | ||||
SeparatorStyle separators = separatorStandard, | SeparatorStyle separators = SeparatorStyle::STANDARD, | ||||
bool justify = false); | bool justify = false); | ||||
//! Format as string (with unit) | //! Format as string (with unit) | ||||
static QString | static QString | ||||
formatWithUnit(int unit, const Amount amount, bool plussign = false, | formatWithUnit(int unit, const Amount amount, bool plussign = false, | ||||
SeparatorStyle separators = separatorStandard); | SeparatorStyle separators = SeparatorStyle::STANDARD); | ||||
//! Format as HTML string (with unit) | //! Format as HTML string (with unit) | ||||
static QString | static QString | ||||
formatHtmlWithUnit(int unit, const Amount amount, bool plussign = false, | formatHtmlWithUnit(int unit, const Amount amount, bool plussign = false, | ||||
SeparatorStyle separators = separatorStandard); | SeparatorStyle separators = SeparatorStyle::STANDARD); | ||||
//! Format as string (with unit) of fixed length to preserve privacy, if it | //! Format as string (with unit) of fixed length to preserve privacy, if it | ||||
//! is set. | //! is set. | ||||
static QString formatWithPrivacy(int unit, const Amount &amount, | static QString formatWithPrivacy(int unit, const Amount &amount, | ||||
SeparatorStyle separators, bool privacy); | SeparatorStyle separators, bool privacy); | ||||
//! Parse string to coin amount | //! Parse string to coin amount | ||||
static bool parse(int unit, const QString &value, Amount *val_out); | static bool parse(int unit, const QString &value, Amount *val_out); | ||||
//! Gets title for amount column including current display unit if | //! Gets title for amount column including current display unit if | ||||
//! optionsModel reference available */ | //! optionsModel reference available */ | ||||
Show All 28 Lines |