citra-qt: Improve Title Bar display

This commit is contained in:
zhupengfei 2018-06-02 11:27:09 +08:00
parent ddc97b15f4
commit fa80ba9846
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
2 changed files with 14 additions and 2 deletions

View file

@ -606,6 +606,10 @@ bool GMainWindow::LoadROM(const QString& filename) {
Core::System& system{Core::System::GetInstance()}; Core::System& system{Core::System::GetInstance()};
const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())}; 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) { if (result != Core::System::ResultStatus::Success) {
switch (result) { switch (result) {
@ -755,6 +759,9 @@ void GMainWindow::ShutdownGame() {
if (defer_update_prompt) { if (defer_update_prompt) {
ShowUpdatePrompt(); ShowUpdatePrompt();
} }
game_title.clear();
SetupUIStrings();
} }
void GMainWindow::StoreRecentFile(const QString& filename) { void GMainWindow::StoreRecentFile(const QString& filename) {
@ -1407,8 +1414,11 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
} }
void GMainWindow::SetupUIStrings() { void GMainWindow::SetupUIStrings() {
setWindowTitle(tr("Citra %1| %2-%3") if (game_title.isEmpty()) {
.arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc)); 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() { void GMainWindow::SyncMenuUISettings() {

View file

@ -202,6 +202,8 @@ private:
// Whether emulation is currently running in Citra. // Whether emulation is currently running in Citra.
bool emulation_running = false; bool emulation_running = false;
std::unique_ptr<EmuThread> emu_thread; std::unique_ptr<EmuThread> emu_thread;
// The title of the game currently running
QString game_title;
// Debugger panes // Debugger panes
ProfilerWidget* profilerWidget; ProfilerWidget* profilerWidget;