Qt: Fix record A/V window not updating resolution (fixes #1626)

This commit is contained in:
Vicki Pfau 2020-01-20 18:21:37 -08:00
parent e53df9759e
commit 6ae02d0553
2 changed files with 12 additions and 4 deletions

View File

@ -115,6 +115,7 @@ Other fixes:
- Qt: Fix inability to clear default keybindings - Qt: Fix inability to clear default keybindings
- Qt: Release held actions if they get rebound - Qt: Release held actions if they get rebound
- Qt: Fix crash double-clicking menus in shortcut settings (fixes mgba.io/i/1627) - 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) - Vita: Fix analog controls (fixes mgba.io/i/1554)
- Wii: Fix game fast-forwarding after slowing down - Wii: Fix game fast-forwarding after slowing down
- Wii: Improve audio buffering (fixes mgba.io/i/1617) - Wii: Improve audio buffering (fixes mgba.io/i/1617)

View File

@ -197,11 +197,15 @@ VideoView::~VideoView() {
} }
void VideoView::setController(std::shared_ptr<CoreController> controller) { void VideoView::setController(std::shared_ptr<CoreController> controller) {
connect(controller.get(), &CoreController::stopping, this, &VideoView::stopRecording); CoreController* controllerPtr = controller.get();
connect(this, &VideoView::recordingStarted, controller.get(), &CoreController::setAVStream); connect(controllerPtr, &CoreController::frameAvailable, this, [this, controllerPtr]() {
connect(this, &VideoView::recordingStopped, controller.get(), &CoreController::clearAVStream, Qt::DirectConnection); 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() { void VideoView::startRecording() {
@ -225,6 +229,9 @@ void VideoView::stopRecording() {
} }
void VideoView::setNativeResolution(const QSize& dims) { void VideoView::setNativeResolution(const QSize& dims) {
if (dims.width() == m_nativeWidth && dims.height() == m_nativeHeight) {
return;
}
m_nativeWidth = dims.width(); m_nativeWidth = dims.width();
m_nativeHeight = dims.height(); m_nativeHeight = dims.height();
m_ui.presetNative->setText(tr("Native (%0x%1)").arg(m_nativeWidth).arg(m_nativeHeight)); m_ui.presetNative->setText(tr("Native (%0x%1)").arg(m_nativeWidth).arg(m_nativeHeight));