diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-05-03 11:16:06 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-05-15 19:10:38 +0300 |
commit | 3fd3a0fc87a81d42755246830124833e9ca3f0a9 (patch) | |
tree | 137ba7bb8d8d91fc0e524b27070635f925038076 /src/qt/transactiondesc.cpp | |
parent | b8593616dc2ab5b8f81edd8b2408d400e3b696cd (diff) |
qt, build: Optimize string concatenation
The defined QT_USE_QSTRINGBUILDER macro means using the QStringBuilder
for efficient string concatenation in all Qt code by default.
Diffstat (limited to 'src/qt/transactiondesc.cpp')
-rw-r--r-- | src/qt/transactiondesc.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index ece3a9cf48..02d220db20 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -26,6 +26,8 @@ #include <stdint.h> #include <string> +#include <QLatin1String> + QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks) { if (!status.is_final) @@ -38,14 +40,16 @@ QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const i else { int nDepth = status.depth_in_main_chain; - if (nDepth < 0) + if (nDepth < 0) { return tr("conflicted with a transaction with %1 confirmations").arg(-nDepth); - else if (nDepth == 0) - return tr("0/unconfirmed, %1").arg((inMempool ? tr("in memory pool") : tr("not in memory pool"))) + (status.is_abandoned ? ", "+tr("abandoned") : ""); - else if (nDepth < 6) + } else if (nDepth == 0) { + const QString abandoned{status.is_abandoned ? QLatin1String(", ") + tr("abandoned") : QString()}; + return tr("0/unconfirmed, %1").arg(inMempool ? tr("in memory pool") : tr("not in memory pool")) + abandoned; + } else if (nDepth < 6) { return tr("%1/unconfirmed").arg(nDepth); - else + } else { return tr("%1 confirmations").arg(nDepth); + } } } |