From cda0f95464f1e2a7c9f1202b87c476bfb07ed6e1 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 26 Oct 2017 20:04:33 -0700 Subject: [PATCH] Qt: Add option to disable FPS display --- CHANGES | 1 + src/platform/qt/SettingsView.cpp | 2 ++ src/platform/qt/SettingsView.ui | 10 ++++++++++ src/platform/qt/Window.cpp | 14 +++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index fafa088ef..e41f9eef9 100644 --- a/CHANGES +++ b/CHANGES @@ -33,6 +33,7 @@ Misc: - Util: Don't build crc32 if the function already exists - GBA: Implement display start DMAs - Qt: Prevent window from being created off-screen + - Qt: Add option to disable FPS display 0.6.1: (2017-10-01) Bugfixes: diff --git a/src/platform/qt/SettingsView.cpp b/src/platform/qt/SettingsView.cpp index d17134563..14a58e175 100644 --- a/src/platform/qt/SettingsView.cpp +++ b/src/platform/qt/SettingsView.cpp @@ -337,6 +337,7 @@ void SettingsView::updateConfig() { saveSetting("libraryStyle", m_ui.libraryStyle->currentIndex()); saveSetting("showLibrary", m_ui.showLibrary); saveSetting("preload", m_ui.preload); + saveSetting("showFps", m_ui.showFps); if (m_ui.fastForwardUnbounded->isChecked()) { saveSetting("fastForwardRatio", "-1"); @@ -454,6 +455,7 @@ void SettingsView::reloadConfig() { loadSetting("patchPath", m_ui.patchPath); loadSetting("showLibrary", m_ui.showLibrary); loadSetting("preload", m_ui.preload); + loadSetting("showFps", m_ui.showFps, true); m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt()); diff --git a/src/platform/qt/SettingsView.ui b/src/platform/qt/SettingsView.ui index be801f5f3..1fabdd8cd 100644 --- a/src/platform/qt/SettingsView.ui +++ b/src/platform/qt/SettingsView.ui @@ -495,6 +495,16 @@ + + + + Show FPS in title bar + + + true + + + diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 95cf7c83f..0ffd22ab9 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -677,7 +677,9 @@ void Window::gameStarted() { #endif m_hitUnimplementedBiosCall = false; - m_fpsTimer.start(); + if (m_config->getOption("showFps", "1").toInt()) { + m_fpsTimer.start(); + } m_focusCheck.start(); if (m_display->underMouse()) { m_screenWidget->setCursor(Qt::BlankCursor); @@ -1585,6 +1587,16 @@ void Window::setupMenu(QMenuBar* menubar) { }, this); m_config->updateOption("preload"); + ConfigOption* showFps = m_config->addOption("showFps"); + showFps->connect([this](const QVariant& value) { + if (!value.toInt()) { + m_fpsTimer.stop(); + updateTitle(); + } else if (m_controller) { + m_fpsTimer.start(); + } + }, this); + QAction* exitFullScreen = new QAction(tr("Exit fullscreen"), frameMenu); connect(exitFullScreen, &QAction::triggered, this, &Window::exitFullScreen); exitFullScreen->setShortcut(QKeySequence("Esc"));