Qt: Window title updates can be disabled (closes #1912)
Vicki Pfau vi@endrift.com
Wed, 21 Oct 2020 19:34:55 -0700
4 files changed,
77 insertions(+),
20 deletions(-)
M
CHANGES
→
CHANGES
@@ -101,6 +101,7 @@ - Qt: Add hex index to palette view
- Qt: Add transformation matrix info to sprite view - Qt: Memory viewer now supports editing decimal values directly (closes mgba.io/i/1705) - Qt: Add copy button to GB printer dialog + - Qt: Window title updates can be disabled (closes mgba.io/i/1912) - Util: Reset vector size on deinit - VFS: Change semantics of VFile.sync on mapped files (fixes mgba.io/i/1730)
M
src/platform/qt/SettingsView.cpp
→
src/platform/qt/SettingsView.cpp
@@ -416,6 +416,7 @@ saveSetting("logToStdout", m_ui.logToStdout);
saveSetting("logFile", m_ui.logFile); saveSetting("useDiscordPresence", m_ui.useDiscordPresence); saveSetting("gba.audioHle", m_ui.audioHle); + saveSetting("dynamicTitle", m_ui.dynamicTitle); if (m_ui.audioBufferSize->currentText().toInt() > 8192) { m_ui.audioBufferSize->setCurrentText("8192");@@ -607,6 +608,7 @@ loadSetting("logToStdout", m_ui.logToStdout);
loadSetting("logFile", m_ui.logFile); loadSetting("useDiscordPresence", m_ui.useDiscordPresence); loadSetting("gba.audioHle", m_ui.audioHle); + loadSetting("dynamicTitle", m_ui.dynamicTitle); m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt());
M
src/platform/qt/SettingsView.ui
→
src/platform/qt/SettingsView.ui
@@ -577,30 +577,50 @@ </property>
</widget> </item> <item row="11" column="1"> - <widget class="QCheckBox" name="showFps"> + <widget class="QCheckBox" name="dynamicTitle"> <property name="text"> - <string>Show FPS in title bar</string> + <string>Dynamically update window title</string> </property> <property name="checked"> <bool>true</bool> </property> </widget> </item> - <item row="14" column="1"> + <item row="13" 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> + <item row="15" column="1"> + <widget class="QCheckBox" name="showOSD"> + <property name="text"> + <string>Show OSD messages</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="16" column="1"> <widget class="QCheckBox" name="useDiscordPresence"> <property name="text"> <string>Enable Discord Rich Presence</string> </property> </widget> </item> - <item row="15" column="0" colspan="2"> + <item row="17" column="0" colspan="2"> <widget class="Line" name="line_13"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="16" column="1"> + <item row="18" column="1"> <widget class="QCheckBox" name="autosave"> <property name="text"> <string>Automatically save state</string>@@ -610,7 +630,7 @@ <bool>true</bool>
</property> </widget> </item> - <item row="17" column="1"> + <item row="19" column="1"> <widget class="QCheckBox" name="autoload"> <property name="text"> <string>Automatically load state</string>@@ -620,14 +640,14 @@ <bool>true</bool>
</property> </widget> </item> - <item row="18" column="0" colspan="2"> + <item row="20" column="0" colspan="2"> <widget class="Line" name="line_16"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="19" column="1"> + <item row="21" column="1"> <widget class="QCheckBox" name="cheatAutosave"> <property name="text"> <string>Automatically save cheats</string>@@ -637,7 +657,7 @@ <bool>true</bool>
</property> </widget> </item> - <item row="20" column="1"> + <item row="22" column="1"> <widget class="QCheckBox" name="cheatAutoload"> <property name="text"> <string>Automatically load cheats</string>@@ -647,23 +667,20 @@ <bool>true</bool>
</property> </widget> </item> - <item row="13" column="1"> - <widget class="QCheckBox" name="showOSD"> + <item row="12" column="1"> + <widget class="QCheckBox" name="showFps"> <property name="text"> - <string>Show OSD messages</string> + <string>Show FPS in title bar</string> </property> <property name="checked"> <bool>true</bool> </property> </widget> </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> + <item row="14" column="0" colspan="2"> + <widget class="Line" name="line_18"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item>@@ -2003,6 +2020,38 @@ </hint>
<hint type="destinationlabel"> <x>20</x> <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>dynamicTitle</sender> + <signal>toggled(bool)</signal> + <receiver>showFps</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>366</x> + <y>381</y> + </hint> + <hint type="destinationlabel"> + <x>332</x> + <y>415</y> + </hint> + </hints> + </connection> + <connection> + <sender>dynamicTitle</sender> + <signal>toggled(bool)</signal> + <receiver>showFilename</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>366</x> + <y>381</y> + </hint> + <hint type="destinationlabel"> + <x>409</x> + <y>449</y> </hint> </hints> </connection>
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -1014,7 +1014,7 @@
void Window::updateTitle(float fps) { QString title; - if (m_controller) { + if (m_config->getOption("dynamicTitle", 1).toInt() && m_controller) { CoreController::Interrupter interrupter(m_controller); const NoIntroDB* db = GBAApp::app()->gameDB(); NoIntroGame game{};@@ -1626,6 +1626,11 @@ videoScale->connect([this](const QVariant& value) {
if (m_display) { m_display->setVideoScale(value.toInt()); } + }, this); + + ConfigOption* dynamicTitle = m_config->addOption("dynamicTitle"); + dynamicTitle->connect([this](const QVariant&) { + updateTitle(); }, this); m_actions.addHiddenAction(tr("Exit fullscreen"), "exitFullScreen", this, &Window::exitFullScreen, "frame", QKeySequence("Esc"));