Skip to content

Commit 21f174a

Browse files
knstPastaPastaPasta
authored andcommitted
feat: improve query categorisation in Qt App
1 parent c863473 commit 21f174a

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/qt/transactiontablemodel.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const
431431
return tr("Payment to yourself");
432432
case TransactionRecord::Generated:
433433
return tr("Mined");
434+
case TransactionRecord::PlatformTransfer:
435+
return tr("Platform Transfer");
434436

435437
case TransactionRecord::CoinJoinMixing:
436438
return tr("%1 Mixing").arg(QString::fromStdString(gCoinJoinName));
@@ -443,9 +445,10 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const
443445
case TransactionRecord::CoinJoinSend:
444446
return tr("%1 Send").arg(QString::fromStdString(gCoinJoinName));
445447

446-
default:
447-
return QString();
448-
}
448+
case TransactionRecord::Other:
449+
break; // use fail-over here
450+
} // no default case, so the compiler can warn about missing cases
451+
return QString();
449452
}
450453

451454
QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx) const
@@ -473,14 +476,20 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b
473476
case TransactionRecord::SendToAddress:
474477
case TransactionRecord::Generated:
475478
case TransactionRecord::CoinJoinSend:
479+
case TransactionRecord::PlatformTransfer:
476480
return formatAddressLabel(wtx->strAddress, wtx->label, tooltip) + watchAddress;
477481
case TransactionRecord::SendToOther:
478482
return QString::fromStdString(wtx->strAddress) + watchAddress;
479483
case TransactionRecord::SendToSelf:
480484
return formatAddressLabel(wtx->strAddress, wtx->label, tooltip) + watchAddress;
481-
default:
482-
return tr("(n/a)") + watchAddress;
483-
}
485+
case TransactionRecord::CoinJoinMixing:
486+
case TransactionRecord::CoinJoinCollateralPayment:
487+
case TransactionRecord::CoinJoinMakeCollaterals:
488+
case TransactionRecord::CoinJoinCreateDenominations:
489+
case TransactionRecord::Other:
490+
break; // use fail-over here
491+
} // no default case, so the compiler can warn about missing cases
492+
return tr("(n/a)") + watchAddress;
484493
}
485494

486495
QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
@@ -491,6 +500,7 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
491500
case TransactionRecord::RecvWithAddress:
492501
case TransactionRecord::SendToAddress:
493502
case TransactionRecord::Generated:
503+
case TransactionRecord::PlatformTransfer:
494504
case TransactionRecord::CoinJoinSend:
495505
case TransactionRecord::RecvWithCoinJoin:
496506
{
@@ -504,9 +514,11 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
504514
case TransactionRecord::CoinJoinMakeCollaterals:
505515
case TransactionRecord::CoinJoinCollateralPayment:
506516
return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BAREADDRESS);
507-
default:
517+
case TransactionRecord::SendToOther:
518+
case TransactionRecord::RecvFromOther:
519+
case TransactionRecord::Other:
508520
break;
509-
}
521+
} // no default case, so the compiler can warn about missing cases
510522
return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::DEFAULT);
511523
}
512524

0 commit comments

Comments
 (0)