Qt: Code cleanup
Jeffrey Pfau jeffrey@endrift.com
Mon, 10 Aug 2015 01:38:08 -0700
2 files changed,
9 insertions(+),
11 deletions(-)
M
src/platform/qt/DisplayGL.cpp
→
src/platform/qt/DisplayGL.cpp
@@ -244,9 +244,6 @@ }
void PainterGL::pause() { m_active = false; - if (!m_queue.isEmpty()) { - QMetaObject::invokeMethod(this, "pause", Qt::QueuedConnection); - } } void PainterGL::unpause() {
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -100,6 +100,14 @@ connect(m_controller, SIGNAL(gameStopped(GBAThread*)), this, SLOT(gameStopped()));
connect(m_controller, SIGNAL(gameStopped(GBAThread*)), &m_inputController, SLOT(resumeScreensaver())); connect(m_controller, SIGNAL(stateLoaded(GBAThread*)), m_display, SLOT(forceDraw())); connect(m_controller, SIGNAL(rewound(GBAThread*)), m_display, SLOT(forceDraw())); + connect(m_controller, &GameController::gamePaused, [this]() { + QImage currentImage(reinterpret_cast<const uchar*>(m_controller->drawContext()), VIDEO_HORIZONTAL_PIXELS, + VIDEO_VERTICAL_PIXELS, 1024, QImage::Format_RGB32); + QPixmap pixmap; + pixmap.convertFromImage(currentImage.rgbSwapped()); + m_screenWidget->setPixmap(pixmap); + m_screenWidget->setLockAspectRatio(3, 2); + }); connect(m_controller, SIGNAL(gamePaused(GBAThread*)), m_display, SLOT(pauseDrawing())); #ifndef Q_OS_MAC connect(m_controller, SIGNAL(gamePaused(GBAThread*)), menuBar(), SLOT(show()));@@ -827,13 +835,6 @@ pause->setShortcut(tr("Ctrl+P"));
connect(pause, SIGNAL(triggered(bool)), m_controller, SLOT(setPaused(bool))); connect(m_controller, &GameController::gamePaused, [this, pause]() { pause->setChecked(true); - - QImage currentImage(reinterpret_cast<const uchar*>(m_controller->drawContext()), VIDEO_HORIZONTAL_PIXELS, - VIDEO_VERTICAL_PIXELS, 1024, QImage::Format_RGB32); - QPixmap pixmap; - pixmap.convertFromImage(currentImage.rgbSwapped()); - m_screenWidget->setPixmap(pixmap); - m_screenWidget->setLockAspectRatio(3, 2); }); connect(m_controller, &GameController::gameUnpaused, [pause]() { pause->setChecked(false); }); m_gameActions.append(pause);@@ -1174,7 +1175,7 @@ }
void Window::attachWidget(QWidget* widget) { m_screenWidget->layout()->addWidget(widget); - unsetCursor(); + m_screenWidget->unsetCursor(); static_cast<QStackedLayout*>(m_screenWidget->layout())->setCurrentWidget(widget); }