Qt: Window title updates can be disabled (closes #1912)

This commit is contained in:
Vicki Pfau 2020-10-21 19:34:55 -07:00
parent c134c6cae1
commit 659b929f3e
4 changed files with 124 additions and 67 deletions

View File

@ -101,6 +101,7 @@ Misc:
- Qt: Add transformation matrix info to sprite view - Qt: Add transformation matrix info to sprite view
- Qt: Memory viewer now supports editing decimal values directly (closes mgba.io/i/1705) - Qt: Memory viewer now supports editing decimal values directly (closes mgba.io/i/1705)
- Qt: Add copy button to GB printer dialog - 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 - Util: Reset vector size on deinit
- VFS: Change semantics of VFile.sync on mapped files (fixes mgba.io/i/1730) - VFS: Change semantics of VFile.sync on mapped files (fixes mgba.io/i/1730)

View File

@ -416,6 +416,7 @@ void SettingsView::updateConfig() {
saveSetting("logFile", m_ui.logFile); saveSetting("logFile", m_ui.logFile);
saveSetting("useDiscordPresence", m_ui.useDiscordPresence); saveSetting("useDiscordPresence", m_ui.useDiscordPresence);
saveSetting("gba.audioHle", m_ui.audioHle); saveSetting("gba.audioHle", m_ui.audioHle);
saveSetting("dynamicTitle", m_ui.dynamicTitle);
if (m_ui.audioBufferSize->currentText().toInt() > 8192) { if (m_ui.audioBufferSize->currentText().toInt() > 8192) {
m_ui.audioBufferSize->setCurrentText("8192"); m_ui.audioBufferSize->setCurrentText("8192");
@ -607,6 +608,7 @@ void SettingsView::reloadConfig() {
loadSetting("logFile", m_ui.logFile); loadSetting("logFile", m_ui.logFile);
loadSetting("useDiscordPresence", m_ui.useDiscordPresence); loadSetting("useDiscordPresence", m_ui.useDiscordPresence);
loadSetting("gba.audioHle", m_ui.audioHle); loadSetting("gba.audioHle", m_ui.audioHle);
loadSetting("dynamicTitle", m_ui.dynamicTitle);
m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt()); m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt());

View File

@ -577,70 +577,9 @@
</widget> </widget>
</item> </item>
<item row="11" column="1"> <item row="11" column="1">
<widget class="QCheckBox" name="showFps"> <widget class="QCheckBox" name="dynamicTitle">
<property name="text"> <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">
<widget class="QCheckBox" name="useDiscordPresence">
<property name="text">
<string>Enable Discord Rich Presence</string>
</property>
</widget>
</item>
<item row="15" 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">
<widget class="QCheckBox" name="autosave">
<property name="text">
<string>Automatically save state</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QCheckBox" name="autoload">
<property name="text">
<string>Automatically load state</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="18" 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">
<widget class="QCheckBox" name="cheatAutosave">
<property name="text">
<string>Automatically save cheats</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="20" column="1">
<widget class="QCheckBox" name="cheatAutoload">
<property name="text">
<string>Automatically load cheats</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@ -648,6 +587,16 @@
</widget> </widget>
</item> </item>
<item row="13" 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"> <widget class="QCheckBox" name="showOSD">
<property name="text"> <property name="text">
<string>Show OSD messages</string> <string>Show OSD messages</string>
@ -657,16 +606,84 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1"> <item row="16" column="1">
<widget class="QCheckBox" name="showFilename"> <widget class="QCheckBox" name="useDiscordPresence">
<property name="text"> <property name="text">
<string>Show filename instead of ROM name in title bar</string> <string>Enable Discord Rich Presence</string>
</property>
</widget>
</item>
<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="18" column="1">
<widget class="QCheckBox" name="autosave">
<property name="text">
<string>Automatically save state</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="19" column="1">
<widget class="QCheckBox" name="autoload">
<property name="text">
<string>Automatically load state</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<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="21" column="1">
<widget class="QCheckBox" name="cheatAutosave">
<property name="text">
<string>Automatically save cheats</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="22" column="1">
<widget class="QCheckBox" name="cheatAutoload">
<property name="text">
<string>Automatically load cheats</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="showFps">
<property name="text">
<string>Show FPS in title bar</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="0" colspan="2">
<widget class="Line" name="line_18">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="emulation"> <widget class="QWidget" name="emulation">
@ -2006,5 +2023,37 @@
</hint> </hint>
</hints> </hints>
</connection> </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>
</connections> </connections>
</ui> </ui>

View File

@ -1014,7 +1014,7 @@ void Window::showFPS() {
void Window::updateTitle(float fps) { void Window::updateTitle(float fps) {
QString title; QString title;
if (m_controller) { if (m_config->getOption("dynamicTitle", 1).toInt() && m_controller) {
CoreController::Interrupter interrupter(m_controller); CoreController::Interrupter interrupter(m_controller);
const NoIntroDB* db = GBAApp::app()->gameDB(); const NoIntroDB* db = GBAApp::app()->gameDB();
NoIntroGame game{}; NoIntroGame game{};
@ -1628,6 +1628,11 @@ void Window::setupMenu(QMenuBar* menubar) {
} }
}, this); }, 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")); m_actions.addHiddenAction(tr("Exit fullscreen"), "exitFullScreen", this, &Window::exitFullScreen, "frame", QKeySequence("Esc"));
m_actions.addHeldAction(tr("GameShark Button (held)"), "holdGSButton", [this](bool held) { m_actions.addHeldAction(tr("GameShark Button (held)"), "holdGSButton", [this](bool held) {