mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Config: Move the 'Display' settings from ConfigManager to the layered config system
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
@ -59,7 +60,7 @@ void GeneralWidget::CreateWidgets()
|
||||
Config::GFX_ASPECT_RATIO);
|
||||
m_adapter_combo = new QComboBox;
|
||||
m_enable_vsync = new GraphicsBool(tr("V-Sync"), Config::GFX_VSYNC);
|
||||
m_enable_fullscreen = new QCheckBox(tr("Use Fullscreen"));
|
||||
m_enable_fullscreen = new GraphicsBool(tr("Use Fullscreen"), Config::MAIN_FULLSCREEN);
|
||||
|
||||
m_video_box->setLayout(m_video_layout);
|
||||
|
||||
@ -87,10 +88,11 @@ void GeneralWidget::CreateWidgets()
|
||||
m_show_ping = new GraphicsBool(tr("Show NetPlay Ping"), Config::GFX_SHOW_NETPLAY_PING);
|
||||
m_log_render_time =
|
||||
new GraphicsBool(tr("Log Render Time to File"), Config::GFX_LOG_RENDER_TIME_TO_FILE);
|
||||
m_autoadjust_window_size = new QCheckBox(tr("Auto-Adjust Window Size"));
|
||||
m_autoadjust_window_size =
|
||||
new GraphicsBool(tr("Auto-Adjust Window Size"), Config::MAIN_RENDER_WINDOW_AUTOSIZE);
|
||||
m_show_messages =
|
||||
new GraphicsBool(tr("Show NetPlay Messages"), Config::GFX_SHOW_NETPLAY_MESSAGES);
|
||||
m_render_main_window = new QCheckBox(tr("Render to Main Window"));
|
||||
m_render_main_window = new GraphicsBool(tr("Render to Main Window"), Config::MAIN_RENDER_TO_MAIN);
|
||||
|
||||
m_options_box->setLayout(m_options_layout);
|
||||
|
||||
@ -143,9 +145,6 @@ void GeneralWidget::ConnectWidgets()
|
||||
g_Config.iAdapter = index;
|
||||
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
|
||||
});
|
||||
|
||||
for (QCheckBox* checkbox : {m_enable_fullscreen, m_render_main_window, m_autoadjust_window_size})
|
||||
connect(checkbox, &QCheckBox::toggled, this, &GeneralWidget::SaveSettings);
|
||||
}
|
||||
|
||||
void GeneralWidget::LoadSettings()
|
||||
@ -153,15 +152,6 @@ void GeneralWidget::LoadSettings()
|
||||
// Video Backend
|
||||
m_backend_combo->setCurrentIndex(m_backend_combo->findData(
|
||||
QVariant(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend))));
|
||||
|
||||
// Enable Fullscreen
|
||||
m_enable_fullscreen->setChecked(SConfig::GetInstance().bFullscreen);
|
||||
|
||||
// Render to Main Window
|
||||
m_render_main_window->setChecked(SConfig::GetInstance().bRenderToMain);
|
||||
|
||||
// Autoadjust window size
|
||||
m_autoadjust_window_size->setChecked(SConfig::GetInstance().bRenderWindowAutoSize);
|
||||
}
|
||||
|
||||
void GeneralWidget::SaveSettings()
|
||||
@ -190,13 +180,6 @@ void GeneralWidget::SaveSettings()
|
||||
}
|
||||
emit BackendChanged(QString::fromStdString(current_backend));
|
||||
}
|
||||
|
||||
// Enable Fullscreen
|
||||
SConfig::GetInstance().bFullscreen = m_enable_fullscreen->isChecked();
|
||||
// Autoadjust window size
|
||||
SConfig::GetInstance().bRenderWindowAutoSize = m_autoadjust_window_size->isChecked();
|
||||
// Render To Main
|
||||
SConfig::GetInstance().bRenderToMain = m_render_main_window->isChecked();
|
||||
}
|
||||
|
||||
void GeneralWidget::OnEmulationStateChanged(bool running)
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "Common/Common.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/PPCDebugInterface.h"
|
||||
@ -58,7 +59,7 @@ void Host::SetRenderFocus(bool focus)
|
||||
m_render_focus = focus;
|
||||
if (g_renderer && m_render_fullscreen && g_ActiveConfig.ExclusiveFullscreenEnabled())
|
||||
Core::RunAsCPUThread([focus] {
|
||||
if (!SConfig::GetInstance().bRenderToMain)
|
||||
if (!Config::Get(Config::MAIN_RENDER_TO_MAIN))
|
||||
g_renderer->SetFullscreen(focus);
|
||||
});
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "imgui.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/State.h"
|
||||
@ -44,14 +45,15 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
||||
|
||||
connect(Host::GetInstance(), &Host::RequestTitle, this, &RenderWidget::setWindowTitle);
|
||||
connect(Host::GetInstance(), &Host::RequestRenderSize, this, [this](int w, int h) {
|
||||
if (!SConfig::GetInstance().bRenderWindowAutoSize || isFullScreen() || isMaximized())
|
||||
if (!Config::Get(Config::MAIN_RENDER_WINDOW_AUTOSIZE) || isFullScreen() || isMaximized())
|
||||
return;
|
||||
|
||||
resize(w, h);
|
||||
});
|
||||
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
|
||||
SetFillBackground(SConfig::GetInstance().bRenderToMain && state == Core::State::Uninitialized);
|
||||
SetFillBackground(Config::Get(Config::MAIN_RENDER_TO_MAIN) &&
|
||||
state == Core::State::Uninitialized);
|
||||
if (state == Core::State::Running)
|
||||
SetImGuiKeyMap();
|
||||
});
|
||||
|
@ -219,13 +219,13 @@ void Settings::SetKeepWindowOnTop(bool top)
|
||||
if (IsKeepWindowOnTopEnabled() == top)
|
||||
return;
|
||||
|
||||
SConfig::GetInstance().bKeepWindowOnTop = top;
|
||||
Config::SetBaseOrCurrent(Config::MAIN_KEEP_WINDOW_ON_TOP, top);
|
||||
emit KeepWindowOnTopChanged(top);
|
||||
}
|
||||
|
||||
bool Settings::IsKeepWindowOnTopEnabled() const
|
||||
{
|
||||
return SConfig::GetInstance().bKeepWindowOnTop;
|
||||
return Config::Get(Config::MAIN_KEEP_WINDOW_ON_TOP);
|
||||
}
|
||||
|
||||
int Settings::GetVolume() const
|
||||
|
Reference in New Issue
Block a user