Qt: Make input source selection non-inheritable
Makes sense to set this in the profile specifically, given it is tied to devices.
This commit is contained in:
parent
a8b588371a
commit
8c4d595a89
|
@ -3607,7 +3607,7 @@ void FullscreenUI::DoLoadInputProfile()
|
||||||
|
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
SettingsInterface* dsi = GetEditingSettingsInterface();
|
SettingsInterface* dsi = GetEditingSettingsInterface();
|
||||||
InputManager::CopyConfiguration(dsi, ssi, true, true, IsEditingGameSettings(dsi));
|
InputManager::CopyConfiguration(dsi, ssi, true, true, true, IsEditingGameSettings(dsi));
|
||||||
SetSettingsChanged(dsi);
|
SetSettingsChanged(dsi);
|
||||||
ShowToast(std::string(), fmt::format(FSUI_FSTR("Input profile '{}' loaded."), title));
|
ShowToast(std::string(), fmt::format(FSUI_FSTR("Input profile '{}' loaded."), title));
|
||||||
CloseChoiceDialog();
|
CloseChoiceDialog();
|
||||||
|
@ -3620,7 +3620,7 @@ void FullscreenUI::DoSaveInputProfile(const std::string& name)
|
||||||
|
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
SettingsInterface* ssi = GetEditingSettingsInterface();
|
SettingsInterface* ssi = GetEditingSettingsInterface();
|
||||||
InputManager::CopyConfiguration(&dsi, *ssi, true, true, IsEditingGameSettings(ssi));
|
InputManager::CopyConfiguration(&dsi, *ssi, true, true, true, IsEditingGameSettings(ssi));
|
||||||
if (dsi.Save())
|
if (dsi.Save())
|
||||||
ShowToast(std::string(), fmt::format(FSUI_FSTR("Input profile '{}' saved."), name));
|
ShowToast(std::string(), fmt::format(FSUI_FSTR("Input profile '{}' saved."), name));
|
||||||
else
|
else
|
||||||
|
|
|
@ -18,16 +18,16 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,
|
||||||
|
|
||||||
SettingsInterface* sif = dialog->getEditingSettingsInterface();
|
SettingsInterface* sif = dialog->getEditingSettingsInterface();
|
||||||
|
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true);
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableSDLSource, "InputSources", "SDL", true);
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources",
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableSDLEnhancedMode, "InputSources",
|
||||||
"SDLControllerEnhancedMode", false);
|
"SDLControllerEnhancedMode", false);
|
||||||
connect(m_ui.enableSDLSource, &QCheckBox::checkStateChanged, this,
|
connect(m_ui.enableSDLSource, &QCheckBox::checkStateChanged, this,
|
||||||
&ControllerGlobalSettingsWidget::updateSDLOptionsEnabled);
|
&ControllerGlobalSettingsWidget::updateSDLOptionsEnabled);
|
||||||
connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked);
|
connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLIOKitDriver, "InputSources", "SDLIOKitDriver", true);
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableSDLIOKitDriver, "InputSources", "SDLIOKitDriver", true);
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLMFIDriver, "InputSources", "SDLMFIDriver", true);
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableSDLMFIDriver, "InputSources", "SDLMFIDriver", true);
|
||||||
#else
|
#else
|
||||||
m_ui.sdlGridLayout->removeWidget(m_ui.enableSDLIOKitDriver);
|
m_ui.sdlGridLayout->removeWidget(m_ui.enableSDLIOKitDriver);
|
||||||
delete m_ui.enableSDLIOKitDriver;
|
delete m_ui.enableSDLIOKitDriver;
|
||||||
|
@ -38,9 +38,9 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableDInputSource, "InputSources", "DInput", false);
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableDInputSource, "InputSources", "DInput", false);
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableXInputSource, "InputSources", "XInput", false);
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableXInputSource, "InputSources", "XInput", false);
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableRawInput, "InputSources", "RawInput", false);
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableRawInput, "InputSources", "RawInput", false);
|
||||||
#else
|
#else
|
||||||
m_ui.mainLayout->removeWidget(m_ui.xinputGroup);
|
m_ui.mainLayout->removeWidget(m_ui.xinputGroup);
|
||||||
delete m_ui.xinputGroup;
|
delete m_ui.xinputGroup;
|
||||||
|
|
|
@ -196,7 +196,7 @@ void ControllerSettingsWindow::onNewProfileClicked()
|
||||||
|
|
||||||
// from global
|
// from global
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
InputManager::CopyConfiguration(&temp_si, *Host::Internal::GetBaseSettingsLayer(), true, true,
|
InputManager::CopyConfiguration(&temp_si, *Host::Internal::GetBaseSettingsLayer(), true, true, true,
|
||||||
copy_hotkey_bindings);
|
copy_hotkey_bindings);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -205,9 +205,17 @@ void ControllerSettingsWindow::onNewProfileClicked()
|
||||||
const bool copy_hotkey_bindings =
|
const bool copy_hotkey_bindings =
|
||||||
m_editing_settings_interface->GetBoolValue("ControllerPorts", "UseProfileHotkeyBindings", false);
|
m_editing_settings_interface->GetBoolValue("ControllerPorts", "UseProfileHotkeyBindings", false);
|
||||||
temp_si.SetBoolValue("ControllerPorts", "UseProfileHotkeyBindings", copy_hotkey_bindings);
|
temp_si.SetBoolValue("ControllerPorts", "UseProfileHotkeyBindings", copy_hotkey_bindings);
|
||||||
InputManager::CopyConfiguration(&temp_si, *m_editing_settings_interface, true, true, copy_hotkey_bindings);
|
InputManager::CopyConfiguration(&temp_si, *m_editing_settings_interface, true, true, true, copy_hotkey_bindings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// still need to copy the source config
|
||||||
|
if (!m_editing_settings_interface)
|
||||||
|
InputManager::CopyConfiguration(&temp_si, *Host::Internal::GetBaseSettingsLayer(), false, true, false, false);
|
||||||
|
else
|
||||||
|
InputManager::CopyConfiguration(&temp_si, *m_editing_settings_interface, false, true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!temp_si.Save())
|
if (!temp_si.Save())
|
||||||
{
|
{
|
||||||
|
@ -237,7 +245,7 @@ void ControllerSettingsWindow::onApplyProfileClicked()
|
||||||
m_editing_settings_interface->GetBoolValue("ControllerPorts", "UseProfileHotkeyBindings", false);
|
m_editing_settings_interface->GetBoolValue("ControllerPorts", "UseProfileHotkeyBindings", false);
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
InputManager::CopyConfiguration(Host::Internal::GetBaseSettingsLayer(), *m_editing_settings_interface, true, true,
|
InputManager::CopyConfiguration(Host::Internal::GetBaseSettingsLayer(), *m_editing_settings_interface, true, true,
|
||||||
copy_hotkey_bindings);
|
true, copy_hotkey_bindings);
|
||||||
QtHost::QueueSettingsSave();
|
QtHost::QueueSettingsSave();
|
||||||
}
|
}
|
||||||
g_emu_thread->applySettings();
|
g_emu_thread->applySettings();
|
||||||
|
@ -293,7 +301,7 @@ void ControllerSettingsWindow::onCopyGlobalSettingsClicked()
|
||||||
{
|
{
|
||||||
const auto lock = Host::GetSettingsLock();
|
const auto lock = Host::GetSettingsLock();
|
||||||
InputManager::CopyConfiguration(m_editing_settings_interface, *Host::Internal::GetBaseSettingsLayer(), true, true,
|
InputManager::CopyConfiguration(m_editing_settings_interface, *Host::Internal::GetBaseSettingsLayer(), true, true,
|
||||||
false);
|
true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_editing_settings_interface->Save();
|
m_editing_settings_interface->Save();
|
||||||
|
|
|
@ -350,7 +350,7 @@ void GameSummaryWidget::onInputProfileChanged(int index)
|
||||||
{
|
{
|
||||||
const auto lock = Host::GetSettingsLock();
|
const auto lock = Host::GetSettingsLock();
|
||||||
SettingsInterface* base_sif = Host::Internal::GetBaseSettingsLayer();
|
SettingsInterface* base_sif = Host::Internal::GetBaseSettingsLayer();
|
||||||
InputManager::CopyConfiguration(sif, *base_sif, true, true, false);
|
InputManager::CopyConfiguration(sif, *base_sif, true, true, true, false);
|
||||||
|
|
||||||
QWidget* dlg_parent = QtUtils::GetRootWidget(this);
|
QWidget* dlg_parent = QtUtils::GetRootWidget(this);
|
||||||
QMessageBox::information(dlg_parent, dlg_parent->windowTitle(),
|
QMessageBox::information(dlg_parent, dlg_parent->windowTitle(),
|
||||||
|
|
|
@ -1388,12 +1388,21 @@ void InputManager::ClearPortBindings(SettingsInterface& si, u32 port)
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::CopyConfiguration(SettingsInterface* dest_si, const SettingsInterface& src_si,
|
void InputManager::CopyConfiguration(SettingsInterface* dest_si, const SettingsInterface& src_si,
|
||||||
bool copy_pad_config /*= true*/, bool copy_pad_bindings /*= true*/,
|
bool copy_pad_config /*= true*/, bool copy_source_config /*= true*/,
|
||||||
bool copy_hotkey_bindings /*= true*/)
|
bool copy_pad_bindings /*= true*/, bool copy_hotkey_bindings /*= true*/)
|
||||||
{
|
{
|
||||||
if (copy_pad_config)
|
if (copy_pad_config)
|
||||||
dest_si->CopyStringValue(src_si, "ControllerPorts", "MultitapMode");
|
dest_si->CopyStringValue(src_si, "ControllerPorts", "MultitapMode");
|
||||||
|
|
||||||
|
if (copy_source_config)
|
||||||
|
{
|
||||||
|
for (u32 type = 0; type < static_cast<u32>(InputSourceType::Count); type++)
|
||||||
|
{
|
||||||
|
dest_si->CopyBoolValue(src_si, "InputSources",
|
||||||
|
InputManager::InputSourceToString(static_cast<InputSourceType>(type)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (u32 port = 0; port < NUM_CONTROLLER_AND_CARD_PORTS; port++)
|
for (u32 port = 0; port < NUM_CONTROLLER_AND_CARD_PORTS; port++)
|
||||||
{
|
{
|
||||||
if (Controller::PadIsMultitapSlot(port))
|
if (Controller::PadIsMultitapSlot(port))
|
||||||
|
@ -2021,7 +2030,7 @@ bool InputManager::IsInputSourceEnabled(const SettingsInterface& si, InputSource
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return si.GetBoolValue("InputSources", InputManager::InputSourceToString(type), GetInputSourceDefaultEnabled(type));
|
return si.GetBoolValue("InputSources", InputSourceToString(type), GetInputSourceDefaultEnabled(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::UpdateInputSourceState(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock,
|
void InputManager::UpdateInputSourceState(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock,
|
||||||
|
@ -2039,7 +2048,7 @@ void InputManager::UpdateInputSourceState(const SettingsInterface& si, std::uniq
|
||||||
std::unique_ptr<InputSource> source(factory_function());
|
std::unique_ptr<InputSource> source(factory_function());
|
||||||
if (!source->Initialize(si, settings_lock))
|
if (!source->Initialize(si, settings_lock))
|
||||||
{
|
{
|
||||||
ERROR_LOG("Source '{}' failed to initialize.", InputManager::InputSourceToString(type));
|
ERROR_LOG("Source '{}' failed to initialize.", InputSourceToString(type));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ void ClearPortBindings(SettingsInterface& si, u32 port);
|
||||||
|
|
||||||
/// Copies pad configuration from one interface (ini) to another.
|
/// Copies pad configuration from one interface (ini) to another.
|
||||||
void CopyConfiguration(SettingsInterface* dest_si, const SettingsInterface& src_si, bool copy_pad_config = true,
|
void CopyConfiguration(SettingsInterface* dest_si, const SettingsInterface& src_si, bool copy_pad_config = true,
|
||||||
bool copy_pad_bindings = true, bool copy_hotkey_bindings = true);
|
bool copy_source_config = true, bool copy_pad_bindings = true, bool copy_hotkey_bindings = true);
|
||||||
|
|
||||||
/// Performs automatic controller mapping with the provided list of generic mappings.
|
/// Performs automatic controller mapping with the provided list of generic mappings.
|
||||||
bool MapController(SettingsInterface& si, u32 controller,
|
bool MapController(SettingsInterface& si, u32 controller,
|
||||||
|
|
Loading…
Reference in New Issue