Added logic to Qt GUI to save off window size and video scaling parameters at application exit so that they can be used at startup to restore window to same size it was previously.
This commit is contained in:
parent
6cbcc9cc59
commit
7ce62ebee3
|
@ -83,6 +83,9 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
g_config->getOption ("SDL.AutoScale", &opt);
|
||||
|
||||
autoScaleEna = (opt) ? true : false;
|
||||
|
||||
g_config->getOption("SDL.XScale", &xscale);
|
||||
g_config->getOption("SDL.YScale", &yscale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,9 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
g_config->getOption ("SDL.AutoScale", &opt);
|
||||
|
||||
autoScaleEna = (opt) ? true : false;
|
||||
|
||||
g_config->getOption("SDL.XScale", &xscale);
|
||||
g_config->getOption("SDL.YScale", &yscale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,6 +276,9 @@ void ConsoleViewSDL_t::resizeEvent(QResizeEvent *event)
|
|||
view_height = s.height();
|
||||
printf("SDL Resize: %i x %i \n", view_width, view_height);
|
||||
|
||||
gui_draw_area_width = view_width;
|
||||
gui_draw_area_height = view_height;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -82,11 +82,17 @@
|
|||
consoleWin_t::consoleWin_t(QWidget *parent)
|
||||
: QMainWindow( parent )
|
||||
{
|
||||
int opt;
|
||||
int opt, xWinSize = 512, yWinSize = 512;
|
||||
int use_SDL_video = false;
|
||||
int setFullScreen = false;
|
||||
|
||||
this->resize( 512, 512 );
|
||||
g_config->getOption( "SDL.WinSizeX", &xWinSize );
|
||||
g_config->getOption( "SDL.WinSizeY", &yWinSize );
|
||||
|
||||
if ( xWinSize < 256 ) xWinSize = 256;
|
||||
if ( yWinSize < 256 ) yWinSize = 256;
|
||||
|
||||
this->resize( xWinSize, yWinSize );
|
||||
|
||||
g_config->getOption( "SDL.Fullscreen", &setFullScreen );
|
||||
g_config->setOption( "SDL.Fullscreen", 0 ); // Reset full screen config parameter to false so it is never saved this way
|
||||
|
@ -152,8 +158,27 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
|||
|
||||
consoleWin_t::~consoleWin_t(void)
|
||||
{
|
||||
QSize w;
|
||||
QClipboard *clipboard;
|
||||
|
||||
// Save window size and image scaling parameters at app exit.
|
||||
w = consoleWindow->size();
|
||||
|
||||
if ( viewport_GL != NULL )
|
||||
{
|
||||
g_config->setOption( "SDL.XScale", viewport_GL->getScaleX() );
|
||||
g_config->setOption( "SDL.YScale", viewport_GL->getScaleY() );
|
||||
}
|
||||
else if ( viewport_SDL != NULL )
|
||||
{
|
||||
g_config->setOption( "SDL.XScale", viewport_SDL->getScaleX() );
|
||||
g_config->setOption( "SDL.YScale", viewport_SDL->getScaleY() );
|
||||
}
|
||||
g_config->setOption( "SDL.WinSizeX", w.width() );
|
||||
g_config->setOption( "SDL.WinSizeY", w.height() );
|
||||
g_config->save();
|
||||
|
||||
// Signal Emulator Thread to Stop
|
||||
nes_shm->runEmulator = 0;
|
||||
|
||||
gameTimer->stop();
|
||||
|
|
|
@ -225,11 +225,13 @@ InitConfig()
|
|||
config->addOption('y', "yres", "SDL.YResolution", 0);
|
||||
config->addOption("SDL.LastXRes", 0);
|
||||
config->addOption("SDL.LastYRes", 0);
|
||||
config->addOption("SDL.WinSizeX", 512);
|
||||
config->addOption("SDL.WinSizeY", 512);
|
||||
config->addOption("doublebuf", "SDL.DoubleBuffering", 1);
|
||||
config->addOption("autoscale", "SDL.AutoScale", 1);
|
||||
config->addOption("keepratio", "SDL.KeepRatio", 1);
|
||||
config->addOption("xscale", "SDL.XScale", 1.0);
|
||||
config->addOption("yscale", "SDL.YScale", 1.0);
|
||||
config->addOption("xscale", "SDL.XScale", 2.0);
|
||||
config->addOption("yscale", "SDL.YScale", 2.0);
|
||||
config->addOption("xstretch", "SDL.XStretch", 0);
|
||||
config->addOption("ystretch", "SDL.YStretch", 0);
|
||||
config->addOption("noframe", "SDL.NoFrame", 0);
|
||||
|
|
Loading…
Reference in New Issue