From 182476c96a6c75e90a90cbb52048bf754fdd786d Mon Sep 17 00:00:00 2001
From: Tony Wasserka <NeoBrainX@gmail.com>
Date: Thu, 13 Nov 2014 18:17:39 +0100
Subject: [PATCH] EmuWindow: Remove window title getters/setters.

The window title is none of the emulation core's business. The GUI code is free to put whatever it wants there.
Providing properly thread-safe window title getters and setters is a mess anyway.
---
 src/citra/emu_window/emu_window_glfw.cpp |  7 ++++---
 src/citra_qt/bootmanager.cpp             | 11 +++--------
 src/citra_qt/main.cpp                    |  3 ++-
 src/common/emu_window.h                  | 17 +----------------
 4 files changed, 10 insertions(+), 28 deletions(-)

diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 7e1e1c9a61..9e6f91578a 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -75,9 +75,10 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
     glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
     glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 
-    m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth, 
-        (VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight), 
-        GetWindowTitle().c_str(), NULL, NULL);
+    std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
+    m_render_window = glfwCreateWindow(VideoCore::kScreenTopWidth,
+        (VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight),
+        window_title.c_str(), NULL, NULL);
 
     if (m_render_window == NULL) {
         printf("Failed to create GLFW window! Exiting...");
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 8c12cb2280..ace48a2374 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -111,6 +111,9 @@ EmuThread& GRenderWindow::GetEmuThread()
 
 GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this), keyboard_id(0)
 {
+    std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
+    setWindowTitle(QString::fromStdString(window_title));
+
     keyboard_id = KeyMap::NewDeviceId();
     ReloadSetKeymaps();
 
@@ -182,14 +185,6 @@ void GRenderWindow::DoneCurrent()
 }
 
 void GRenderWindow::PollEvents() {
-    // TODO(ShizZy): Does this belong here? This is a reasonable place to update the window title
-    //  from the main thread, but this should probably be in an event handler...
-    /*
-    static char title[128];
-    sprintf(title, "%s (FPS: %02.02f)", window_title_.c_str(), 
-        video_core::g_renderer->current_fps());
-    setWindowTitle(title);
-    */
 }
 
 // On Qt 5.0+, this correctly gets the size of the framebuffer (pixels).
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 9a4e36adf1..d5554d917d 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -117,7 +117,8 @@ GMainWindow::GMainWindow()
     connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile()));
     connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));
 
-    setWindowTitle(render_window->GetWindowTitle().c_str());
+    std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
+    setWindowTitle(window_title.c_str());
 
     show();
 
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index 1465743f26..3817a7734b 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -89,20 +89,8 @@ public:
         return std::make_pair(client_area_width, client_area_height);
     }
 
-    // TODO: Remove
-    std::string GetWindowTitle() const {
-        return window_title;
-    }
-
-    // TODO: Remove
-    void SetWindowTitle(const std::string& val) {
-        window_title = val;
-    }
-
 protected:
-    // TODO: Remove window title initialization
-    EmuWindow() :
-        window_title(Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc))
+    EmuWindow()
     {
         // TODO
         config.min_client_area_size = std::make_pair(300u, 500u);
@@ -145,9 +133,6 @@ private:
     virtual void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) {
     }
 
-    // TODO: Remove
-    std::string window_title;      ///< Current window title, should be used by window impl.
-
     std::pair<unsigned,unsigned> framebuffer_size;
 
     unsigned client_area_width;    ///< Current client width, should be set by window impl.