From 7149499fd85d5adea23c9c3057944c3f2f69a2d2 Mon Sep 17 00:00:00 2001 From: Roy Badami Date: Mon, 7 Jul 2014 22:28:11 +0100 Subject: Add comments re BitcoinUnits::formatWithUnit/formatHtmlWithUnit --- src/qt/bitcoinunits.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); -- cgit v1.2.3