priv(new TransactionTablePriv(wallet, this)),
cachedNumBlocks(0)
{
- columns << QString() << tr("Date") << tr("Type") << tr("Address") << tr("Amount");
+ columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet();
delete priv;
}
+/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+void TransactionTableModel::updateAmountColumnTitle()
+{
+ columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
+ emit headerDataChanged(Qt::Horizontal,Amount,Amount);
+}
+
void TransactionTableModel::updateTransaction(const QString &hash, int status)
{
uint256 updated;
QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) const
{
QString status;
+ int nNumConf = TransactionRecord::NumConfirmations;
+
+ if (wtx->type == TransactionRecord::Generated)
+ {
+ nNumConf = nCoinbaseMaturity + 20;
+ }
switch(wtx->status.status)
{
status = tr("Offline (%1 confirmations)").arg(wtx->status.depth);
break;
case TransactionStatus::Unconfirmed:
- status = tr("Unconfirmed (%1 of %2 confirmations)").arg(wtx->status.depth).arg(TransactionRecord::NumConfirmations);
+ status = tr("Unconfirmed (%1 of %2 confirmations)").arg(wtx->status.depth).arg(nNumConf);
break;
case TransactionStatus::HaveConfirmations:
status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth);
default:
return QIcon(":/icons/tx_inout");
}
- return QVariant();
}
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
void TransactionTableModel::updateDisplayUnit()
{
+ updateAmountColumnTitle();
// emit dataChanged to update Amount column with the current unit
emit dataChanged(index(0, Amount), index(priv->size()-1, Amount));
}