Config: Move the 'Display' settings from ConfigManager to the layered config system

This commit is contained in:
iwubcode
2019-03-02 22:41:50 -06:00
parent 735a705e4d
commit 840afc2ad4
15 changed files with 83 additions and 100 deletions

View File

@ -930,20 +930,20 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
Discord::UpdateDiscordPresence();
#endif
if (SConfig::GetInstance().bFullscreen)
if (Config::Get(Config::MAIN_FULLSCREEN))
m_fullscreen_requested = true;
#ifdef Q_OS_WIN
// Prevents Windows from sleeping, turning off the display, or idling
EXECUTION_STATE shouldScreenSave =
SConfig::GetInstance().bDisableScreenSaver ? ES_DISPLAY_REQUIRED : 0;
Config::Get(Config::MAIN_DISABLE_SCREENSAVER) ? ES_DISPLAY_REQUIRED : 0;
SetThreadExecutionState(ES_CONTINUOUS | shouldScreenSave | ES_SYSTEM_REQUIRED);
#endif
}
void MainWindow::SetFullScreenResolution(bool fullscreen)
{
if (SConfig::GetInstance().strFullscreenResolution == "Auto")
if (Config::Get(Config::MAIN_FULLSCREEN_DISPLAY_RES) == "Auto")
return;
#ifdef _WIN32
@ -956,7 +956,7 @@ void MainWindow::SetFullScreenResolution(bool fullscreen)
DEVMODE screen_settings;
memset(&screen_settings, 0, sizeof(screen_settings));
screen_settings.dmSize = sizeof(screen_settings);
sscanf(SConfig::GetInstance().strFullscreenResolution.c_str(), "%dx%d",
sscanf(Config::Get(Config::MAIN_FULLSCREEN_DISPLAY_RES).c_str(), "%dx%d",
&screen_settings.dmPelsWidth, &screen_settings.dmPelsHeight);
screen_settings.dmBitsPerPel = 32;
screen_settings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
@ -974,7 +974,7 @@ void MainWindow::ShowRenderWidget()
SetFullScreenResolution(false);
Host::GetInstance()->SetRenderFullscreen(false);
if (SConfig::GetInstance().bRenderToMain)
if (Config::Get(Config::MAIN_RENDER_TO_MAIN))
{
// If we're rendering to main, add it to the stack and update our title when necessary.
m_rendering_to_main = true;