30 "Satoshi (sat) (1 / 100)"}},
47 : QAbstractListModel(parent), unitlist(availableUnits()) {}
69 return it !=
units.end() ? std::get<0>(it->second) :
"???";
82 return it !=
units.end() ? std::get<1>(it->second) :
"???";
93 assert(
false &&
"non-existent BitcoinUnits::Unit");
104 assert(
false &&
"non-existent BitcoinUnits::Unit");
132 for (
int i = 3; i <
q_size; i += 3) {
139 }
else if (
fPlus && n > 0) {
172 return QString(
"<span style='white-space: nowrap;'>%1</span>").arg(str);
190 if (!
valid(unit) || value.isEmpty()) {
199 if (
parts.size() > 2) {
206 if (
parts.size() > 1) {
216 if (str.size() > 18) {
241 int row = index.row();
246 case Qt::DisplayRole:
248 case Qt::ToolTipRole:
251 return QVariant(
static_cast<int>(unit));
static constexpr Amount SATOSHI
static constexpr Amount MAX_MONEY
No amount larger than this (in satoshi) is valid.
static const unitNameMap xecUnits
static const unitNameMap bchUnits
std::map< BitcoinUnits::Unit, std::tuple< QString, QString > > unitNameMap
static const unitNameMap & getUnitsAtRuntime()
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
@ UnitRole
Unit identifier.
int rowCount(const QModelIndex &parent) const override
QList< BitcoinUnits::Unit > unitlist
static QString formatWithUnit(int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as string (with unit)
static int decimals(int unit)
Number of decimals left.
QVariant data(const QModelIndex &index, int role) const override
static Amount factor(int unit)
Number of Satoshis (1e-8) per unit.
static bool valid(int unit)
Is unit ID valid?
static QString formatWithPrivacy(int unit, const Amount &amount, SeparatorStyle separators, bool privacy)
Format as string (with unit) of fixed length to preserve privacy, if it is set.
static QString description(int unit)
Longer description.
static QString removeSpaces(QString text)
static QString longName(int unit)
Long name.
static Amount maxMoney()
Return maximum number of base units (Satoshis)
static QList< Unit > availableUnits()
Get list of units, for drop-down box.
static QString format(int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD, bool justify=false)
Format as string.
static bool parse(int unit, const QString &value, Amount *val_out)
Parse string to coin amount.
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */.
Unit
Currency units Please add only sensible ones.
BitcoinUnits(QObject *parent)
static QString shortName(int unit)
Short name.
static QString formatHtmlWithUnit(int unit, const Amount amount, bool plussign=false, SeparatorStyle separators=SeparatorStyle::STANDARD)
Format as HTML string (with unit)
constexpr bool DEFAULT_ECASH
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static constexpr Amount zero() noexcept
static const Currency & get()