Skip to content

Commit

Permalink
feat: improve query categorisation in Qt App
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Aug 5, 2024
1 parent c9ad1f6 commit 5d608f0
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
{
Expand All @@ -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);
}

Expand Down

0 comments on commit 5d608f0

Please sign in to comment.