Merge pull request #10324 from AdmiralCurtiss/config-port-input

Config: Port BackgroundInput setting to new config system.
This commit is contained in:
JMC47 2021-12-30 16:08:30 -05:00 committed by GitHub
commit 33d0442604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 26 deletions

View File

@ -270,4 +270,8 @@ const Info<bool> MAIN_MOVIE_SHOW_INPUT_DISPLAY{{System::Main, "Movie", "ShowInpu
const Info<bool> MAIN_MOVIE_SHOW_RTC{{System::Main, "Movie", "ShowRTC"}, false}; const Info<bool> MAIN_MOVIE_SHOW_RTC{{System::Main, "Movie", "ShowRTC"}, false};
const Info<bool> MAIN_MOVIE_SHOW_RERECORD{{System::Main, "Movie", "ShowRerecord"}, false}; const Info<bool> MAIN_MOVIE_SHOW_RERECORD{{System::Main, "Movie", "ShowRerecord"}, false};
// Main.Input
const Info<bool> MAIN_INPUT_BACKGROUND_INPUT{{System::Main, "Input", "BackgroundInput"}, false};
} // namespace Config } // namespace Config

View File

@ -230,4 +230,8 @@ extern const Info<bool> MAIN_MOVIE_SHOW_INPUT_DISPLAY;
extern const Info<bool> MAIN_MOVIE_SHOW_RTC; extern const Info<bool> MAIN_MOVIE_SHOW_RTC;
extern const Info<bool> MAIN_MOVIE_SHOW_RERECORD; extern const Info<bool> MAIN_MOVIE_SHOW_RERECORD;
// Main.Input
extern const Info<bool> MAIN_INPUT_BACKGROUND_INPUT;
} // namespace Config } // namespace Config

View File

@ -27,7 +27,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
{ {
for (const std::string_view section : for (const std::string_view section :
{"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons", {"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons",
"DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie"}) "DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie", "Input"})
{ {
if (config_location.section == section) if (config_location.section == section)
return true; return true;

View File

@ -91,7 +91,6 @@ void SConfig::SaveSettings()
SaveGeneralSettings(ini); SaveGeneralSettings(ini);
SaveInterfaceSettings(ini); SaveInterfaceSettings(ini);
SaveCoreSettings(ini); SaveCoreSettings(ini);
SaveInputSettings(ini);
SaveBluetoothPassthroughSettings(ini); SaveBluetoothPassthroughSettings(ini);
SaveUSBPassthroughSettings(ini); SaveUSBPassthroughSettings(ini);
SaveJitDebugSettings(ini); SaveJitDebugSettings(ini);
@ -198,13 +197,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("CustomRTCValue", m_customRTCValue); core->Set("CustomRTCValue", m_customRTCValue);
} }
void SConfig::SaveInputSettings(IniFile& ini)
{
IniFile::Section* input = ini.GetOrCreateSection("Input");
input->Set("BackgroundInput", m_BackgroundInput);
}
void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini) void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini)
{ {
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough"); IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
@ -256,7 +248,6 @@ void SConfig::LoadSettings()
LoadGeneralSettings(ini); LoadGeneralSettings(ini);
LoadInterfaceSettings(ini); LoadInterfaceSettings(ini);
LoadCoreSettings(ini); LoadCoreSettings(ini);
LoadInputSettings(ini);
LoadBluetoothPassthroughSettings(ini); LoadBluetoothPassthroughSettings(ini);
LoadUSBPassthroughSettings(ini); LoadUSBPassthroughSettings(ini);
LoadJitDebugSettings(ini); LoadJitDebugSettings(ini);
@ -368,13 +359,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("CustomRTCValue", &m_customRTCValue, 946684800); core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
} }
void SConfig::LoadInputSettings(IniFile& ini)
{
IniFile::Section* input = ini.GetOrCreateSection("Input");
input->Get("BackgroundInput", &m_BackgroundInput, false);
}
void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini) void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini)
{ {
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough"); IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");

View File

@ -230,7 +230,6 @@ struct SConfig
bool m_PauseOnFocusLost; bool m_PauseOnFocusLost;
// Input settings // Input settings
bool m_BackgroundInput;
bool m_AdapterRumble[4]; bool m_AdapterRumble[4];
bool m_AdapterKonga[4]; bool m_AdapterKonga[4];
@ -257,7 +256,6 @@ private:
void SaveGeneralSettings(IniFile& ini); void SaveGeneralSettings(IniFile& ini);
void SaveInterfaceSettings(IniFile& ini); void SaveInterfaceSettings(IniFile& ini);
void SaveCoreSettings(IniFile& ini); void SaveCoreSettings(IniFile& ini);
void SaveInputSettings(IniFile& ini);
void SaveBluetoothPassthroughSettings(IniFile& ini); void SaveBluetoothPassthroughSettings(IniFile& ini);
void SaveUSBPassthroughSettings(IniFile& ini); void SaveUSBPassthroughSettings(IniFile& ini);
void SaveJitDebugSettings(IniFile& ini); void SaveJitDebugSettings(IniFile& ini);
@ -265,7 +263,6 @@ private:
void LoadGeneralSettings(IniFile& ini); void LoadGeneralSettings(IniFile& ini);
void LoadInterfaceSettings(IniFile& ini); void LoadInterfaceSettings(IniFile& ini);
void LoadCoreSettings(IniFile& ini); void LoadCoreSettings(IniFile& ini);
void LoadInputSettings(IniFile& ini);
void LoadBluetoothPassthroughSettings(IniFile& ini); void LoadBluetoothPassthroughSettings(IniFile& ini);
void LoadUSBPassthroughSettings(IniFile& ini); void LoadUSBPassthroughSettings(IniFile& ini);
void LoadJitDebugSettings(IniFile& ini); void LoadJitDebugSettings(IniFile& ini);

View File

@ -881,7 +881,7 @@ void Update(u64 ticks)
if (s_half_line_of_next_si_poll == s_half_line_count) if (s_half_line_of_next_si_poll == s_half_line_count)
{ {
Core::UpdateInputGate(!SConfig::GetInstance().m_BackgroundInput, Core::UpdateInputGate(!Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT),
SConfig::GetInstance().bLockCursor); SConfig::GetInstance().bLockCursor);
SerialInterface::UpdateDevices(); SerialInterface::UpdateDevices();
s_half_line_of_next_si_poll += 2 * SerialInterface::GetPollXLines(); s_half_line_of_next_si_poll += 2 * SerialInterface::GetPollXLines();

View File

@ -8,7 +8,7 @@
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h" #include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
@ -57,11 +57,11 @@ void CommonControllersWidget::OnControllerInterfaceConfigure()
void CommonControllersWidget::LoadSettings() void CommonControllersWidget::LoadSettings()
{ {
m_common_bg_input->setChecked(SConfig::GetInstance().m_BackgroundInput); m_common_bg_input->setChecked(Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT));
} }
void CommonControllersWidget::SaveSettings() void CommonControllersWidget::SaveSettings()
{ {
SConfig::GetInstance().m_BackgroundInput = m_common_bg_input->isChecked(); Config::SetBaseOrCurrent(Config::MAIN_INPUT_BACKGROUND_INPUT, m_common_bg_input->isChecked());
SConfig::GetInstance().SaveSettings(); Config::Save();
} }

View File

@ -157,7 +157,7 @@ void RenderWidget::UpdateCursor()
const bool keep_on_top = (windowFlags() & Qt::WindowStaysOnTopHint) != 0; const bool keep_on_top = (windowFlags() & Qt::WindowStaysOnTopHint) != 0;
const bool should_hide = const bool should_hide =
(Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) && (Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) &&
(keep_on_top || SConfig::GetInstance().m_BackgroundInput || isActiveWindow()); (keep_on_top || Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT) || isActiveWindow());
setCursor(should_hide ? Qt::BlankCursor : Qt::ArrowCursor); setCursor(should_hide ? Qt::BlankCursor : Qt::ArrowCursor);
} }
else else