Improve view of generated transactions (show clock icon when still maturing)

This commit is contained in:
Wladimir J. van der Laan 2011-07-07 10:29:07 +02:00
parent 393adf7acd
commit e599246803

View File

@ -275,15 +275,34 @@ QVariant TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) con
status = tr("Open until %1").arg(GUIUtil::DateTimeStr(wtx->status.open_for)); status = tr("Open until %1").arg(GUIUtil::DateTimeStr(wtx->status.open_for));
break; break;
case TransactionStatus::Offline: case TransactionStatus::Offline:
status = tr("Offline (%1)").arg(wtx->status.depth); status = tr("Offline (%1 confirmations)").arg(wtx->status.depth);
break; break;
case TransactionStatus::Unconfirmed: 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; break;
case TransactionStatus::HaveConfirmations: case TransactionStatus::HaveConfirmations:
status = tr("Confirmed (%1)").arg(wtx->status.depth); status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth);
break; 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); return QVariant(status);
} }
@ -369,23 +388,8 @@ QVariant TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx)
description = QString(); description = QString();
break; break;
case TransactionRecord::Generated: 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(); description = QString();
break; 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); return QVariant(description);
} }
@ -401,6 +405,24 @@ QVariant TransactionTableModel::formatTxAmount(const TransactionRecord *wtx) con
} }
QVariant TransactionTableModel::formatTxDecoration(const TransactionRecord *wtx) const 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) switch(wtx->status.status)
{ {
@ -423,6 +445,7 @@ QVariant TransactionTableModel::formatTxDecoration(const TransactionRecord *wtx)
case TransactionStatus::HaveConfirmations: case TransactionStatus::HaveConfirmations:
return QIcon(":/icons/transaction_confirmed"); return QIcon(":/icons/transaction_confirmed");
} }
}
return QColor(0,0,0); return QColor(0,0,0);
} }