![]() |
Master Core
v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
|
Bitcoin unit definitions. More...
#include <bitcoinunits.h>
Inheritance diagram for BitcoinUnits:
Collaboration diagram for BitcoinUnits:Public Types | |
| enum | Unit { BTC, mBTC, uBTC } |
| Bitcoin units. More... | |
Public Member Functions | |
| BitcoinUnits (QObject *parent) | |
Static Public Member Functions | |
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 qint64 | maxAmount (int unit) |
| Max amount per unit. More... | |
| static int | amountDigits (int unit) |
| Number of amount digits (to represent max number of coins) More... | |
| static int | decimals (int unit) |
| Number of decimals left. More... | |
| static QString | format (int unit, qint64 amount, bool plussign=false) |
| Format as string. More... | |
| static QString | formatWithUnit (int unit, qint64 amount, bool plussign=false) |
| Format as string (with unit) More... | |
| static bool | parse (int unit, const QString &value, qint64 *val_out) |
| Parse string to coin amount. 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 |
Bitcoin unit definitions.
Encapsulates parsing and formatting and serves as list model for drop-down selection boxes.
Definition at line 14 of file bitcoinunits.h.
| Enumerator | |
|---|---|
| UnitRole |
Unit identifier. |
Definition at line 62 of file bitcoinunits.h.
| enum BitcoinUnits::Unit |
Bitcoin units.
| Enumerator | |
|---|---|
| BTC | |
| mBTC | |
| uBTC | |
Definition at line 24 of file bitcoinunits.h.
|
explicit |
Definition at line 9 of file bitcoinunits.cpp.
Number of amount digits (to represent max number of coins)
Definition at line 81 of file bitcoinunits.cpp.
References BTC, mBTC, and uBTC.
Referenced by BitcoinAmountField::unitChanged().
Here is the caller graph for this function:
|
static |
Get list of units, for drop-down box.
Definition at line 15 of file bitcoinunits.cpp.
References BTC, mBTC, uBTC, and unitlist.
Referenced by SendCoinsDialog::on_sendButton_clicked().
Here is the caller graph for this function:| QVariant BitcoinUnits::data | ( | const QModelIndex & | index, |
| int | role | ||
| ) | const |
Definition at line 178 of file bitcoinunits.cpp.
References description(), name(), unitlist, and UnitRole.
Here is the call graph for this function:Number of decimals left.
Definition at line 92 of file bitcoinunits.cpp.
References BTC, mBTC, and uBTC.
Referenced by format(), parse(), and BitcoinAmountField::unitChanged().
Here is the caller graph for this function:
|
static |
|
static |
Number of Satoshis (1e-8) per unit.
Definition at line 59 of file bitcoinunits.cpp.
References BTC, mBTC, and uBTC.
Referenced by format(), and BitcoinAmountField::unitChanged().
Here is the caller graph for this function:
|
static |
Format as string.
Definition at line 103 of file bitcoinunits.cpp.
References decimals(), factor(), and valid().
Referenced by RecentRequestsTableModel::data(), GUIUtil::formatBitcoinURI(), TransactionTableModel::formatTxAmount(), formatWithUnit(), OverviewPage::setBalance(), BitcoinAmountField::setValue(), and CoinControlDialog::updateView().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Format as string (with unit)
Definition at line 130 of file bitcoinunits.cpp.
References format(), and name().
Referenced by SendCoinsDialog::on_sendButton_clicked(), TxViewDelegate::paint(), PaymentServer::processPaymentRequest(), OverviewPage::setBalance(), SendCoinsDialog::setBalance(), TransactionDesc::toHTML(), ReceiveRequestDialog::update(), and CoinControlDialog::updateLabels().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Max amount per unit.
Definition at line 70 of file bitcoinunits.cpp.
References BTC, mBTC, and uBTC.
Referenced by BitcoinAmountField::validate().
Here is the caller graph for this function:
|
static |
Short name.
Definition at line 37 of file bitcoinunits.cpp.
References BTC, mBTC, and uBTC.
Referenced by data(), and formatWithUnit().
Here is the caller graph for this function:
|
static |
Parse string to coin amount.
Definition at line 135 of file bitcoinunits.cpp.
References decimals(), and valid().
Referenced by TransactionView::changedAmount(), GUIUtil::parseBitcoinURI(), BitcoinAmountField::validate(), and BitcoinAmountField::value().
Here is the call graph for this function:
Here is the caller graph for this function:| int BitcoinUnits::rowCount | ( | const QModelIndex & | parent | ) | const |
Definition at line 172 of file bitcoinunits.cpp.
References unitlist.
|
static |
|
private |
Definition at line 71 of file bitcoinunits.h.
Referenced by availableUnits(), data(), and rowCount().
1.8.8