Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Dash unit definitions. More...
#include <bitcoinunits.h>
Public Types | |
enum | Unit { DASH, mDASH, uDASH, duffs } |
Dash units. More... | |
enum | SeparatorStyle { separatorNever, separatorStandard, separatorAlways } |
Public Member Functions | |
BitcoinUnits (QObject *parent) | |
Static Public Member Functions | |
static QString | removeSpaces (QString text) |
static CAmount | maxMoney () |
Return maximum number of base units (Satoshis) More... | |
Static API | |
Unit conversion and formatting | |
static QList< Unit > | availableUnits () |
Get list of units, for drop-down box. More... | |
static bool | valid (int unit) |
Is unit ID valid? More... | |
static QString | name (int unit) |
Short name. More... | |
static QString | description (int unit) |
Longer description. More... | |
static qint64 | factor (int unit) |
Number of Satoshis (1e-8) per unit. More... | |
static int | decimals (int unit) |
Number of decimals left. More... | |
static QString | format (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard) |
Format as string. More... | |
static QString | simpleFormat (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard) |
static QString | formatWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard) |
Format as string (with unit) More... | |
static QString | formatHtmlWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard) |
Format as HTML string (with unit) More... | |
static QString | floorWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard) |
Format as string (with unit) but floor value up to "digits" settings. More... | |
static QString | floorHtmlWithUnit (int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard) |
static bool | parse (int unit, const QString &value, CAmount *val_out) |
Parse string to coin amount. More... | |
static QString | getAmountColumnTitle (int unit) |
Gets title for amount column including current display unit if optionsModel reference available */. More... | |
Private Attributes | |
QList< BitcoinUnits::Unit > | unitlist |
AbstractListModel implementation | |
enum | RoleIndex { UnitRole = Qt::UserRole } |
int | rowCount (const QModelIndex &parent) const |
QVariant | data (const QModelIndex &index, int role) const |
QVariant | data (const int &row, int role) const |
Detailed Description
Dash unit definitions.
Encapsulates parsing and formatting and serves as list model for drop-down selection boxes.
Definition at line 48 of file bitcoinunits.h.
Member Enumeration Documentation
◆ RoleIndex
Enumerator | |
---|---|
UnitRole | Unit identifier. |
Definition at line 108 of file bitcoinunits.h.
◆ SeparatorStyle
Enumerator | |
---|---|
separatorNever | |
separatorStandard | |
separatorAlways |
Definition at line 66 of file bitcoinunits.h.
◆ Unit
enum BitcoinUnits::Unit |
Dash units.
- Note
- Source: https://en.bitcoin.it/wiki/Units . Please add only sensible ones
Enumerator | |
---|---|
DASH | |
mDASH | |
uDASH | |
duffs |
Definition at line 58 of file bitcoinunits.h.
Constructor & Destructor Documentation
◆ BitcoinUnits()
|
explicit |
Definition at line 13 of file bitcoinunits.cpp.
Member Function Documentation
◆ availableUnits()
|
static |
Get list of units, for drop-down box.
Definition at line 19 of file bitcoinunits.cpp.
References DASH, duffs, mDASH, uDASH, and unitlist.
Referenced by UnitDisplayStatusBarControl::createContextMenu(), SendCoinsDialog::send(), and UnitDisplayStatusBarControl::UnitDisplayStatusBarControl().
◆ data() [1/2]
QVariant BitcoinUnits::data | ( | const QModelIndex & | index, |
int | role | ||
) | const |
Definition at line 247 of file bitcoinunits.cpp.
Referenced by BitcoinAmountField::unitChanged().
◆ data() [2/2]
QVariant BitcoinUnits::data | ( | const int & | row, |
int | role | ||
) | const |
Definition at line 252 of file bitcoinunits.cpp.
References description(), name(), unitlist, and UnitRole.
◆ decimals()
|
static |
Number of decimals left.
Definition at line 107 of file bitcoinunits.cpp.
References DASH, duffs, mDASH, and uDASH.
Referenced by floorWithUnit(), format(), parse(), and OverviewPage::updatePrivateSendProgress().
◆ description()
|
static |
Longer description.
Definition at line 69 of file bitcoinunits.cpp.
References DASH, duffs, CBaseChainParams::MAIN, mDASH, Params(), THIN_SP_UTF8, and uDASH.
Referenced by data().
◆ factor()
|
static |
Number of Satoshis (1e-8) per unit.
Definition at line 95 of file bitcoinunits.cpp.
References DASH, duffs, mDASH, and uDASH.
Referenced by format(), and OverviewPage::updatePrivateSendProgress().
◆ floorHtmlWithUnit()
|
static |
Definition at line 185 of file bitcoinunits.cpp.
References floorWithUnit(), THIN_SP_CP, and THIN_SP_HTML.
Referenced by OverviewPage::setBalance().
◆ floorWithUnit()
|
static |
Format as string (with unit) but floor value up to "digits" settings.
Definition at line 174 of file bitcoinunits.cpp.
References decimals(), format(), and name().
Referenced by floorHtmlWithUnit(), and TxViewDelegate::paint().
◆ format()
|
static |
Format as string.
Definition at line 119 of file bitcoinunits.cpp.
References decimals(), factor(), separatorAlways, separatorStandard, THIN_SP_CP, and valid().
Referenced by RecentRequestsTableModel::data(), AmountLineEdit::fixup(), floorWithUnit(), GUIUtil::formatBitcoinURI(), TransactionTableModel::formatTxAmount(), formatWithUnit(), AmountLineEdit::minimumSizeHint(), AmountLineEdit::setValue(), and CoinControlDialog::updateView().
◆ formatHtmlWithUnit()
|
static |
Format as HTML string (with unit)
Definition at line 167 of file bitcoinunits.cpp.
References formatWithUnit(), THIN_SP_CP, and THIN_SP_HTML.
Referenced by SendCoinsDialog::send(), TransactionDesc::toHTML(), ReceiveRequestDialog::update(), and OverviewPage::updatePrivateSendProgress().
◆ formatWithUnit()
|
static |
Format as string (with unit)
Definition at line 162 of file bitcoinunits.cpp.
References format(), and name().
Referenced by TransactionView::computeSum(), formatHtmlWithUnit(), PaymentServer::processPaymentRequest(), SendCoinsDialog::processSendCoinsReturn(), SendCoinsDialog::send(), SendCoinsDialog::setBalance(), OverviewPage::togglePrivateSend(), SendCoinsDialog::updateFeeMinimizedLabel(), CoinControlDialog::updateLabels(), SendCoinsDialog::updateMinFeeLabel(), and SendCoinsDialog::updateSmartFeeLabel().
◆ getAmountColumnTitle()
|
static |
Gets title for amount column including current display unit if optionsModel reference available */.
Definition at line 231 of file bitcoinunits.cpp.
References name(), and valid().
Referenced by TransactionView::exportClicked(), TransactionTableModel::TransactionTableModel(), and TransactionTableModel::updateAmountColumnTitle().
◆ maxMoney()
|
static |
Return maximum number of base units (Satoshis)
Definition at line 271 of file bitcoinunits.cpp.
References MAX_MONEY.
Referenced by AmountLineEdit::minimumSizeHint(), and parse().
◆ name()
|
static |
Short name.
Definition at line 43 of file bitcoinunits.cpp.
References DASH, duffs, CBaseChainParams::MAIN, mDASH, Params(), and uDASH.
Referenced by UnitDisplayStatusBarControl::createContextMenu(), data(), floorWithUnit(), formatWithUnit(), getAmountColumnTitle(), RecentRequestsTableModel::getAmountTitle(), UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(), and UnitDisplayStatusBarControl::updateDisplayUnit().
◆ parse()
|
static |
Parse string to coin amount.
Definition at line 192 of file bitcoinunits.cpp.
References decimals(), removeSpaces(), and valid().
Referenced by TransactionView::changedAmount(), parse(), and GUIUtil::parseBitcoinURI().
◆ removeSpaces()
|
inlinestatic |
Definition at line 117 of file bitcoinunits.h.
References REAL_THIN_SP_CP, and THIN_SP_CP.
Referenced by CoinControlDialog::copyAmount(), and parse().
◆ rowCount()
int BitcoinUnits::rowCount | ( | const QModelIndex & | parent | ) | const |
Definition at line 241 of file bitcoinunits.cpp.
References unitlist.
◆ simpleFormat()
|
static |
◆ valid()
|
static |
Is unit ID valid?
Definition at line 29 of file bitcoinunits.cpp.
References DASH, duffs, mDASH, and uDASH.
Referenced by format(), getAmountColumnTitle(), and parse().
Member Data Documentation
◆ unitlist
|
private |
Definition at line 131 of file bitcoinunits.h.
Referenced by availableUnits(), data(), and rowCount().
The documentation for this class was generated from the following files:
- src/qt/bitcoinunits.h
- src/qt/bitcoinunits.cpp