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()};
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() {

View File

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