From 79a52fce1d6bf5d3b6c90a940d3270776e05fc77 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 9 May 2019 01:18:28 -0400
Subject: [PATCH 1/2] yuzu/about_dialog: Specify string conversions explicitly

Specifies the conversions explicitly to avoid implicit conversions from
const char* to QString. This makes it easier to disable implicit QString
conversions in the future.

In this case, the implicit conversion was technically wrong as well. The
implicit conversion treats the input strings as ASCII characters. This
would result in an incorrect conversion being performed in the rare case
a branch name was created with a non-ASCII Unicode character, likely
resulting in junk being displayed.
---
 src/yuzu/about_dialog.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp
index 3efa65a381..d39b3f07ae 100644
--- a/src/yuzu/about_dialog.cpp
+++ b/src/yuzu/about_dialog.cpp
@@ -9,10 +9,10 @@
 
 AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
     ui->setupUi(this);
-    ui->labelLogo->setPixmap(QIcon::fromTheme("yuzu").pixmap(200));
-    ui->labelBuildInfo->setText(
-        ui->labelBuildInfo->text().arg(Common::g_build_fullname, Common::g_scm_branch,
-                                       Common::g_scm_desc, QString(Common::g_build_date).left(10)));
+    ui->labelLogo->setPixmap(QIcon::fromTheme(QStringLiteral("yuzu")).pixmap(200));
+    ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg(
+        QString::fromUtf8(Common::g_build_fullname), QString::fromUtf8(Common::g_scm_branch),
+        QString::fromUtf8(Common::g_scm_desc), QString::fromUtf8(Common::g_build_date).left(10)));
 }
 
 AboutDialog::~AboutDialog() = default;

From 71b39d4b2ee0ab2308d0bdd3bc156c6905079df3 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 9 May 2019 01:41:33 -0400
Subject: [PATCH 2/2] yuzu/main: Move window title updating logic to its own
 function

For similar reasons to the previous change, we move this to a single
function, so we don't need to duplicate the conversion logic in several
places within main.cpp.
---
 src/yuzu/main.cpp | 25 ++++++++++++++++++-------
 src/yuzu/main.h   |  1 +
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e33e3aaaf5..a59abf6e8d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -198,11 +198,11 @@ GMainWindow::GMainWindow()
 
     ConnectMenuEvents();
     ConnectWidgetEvents();
+
     LOG_INFO(Frontend, "yuzu Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch,
              Common::g_scm_desc);
+    UpdateWindowTitle();
 
-    setWindowTitle(QString("yuzu %1| %2-%3")
-                       .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc));
     show();
 
     Core::System::GetInstance().SetContentProvider(
@@ -936,9 +936,7 @@ void GMainWindow::BootGame(const QString& filename) {
             title_name = FileUtil::GetFilename(filename.toStdString());
     }
 
-    setWindowTitle(QString("yuzu %1| %4 | %2-%3")
-                       .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc,
-                            QString::fromStdString(title_name)));
+    UpdateWindowTitle(QString::fromStdString(title_name));
 
     loading_screen->Prepare(Core::System::GetInstance().GetAppLoader());
     loading_screen->show();
@@ -979,8 +977,8 @@ void GMainWindow::ShutdownGame() {
     loading_screen->Clear();
     game_list->show();
     game_list->setFilterFocus();
-    setWindowTitle(QString("yuzu %1| %2-%3")
-                       .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc));
+
+    UpdateWindowTitle();
 
     // Disable status bar updates
     status_bar_update_timer.stop();
@@ -1767,6 +1765,19 @@ void GMainWindow::OnCaptureScreenshot() {
     OnStartGame();
 }
 
+void GMainWindow::UpdateWindowTitle(const QString& title_name) {
+    const QString full_name = QString::fromUtf8(Common::g_build_fullname);
+    const QString branch_name = QString::fromUtf8(Common::g_scm_branch);
+    const QString description = QString::fromUtf8(Common::g_scm_desc);
+
+    if (title_name.isEmpty()) {
+        setWindowTitle(QStringLiteral("yuzu %1| %2-%3").arg(full_name, branch_name, description));
+    } else {
+        setWindowTitle(QStringLiteral("yuzu %1| %4 | %2-%3")
+                           .arg(full_name, branch_name, description, title_name));
+    }
+}
+
 void GMainWindow::UpdateStatusBar() {
     if (emu_thread == nullptr) {
         status_bar_update_timer.stop();
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index fb2a193cb8..7bf82e665b 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -209,6 +209,7 @@ private slots:
 
 private:
     std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id);
+    void UpdateWindowTitle(const QString& title_name = {});
     void UpdateStatusBar();
 
     Ui::MainWindow ui;