From 6cbcc9cc591d2e7ae3c3b515bfd35f7665208e1c Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sun, 24 Jan 2021 12:30:42 -0500 Subject: [PATCH] Added logic to save the video auto scaling config setting between restarts of Qt GUI. This addresses part of issue #311. --- src/drivers/Qt/ConsoleVideoConf.cpp | 21 +++++++++++++++++++++ src/drivers/Qt/ConsoleVideoConf.h | 1 + src/drivers/Qt/ConsoleViewerGL.cpp | 4 ++++ src/drivers/Qt/ConsoleViewerSDL.cpp | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/src/drivers/Qt/ConsoleVideoConf.cpp b/src/drivers/Qt/ConsoleVideoConf.cpp index 65b26bce..54033adc 100644 --- a/src/drivers/Qt/ConsoleVideoConf.cpp +++ b/src/drivers/Qt/ConsoleVideoConf.cpp @@ -164,6 +164,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent) connect(clipSidesCbx, SIGNAL(stateChanged(int)), this, SLOT(clipSidesChanged(int)) ); connect(showFPS_cbx , SIGNAL(stateChanged(int)), this, SLOT(showFPSChanged(int)) ); connect(sqrPixCbx , SIGNAL(stateChanged(int)), this, SLOT(sqrPixChanged(int)) ); + connect(autoScaleCbx, SIGNAL(stateChanged(int)), this, SLOT(autoScaleChanged(int)) ); main_vbox->addWidget( new_PPU_ena ); main_vbox->addWidget( frmskipcbx ); @@ -309,6 +310,26 @@ void ConsoleVideoConfDialog_t::openGL_linearFilterChanged( int value ) } } } +//---------------------------------------------------- +void ConsoleVideoConfDialog_t::autoScaleChanged( int value ) +{ + bool opt = (value != Qt::Unchecked); + g_config->setOption("SDL.AutoScale", opt ); + g_config->save (); + + if ( consoleWindow != NULL ) + { + if ( consoleWindow->viewport_GL ) + { + consoleWindow->viewport_GL->setAutoScaleOpt( opt ); + } + if ( consoleWindow->viewport_SDL ) + { + consoleWindow->viewport_SDL->setAutoScaleOpt( opt ); + } + } +} + //---------------------------------------------------- void ConsoleVideoConfDialog_t::use_new_PPU_changed( int value ) { diff --git a/src/drivers/Qt/ConsoleVideoConf.h b/src/drivers/Qt/ConsoleVideoConf.h index d65b4628..cf7e7b62 100644 --- a/src/drivers/Qt/ConsoleVideoConf.h +++ b/src/drivers/Qt/ConsoleVideoConf.h @@ -56,6 +56,7 @@ class ConsoleVideoConfDialog_t : public QDialog private slots: void openGL_linearFilterChanged( int value ); + void autoScaleChanged( int value ); void sqrPixChanged( int value ); void use_new_PPU_changed( int value ); void frameskip_changed( int value ); diff --git a/src/drivers/Qt/ConsoleViewerGL.cpp b/src/drivers/Qt/ConsoleViewerGL.cpp index c0e95fa8..5517043a 100644 --- a/src/drivers/Qt/ConsoleViewerGL.cpp +++ b/src/drivers/Qt/ConsoleViewerGL.cpp @@ -79,6 +79,10 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent) g_config->getOption("SDL.OpenGLip", &opt ); linearFilter = (opt) ? true : false; + + g_config->getOption ("SDL.AutoScale", &opt); + + autoScaleEna = (opt) ? true : false; } } diff --git a/src/drivers/Qt/ConsoleViewerSDL.cpp b/src/drivers/Qt/ConsoleViewerSDL.cpp index 44a22522..bf81dc56 100644 --- a/src/drivers/Qt/ConsoleViewerSDL.cpp +++ b/src/drivers/Qt/ConsoleViewerSDL.cpp @@ -82,6 +82,10 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent) g_config->getOption("SDL.OpenGLip", &opt ); linearFilter = (opt) ? true : false; + + g_config->getOption ("SDL.AutoScale", &opt); + + autoScaleEna = (opt) ? true : false; } }