Qt: Move screenshot to GameController

This commit is contained in:
Jeffrey Pfau 2015-03-31 23:43:47 -07:00
parent 0d6cc88f9f
commit 11eab66247
6 changed files with 13 additions and 15 deletions

View File

@ -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
};
}

View File

@ -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());
}

View File

@ -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 {};

View File

@ -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();

View File

@ -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);

View File

@ -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