Improve view of generated transactions (show clock icon when still maturing)
This commit is contained in:
parent
393adf7acd
commit
e599246803
1 changed files with 60 additions and 37 deletions
|
@ -275,15 +275,34 @@ QVariant TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) con
|
|||
status = tr("Open until %1").arg(GUIUtil::DateTimeStr(wtx->status.open_for));
|
||||
break;
|
||||
case TransactionStatus::Offline:
|
||||
status = tr("Offline (%1)").arg(wtx->status.depth);
|
||||
status = tr("Offline (%1 confirmations)").arg(wtx->status.depth);
|
||||
break;
|
||||
case TransactionStatus::Unconfirmed:
|
||||
status = tr("Unconfirmed (%1/%2)").arg(wtx->status.depth).arg(TransactionRecord::NumConfirmations);
|
||||
status = tr("Unconfirmed (%1/%2 confirmations)").arg(wtx->status.depth).arg(TransactionRecord::NumConfirmations);
|
||||
break;
|
||||
case TransactionStatus::HaveConfirmations:
|
||||
status = tr("Confirmed (%1)").arg(wtx->status.depth);
|
||||
status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth);
|
||||
break;
|
||||
}
|
||||
if(wtx->type == TransactionRecord::Generated)
|
||||
{
|
||||
status += "\n";
|
||||
switch(wtx->status.maturity)
|
||||
{
|
||||
case TransactionStatus::Immature:
|
||||
status += tr("Generation matures in %n more blocks", "",
|
||||
wtx->status.matures_in);
|
||||
break;
|
||||
case TransactionStatus::Mature:
|
||||
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 QVariant(status);
|
||||
}
|
||||
|
@ -369,23 +388,8 @@ QVariant TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx)
|
|||
description = QString();
|
||||
break;
|
||||
case TransactionRecord::Generated:
|
||||
switch(wtx->status.maturity)
|
||||
{
|
||||
case TransactionStatus::Immature:
|
||||
description = tr("(matures in %n more blocks)", "",
|
||||
wtx->status.matures_in);
|
||||
break;
|
||||
case TransactionStatus::Mature:
|
||||
description = QString();
|
||||
break;
|
||||
case TransactionStatus::MaturesWarning:
|
||||
description = tr("(Warning: This block was not received by any other nodes and will probably not be accepted!)");
|
||||
break;
|
||||
case TransactionStatus::NotAccepted:
|
||||
description = tr("(not accepted)");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return QVariant(description);
|
||||
}
|
||||
|
@ -401,6 +405,24 @@ QVariant TransactionTableModel::formatTxAmount(const TransactionRecord *wtx) con
|
|||
}
|
||||
|
||||
QVariant TransactionTableModel::formatTxDecoration(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)
|
||||
{
|
||||
|
@ -423,6 +445,7 @@ QVariant TransactionTableModel::formatTxDecoration(const TransactionRecord *wtx)
|
|||
case TransactionStatus::HaveConfirmations:
|
||||
return QIcon(":/icons/transaction_confirmed");
|
||||
}
|
||||
}
|
||||
return QColor(0,0,0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue