From 659b929f3e58d50762f3054ba634877e458cdb4c Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 21 Oct 2020 19:34:55 -0700 Subject: [PATCH] Qt: Window title updates can be disabled (closes #1912) --- CHANGES | 1 + src/platform/qt/SettingsView.cpp | 2 + src/platform/qt/SettingsView.ui | 181 ++++++++++++++++++++----------- src/platform/qt/Window.cpp | 7 +- 4 files changed, 124 insertions(+), 67 deletions(-) diff --git a/CHANGES b/CHANGES index 3a7d81c29..ae415c477 100644 --- a/CHANGES +++ b/CHANGES @@ -101,6 +101,7 @@ Misc: - 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) diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index 13bd7042c..c4e699a9d 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -416,6 +416,7 @@ void SettingsView::updateConfig() { 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 @@ void SettingsView::reloadConfig() { 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()); diff --git a/src/platform/qt/SettingsView.ui b/src/platform/qt/SettingsView.ui index 166810adc..46ab4861e 100644 --- a/src/platform/qt/SettingsView.ui +++ b/src/platform/qt/SettingsView.ui @@ -577,70 +577,9 @@ - + - Show FPS in title bar - - - true - - - - - - - Enable Discord Rich Presence - - - - - - - Qt::Horizontal - - - - - - - Automatically save state - - - true - - - - - - - Automatically load state - - - true - - - - - - - Qt::Horizontal - - - - - - - Automatically save cheats - - - true - - - - - - - Automatically load cheats + Dynamically update window title true @@ -648,6 +587,16 @@ + + + Show filename instead of ROM name in title bar + + + true + + + + Show OSD messages @@ -657,16 +606,84 @@ - - + + - Show filename instead of ROM name in title bar + Enable Discord Rich Presence + + + + + + + Qt::Horizontal + + + + + + + Automatically save state true + + + + Automatically load state + + + true + + + + + + + Qt::Horizontal + + + + + + + Automatically save cheats + + + true + + + + + + + Automatically load cheats + + + true + + + + + + + Show FPS in title bar + + + true + + + + + + + Qt::Horizontal + + + @@ -2006,5 +2023,37 @@ + + dynamicTitle + toggled(bool) + showFps + setEnabled(bool) + + + 366 + 381 + + + 332 + 415 + + + + + dynamicTitle + toggled(bool) + showFilename + setEnabled(bool) + + + 366 + 381 + + + 409 + 449 + + + diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 2052bfef4..d8c69bf89 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -1014,7 +1014,7 @@ void Window::showFPS() { 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{}; @@ -1628,6 +1628,11 @@ void Window::setupMenu(QMenuBar* menubar) { } }, 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.addHeldAction(tr("GameShark Button (held)"), "holdGSButton", [this](bool held) {