mirror of https://github.com/mgba-emu/mgba.git
Qt: Setting to show filename in title bar instead of ROM name. (#1807)
* All: Setting to display the file name of the currently loaded ROM instead of the game name in the title bar (closes mgba.io/i/1784) * Utilize ConfigController getOption method and restructured to not use dynamically allocated memory for the temporary title * Grab actual path name, use getOption to avoid having to modify the core, update CHANGES file, and moved core declaration to condense code. * Change CHANGES text * Qt: Simplify settings UI for PR Co-authored-by: Vicki Pfau <vi@endrift.com>
This commit is contained in:
parent
dd4619db61
commit
0230e654a3
1
CHANGES
1
CHANGES
|
@ -36,6 +36,7 @@ Misc:
|
||||||
- Qt: Add hex index to palette view
|
- Qt: Add hex index to palette view
|
||||||
- Qt: Add transformation matrix info to sprite view
|
- Qt: Add transformation matrix info to sprite view
|
||||||
- Qt: Add per-page scrolling to memory view (fixes mgba.io/i/1795)
|
- 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)
|
0.8.2: (2020-06-14)
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
|
|
|
@ -400,6 +400,7 @@ void SettingsView::updateConfig() {
|
||||||
saveSetting("showFps", m_ui.showFps);
|
saveSetting("showFps", m_ui.showFps);
|
||||||
saveSetting("cheatAutoload", m_ui.cheatAutoload);
|
saveSetting("cheatAutoload", m_ui.cheatAutoload);
|
||||||
saveSetting("cheatAutosave", m_ui.cheatAutosave);
|
saveSetting("cheatAutosave", m_ui.cheatAutosave);
|
||||||
|
saveSetting("showFilename", m_ui.showFilename);
|
||||||
saveSetting("autoload", m_ui.autoload);
|
saveSetting("autoload", m_ui.autoload);
|
||||||
saveSetting("autosave", m_ui.autosave);
|
saveSetting("autosave", m_ui.autosave);
|
||||||
saveSetting("logToFile", m_ui.logToFile);
|
saveSetting("logToFile", m_ui.logToFile);
|
||||||
|
@ -574,6 +575,7 @@ void SettingsView::reloadConfig() {
|
||||||
loadSetting("showFps", m_ui.showFps, true);
|
loadSetting("showFps", m_ui.showFps, true);
|
||||||
loadSetting("cheatAutoload", m_ui.cheatAutoload, true);
|
loadSetting("cheatAutoload", m_ui.cheatAutoload, true);
|
||||||
loadSetting("cheatAutosave", m_ui.cheatAutosave, true);
|
loadSetting("cheatAutosave", m_ui.cheatAutosave, true);
|
||||||
|
loadSetting("showFilename", m_ui.showFilename, false);
|
||||||
loadSetting("autoload", m_ui.autoload, true);
|
loadSetting("autoload", m_ui.autoload, true);
|
||||||
loadSetting("autosave", m_ui.autosave, false);
|
loadSetting("autosave", m_ui.autosave, false);
|
||||||
loadSetting("logToFile", m_ui.logToFile);
|
loadSetting("logToFile", m_ui.logToFile);
|
||||||
|
|
|
@ -586,21 +586,21 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="1">
|
<item row="14" column="1">
|
||||||
<widget class="QCheckBox" name="useDiscordPresence">
|
<widget class="QCheckBox" name="useDiscordPresence">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable Discord Rich Presence</string>
|
<string>Enable Discord Rich Presence</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="14" column="0" colspan="2">
|
<item row="15" column="0" colspan="2">
|
||||||
<widget class="Line" name="line_13">
|
<widget class="Line" name="line_13">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="1">
|
<item row="16" column="1">
|
||||||
<widget class="QCheckBox" name="autosave">
|
<widget class="QCheckBox" name="autosave">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically save state</string>
|
<string>Automatically save state</string>
|
||||||
|
@ -610,7 +610,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="16" column="1">
|
<item row="17" column="1">
|
||||||
<widget class="QCheckBox" name="autoload">
|
<widget class="QCheckBox" name="autoload">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically load state</string>
|
<string>Automatically load state</string>
|
||||||
|
@ -620,14 +620,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="17" column="0" colspan="2">
|
<item row="18" column="0" colspan="2">
|
||||||
<widget class="Line" name="line_16">
|
<widget class="Line" name="line_16">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="18" column="1">
|
<item row="19" column="1">
|
||||||
<widget class="QCheckBox" name="cheatAutosave">
|
<widget class="QCheckBox" name="cheatAutosave">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically save cheats</string>
|
<string>Automatically save cheats</string>
|
||||||
|
@ -637,7 +637,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="19" column="1">
|
<item row="20" column="1">
|
||||||
<widget class="QCheckBox" name="cheatAutoload">
|
<widget class="QCheckBox" name="cheatAutoload">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Automatically load cheats</string>
|
<string>Automatically load cheats</string>
|
||||||
|
@ -647,7 +647,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="13" column="1">
|
||||||
<widget class="QCheckBox" name="showOSD">
|
<widget class="QCheckBox" name="showOSD">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show OSD messages</string>
|
<string>Show OSD messages</string>
|
||||||
|
@ -657,6 +657,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="12" column="1">
|
||||||
|
<widget class="QCheckBox" name="showFilename">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show filename instead of ROM name in title bar</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="emulation">
|
<widget class="QWidget" name="emulation">
|
||||||
|
|
|
@ -1030,18 +1030,25 @@ void Window::updateTitle(float fps) {
|
||||||
const NoIntroDB* db = GBAApp::app()->gameDB();
|
const NoIntroDB* db = GBAApp::app()->gameDB();
|
||||||
NoIntroGame game{};
|
NoIntroGame game{};
|
||||||
uint32_t crc32 = 0;
|
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;
|
mCore* core = m_controller->thread()->core;
|
||||||
core->getGameTitle(core, gameTitle);
|
core->checksum(m_controller->thread()->core, &crc32, CHECKSUM_CRC32);
|
||||||
title = gameTitle;
|
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
|
#ifdef USE_SQLITE3
|
||||||
if (db && crc32 && NoIntroDBLookupGameByCRC(db, crc32, &game)) {
|
if (db && crc32 && NoIntroDBLookupGameByCRC(db, crc32, &game)) {
|
||||||
title = QLatin1String(game.name);
|
title = QLatin1String(game.name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
MultiplayerController* multiplayer = m_controller->multiplayerController();
|
MultiplayerController* multiplayer = m_controller->multiplayerController();
|
||||||
if (multiplayer && multiplayer->attached() > 1) {
|
if (multiplayer && multiplayer->attached() > 1) {
|
||||||
title += tr(" - Player %1 of %2").arg(multiplayer->playerId(m_controller.get()) + 1).arg(multiplayer->attached());
|
title += tr(" - Player %1 of %2").arg(multiplayer->playerId(m_controller.get()) + 1).arg(multiplayer->attached());
|
||||||
|
|
Loading…
Reference in New Issue