summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2019-05-20 20:43:28 -0400
committerGravatar GitHub2019-05-20 20:43:28 -0400
commitdbcff5d574ec879bd2267d18c286708b9239d4bf (patch)
treebd836d730939d35448ad78a2a05803585e1df92c
parentMerge pull request #2494 from lioncash/shader-text (diff)
parentyuzu/game_list: Specify string conversions explicitly (diff)
downloadyuzu-dbcff5d574ec879bd2267d18c286708b9239d4bf.tar.gz
yuzu-dbcff5d574ec879bd2267d18c286708b9239d4bf.tar.xz
yuzu-dbcff5d574ec879bd2267d18c286708b9239d4bf.zip
Merge pull request #2503 from lioncash/util
yuzu/game_list: Specify string conversions explicitly
-rw-r--r--src/yuzu/bootmanager.cpp6
-rw-r--r--src/yuzu/game_list.cpp103
-rw-r--r--src/yuzu/game_list.h2
-rw-r--r--src/yuzu/game_list_p.h25
-rw-r--r--src/yuzu/game_list_worker.cpp4
-rw-r--r--src/yuzu/loading_screen.cpp18
-rw-r--r--src/yuzu/util/util.cpp18
7 files changed, 92 insertions, 84 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 810954b36..c2783d684 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -188,7 +188,9 @@ private:
188GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) 188GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread)
189 : QWidget(parent), emu_thread(emu_thread) { 189 : QWidget(parent), emu_thread(emu_thread) {
190 setWindowTitle(QStringLiteral("yuzu %1 | %2-%3") 190 setWindowTitle(QStringLiteral("yuzu %1 | %2-%3")
191 .arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc)); 191 .arg(QString::fromUtf8(Common::g_build_name),
192 QString::fromUtf8(Common::g_scm_branch),
193 QString::fromUtf8(Common::g_scm_desc)));
192 setAttribute(Qt::WA_AcceptTouchEvents); 194 setAttribute(Qt::WA_AcceptTouchEvents);
193 195
194 InputCommon::Init(); 196 InputCommon::Init();
@@ -217,7 +219,7 @@ void GRenderWindow::SwapBuffers() {
217 // However: 219 // However:
218 // - The Qt debug runtime prints a bogus warning on the console if `makeCurrent` wasn't called 220 // - The Qt debug runtime prints a bogus warning on the console if `makeCurrent` wasn't called
219 // since the last time `swapBuffers` was executed; 221 // since the last time `swapBuffers` was executed;
220 // - On macOS, if `makeCurrent` isn't called explicitely, resizing the buffer breaks. 222 // - On macOS, if `makeCurrent` isn't called explicitly, resizing the buffer breaks.
221 context->makeCurrent(child); 223 context->makeCurrent(child);
222 224
223 context->swapBuffers(child); 225 context->swapBuffers(child);
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index b0ca766ec..83d675773 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -14,7 +14,6 @@
14#include <QMenu> 14#include <QMenu>
15#include <QThreadPool> 15#include <QThreadPool>
16#include <fmt/format.h> 16#include <fmt/format.h>
17#include "common/common_paths.h"
18#include "common/common_types.h" 17#include "common/common_types.h"
19#include "common/logging/log.h" 18#include "common/logging/log.h"
20#include "core/file_sys/patch_manager.h" 19#include "core/file_sys/patch_manager.h"
@@ -48,7 +47,7 @@ bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* eve
48 return QObject::eventFilter(obj, event); 47 return QObject::eventFilter(obj, event);
49 } else { 48 } else {
50 gamelist->search_field->edit_filter->clear(); 49 gamelist->search_field->edit_filter->clear();
51 edit_filter_text = ""; 50 edit_filter_text.clear();
52 } 51 }
53 break; 52 break;
54 } 53 }
@@ -71,9 +70,9 @@ bool GameListSearchField::KeyReleaseEater::eventFilter(QObject* obj, QEvent* eve
71 } 70 }
72 if (resultCount == 1) { 71 if (resultCount == 1) {
73 // To avoid loading error dialog loops while confirming them using enter 72 // To avoid loading error dialog loops while confirming them using enter
74 // Also users usually want to run a diffrent game after closing one 73 // Also users usually want to run a different game after closing one
75 gamelist->search_field->edit_filter->setText(""); 74 gamelist->search_field->edit_filter->clear();
76 edit_filter_text = ""; 75 edit_filter_text.clear();
77 emit gamelist->GameChosen(file_path); 76 emit gamelist->GameChosen(file_path);
78 } else { 77 } else {
79 return QObject::eventFilter(obj, event); 78 return QObject::eventFilter(obj, event);
@@ -93,7 +92,7 @@ void GameListSearchField::setFilterResult(int visible, int total) {
93} 92}
94 93
95void GameListSearchField::clear() { 94void GameListSearchField::clear() {
96 edit_filter->setText(""); 95 edit_filter->clear();
97} 96}
98 97
99void GameListSearchField::setFocus() { 98void GameListSearchField::setFocus() {
@@ -103,25 +102,26 @@ void GameListSearchField::setFocus() {
103} 102}
104 103
105GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} { 104GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
106 KeyReleaseEater* keyReleaseEater = new KeyReleaseEater(parent); 105 auto* const key_release_eater = new KeyReleaseEater(parent);
107 layout_filter = new QHBoxLayout; 106 layout_filter = new QHBoxLayout;
108 layout_filter->setMargin(8); 107 layout_filter->setMargin(8);
109 label_filter = new QLabel; 108 label_filter = new QLabel;
110 label_filter->setText(tr("Filter:")); 109 label_filter->setText(tr("Filter:"));
111 edit_filter = new QLineEdit; 110 edit_filter = new QLineEdit;
112 edit_filter->setText(""); 111 edit_filter->clear();
113 edit_filter->setPlaceholderText(tr("Enter pattern to filter")); 112 edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
114 edit_filter->installEventFilter(keyReleaseEater); 113 edit_filter->installEventFilter(key_release_eater);
115 edit_filter->setClearButtonEnabled(true); 114 edit_filter->setClearButtonEnabled(true);
116 connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::onTextChanged); 115 connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::onTextChanged);
117 label_filter_result = new QLabel; 116 label_filter_result = new QLabel;
118 button_filter_close = new QToolButton(this); 117 button_filter_close = new QToolButton(this);
119 button_filter_close->setText("X"); 118 button_filter_close->setText(QStringLiteral("X"));
120 button_filter_close->setCursor(Qt::ArrowCursor); 119 button_filter_close->setCursor(Qt::ArrowCursor);
121 button_filter_close->setStyleSheet("QToolButton{ border: none; padding: 0px; color: " 120 button_filter_close->setStyleSheet(
122 "#000000; font-weight: bold; background: #F0F0F0; }" 121 QStringLiteral("QToolButton{ border: none; padding: 0px; color: "
123 "QToolButton:hover{ border: none; padding: 0px; color: " 122 "#000000; font-weight: bold; background: #F0F0F0; }"
124 "#EEEEEE; font-weight: bold; background: #E81123}"); 123 "QToolButton:hover{ border: none; padding: 0px; color: "
124 "#EEEEEE; font-weight: bold; background: #E81123}"));
125 connect(button_filter_close, &QToolButton::clicked, parent, &GameList::onFilterCloseClicked); 125 connect(button_filter_close, &QToolButton::clicked, parent, &GameList::onFilterCloseClicked);
126 layout_filter->setSpacing(10); 126 layout_filter->setSpacing(10);
127 layout_filter->addWidget(label_filter); 127 layout_filter->addWidget(label_filter);
@@ -141,36 +141,34 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
141 */ 141 */
142static bool ContainsAllWords(const QString& haystack, const QString& userinput) { 142static bool ContainsAllWords(const QString& haystack, const QString& userinput) {
143 const QStringList userinput_split = 143 const QStringList userinput_split =
144 userinput.split(' ', QString::SplitBehavior::SkipEmptyParts); 144 userinput.split(QLatin1Char{' '}, QString::SplitBehavior::SkipEmptyParts);
145 145
146 return std::all_of(userinput_split.begin(), userinput_split.end(), 146 return std::all_of(userinput_split.begin(), userinput_split.end(),
147 [&haystack](const QString& s) { return haystack.contains(s); }); 147 [&haystack](const QString& s) { return haystack.contains(s); });
148} 148}
149 149
150// Event in order to filter the gamelist after editing the searchfield 150// Event in order to filter the gamelist after editing the searchfield
151void GameList::onTextChanged(const QString& newText) { 151void GameList::onTextChanged(const QString& new_text) {
152 int rowCount = tree_view->model()->rowCount(); 152 const int row_count = tree_view->model()->rowCount();
153 QString edit_filter_text = newText.toLower(); 153 const QString edit_filter_text = new_text.toLower();
154 154 const QModelIndex root_index = item_model->invisibleRootItem()->index();
155 QModelIndex root_index = item_model->invisibleRootItem()->index();
156 155
157 // If the searchfield is empty every item is visible 156 // If the searchfield is empty every item is visible
158 // Otherwise the filter gets applied 157 // Otherwise the filter gets applied
159 if (edit_filter_text.isEmpty()) { 158 if (edit_filter_text.isEmpty()) {
160 for (int i = 0; i < rowCount; ++i) { 159 for (int i = 0; i < row_count; ++i) {
161 tree_view->setRowHidden(i, root_index, false); 160 tree_view->setRowHidden(i, root_index, false);
162 } 161 }
163 search_field->setFilterResult(rowCount, rowCount); 162 search_field->setFilterResult(row_count, row_count);
164 } else { 163 } else {
165 int result_count = 0; 164 int result_count = 0;
166 for (int i = 0; i < rowCount; ++i) { 165 for (int i = 0; i < row_count; ++i) {
167 const QStandardItem* child_file = item_model->item(i, 0); 166 const QStandardItem* child_file = item_model->item(i, 0);
168 const QString file_path = 167 const QString file_path =
169 child_file->data(GameListItemPath::FullPathRole).toString().toLower(); 168 child_file->data(GameListItemPath::FullPathRole).toString().toLower();
170 QString file_name = file_path.mid(file_path.lastIndexOf('/') + 1);
171 const QString file_title = 169 const QString file_title =
172 child_file->data(GameListItemPath::TitleRole).toString().toLower(); 170 child_file->data(GameListItemPath::TitleRole).toString().toLower();
173 const QString file_programmid = 171 const QString file_program_id =
174 child_file->data(GameListItemPath::ProgramIdRole).toString().toLower(); 172 child_file->data(GameListItemPath::ProgramIdRole).toString().toLower();
175 173
176 // Only items which filename in combination with its title contains all words 174 // Only items which filename in combination with its title contains all words
@@ -178,14 +176,16 @@ void GameList::onTextChanged(const QString& newText) {
178 // The search is case insensitive because of toLower() 176 // The search is case insensitive because of toLower()
179 // I decided not to use Qt::CaseInsensitive in containsAllWords to prevent 177 // I decided not to use Qt::CaseInsensitive in containsAllWords to prevent
180 // multiple conversions of edit_filter_text for each game in the gamelist 178 // multiple conversions of edit_filter_text for each game in the gamelist
181 if (ContainsAllWords(file_name.append(' ').append(file_title), edit_filter_text) || 179 const QString file_name = file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) +
182 (file_programmid.count() == 16 && edit_filter_text.contains(file_programmid))) { 180 QLatin1Char{' '} + file_title;
181 if (ContainsAllWords(file_name, edit_filter_text) ||
182 (file_program_id.count() == 16 && edit_filter_text.contains(file_program_id))) {
183 tree_view->setRowHidden(i, root_index, false); 183 tree_view->setRowHidden(i, root_index, false);
184 ++result_count; 184 ++result_count;
185 } else { 185 } else {
186 tree_view->setRowHidden(i, root_index, true); 186 tree_view->setRowHidden(i, root_index, true);
187 } 187 }
188 search_field->setFilterResult(result_count, rowCount); 188 search_field->setFilterResult(result_count, row_count);
189 } 189 }
190 } 190 }
191} 191}
@@ -216,7 +216,7 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide
216 tree_view->setEditTriggers(QHeaderView::NoEditTriggers); 216 tree_view->setEditTriggers(QHeaderView::NoEditTriggers);
217 tree_view->setUniformRowHeights(true); 217 tree_view->setUniformRowHeights(true);
218 tree_view->setContextMenuPolicy(Qt::CustomContextMenu); 218 tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
219 tree_view->setStyleSheet("QTreeView{ border: none; }"); 219 tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }"));
220 220
221 item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); 221 item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1);
222 item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); 222 item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
@@ -282,9 +282,9 @@ void GameList::ValidateEntry(const QModelIndex& item) {
282 const QFileInfo file_info{file_path}; 282 const QFileInfo file_info{file_path};
283 if (file_info.isDir()) { 283 if (file_info.isDir()) {
284 const QDir dir{file_path}; 284 const QDir dir{file_path};
285 const QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); 285 const QStringList matching_main = dir.entryList({QStringLiteral("main")}, QDir::Files);
286 if (matching_main.size() == 1) { 286 if (matching_main.size() == 1) {
287 emit GameChosen(dir.path() + DIR_SEP + matching_main[0]); 287 emit GameChosen(dir.path() + QDir::separator() + matching_main[0]);
288 } 288 }
289 return; 289 return;
290 } 290 }
@@ -360,7 +360,7 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
360} 360}
361 361
362void GameList::LoadCompatibilityList() { 362void GameList::LoadCompatibilityList() {
363 QFile compat_list{":compatibility_list/compatibility_list.json"}; 363 QFile compat_list{QStringLiteral(":compatibility_list/compatibility_list.json")};
364 364
365 if (!compat_list.open(QFile::ReadOnly | QFile::Text)) { 365 if (!compat_list.open(QFile::ReadOnly | QFile::Text)) {
366 LOG_ERROR(Frontend, "Unable to open game compatibility list"); 366 LOG_ERROR(Frontend, "Unable to open game compatibility list");
@@ -378,25 +378,27 @@ void GameList::LoadCompatibilityList() {
378 return; 378 return;
379 } 379 }
380 380
381 const QString string_content = content; 381 const QJsonDocument json = QJsonDocument::fromJson(content);
382 QJsonDocument json = QJsonDocument::fromJson(string_content.toUtf8()); 382 const QJsonArray arr = json.array();
383 QJsonArray arr = json.array();
384 383
385 for (const QJsonValueRef value : arr) { 384 for (const QJsonValue value : arr) {
386 QJsonObject game = value.toObject(); 385 const QJsonObject game = value.toObject();
386 const QString compatibility_key = QStringLiteral("compatibility");
387 387
388 if (game.contains("compatibility") && game["compatibility"].isDouble()) { 388 if (!game.contains(compatibility_key) || !game[compatibility_key].isDouble()) {
389 int compatibility = game["compatibility"].toInt(); 389 continue;
390 QString directory = game["directory"].toString(); 390 }
391 QJsonArray ids = game["releases"].toArray();
392 391
393 for (const QJsonValueRef id_ref : ids) { 392 const int compatibility = game[compatibility_key].toInt();
394 QJsonObject id_object = id_ref.toObject(); 393 const QString directory = game[QStringLiteral("directory")].toString();
395 QString id = id_object["id"].toString(); 394 const QJsonArray ids = game[QStringLiteral("releases")].toArray();
396 compatibility_list.emplace( 395
397 id.toUpper().toStdString(), 396 for (const QJsonValue id_ref : ids) {
398 std::make_pair(QString::number(compatibility), directory)); 397 const QJsonObject id_object = id_ref.toObject();
399 } 398 const QString id = id_object[QStringLiteral("id")].toString();
399
400 compatibility_list.emplace(id.toUpper().toStdString(),
401 std::make_pair(QString::number(compatibility), directory));
400 } 402 }
401 } 403 }
402} 404}
@@ -464,7 +466,10 @@ void GameList::LoadInterfaceLayout() {
464 item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder()); 466 item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder());
465} 467}
466 468
467const QStringList GameList::supported_file_extensions = {"nso", "nro", "nca", "xci", "nsp"}; 469const QStringList GameList::supported_file_extensions = {
470 QStringLiteral("nso"), QStringLiteral("nro"), QStringLiteral("nca"),
471 QStringLiteral("xci"), QStringLiteral("nsp"),
472};
468 473
469void GameList::RefreshGameDirectory() { 474void GameList::RefreshGameDirectory() {
470 if (!UISettings::values.game_directory_path.isEmpty() && current_worker != nullptr) { 475 if (!UISettings::values.game_directory_path.isEmpty() && current_worker != nullptr) {
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 56007eef8..f8f8bd6c5 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -76,7 +76,7 @@ signals:
76 void OpenPerGameGeneralRequested(const std::string& file); 76 void OpenPerGameGeneralRequested(const std::string& file);
77 77
78private slots: 78private slots:
79 void onTextChanged(const QString& newText); 79 void onTextChanged(const QString& new_text);
80 void onFilterCloseClicked(); 80 void onFilterCloseClicked();
81 81
82private: 82private:
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index 2cf5c58a0..0b458ef48 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -4,11 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <algorithm>
8#include <array> 7#include <array>
9#include <map> 8#include <map>
10#include <string> 9#include <string>
11#include <unordered_map>
12#include <utility> 10#include <utility>
13 11
14#include <QCoreApplication> 12#include <QCoreApplication>
@@ -25,8 +23,8 @@
25#include "yuzu/util/util.h" 23#include "yuzu/util/util.h"
26 24
27/** 25/**
28 * Gets the default icon (for games without valid SMDH) 26 * Gets the default icon (for games without valid title metadata)
29 * @param large If true, returns large icon (48x48), otherwise returns small icon (24x24) 27 * @param size The desired width and height of the default icon.
30 * @return QPixmap default icon 28 * @return QPixmap default icon
31 */ 29 */
32static QPixmap GetDefaultIcon(u32 size) { 30static QPixmap GetDefaultIcon(u32 size) {
@@ -46,7 +44,7 @@ public:
46 * A specialization of GameListItem for path values. 44 * A specialization of GameListItem for path values.
47 * This class ensures that for every full path value it holds, a correct string representation 45 * This class ensures that for every full path value it holds, a correct string representation
48 * of just the filename (with no extension) will be displayed to the user. 46 * of just the filename (with no extension) will be displayed to the user.
49 * If this class receives valid SMDH data, it will also display game icons and titles. 47 * If this class receives valid title metadata, it will also display game icons and titles.
50 */ 48 */
51class GameListItemPath : public GameListItem { 49class GameListItemPath : public GameListItem {
52public: 50public:
@@ -95,7 +93,7 @@ public:
95 if (row2.isEmpty()) 93 if (row2.isEmpty())
96 return row1; 94 return row1;
97 95
98 return QString(row1 + "\n " + row2); 96 return QString(row1 + QStringLiteral("\n ") + row2);
99 } 97 }
100 98
101 return GameListItem::data(role); 99 return GameListItem::data(role);
@@ -115,13 +113,14 @@ public:
115 }; 113 };
116 // clang-format off 114 // clang-format off
117 static const std::map<QString, CompatStatus> status_data = { 115 static const std::map<QString, CompatStatus> status_data = {
118 {"0", {"#5c93ed", QT_TR_NOOP("Perfect"), QT_TR_NOOP("Game functions flawless with no audio or graphical glitches, all tested functionality works as intended without\nany workarounds needed.")}}, 116 {QStringLiteral("0"), {QStringLiteral("#5c93ed"), QT_TR_NOOP("Perfect"), QT_TR_NOOP("Game functions flawless with no audio or graphical glitches, all tested functionality works as intended without\nany workarounds needed.")}},
119 {"1", {"#47d35c", QT_TR_NOOP("Great"), QT_TR_NOOP("Game functions with minor graphical or audio glitches and is playable from start to finish. May require some\nworkarounds.")}}, 117 {QStringLiteral("1"), {QStringLiteral("#47d35c"), QT_TR_NOOP("Great"), QT_TR_NOOP("Game functions with minor graphical or audio glitches and is playable from start to finish. May require some\nworkarounds.")}},
120 {"2", {"#94b242", QT_TR_NOOP("Okay"), QT_TR_NOOP("Game functions with major graphical or audio glitches, but game is playable from start to finish with\nworkarounds.")}}, 118 {QStringLiteral("2"), {QStringLiteral("#94b242"), QT_TR_NOOP("Okay"), QT_TR_NOOP("Game functions with major graphical or audio glitches, but game is playable from start to finish with\nworkarounds.")}},
121 {"3", {"#f2d624", QT_TR_NOOP("Bad"), QT_TR_NOOP("Game functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches\neven with workarounds.")}}, 119 {QStringLiteral("3"), {QStringLiteral("#f2d624"), QT_TR_NOOP("Bad"), QT_TR_NOOP("Game functions, but with major graphical or audio glitches. Unable to progress in specific areas due to glitches\neven with workarounds.")}},
122 {"4", {"#FF0000", QT_TR_NOOP("Intro/Menu"), QT_TR_NOOP("Game is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start\nScreen.")}}, 120 {QStringLiteral("4"), {QStringLiteral("#FF0000"), QT_TR_NOOP("Intro/Menu"), QT_TR_NOOP("Game is completely unplayable due to major graphical or audio glitches. Unable to progress past the Start\nScreen.")}},
123 {"5", {"#828282", QT_TR_NOOP("Won't Boot"), QT_TR_NOOP("The game crashes when attempting to startup.")}}, 121 {QStringLiteral("5"), {QStringLiteral("#828282"), QT_TR_NOOP("Won't Boot"), QT_TR_NOOP("The game crashes when attempting to startup.")}},
124 {"99", {"#000000", QT_TR_NOOP("Not Tested"), QT_TR_NOOP("The game has not yet been tested.")}}}; 122 {QStringLiteral("99"), {QStringLiteral("#000000"), QT_TR_NOOP("Not Tested"), QT_TR_NOOP("The game has not yet been tested.")}},
123 };
125 // clang-format on 124 // clang-format on
126 125
127 auto iterator = status_data.find(compatibility); 126 auto iterator = status_data.find(compatibility);
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 8687e7c5a..82d2826ba 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -45,7 +45,7 @@ bool HasSupportedFileExtension(const std::string& file_name) {
45} 45}
46 46
47bool IsExtractedNCAMain(const std::string& file_name) { 47bool IsExtractedNCAMain(const std::string& file_name) {
48 return QFileInfo(QString::fromStdString(file_name)).fileName() == "main"; 48 return QFileInfo(QString::fromStdString(file_name)).fileName() == QStringLiteral("main");
49} 49}
50 50
51QString FormatGameName(const std::string& physical_name) { 51QString FormatGameName(const std::string& physical_name) {
@@ -97,7 +97,7 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
97 const auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id); 97 const auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
98 98
99 // The game list uses this as compatibility number for untested games 99 // The game list uses this as compatibility number for untested games
100 QString compatibility{"99"}; 100 QString compatibility{QStringLiteral("99")};
101 if (it != compatibility_list.end()) { 101 if (it != compatibility_list.end()) {
102 compatibility = it->second.first; 102 compatibility = it->second.first;
103 } 103 }
diff --git a/src/yuzu/loading_screen.cpp b/src/yuzu/loading_screen.cpp
index 4e2d988cd..4f2bfab48 100644
--- a/src/yuzu/loading_screen.cpp
+++ b/src/yuzu/loading_screen.cpp
@@ -30,11 +30,11 @@
30#include <QMovie> 30#include <QMovie>
31#endif 31#endif
32 32
33constexpr const char PROGRESSBAR_STYLE_PREPARE[] = R"( 33constexpr char PROGRESSBAR_STYLE_PREPARE[] = R"(
34QProgressBar {} 34QProgressBar {}
35QProgressBar::chunk {})"; 35QProgressBar::chunk {})";
36 36
37constexpr const char PROGRESSBAR_STYLE_DECOMPILE[] = R"( 37constexpr char PROGRESSBAR_STYLE_DECOMPILE[] = R"(
38QProgressBar { 38QProgressBar {
39 background-color: black; 39 background-color: black;
40 border: 2px solid white; 40 border: 2px solid white;
@@ -46,7 +46,7 @@ QProgressBar::chunk {
46 width: 1px; 46 width: 1px;
47})"; 47})";
48 48
49constexpr const char PROGRESSBAR_STYLE_BUILD[] = R"( 49constexpr char PROGRESSBAR_STYLE_BUILD[] = R"(
50QProgressBar { 50QProgressBar {
51 background-color: black; 51 background-color: black;
52 border: 2px solid white; 52 border: 2px solid white;
@@ -58,7 +58,7 @@ QProgressBar::chunk {
58 width: 1px; 58 width: 1px;
59})"; 59})";
60 60
61constexpr const char PROGRESSBAR_STYLE_COMPLETE[] = R"( 61constexpr char PROGRESSBAR_STYLE_COMPLETE[] = R"(
62QProgressBar { 62QProgressBar {
63 background-color: #0ab9e6; 63 background-color: #0ab9e6;
64 border: 2px solid white; 64 border: 2px solid white;
@@ -149,10 +149,10 @@ void LoadingScreen::OnLoadComplete() {
149void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, 149void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value,
150 std::size_t total) { 150 std::size_t total) {
151 using namespace std::chrono; 151 using namespace std::chrono;
152 auto now = high_resolution_clock::now(); 152 const auto now = high_resolution_clock::now();
153 // reset the timer if the stage changes 153 // reset the timer if the stage changes
154 if (stage != previous_stage) { 154 if (stage != previous_stage) {
155 ui->progress_bar->setStyleSheet(progressbar_style[stage]); 155 ui->progress_bar->setStyleSheet(QString::fromUtf8(progressbar_style[stage]));
156 // Hide the progress bar during the prepare stage 156 // Hide the progress bar during the prepare stage
157 if (stage == VideoCore::LoadCallbackStage::Prepare) { 157 if (stage == VideoCore::LoadCallbackStage::Prepare) {
158 ui->progress_bar->hide(); 158 ui->progress_bar->hide();
@@ -178,16 +178,16 @@ void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size
178 slow_shader_first_value = value; 178 slow_shader_first_value = value;
179 } 179 }
180 // only calculate an estimate time after a second has passed since stage change 180 // only calculate an estimate time after a second has passed since stage change
181 auto diff = duration_cast<milliseconds>(now - slow_shader_start); 181 const auto diff = duration_cast<milliseconds>(now - slow_shader_start);
182 if (diff > seconds{1}) { 182 if (diff > seconds{1}) {
183 auto eta_mseconds = 183 const auto eta_mseconds =
184 static_cast<long>(static_cast<double>(total - slow_shader_first_value) / 184 static_cast<long>(static_cast<double>(total - slow_shader_first_value) /
185 (value - slow_shader_first_value) * diff.count()); 185 (value - slow_shader_first_value) * diff.count());
186 estimate = 186 estimate =
187 tr("Estimated Time %1") 187 tr("Estimated Time %1")
188 .arg(QTime(0, 0, 0, 0) 188 .arg(QTime(0, 0, 0, 0)
189 .addMSecs(std::max<long>(eta_mseconds - diff.count() + 1000, 1000)) 189 .addMSecs(std::max<long>(eta_mseconds - diff.count() + 1000, 1000))
190 .toString("mm:ss")); 190 .toString(QStringLiteral("mm:ss")));
191 } 191 }
192 } 192 }
193 193
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
10QFont GetMonospaceFont() { 10QFont 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
18QString ReadableByteSize(qulonglong size) { 18QString 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
29QPixmap CreateCirclePixmapFromColor(const QColor& color) { 31QPixmap CreateCirclePixmapFromColor(const QColor& color) {