From 6ae02d05536568c6139b201c72db41a126451235 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 20 Jan 2020 18:21:37 -0800 Subject: [PATCH] Qt: Fix record A/V window not updating resolution (fixes #1626) --- CHANGES | 1 + src/platform/qt/VideoView.cpp | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 32c24ac18..7ed6423b0 100644 --- a/CHANGES +++ b/CHANGES @@ -115,6 +115,7 @@ Other fixes: - Qt: Fix inability to clear default keybindings - Qt: Release held actions if they get rebound - Qt: Fix crash double-clicking menus in shortcut settings (fixes mgba.io/i/1627) + - Qt: Fix record A/V window not updating resolution (fixes mgba.io/i/1626) - Vita: Fix analog controls (fixes mgba.io/i/1554) - Wii: Fix game fast-forwarding after slowing down - Wii: Improve audio buffering (fixes mgba.io/i/1617) diff --git a/src/platform/qt/VideoView.cpp b/src/platform/qt/VideoView.cpp index 42d00f587..94557900c 100644 --- a/src/platform/qt/VideoView.cpp +++ b/src/platform/qt/VideoView.cpp @@ -197,11 +197,15 @@ VideoView::~VideoView() { } void VideoView::setController(std::shared_ptr controller) { - connect(controller.get(), &CoreController::stopping, this, &VideoView::stopRecording); - connect(this, &VideoView::recordingStarted, controller.get(), &CoreController::setAVStream); - connect(this, &VideoView::recordingStopped, controller.get(), &CoreController::clearAVStream, Qt::DirectConnection); + CoreController* controllerPtr = controller.get(); + connect(controllerPtr, &CoreController::frameAvailable, this, [this, controllerPtr]() { + setNativeResolution(controllerPtr->screenDimensions()); + }); + connect(controllerPtr, &CoreController::stopping, this, &VideoView::stopRecording); + connect(this, &VideoView::recordingStarted, controllerPtr, &CoreController::setAVStream); + connect(this, &VideoView::recordingStopped, controllerPtr, &CoreController::clearAVStream, Qt::DirectConnection); - setNativeResolution(controller->screenDimensions()); + setNativeResolution(controllerPtr->screenDimensions()); } void VideoView::startRecording() { @@ -225,6 +229,9 @@ void VideoView::stopRecording() { } void VideoView::setNativeResolution(const QSize& dims) { + if (dims.width() == m_nativeWidth && dims.height() == m_nativeHeight) { + return; + } m_nativeWidth = dims.width(); m_nativeHeight = dims.height(); m_ui.presetNative->setText(tr("Native (%0x%1)").arg(m_nativeWidth).arg(m_nativeHeight));