aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactiondesc.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-05-03 11:16:06 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-05-15 19:10:38 +0300
commit3fd3a0fc87a81d42755246830124833e9ca3f0a9 (patch)
tree137ba7bb8d8d91fc0e524b27070635f925038076 /src/qt/transactiondesc.cpp
parentb8593616dc2ab5b8f81edd8b2408d400e3b696cd (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.cpp14
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);
+ }
}
}