|
|
|
@ -27,6 +27,7 @@
@@ -27,6 +27,7 @@
|
|
|
|
|
// Amount column is right-aligned it contains numbers
|
|
|
|
|
static int column_alignments[] = { |
|
|
|
|
Qt::AlignLeft|Qt::AlignVCenter, /* status */ |
|
|
|
|
Qt::AlignLeft|Qt::AlignVCenter, /* watchonly */ |
|
|
|
|
Qt::AlignLeft|Qt::AlignVCenter, /* date */ |
|
|
|
|
Qt::AlignLeft|Qt::AlignVCenter, /* type */ |
|
|
|
|
Qt::AlignLeft|Qt::AlignVCenter, /* address */ |
|
|
|
@ -234,7 +235,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
@@ -234,7 +235,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
|
|
|
|
|
walletModel(parent), |
|
|
|
|
priv(new TransactionTablePriv(wallet, this)) |
|
|
|
|
{ |
|
|
|
|
columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); |
|
|
|
|
columns << QString() << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); |
|
|
|
|
priv->refreshWallet(); |
|
|
|
|
|
|
|
|
|
connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); |
|
|
|
@ -393,22 +394,19 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
@@ -393,22 +394,19 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
|
|
|
|
|
|
|
|
|
|
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const |
|
|
|
|
{ |
|
|
|
|
// mark transactions involving watch-only addresses:
|
|
|
|
|
QString watchAddress = wtx->involvesWatchAddress ? " (w) " : ""; |
|
|
|
|
|
|
|
|
|
switch(wtx->type) |
|
|
|
|
{ |
|
|
|
|
case TransactionRecord::RecvFromOther: |
|
|
|
|
return QString::fromStdString(wtx->address) + watchAddress; |
|
|
|
|
return QString::fromStdString(wtx->address); |
|
|
|
|
case TransactionRecord::RecvWithAddress: |
|
|
|
|
case TransactionRecord::SendToAddress: |
|
|
|
|
case TransactionRecord::Generated: |
|
|
|
|
return lookupAddress(wtx->address, tooltip) + watchAddress; |
|
|
|
|
return lookupAddress(wtx->address, tooltip); |
|
|
|
|
case TransactionRecord::SendToOther: |
|
|
|
|
return QString::fromStdString(wtx->address) + watchAddress; |
|
|
|
|
return QString::fromStdString(wtx->address); |
|
|
|
|
case TransactionRecord::SendToSelf: |
|
|
|
|
default: |
|
|
|
|
return tr("(n/a)") + watchAddress; |
|
|
|
|
return tr("(n/a)"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -482,6 +480,14 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
@@ -482,6 +480,14 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
|
|
|
|
return QColor(0,0,0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const |
|
|
|
|
{ |
|
|
|
|
if (wtx->involvesWatchAddress) |
|
|
|
|
return QIcon(":/icons/eye"); |
|
|
|
|
else |
|
|
|
|
return QVariant(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString TransactionTableModel::formatTooltip(const TransactionRecord *rec) const |
|
|
|
|
{ |
|
|
|
|
QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec); |
|
|
|
@ -506,6 +512,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
@@ -506,6 +512,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
{ |
|
|
|
|
case Status: |
|
|
|
|
return txStatusDecoration(rec); |
|
|
|
|
case Watchonly: |
|
|
|
|
return txWatchonlyDecoration(rec); |
|
|
|
|
case ToAddress: |
|
|
|
|
return txAddressDecoration(rec); |
|
|
|
|
} |
|
|
|
@ -533,6 +541,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
@@ -533,6 +541,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
return rec->time; |
|
|
|
|
case Type: |
|
|
|
|
return formatTxType(rec); |
|
|
|
|
case Watchonly: |
|
|
|
|
return (rec->involvesWatchAddress ? 1 : 0); |
|
|
|
|
case ToAddress: |
|
|
|
|
return formatTxToAddress(rec, true); |
|
|
|
|
case Amount: |
|
|
|
@ -562,6 +572,10 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
@@ -562,6 +572,10 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
return rec->type; |
|
|
|
|
case DateRole: |
|
|
|
|
return QDateTime::fromTime_t(static_cast<uint>(rec->time)); |
|
|
|
|
case WatchonlyRole: |
|
|
|
|
return rec->involvesWatchAddress; |
|
|
|
|
case WatchonlyDecorationRole: |
|
|
|
|
return txWatchonlyDecoration(rec); |
|
|
|
|
case LongDescriptionRole: |
|
|
|
|
return priv->describe(rec, walletModel->getOptionsModel()->getDisplayUnit()); |
|
|
|
|
case AddressRole: |
|
|
|
@ -606,6 +620,8 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
@@ -606,6 +620,8 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
|
|
|
|
|
return tr("Date and time that the transaction was received."); |
|
|
|
|
case Type: |
|
|
|
|
return tr("Type of transaction."); |
|
|
|
|
case Watchonly: |
|
|
|
|
return tr("Whether or not a watch-only address is involved in this transaction."); |
|
|
|
|
case ToAddress: |
|
|
|
|
return tr("Destination address of transaction."); |
|
|
|
|
case Amount: |
|
|
|
|