all repos — mgba @ 1f58db096f12dfe655fd81fc8729c704e581b676

mGBA Game Boy Advance Emulator

Qt: Code cleanup
Jeffrey Pfau jeffrey@endrift.com
Mon, 10 Aug 2015 01:38:08 -0700
commit

1f58db096f12dfe655fd81fc8729c704e581b676

parent

9352f75e6fa0cd4e2f6b482ef2f8cc3e62626e25

2 files changed, 9 insertions(+), 11 deletions(-)

jump to
M src/platform/qt/DisplayGL.cppsrc/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.cppsrc/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); }