diff --git a/CHANGES b/CHANGES index ce92bd976..76087f076 100644 --- a/CHANGES +++ b/CHANGES @@ -36,6 +36,7 @@ Misc: - Qt: Add hex index to palette view - Qt: Add transformation matrix info to sprite view - Qt: Add per-page scrolling to memory view (fixes mgba.io/i/1795) + - Qt: Add setting to display ROM filename in title (closes mgba.io/i/1784) 0.8.2: (2020-06-14) Emulation fixes: diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index 510528a12..4eb99c55e 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -400,6 +400,7 @@ void SettingsView::updateConfig() { saveSetting("showFps", m_ui.showFps); saveSetting("cheatAutoload", m_ui.cheatAutoload); saveSetting("cheatAutosave", m_ui.cheatAutosave); + saveSetting("showFilename", m_ui.showFilename); saveSetting("autoload", m_ui.autoload); saveSetting("autosave", m_ui.autosave); saveSetting("logToFile", m_ui.logToFile); @@ -574,6 +575,7 @@ void SettingsView::reloadConfig() { loadSetting("showFps", m_ui.showFps, true); loadSetting("cheatAutoload", m_ui.cheatAutoload, true); loadSetting("cheatAutosave", m_ui.cheatAutosave, true); + loadSetting("showFilename", m_ui.showFilename, false); loadSetting("autoload", m_ui.autoload, true); loadSetting("autosave", m_ui.autosave, false); loadSetting("logToFile", m_ui.logToFile); diff --git a/src/platform/qt/SettingsView.ui b/src/platform/qt/SettingsView.ui index 0847639a7..0dfb884d2 100644 --- a/src/platform/qt/SettingsView.ui +++ b/src/platform/qt/SettingsView.ui @@ -586,21 +586,21 @@ - + Enable Discord Rich Presence - + Qt::Horizontal - + Automatically save state @@ -610,7 +610,7 @@ - + Automatically load state @@ -620,14 +620,14 @@ - + Qt::Horizontal - + Automatically save cheats @@ -637,7 +637,7 @@ - + Automatically load cheats @@ -647,7 +647,7 @@ - + Show OSD messages @@ -657,6 +657,16 @@ + + + + Show filename instead of ROM name in title bar + + + true + + + diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 8b0b6e2c3..c139ebf31 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -1030,18 +1030,25 @@ void Window::updateTitle(float fps) { const NoIntroDB* db = GBAApp::app()->gameDB(); NoIntroGame game{}; uint32_t crc32 = 0; - m_controller->thread()->core->checksum(m_controller->thread()->core, &crc32, CHECKSUM_CRC32); - - char gameTitle[17] = { '\0' }; mCore* core = m_controller->thread()->core; - core->getGameTitle(core, gameTitle); - title = gameTitle; + core->checksum(m_controller->thread()->core, &crc32, CHECKSUM_CRC32); + QString filePath = windowFilePath(); + + if (m_config->getOption("showFilename").toInt() && !filePath.isNull()) { + QFileInfo fileInfo(filePath); + title = fileInfo.fileName(); + } else { + char gameTitle[17] = { '\0' }; + core->getGameTitle(core, gameTitle); + title = gameTitle; #ifdef USE_SQLITE3 - if (db && crc32 && NoIntroDBLookupGameByCRC(db, crc32, &game)) { - title = QLatin1String(game.name); - } + if (db && crc32 && NoIntroDBLookupGameByCRC(db, crc32, &game)) { + title = QLatin1String(game.name); + } #endif + } + MultiplayerController* multiplayer = m_controller->multiplayerController(); if (multiplayer && multiplayer->attached() > 1) { title += tr(" - Player %1 of %2").arg(multiplayer->playerId(m_controller.get()) + 1).arg(multiplayer->attached());