From 11eab66247ed0ac13508921a9fd6b3a3ae14ed0e Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 31 Mar 2015 23:43:47 -0700 Subject: [PATCH] Qt: Move screenshot to GameController --- src/platform/qt/Display.h | 3 --- src/platform/qt/DisplayGL.cpp | 8 -------- src/platform/qt/DisplayGL.h | 3 --- src/platform/qt/GameController.cpp | 8 ++++++++ src/platform/qt/GameController.h | 4 ++++ src/platform/qt/Window.cpp | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/platform/qt/Display.h b/src/platform/qt/Display.h index 7cad04307..85e799c9e 100644 --- a/src/platform/qt/Display.h +++ b/src/platform/qt/Display.h @@ -26,9 +26,6 @@ public slots: virtual void forceDraw() = 0; virtual void lockAspectRatio(bool lock) = 0; virtual void filter(bool filter) = 0; -#ifdef USE_PNG - virtual void screenshot() = 0; -#endif }; } diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index 074639c95..f9847e5c5 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -117,14 +117,6 @@ void DisplayGL::filter(bool filter) { } } -#ifdef USE_PNG -void DisplayGL::screenshot() { - GBAThreadInterrupt(m_context); - GBAThreadTakeScreenshot(m_context); - GBAThreadContinue(m_context); -} -#endif - void DisplayGL::resizeEvent(QResizeEvent* event) { m_painter->resize(event->size()); } diff --git a/src/platform/qt/DisplayGL.h b/src/platform/qt/DisplayGL.h index e7c0b9bc6..d247c8de0 100644 --- a/src/platform/qt/DisplayGL.h +++ b/src/platform/qt/DisplayGL.h @@ -31,9 +31,6 @@ public slots: void forceDraw(); void lockAspectRatio(bool lock); void filter(bool filter); -#ifdef USE_PNG - void screenshot(); -#endif protected: virtual void paintEvent(QPaintEvent*) override {}; diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index 38bcc0ff8..20d8e30a1 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -520,6 +520,14 @@ void GameController::clearAVStream() { threadContinue(); } +#ifdef USE_PNG +void GameController::screenshot() { + GBAThreadInterrupt(&m_threadContext); + GBAThreadTakeScreenshot(&m_threadContext); + GBAThreadContinue(&m_threadContext); +} +#endif + void GameController::reloadAudioDriver() { QMetaObject::invokeMethod(m_audioProcessor, "pause", Qt::BlockingQueuedConnection); int samples = m_audioProcessor->getBufferSamples(); diff --git a/src/platform/qt/GameController.h b/src/platform/qt/GameController.h index a7036f7f8..0869a59a0 100644 --- a/src/platform/qt/GameController.h +++ b/src/platform/qt/GameController.h @@ -119,6 +119,10 @@ public slots: void clearAVStream(); void reloadAudioDriver(); +#ifdef USE_PNG + void screenshot(); +#endif + void setLuminanceValue(uint8_t value); uint8_t luminanceValue() const { return m_luxValue; } void setLuminanceLevel(int level); diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 1eb8b52ad..979ad8f6f 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -738,7 +738,7 @@ void Window::setupMenu(QMenuBar* menubar) { #ifdef USE_PNG QAction* screenshot = new QAction(tr("Take &screenshot"), avMenu); screenshot->setShortcut(tr("F12")); - connect(screenshot, SIGNAL(triggered()), m_display, SLOT(screenshot())); + connect(screenshot, SIGNAL(triggered()), m_controller, SLOT(screenshot())); m_gameActions.append(screenshot); addControlledAction(avMenu, screenshot, "screenshot"); #endif