7 #ifndef PIVX_QT_BITCOINUNITS_H
8 #define PIVX_QT_BITCOINUNITS_H
12 #include <QAbstractListModel>
16 #define REAL_THIN_SP_CP 0x2009
17 #define REAL_THIN_SP_UTF8 "\xE2\x80\x89"
18 #define REAL_THIN_SP_HTML " "
21 #define COMMA_UTF8 "\x2C"
22 #define COMMA_HTML ","
25 #define HAIR_SP_CP 0x200A
26 #define HAIR_SP_UTF8 "\xE2\x80\x8A"
27 #define HAIR_SP_HTML " "
30 #define SIXPEREM_SP_CP 0x2006
31 #define SIXPEREM_SP_UTF8 "\xE2\x80\x86"
32 #define SIXPEREM_SP_HTML " "
35 #define FIGURE_SP_CP 0x2007
36 #define FIGURE_SP_UTF8 "\xE2\x80\x87"
37 #define FIGURE_SP_HTML " "
43 #define HTML_HACK_SP "<span style='white-space: nowrap; font-size: 6pt'> </span>"
46 #define THIN_SP_CP REAL_THIN_SP_CP
47 #define THIN_SP_UTF8 REAL_THIN_SP_UTF8
48 #define THIN_SP_HTML HTML_HACK_SP
82 static bool valid(
int unit);
84 static QString
id(
int unit);
86 static QString
name(
int unit,
bool isZpiv =
false);
90 static qint64
factor(
int unit);
103 static bool parse(
int unit,
const QString& value,
CAmount* val_out);
115 int rowCount(
const QModelIndex& parent)
const;
116 QVariant
data(
const QModelIndex& index,
int role)
const;
123 #if (THIN_SP_CP != REAL_THIN_SP_CP)
int64_t CAmount
Amount in PIV (Can be negative)
BitcoinUnits::Unit BitcoinUnit
@ UnitRole
Unit identifier.
QList< BitcoinUnits::Unit > unitlist
static bool parse(int unit, const QString &value, CAmount *val_out)
Parse string to coin amount.
static CAmount maxMoney()
Return maximum number of base units (Satoshis)
static int decimals(int unit)
Number of decimals left.
static QString floorHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard, bool cleanRemainderZeros=false, bool isZPIV=false)
static QString floorWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard, bool cleanRemainderZeros=false, bool isZPIV=false)
Format as string (with unit) but floor value up to "digits" settings.
QVariant data(const QModelIndex &index, int role) const
static QString id(int unit)
Identifier, e.g. for image names.
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
static bool valid(int unit)
Is unit ID valid?
static QString description(int unit)
Longer description.
static QString removeSpaces(QString text)
int rowCount(const QModelIndex &parent) const
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard, bool cleanRemainderZeros=true)
Format as string.
static QString simpleFormat(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
static QList< Unit > availableUnits()
Get list of units, for drop-down box.
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */.
BitcoinUnits(QObject *parent)
static qint64 factor(int unit)
Number of Satoshis (1e-8) per unit.
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
static QString name(int unit, bool isZpiv=false)
Short name.