aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoinunits.cpp
diff options
context:
space:
mode:
authorRoy Badami <roy@gnomon.org.uk>2014-07-07 22:28:11 +0100
committerRoy Badami <roy@gnomon.org.uk>2014-07-07 22:28:11 +0100
commit7149499fd85d5adea23c9c3057944c3f2f69a2d2 (patch)
tree4b5b2b2c0fe5043cc1ded1f6c83f990ab796adb4 /src/qt/bitcoinunits.cpp
parentf7d70c603f3b2a664082e0829b92844233c46cb4 (diff)
Add comments re BitcoinUnits::formatWithUnit/formatHtmlWithUnit
Diffstat (limited to 'src/qt/bitcoinunits.cpp')
-rw-r--r--src/qt/bitcoinunits.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp
index 64751c1783..21aed235cf 100644
--- a/src/qt/bitcoinunits.cpp
+++ b/src/qt/bitcoinunits.cpp
@@ -148,6 +148,21 @@ QString BitcoinUnits::format(int unit, qint64 n, bool fPlus, SeparatorStyle sepa
}
+// TODO: Review all remaining calls to BitcoinUnits::formatWithUnit to
+// TODO: determine whether the output is used in a plain text context
+// TODO: or an HTML context (and replace with
+// TODO: BtcoinUnits::formatHtmlWithUnit in the latter case). Hopefully
+// TODO: there aren't instances where the result could be used in
+// TODO: either context.
+
+// NOTE: Using formatWithUnit in an HTML context risks wrapping
+// quantities at the thousands separator. More subtly, it also results
+// in a standard space rather than a thin space, due to a bug in Qt's
+// XML whitespace canonicalisation
+//
+// Please take care to use formatHtmlWithUnit instead, when
+// appropriate.
+
QString BitcoinUnits::formatWithUnit(int unit, qint64 amount, bool plussign, SeparatorStyle separators)
{
return format(unit, amount, plussign, separators) + QString(" ") + name(unit);