Browse Source

friendlyUnit: Properly replace spaces with non-breaking spaces

adaptive-webui-19844
thalieht 8 years ago committed by thalieht
parent
commit
f8213f5d56
  1. 1
      src/base/unicodestrings.h
  2. 4
      src/base/utils/misc.cpp

1
src/base/unicodestrings.h

@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
// we put all problematic UTF-8 chars/strings in this file.
// See issue #3059 for more details (https://github.com/qbittorrent/qBittorrent/issues/3059).
const char C_INFINITY[] = "";
const char C_NON_BREAKING_SPACE[] = " ";
const char C_UP[] = "";
const char C_DOWN[] = "";
const char C_COPYRIGHT[] = "©";

4
src/base/utils/misc.cpp

@ -356,9 +356,9 @@ QString Utils::Misc::friendlyUnit(qint64 bytesValue, bool isSpeed) @@ -356,9 +356,9 @@ QString Utils::Misc::friendlyUnit(qint64 bytesValue, bool isSpeed)
return QCoreApplication::translate("misc", "Unknown", "Unknown (size)");
QString ret;
if (unit == SizeUnit::Byte)
ret = QString::number(bytesValue) + " " + unitString(unit);
ret = QString::number(bytesValue) + QString::fromUtf8(C_NON_BREAKING_SPACE) + unitString(unit);
else
ret = Utils::String::fromDouble(friendlyVal, friendlyUnitPrecision(unit)) + " " + unitString(unit);
ret = Utils::String::fromDouble(friendlyVal, friendlyUnitPrecision(unit)) + QString::fromUtf8(C_NON_BREAKING_SPACE) + unitString(unit);
if (isSpeed)
ret += QCoreApplication::translate("misc", "/s", "per second");
return ret;

Loading…
Cancel
Save