diff options
Diffstat (limited to 'src')
| -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 @@ | |||
| 8 | #include "yuzu/util/util.h" | 8 | #include "yuzu/util/util.h" |
| 9 | 9 | ||
| 10 | QFont GetMonospaceFont() { | 10 | QFont GetMonospaceFont() { |
| 11 | QFont font("monospace"); | 11 | QFont font(QStringLiteral("monospace")); |
| 12 | // Automatic fallback to a monospace font on on platforms without a font called "monospace" | 12 | // Automatic fallback to a monospace font on on platforms without a font called "monospace" |
| 13 | font.setStyleHint(QFont::Monospace); | 13 | font.setStyleHint(QFont::Monospace); |
| 14 | font.setFixedPitch(true); | 14 | font.setFixedPitch(true); |
| @@ -16,14 +16,16 @@ QFont GetMonospaceFont() { | |||
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | QString ReadableByteSize(qulonglong size) { | 18 | QString ReadableByteSize(qulonglong size) { |
| 19 | static const std::array<const char*, 6> units = {"B", "KiB", "MiB", "GiB", "TiB", "PiB"}; | 19 | static constexpr std::array units{"B", "KiB", "MiB", "GiB", "TiB", "PiB"}; |
| 20 | if (size == 0) | 20 | if (size == 0) { |
| 21 | return "0"; | 21 | return QStringLiteral("0"); |
| 22 | int digit_groups = std::min<int>(static_cast<int>(std::log10(size) / std::log10(1024)), | 22 | } |
| 23 | static_cast<int>(units.size())); | 23 | |
| 24 | return QString("%L1 %2") | 24 | const int digit_groups = std::min(static_cast<int>(std::log10(size) / std::log10(1024)), |
| 25 | static_cast<int>(units.size())); | ||
| 26 | return QStringLiteral("%L1 %2") | ||
| 25 | .arg(size / std::pow(1024, digit_groups), 0, 'f', 1) | 27 | .arg(size / std::pow(1024, digit_groups), 0, 'f', 1) |
| 26 | .arg(units[digit_groups]); | 28 | .arg(QString::fromUtf8(units[digit_groups])); |
| 27 | } | 29 | } |
| 28 | 30 | ||
| 29 | QPixmap CreateCirclePixmapFromColor(const QColor& color) { | 31 | QPixmap CreateCirclePixmapFromColor(const QColor& color) { |