|
|
|
@ -285,24 +285,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
@@ -285,24 +285,6 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
|
|
|
|
|
{ |
|
|
|
|
QString status; |
|
|
|
|
|
|
|
|
|
if(wtx->type == TransactionRecord::Generated) |
|
|
|
|
{ |
|
|
|
|
switch(wtx->status.maturity) |
|
|
|
|
{ |
|
|
|
|
case TransactionStatus::Immature: |
|
|
|
|
status = tr("Immature (%1 confirmations, will be available after %2)").arg(wtx->status.depth).arg(wtx->status.depth + wtx->status.matures_in); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::Mature: |
|
|
|
|
status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::MaturesWarning: |
|
|
|
|
status = tr("This block was not received by any other nodes and will probably not be accepted!"); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::NotAccepted: |
|
|
|
|
status = tr("Generated but not accepted"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
switch(wtx->status.status) |
|
|
|
|
{ |
|
|
|
|
case TransactionStatus::OpenUntilBlock: |
|
|
|
@ -315,15 +297,26 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
@@ -315,15 +297,26 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
|
|
|
|
|
status = tr("Offline"); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::Unconfirmed: |
|
|
|
|
status = tr("Unconfirmed (%1 of %2 confirmations)").arg(wtx->status.depth).arg(TransactionRecord::NumConfirmations); |
|
|
|
|
status = tr("Unconfirmed"); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::Confirming: |
|
|
|
|
status = tr("Confirming (%1 of %2 recommended confirmations)").arg(wtx->status.depth).arg(TransactionRecord::RecommendedNumConfirmations); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::HaveConfirmations: |
|
|
|
|
case TransactionStatus::Confirmed: |
|
|
|
|
status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::Conflicted: |
|
|
|
|
status = tr("Conflicted"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case TransactionStatus::Immature: |
|
|
|
|
status = tr("Immature (%1 confirmations, will be available after %2)").arg(wtx->status.depth).arg(wtx->status.depth + wtx->status.matures_in); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::MaturesWarning: |
|
|
|
|
status = tr("This block was not received by any other nodes and will probably not be accepted!"); |
|
|
|
|
break; |
|
|
|
|
case TransactionStatus::NotAccepted: |
|
|
|
|
status = tr("Generated but not accepted"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return status; |
|
|
|
@ -441,7 +434,7 @@ QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool
@@ -441,7 +434,7 @@ QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool
|
|
|
|
|
QString str = BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), wtx->credit + wtx->debit); |
|
|
|
|
if(showUnconfirmed) |
|
|
|
|
{ |
|
|
|
|
if(!wtx->status.confirmed || wtx->status.maturity != TransactionStatus::Mature) |
|
|
|
|
if(!wtx->status.countsForBalance) |
|
|
|
|
{ |
|
|
|
|
str = QString("[") + str + QString("]"); |
|
|
|
|
} |
|
|
|
@ -451,24 +444,6 @@ QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool
@@ -451,24 +444,6 @@ QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool
|
|
|
|
|
|
|
|
|
|
QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx) const |
|
|
|
|
{ |
|
|
|
|
if(wtx->type == TransactionRecord::Generated) |
|
|
|
|
{ |
|
|
|
|
switch(wtx->status.maturity) |
|
|
|
|
{ |
|
|
|
|
case TransactionStatus::Immature: { |
|
|
|
|
int total = wtx->status.depth + wtx->status.matures_in; |
|
|
|
|
int part = (wtx->status.depth * 4 / total) + 1; |
|
|
|
|
return QIcon(QString(":/icons/transaction_%1").arg(part)); |
|
|
|
|
} |
|
|
|
|
case TransactionStatus::Mature: |
|
|
|
|
return QIcon(":/icons/transaction_confirmed"); |
|
|
|
|
case TransactionStatus::MaturesWarning: |
|
|
|
|
case TransactionStatus::NotAccepted: |
|
|
|
|
return QIcon(":/icons/transaction_0"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
switch(wtx->status.status) |
|
|
|
|
{ |
|
|
|
|
case TransactionStatus::OpenUntilBlock: |
|
|
|
@ -477,20 +452,28 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
@@ -477,20 +452,28 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
|
|
|
|
case TransactionStatus::Offline: |
|
|
|
|
return QColor(192,192,192); |
|
|
|
|
case TransactionStatus::Unconfirmed: |
|
|
|
|
return QIcon(":/icons/transaction_0"); |
|
|
|
|
case TransactionStatus::Confirming: |
|
|
|
|
switch(wtx->status.depth) |
|
|
|
|
{ |
|
|
|
|
case 0: return QIcon(":/icons/transaction_0"); |
|
|
|
|
case 1: return QIcon(":/icons/transaction_1"); |
|
|
|
|
case 2: return QIcon(":/icons/transaction_2"); |
|
|
|
|
case 3: return QIcon(":/icons/transaction_3"); |
|
|
|
|
case 4: return QIcon(":/icons/transaction_4"); |
|
|
|
|
default: return QIcon(":/icons/transaction_5"); |
|
|
|
|
}; |
|
|
|
|
case TransactionStatus::HaveConfirmations: |
|
|
|
|
case TransactionStatus::Confirmed: |
|
|
|
|
return QIcon(":/icons/transaction_confirmed"); |
|
|
|
|
case TransactionStatus::Conflicted: |
|
|
|
|
return QIcon(":/icons/transaction_conflicted"); |
|
|
|
|
case TransactionStatus::Immature: { |
|
|
|
|
int total = wtx->status.depth + wtx->status.matures_in; |
|
|
|
|
int part = (wtx->status.depth * 4 / total) + 1; |
|
|
|
|
return QIcon(QString(":/icons/transaction_%1").arg(part)); |
|
|
|
|
} |
|
|
|
|
case TransactionStatus::MaturesWarning: |
|
|
|
|
case TransactionStatus::NotAccepted: |
|
|
|
|
return QIcon(":/icons/transaction_0"); |
|
|
|
|
} |
|
|
|
|
return QColor(0,0,0); |
|
|
|
|
} |
|
|
|
@ -557,8 +540,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
@@ -557,8 +540,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
case Qt::TextAlignmentRole: |
|
|
|
|
return column_alignments[index.column()]; |
|
|
|
|
case Qt::ForegroundRole: |
|
|
|
|
// Non-confirmed transactions are grey
|
|
|
|
|
if(!rec->status.confirmed) |
|
|
|
|
// Non-confirmed (but not immature) as transactions are grey
|
|
|
|
|
if(!rec->status.countsForBalance && rec->status.status != TransactionStatus::Immature) |
|
|
|
|
{ |
|
|
|
|
return COLOR_UNCONFIRMED; |
|
|
|
|
} |
|
|
|
@ -586,9 +569,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
@@ -586,9 +569,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
case TxIDRole: |
|
|
|
|
return rec->getTxID(); |
|
|
|
|
case ConfirmedRole: |
|
|
|
|
// Return True if transaction counts for balance
|
|
|
|
|
return rec->status.confirmed && !(rec->type == TransactionRecord::Generated && |
|
|
|
|
rec->status.maturity != TransactionStatus::Mature); |
|
|
|
|
return rec->status.countsForBalance; |
|
|
|
|
case FormattedAmountRole: |
|
|
|
|
return formatTxAmount(rec, false); |
|
|
|
|
case StatusRole: |
|
|
|
|