From fa80ba9846950aed63a7edf8638d1fe09105fd0c Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 2 Jun 2018 11:27:09 +0800 Subject: [PATCH] citra-qt: Improve Title Bar display --- src/citra_qt/main.cpp | 14 ++++++++++++-- src/citra_qt/main.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index fcaa515ec..cea372b47 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -606,6 +606,10 @@ bool GMainWindow::LoadROM(const QString& filename) { Core::System& system{Core::System::GetInstance()}; const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())}; + std::string title; + system.GetAppLoader().ReadTitle(title); + game_title = QString::fromStdString(title); + SetupUIStrings(); if (result != Core::System::ResultStatus::Success) { switch (result) { @@ -755,6 +759,9 @@ void GMainWindow::ShutdownGame() { if (defer_update_prompt) { ShowUpdatePrompt(); } + + game_title.clear(); + SetupUIStrings(); } void GMainWindow::StoreRecentFile(const QString& filename) { @@ -1407,8 +1414,11 @@ void GMainWindow::OnLanguageChanged(const QString& locale) { } void GMainWindow::SetupUIStrings() { - setWindowTitle(tr("Citra %1| %2-%3") - .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc)); + if (game_title.isEmpty()) { + setWindowTitle(tr("Citra %1").arg(Common::g_build_fullname)); + } else { + setWindowTitle(tr("Citra %1| %2").arg(Common::g_build_fullname, game_title)); + } } void GMainWindow::SyncMenuUISettings() { diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index edb893168..55879330b 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -202,6 +202,8 @@ private: // Whether emulation is currently running in Citra. bool emulation_running = false; std::unique_ptr emu_thread; + // The title of the game currently running + QString game_title; // Debugger panes ProfilerWidget* profilerWidget;