From 21f174aff107f9aec9b758a00bde67b96ad3cd55 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Mon, 5 Aug 2024 17:15:17 +0700 Subject: [PATCH] feat: improve query categorisation in Qt App --- src/qt/transactiontablemodel.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 22be8c2de1..5ba76de957 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -431,6 +431,8 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const return tr("Payment to yourself"); case TransactionRecord::Generated: return tr("Mined"); + case TransactionRecord::PlatformTransfer: + return tr("Platform Transfer"); case TransactionRecord::CoinJoinMixing: return tr("%1 Mixing").arg(QString::fromStdString(gCoinJoinName)); @@ -443,9 +445,10 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const case TransactionRecord::CoinJoinSend: return tr("%1 Send").arg(QString::fromStdString(gCoinJoinName)); - default: - return QString(); - } + case TransactionRecord::Other: + break; // use fail-over here + } // no default case, so the compiler can warn about missing cases + return QString(); } QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx) const @@ -473,14 +476,20 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b case TransactionRecord::SendToAddress: case TransactionRecord::Generated: case TransactionRecord::CoinJoinSend: + case TransactionRecord::PlatformTransfer: return formatAddressLabel(wtx->strAddress, wtx->label, tooltip) + watchAddress; case TransactionRecord::SendToOther: return QString::fromStdString(wtx->strAddress) + watchAddress; case TransactionRecord::SendToSelf: return formatAddressLabel(wtx->strAddress, wtx->label, tooltip) + watchAddress; - default: - return tr("(n/a)") + watchAddress; - } + case TransactionRecord::CoinJoinMixing: + case TransactionRecord::CoinJoinCollateralPayment: + case TransactionRecord::CoinJoinMakeCollaterals: + case TransactionRecord::CoinJoinCreateDenominations: + case TransactionRecord::Other: + break; // use fail-over here + } // no default case, so the compiler can warn about missing cases + return tr("(n/a)") + watchAddress; } QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const @@ -491,6 +500,7 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: + case TransactionRecord::PlatformTransfer: case TransactionRecord::CoinJoinSend: case TransactionRecord::RecvWithCoinJoin: { @@ -504,9 +514,11 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const case TransactionRecord::CoinJoinMakeCollaterals: case TransactionRecord::CoinJoinCollateralPayment: return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::BAREADDRESS); - default: + case TransactionRecord::SendToOther: + case TransactionRecord::RecvFromOther: + case TransactionRecord::Other: break; - } + } // no default case, so the compiler can warn about missing cases return GUIUtil::getThemedQColor(GUIUtil::ThemedColor::DEFAULT); }