From 4cf401c3910f8a9cce6de621f555d29f5b20cb57 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 25 Aug 2019 19:22:03 -0700 Subject: [PATCH] Qt: Only show emulator restart warning once per settings saving --- CHANGES | 1 + src/platform/qt/Window.cpp | 6 ++++++ src/platform/qt/Window.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/CHANGES b/CHANGES index e4c9342cc..d29c03f5f 100644 --- a/CHANGES +++ b/CHANGES @@ -52,6 +52,7 @@ Other fixes: - Qt: Fix race conditions initializing GDB stub - GBA: Set up GPIO mapping on null and ELF ROM regions (fixes mgba.io/i/1481) - GBA Cheats: Fix value incrementing in CB slide codes (fixes mgba.io/i/1501) + - Qt: Only show emulator restart warning once per settings saving Misc: - GBA Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index b1eea01d5..da1e79c30 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -152,6 +152,8 @@ Window::Window(CoreManager* manager, ConfigController* config, int playerId, QWi m_log.load(m_config); m_fpsTimer.setInterval(FPS_TIMER_INTERVAL); m_focusCheck.setInterval(200); + m_mustRestart.setInterval(MUST_RESTART_TIMEOUT); + m_mustRestart.setSingleShot(true); m_shortcutController->setConfigController(m_config); m_shortcutController->setActionMapper(&m_actions); @@ -970,6 +972,10 @@ void Window::tryMakePortable() { } void Window::mustRestart() { + if (m_mustRestart.isActive()) { + return; + } + m_mustRestart.start(); QMessageBox* dialog = new QMessageBox(QMessageBox::Warning, tr("Restart needed"), tr("Some changes will not take effect until the emulator is restarted."), QMessageBox::Ok, this, Qt::Sheet); diff --git a/src/platform/qt/Window.h b/src/platform/qt/Window.h index b49185740..97fb744f1 100644 --- a/src/platform/qt/Window.h +++ b/src/platform/qt/Window.h @@ -145,6 +145,7 @@ private slots: private: static const int FPS_TIMER_INTERVAL = 2000; + static const int MUST_RESTART_TIMEOUT = 10000; void setupMenu(QMenuBar*); void openStateWindow(LoadSave); @@ -199,6 +200,7 @@ private: QList m_frameList; QElapsedTimer m_frameTimer; QTimer m_fpsTimer; + QTimer m_mustRestart; QList m_mruFiles; ShortcutController* m_shortcutController; #if defined(BUILD_GL) || defined(BUILD_GLES2)