mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Config: Port remaining Interface settings to new config system.
This commit is contained in:
@ -156,6 +156,7 @@ void JITWidget::Update()
|
||||
PPCAnalyst::BlockRegStats fpa;
|
||||
PPCAnalyst::CodeBlock code_block;
|
||||
PPCAnalyst::PPCAnalyzer analyzer;
|
||||
analyzer.SetDebuggingEnabled(Config::Get(Config::MAIN_ENABLE_DEBUGGING));
|
||||
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE);
|
||||
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW);
|
||||
|
||||
|
@ -254,7 +254,7 @@ void HotkeyScheduler::Run()
|
||||
if (auto bt = WiiUtils::GetBluetoothRealDevice())
|
||||
bt->UpdateSyncButtonState(IsHotkey(HK_TRIGGER_SYNC_BUTTON, true));
|
||||
|
||||
if (SConfig::GetInstance().bEnableDebugging)
|
||||
if (Config::Get(Config::MAIN_ENABLE_DEBUGGING))
|
||||
{
|
||||
CheckDebuggingHotkeys();
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ bool MainWindow::RequestStop()
|
||||
else
|
||||
FullScreen();
|
||||
|
||||
if (SConfig::GetInstance().bConfirmStop)
|
||||
if (Config::Get(Config::MAIN_CONFIRM_ON_STOP))
|
||||
{
|
||||
if (std::exchange(m_stop_confirm_showing, true))
|
||||
return true;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <imgui.h>
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/State.h"
|
||||
|
||||
@ -156,14 +155,14 @@ void RenderWidget::UpdateCursor()
|
||||
// on top of the game window in the background
|
||||
const bool keep_on_top = (windowFlags() & Qt::WindowStaysOnTopHint) != 0;
|
||||
const bool should_hide =
|
||||
(Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) &&
|
||||
(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never) &&
|
||||
(keep_on_top || Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT) || isActiveWindow());
|
||||
setCursor(should_hide ? Qt::BlankCursor : Qt::ArrowCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
setCursor((m_cursor_locked &&
|
||||
Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) ?
|
||||
Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never) ?
|
||||
Qt::BlankCursor :
|
||||
Qt::ArrowCursor);
|
||||
}
|
||||
@ -189,7 +188,7 @@ void RenderWidget::HandleCursorTimer()
|
||||
if (!isActiveWindow())
|
||||
return;
|
||||
if ((!Settings::Instance().GetLockCursor() || m_cursor_locked) &&
|
||||
Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::OnMovement)
|
||||
Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement)
|
||||
{
|
||||
setCursor(Qt::BlankCursor);
|
||||
}
|
||||
@ -272,7 +271,7 @@ void RenderWidget::SetCursorLocked(bool locked, bool follow_aspect_ratio)
|
||||
{
|
||||
m_cursor_locked = true;
|
||||
|
||||
if (Settings::Instance().GetCursorVisibility() != SConfig::ShowCursor::Constantly)
|
||||
if (Settings::Instance().GetCursorVisibility() != Config::ShowCursor::Constantly)
|
||||
{
|
||||
setCursor(Qt::BlankCursor);
|
||||
}
|
||||
@ -374,7 +373,7 @@ bool RenderWidget::event(QEvent* event)
|
||||
break;
|
||||
case QEvent::MouseMove:
|
||||
// Unhide on movement
|
||||
if (Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::OnMovement)
|
||||
if (Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement)
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
m_mouse_timer->start(MOUSE_HIDE_DELAY);
|
||||
@ -386,7 +385,7 @@ bool RenderWidget::event(QEvent* event)
|
||||
case QEvent::Show:
|
||||
// Don't do if "stay on top" changed (or was true)
|
||||
if (Settings::Instance().GetLockCursor() &&
|
||||
Settings::Instance().GetCursorVisibility() != SConfig::ShowCursor::Constantly &&
|
||||
Settings::Instance().GetCursorVisibility() != Config::ShowCursor::Constantly &&
|
||||
!m_dont_lock_cursor_on_show)
|
||||
{
|
||||
// Auto lock when this window is shown (it was hidden)
|
||||
@ -399,7 +398,7 @@ bool RenderWidget::event(QEvent* event)
|
||||
// Note that this event in Windows is not always aligned to the window that is highlighted,
|
||||
// it's the window that has keyboard and mouse focus
|
||||
case QEvent::WindowActivate:
|
||||
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Paused)
|
||||
if (Config::Get(Config::MAIN_PAUSE_ON_FOCUS_LOST) && Core::GetState() == Core::State::Paused)
|
||||
Core::SetState(Core::State::Running);
|
||||
|
||||
UpdateCursor();
|
||||
@ -421,7 +420,7 @@ bool RenderWidget::event(QEvent* event)
|
||||
|
||||
UpdateCursor();
|
||||
|
||||
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Running)
|
||||
if (Config::Get(Config::MAIN_PAUSE_ON_FOCUS_LOST) && Core::GetState() == Core::State::Running)
|
||||
{
|
||||
// If we are declared as the CPU thread, it means that the real CPU thread is waiting
|
||||
// for us to finish showing a panic alert (with that panic alert likely being the cause
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
@ -52,7 +52,7 @@ QPixmap Resources::GetPixmap(std::string_view name, const QString& dir)
|
||||
|
||||
static QString GetCurrentThemeDir()
|
||||
{
|
||||
return QString::fromStdString(File::GetThemeDir(SConfig::GetInstance().theme_name));
|
||||
return QString::fromStdString(File::GetThemeDir(Config::Get(Config::MAIN_THEME_NAME)));
|
||||
}
|
||||
|
||||
static QString GetResourcesDir()
|
||||
|
@ -106,7 +106,7 @@ QSettings& Settings::GetQSettings()
|
||||
|
||||
void Settings::SetThemeName(const QString& theme_name)
|
||||
{
|
||||
SConfig::GetInstance().theme_name = theme_name.toStdString();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_THEME_NAME, theme_name.toStdString());
|
||||
emit ThemeChanged();
|
||||
}
|
||||
|
||||
@ -325,27 +325,26 @@ void Settings::SetStateSlot(int slot)
|
||||
GetQSettings().setValue(QStringLiteral("Emulation/StateSlot"), slot);
|
||||
}
|
||||
|
||||
void Settings::SetCursorVisibility(SConfig::ShowCursor hideCursor)
|
||||
void Settings::SetCursorVisibility(Config::ShowCursor hideCursor)
|
||||
{
|
||||
SConfig::GetInstance().m_show_cursor = hideCursor;
|
||||
|
||||
Config::SetBaseOrCurrent(Config::MAIN_SHOW_CURSOR, hideCursor);
|
||||
emit CursorVisibilityChanged();
|
||||
}
|
||||
|
||||
SConfig::ShowCursor Settings::GetCursorVisibility() const
|
||||
Config::ShowCursor Settings::GetCursorVisibility() const
|
||||
{
|
||||
return SConfig::GetInstance().m_show_cursor;
|
||||
return Config::Get(Config::MAIN_SHOW_CURSOR);
|
||||
}
|
||||
|
||||
void Settings::SetLockCursor(bool lock_cursor)
|
||||
{
|
||||
SConfig::GetInstance().bLockCursor = lock_cursor;
|
||||
Config::SetBaseOrCurrent(Config::MAIN_LOCK_CURSOR, lock_cursor);
|
||||
emit LockCursorChanged();
|
||||
}
|
||||
|
||||
bool Settings::GetLockCursor() const
|
||||
{
|
||||
return SConfig::GetInstance().bLockCursor;
|
||||
return Config::Get(Config::MAIN_LOCK_CURSOR);
|
||||
}
|
||||
|
||||
void Settings::SetKeepWindowOnTop(bool top)
|
||||
@ -457,7 +456,7 @@ void Settings::SetDebugModeEnabled(bool enabled)
|
||||
{
|
||||
if (IsDebugModeEnabled() != enabled)
|
||||
{
|
||||
SConfig::GetInstance().bEnableDebugging = enabled;
|
||||
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled);
|
||||
emit DebugModeToggled(enabled);
|
||||
}
|
||||
if (enabled)
|
||||
@ -466,7 +465,7 @@ void Settings::SetDebugModeEnabled(bool enabled)
|
||||
|
||||
bool Settings::IsDebugModeEnabled() const
|
||||
{
|
||||
return SConfig::GetInstance().bEnableDebugging;
|
||||
return Config::Get(Config::MAIN_ENABLE_DEBUGGING);
|
||||
}
|
||||
|
||||
void Settings::SetRegistersVisible(bool enabled)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <QRadioButton>
|
||||
#include <QSettings>
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
|
||||
namespace Core
|
||||
@ -99,8 +99,8 @@ public:
|
||||
void SetUSBKeyboardConnected(bool connected);
|
||||
|
||||
// Graphics
|
||||
void SetCursorVisibility(SConfig::ShowCursor hideCursor);
|
||||
SConfig::ShowCursor GetCursorVisibility() const;
|
||||
void SetCursorVisibility(Config::ShowCursor hideCursor);
|
||||
Config::ShowCursor GetCursorVisibility() const;
|
||||
void SetLockCursor(bool lock_cursor);
|
||||
bool GetLockCursor() const;
|
||||
void SetKeepWindowOnTop(bool top);
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/UISettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
@ -238,13 +237,13 @@ void InterfacePane::ConnectLayout()
|
||||
|
||||
void InterfacePane::LoadConfig()
|
||||
{
|
||||
const SConfig& startup_params = SConfig::GetInstance();
|
||||
m_checkbox_use_builtin_title_database->setChecked(startup_params.m_use_builtin_title_database);
|
||||
m_checkbox_use_builtin_title_database->setChecked(
|
||||
Config::Get(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE));
|
||||
m_checkbox_show_debugging_ui->setChecked(Settings::Instance().IsDebugModeEnabled());
|
||||
m_combobox_language->setCurrentIndex(m_combobox_language->findData(
|
||||
QString::fromStdString(SConfig::GetInstance().m_InterfaceLanguage)));
|
||||
QString::fromStdString(Config::Get(Config::MAIN_INTERFACE_LANGUAGE))));
|
||||
m_combobox_theme->setCurrentIndex(
|
||||
m_combobox_theme->findText(QString::fromStdString(SConfig::GetInstance().theme_name)));
|
||||
m_combobox_theme->findText(QString::fromStdString(Config::Get(Config::MAIN_THEME_NAME))));
|
||||
|
||||
const QString userstyle = Settings::Instance().GetCurrentUserStyle();
|
||||
const int index = m_combobox_userstyle->findData(QFileInfo(userstyle).fileName());
|
||||
@ -261,19 +260,19 @@ void InterfacePane::LoadConfig()
|
||||
|
||||
// Render Window Options
|
||||
m_checkbox_top_window->setChecked(Settings::Instance().IsKeepWindowOnTopEnabled());
|
||||
m_checkbox_confirm_on_stop->setChecked(startup_params.bConfirmStop);
|
||||
m_checkbox_confirm_on_stop->setChecked(Config::Get(Config::MAIN_CONFIRM_ON_STOP));
|
||||
m_checkbox_use_panic_handlers->setChecked(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
|
||||
m_checkbox_enable_osd->setChecked(Config::Get(Config::MAIN_OSD_MESSAGES));
|
||||
m_checkbox_show_active_title->setChecked(startup_params.m_show_active_title);
|
||||
m_checkbox_pause_on_focus_lost->setChecked(startup_params.m_PauseOnFocusLost);
|
||||
m_checkbox_show_active_title->setChecked(Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE));
|
||||
m_checkbox_pause_on_focus_lost->setChecked(Config::Get(Config::MAIN_PAUSE_ON_FOCUS_LOST));
|
||||
m_checkbox_use_covers->setChecked(Config::Get(Config::MAIN_USE_GAME_COVERS));
|
||||
m_checkbox_focused_hotkeys->setChecked(Config::Get(Config::MAIN_FOCUSED_HOTKEYS));
|
||||
m_radio_cursor_visible_movement->setChecked(Settings::Instance().GetCursorVisibility() ==
|
||||
SConfig::ShowCursor::OnMovement);
|
||||
Config::ShowCursor::OnMovement);
|
||||
m_radio_cursor_visible_always->setChecked(Settings::Instance().GetCursorVisibility() ==
|
||||
SConfig::ShowCursor::Constantly);
|
||||
Config::ShowCursor::Constantly);
|
||||
m_radio_cursor_visible_never->setChecked(Settings::Instance().GetCursorVisibility() ==
|
||||
SConfig::ShowCursor::Never);
|
||||
Config::ShowCursor::Never);
|
||||
|
||||
m_checkbox_lock_mouse->setChecked(Settings::Instance().GetLockCursor());
|
||||
m_checkbox_disable_screensaver->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER));
|
||||
@ -281,8 +280,8 @@ void InterfacePane::LoadConfig()
|
||||
|
||||
void InterfacePane::OnSaveConfig()
|
||||
{
|
||||
SConfig& settings = SConfig::GetInstance();
|
||||
settings.m_use_builtin_title_database = m_checkbox_use_builtin_title_database->isChecked();
|
||||
Config::SetBase(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE,
|
||||
m_checkbox_use_builtin_title_database->isChecked());
|
||||
Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked());
|
||||
Settings::Instance().SetUserStylesEnabled(m_checkbox_use_userstyle->isChecked());
|
||||
Settings::Instance().SetCurrentUserStyle(m_combobox_userstyle->currentData().toString());
|
||||
@ -294,18 +293,18 @@ void InterfacePane::OnSaveConfig()
|
||||
|
||||
// Render Window Options
|
||||
Settings::Instance().SetKeepWindowOnTop(m_checkbox_top_window->isChecked());
|
||||
settings.bConfirmStop = m_checkbox_confirm_on_stop->isChecked();
|
||||
Config::SetBase(Config::MAIN_CONFIRM_ON_STOP, m_checkbox_confirm_on_stop->isChecked());
|
||||
Config::SetBase(Config::MAIN_USE_PANIC_HANDLERS, m_checkbox_use_panic_handlers->isChecked());
|
||||
Config::SetBase(Config::MAIN_OSD_MESSAGES, m_checkbox_enable_osd->isChecked());
|
||||
settings.m_show_active_title = m_checkbox_show_active_title->isChecked();
|
||||
settings.m_PauseOnFocusLost = m_checkbox_pause_on_focus_lost->isChecked();
|
||||
Config::SetBase(Config::MAIN_SHOW_ACTIVE_TITLE, m_checkbox_show_active_title->isChecked());
|
||||
Config::SetBase(Config::MAIN_PAUSE_ON_FOCUS_LOST, m_checkbox_pause_on_focus_lost->isChecked());
|
||||
|
||||
Common::SetEnableAlert(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
|
||||
|
||||
auto new_language = m_combobox_language->currentData().toString().toStdString();
|
||||
if (new_language != SConfig::GetInstance().m_InterfaceLanguage)
|
||||
if (new_language != Config::Get(Config::MAIN_INTERFACE_LANGUAGE))
|
||||
{
|
||||
SConfig::GetInstance().m_InterfaceLanguage = new_language;
|
||||
Config::SetBase(Config::MAIN_INTERFACE_LANGUAGE, new_language);
|
||||
ModalMessageBox::information(
|
||||
this, tr("Restart Required"),
|
||||
tr("You must restart Dolphin in order for the change to take effect."));
|
||||
@ -322,20 +321,20 @@ void InterfacePane::OnSaveConfig()
|
||||
Config::SetBase(Config::MAIN_FOCUSED_HOTKEYS, m_checkbox_focused_hotkeys->isChecked());
|
||||
Config::SetBase(Config::MAIN_DISABLE_SCREENSAVER, m_checkbox_disable_screensaver->isChecked());
|
||||
|
||||
settings.SaveSettings();
|
||||
Config::Save();
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleMovement()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::OnMovement);
|
||||
Settings::Instance().SetCursorVisibility(Config::ShowCursor::OnMovement);
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleNever()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Never);
|
||||
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Never);
|
||||
}
|
||||
|
||||
void InterfacePane::OnCursorVisibleAlways()
|
||||
{
|
||||
Settings::Instance().SetCursorVisibility(SConfig::ShowCursor::Constantly);
|
||||
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Constantly);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
|
||||
@ -310,7 +310,7 @@ void Translation::Initialize()
|
||||
[](const char* text) { return QObject::tr(text).toStdString(); });
|
||||
|
||||
// Hook up Qt translations
|
||||
auto& configured_language = SConfig::GetInstance().m_InterfaceLanguage;
|
||||
std::string configured_language = Config::Get(Config::MAIN_INTERFACE_LANGUAGE);
|
||||
if (!configured_language.empty())
|
||||
{
|
||||
if (TryInstallTranslator(QString::fromStdString(configured_language)))
|
||||
@ -319,7 +319,7 @@ void Translation::Initialize()
|
||||
ModalMessageBox::warning(
|
||||
nullptr, QObject::tr("Error"),
|
||||
QObject::tr("Error loading selected language. Falling back to system default."));
|
||||
configured_language.clear();
|
||||
Config::SetBase(Config::MAIN_INTERFACE_LANGUAGE, "");
|
||||
}
|
||||
|
||||
for (const auto& lang : QLocale::system().uiLanguages())
|
||||
|
Reference in New Issue
Block a user