diff options
author | Lioncash <mathew1800@gmail.com> | 2019-05-20 20:44:13 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-05-20 20:44:42 +0200 |
commit | 317f1263fbddcc7b2db24c8bca84d79df63a9fc3 (patch) | |
tree | 62488ac59a1d0f3b6cda74d476abb3ea47564ece | |
parent | Merge pull request #2499 from lioncash/translate (diff) | |
download | yuzu-317f1263fbddcc7b2db24c8bca84d79df63a9fc3.tar yuzu-317f1263fbddcc7b2db24c8bca84d79df63a9fc3.tar.gz yuzu-317f1263fbddcc7b2db24c8bca84d79df63a9fc3.tar.bz2 yuzu-317f1263fbddcc7b2db24c8bca84d79df63a9fc3.tar.lz yuzu-317f1263fbddcc7b2db24c8bca84d79df63a9fc3.tar.xz yuzu-317f1263fbddcc7b2db24c8bca84d79df63a9fc3.tar.zst yuzu-317f1263fbddcc7b2db24c8bca84d79df63a9fc3.zip |
-rw-r--r-- | src/yuzu/util/util.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/yuzu/util/util.cpp b/src/yuzu/util/util.cpp index 62c080aff..ef31bc2d2 100644 --- a/src/yuzu/util/util.cpp +++ b/src/yuzu/util/util.cpp @@ -8,7 +8,7 @@ #include "yuzu/util/util.h" QFont GetMonospaceFont() { - QFont font("monospace"); + QFont font(QStringLiteral("monospace")); // Automatic fallback to a monospace font on on platforms without a font called "monospace" font.setStyleHint(QFont::Monospace); font.setFixedPitch(true); @@ -16,14 +16,16 @@ QFont GetMonospaceFont() { } QString ReadableByteSize(qulonglong size) { - static const std::array<const char*, 6> units = {"B", "KiB", "MiB", "GiB", "TiB", "PiB"}; - if (size == 0) - return "0"; - int digit_groups = std::min<int>(static_cast<int>(std::log10(size) / std::log10(1024)), - static_cast<int>(units.size())); - return QString("%L1 %2") + static constexpr std::array units{"B", "KiB", "MiB", "GiB", "TiB", "PiB"}; + if (size == 0) { + return QStringLiteral("0"); + } + + const int digit_groups = std::min(static_cast<int>(std::log10(size) / std::log10(1024)), + static_cast<int>(units.size())); + return QStringLiteral("%L1 %2") .arg(size / std::pow(1024, digit_groups), 0, 'f', 1) - .arg(units[digit_groups]); + .arg(QString::fromUtf8(units[digit_groups])); } QPixmap CreateCirclePixmapFromColor(const QColor& color) { |