@@ -285,45 +285,38 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
285
285
{
286
286
QString status;
287
287
288
- if (wtx->type == TransactionRecord::Generated )
288
+ switch (wtx->status . status )
289
289
{
290
- switch (wtx->status .maturity )
291
- {
292
- case TransactionStatus::Immature:
293
- status = tr (" Immature (%1 confirmations, will be available after %2)" ).arg (wtx->status .depth ).arg (wtx->status .depth + wtx->status .matures_in );
294
- break ;
295
- case TransactionStatus::Mature:
296
- status = tr (" Confirmed (%1 confirmations)" ).arg (wtx->status .depth );
297
- break ;
298
- case TransactionStatus::MaturesWarning:
299
- status = tr (" This block was not received by any other nodes and will probably not be accepted!" );
300
- break ;
301
- case TransactionStatus::NotAccepted:
302
- status = tr (" Generated but not accepted" );
303
- break ;
304
- }
305
- } else {
306
- switch (wtx->status .status )
307
- {
308
- case TransactionStatus::OpenUntilBlock:
309
- status = tr (" Open for %n more block(s)" ," " ,wtx->status .open_for );
310
- break ;
311
- case TransactionStatus::OpenUntilDate:
312
- status = tr (" Open until %1" ).arg (GUIUtil::dateTimeStr (wtx->status .open_for ));
313
- break ;
314
- case TransactionStatus::Offline:
315
- status = tr (" Offline" );
316
- break ;
317
- case TransactionStatus::Unconfirmed:
318
- status = tr (" Unconfirmed (%1 of %2 confirmations)" ).arg (wtx->status .depth ).arg (TransactionRecord::NumConfirmations);
319
- break ;
320
- case TransactionStatus::HaveConfirmations:
321
- status = tr (" Confirmed (%1 confirmations)" ).arg (wtx->status .depth );
322
- break ;
323
- case TransactionStatus::Conflicted:
324
- status = tr (" Conflicted" );
325
- break ;
326
- }
290
+ case TransactionStatus::OpenUntilBlock:
291
+ status = tr (" Open for %n more block(s)" ," " ,wtx->status .open_for );
292
+ break ;
293
+ case TransactionStatus::OpenUntilDate:
294
+ status = tr (" Open until %1" ).arg (GUIUtil::dateTimeStr (wtx->status .open_for ));
295
+ break ;
296
+ case TransactionStatus::Offline:
297
+ status = tr (" Offline" );
298
+ break ;
299
+ case TransactionStatus::Unconfirmed:
300
+ status = tr (" Unconfirmed" );
301
+ break ;
302
+ case TransactionStatus::Confirming:
303
+ status = tr (" Confirming (%1 of %2 recommended confirmations)" ).arg (wtx->status .depth ).arg (TransactionRecord::RecommendedNumConfirmations);
304
+ break ;
305
+ case TransactionStatus::Confirmed:
306
+ status = tr (" Confirmed (%1 confirmations)" ).arg (wtx->status .depth );
307
+ break ;
308
+ case TransactionStatus::Conflicted:
309
+ status = tr (" Conflicted" );
310
+ break ;
311
+ case TransactionStatus::Immature:
312
+ status = tr (" Immature (%1 confirmations, will be available after %2)" ).arg (wtx->status .depth ).arg (wtx->status .depth + wtx->status .matures_in );
313
+ break ;
314
+ case TransactionStatus::MaturesWarning:
315
+ status = tr (" This block was not received by any other nodes and will probably not be accepted!" );
316
+ break ;
317
+ case TransactionStatus::NotAccepted:
318
+ status = tr (" Generated but not accepted" );
319
+ break ;
327
320
}
328
321
329
322
return status;
@@ -441,7 +434,7 @@ QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool
441
434
QString str = BitcoinUnits::format (walletModel->getOptionsModel ()->getDisplayUnit (), wtx->credit + wtx->debit );
442
435
if (showUnconfirmed)
443
436
{
444
- if (!wtx->status .confirmed || wtx-> status . maturity != TransactionStatus::Mature )
437
+ if (!wtx->status .countsForBalance )
445
438
{
446
439
str = QString (" [" ) + str + QString (" ]" );
447
440
}
@@ -451,46 +444,36 @@ QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool
451
444
452
445
QVariant TransactionTableModel::txStatusDecoration (const TransactionRecord *wtx) const
453
446
{
454
- if (wtx->type == TransactionRecord::Generated)
455
- {
456
- switch (wtx->status .maturity )
457
- {
458
- case TransactionStatus::Immature: {
459
- int total = wtx->status .depth + wtx->status .matures_in ;
460
- int part = (wtx->status .depth * 4 / total) + 1 ;
461
- return QIcon (QString (" :/icons/transaction_%1" ).arg (part));
462
- }
463
- case TransactionStatus::Mature:
464
- return QIcon (" :/icons/transaction_confirmed" );
465
- case TransactionStatus::MaturesWarning:
466
- case TransactionStatus::NotAccepted:
467
- return QIcon (" :/icons/transaction_0" );
468
- }
469
- }
470
- else
447
+ switch (wtx->status .status )
471
448
{
472
- switch (wtx->status .status )
449
+ case TransactionStatus::OpenUntilBlock:
450
+ case TransactionStatus::OpenUntilDate:
451
+ return QColor (64 ,64 ,255 );
452
+ case TransactionStatus::Offline:
453
+ return QColor (192 ,192 ,192 );
454
+ case TransactionStatus::Unconfirmed:
455
+ return QIcon (" :/icons/transaction_0" );
456
+ case TransactionStatus::Confirming:
457
+ switch (wtx->status .depth )
473
458
{
474
- case TransactionStatus::OpenUntilBlock:
475
- case TransactionStatus::OpenUntilDate:
476
- return QColor (64 ,64 ,255 );
477
- case TransactionStatus::Offline:
478
- return QColor (192 ,192 ,192 );
479
- case TransactionStatus::Unconfirmed:
480
- switch (wtx->status .depth )
481
- {
482
- case 0 : return QIcon (" :/icons/transaction_0" );
483
- case 1 : return QIcon (" :/icons/transaction_1" );
484
- case 2 : return QIcon (" :/icons/transaction_2" );
485
- case 3 : return QIcon (" :/icons/transaction_3" );
486
- case 4 : return QIcon (" :/icons/transaction_4" );
487
- default : return QIcon (" :/icons/transaction_5" );
488
- };
489
- case TransactionStatus::HaveConfirmations:
490
- return QIcon (" :/icons/transaction_confirmed" );
491
- case TransactionStatus::Conflicted:
492
- return QIcon (" :/icons/transaction_conflicted" );
459
+ case 1 : return QIcon (" :/icons/transaction_1" );
460
+ case 2 : return QIcon (" :/icons/transaction_2" );
461
+ case 3 : return QIcon (" :/icons/transaction_3" );
462
+ case 4 : return QIcon (" :/icons/transaction_4" );
463
+ default : return QIcon (" :/icons/transaction_5" );
464
+ };
465
+ case TransactionStatus::Confirmed:
466
+ return QIcon (" :/icons/transaction_confirmed" );
467
+ case TransactionStatus::Conflicted:
468
+ return QIcon (" :/icons/transaction_conflicted" );
469
+ case TransactionStatus::Immature: {
470
+ int total = wtx->status .depth + wtx->status .matures_in ;
471
+ int part = (wtx->status .depth * 4 / total) + 1 ;
472
+ return QIcon (QString (" :/icons/transaction_%1" ).arg (part));
493
473
}
474
+ case TransactionStatus::MaturesWarning:
475
+ case TransactionStatus::NotAccepted:
476
+ return QIcon (" :/icons/transaction_0" );
494
477
}
495
478
return QColor (0 ,0 ,0 );
496
479
}
@@ -557,8 +540,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
557
540
case Qt::TextAlignmentRole:
558
541
return column_alignments[index.column ()];
559
542
case Qt::ForegroundRole:
560
- // Non-confirmed transactions are grey
561
- if (!rec->status .confirmed )
543
+ // Non-confirmed (but not immature) as transactions are grey
544
+ if (!rec->status .countsForBalance && rec-> status . status != TransactionStatus::Immature )
562
545
{
563
546
return COLOR_UNCONFIRMED;
564
547
}
@@ -586,9 +569,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
586
569
case TxIDRole:
587
570
return rec->getTxID ();
588
571
case ConfirmedRole:
589
- // Return True if transaction counts for balance
590
- return rec->status .confirmed && !(rec->type == TransactionRecord::Generated &&
591
- rec->status .maturity != TransactionStatus::Mature);
572
+ return rec->status .countsForBalance ;
592
573
case FormattedAmountRole:
593
574
return formatTxAmount (rec, false );
594
575
case StatusRole:
0 commit comments