mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
GUI: TransactionTableModel: Include unit name with formatted amount
This commit is contained in:
parent
a582fe03e4
commit
19c87c0ae7
1 changed files with 18 additions and 1 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <qt/transactionrecord.h>
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include "assetsdir.h"
|
||||
#include <core_io.h>
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
|
|
@ -20,6 +21,7 @@
|
|||
#include <uint256.h>
|
||||
#include <util.h>
|
||||
#include <validation.h>
|
||||
#include <policy/policy.h>
|
||||
|
||||
#include <QColor>
|
||||
#include <QDateTime>
|
||||
|
|
@ -428,7 +430,22 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
|
|||
|
||||
QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed, BitcoinUnits::SeparatorStyle separators) const
|
||||
{
|
||||
QString str = BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), wtx->amount, false, separators);
|
||||
QString str;
|
||||
if (wtx->asset == ::policyAsset) {
|
||||
str = BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), wtx->amount, false, separators);
|
||||
} else {
|
||||
qlonglong whole = wtx->amount / 100000000;
|
||||
qlonglong fraction = wtx->amount % 100000000;
|
||||
str = QString("%1").arg(whole);
|
||||
if (fraction) {
|
||||
str += QString(".%1").arg(fraction, 8, 10, QLatin1Char('0'));
|
||||
}
|
||||
std::string asset_label = gAssetsDir.GetLabel(wtx->asset);
|
||||
if (asset_label.empty()) {
|
||||
asset_label = wtx->asset.GetHex();
|
||||
}
|
||||
str += QString(" ") + QString::fromStdString(asset_label);
|
||||
}
|
||||
if(showUnconfirmed)
|
||||
{
|
||||
if(!wtx->status.countsForBalance)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue