mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 09:59:32 -06:00
InputCommon/DolphinQt: Add advanced settings button for "Point" and "Point (Passthrough)" "Enabled" checkboxes.
This commit is contained in:

committed by
Jordan Woyak

parent
53b54406bd
commit
a5b4a0b9e4
@ -13,8 +13,9 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
ControlGroup::ControlGroup(std::string name_, const GroupType type_, DefaultValue default_value_)
|
||||
: name(name_), ui_name(std::move(name_)), type(type_), default_value(default_value_)
|
||||
ControlGroup::ControlGroup(const std::string& name_, const GroupType type_,
|
||||
DefaultValue default_value_)
|
||||
: ControlGroup{name_, name_, type_, default_value_}
|
||||
{
|
||||
}
|
||||
|
||||
@ -23,6 +24,12 @@ ControlGroup::ControlGroup(std::string name_, std::string ui_name_, const GroupT
|
||||
: name(std::move(name_)), ui_name(std::move(ui_name_)), type(type_),
|
||||
default_value(default_value_)
|
||||
{
|
||||
if (default_value_ != DefaultValue::AlwaysEnabled)
|
||||
{
|
||||
enabled_setting = std::make_unique<NumericSetting<bool>>(
|
||||
&enabled, NumericSettingDetails{_trans("Enabled")},
|
||||
(default_value_ == DefaultValue::Enabled), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlGroup::AddVirtualNotchSetting(SettingValue<double>* value, double max_virtual_notch_deg)
|
||||
@ -53,8 +60,8 @@ void ControlGroup::LoadConfig(Common::IniFile::Section* sec, const std::string&
|
||||
const std::string group(base + name + "/");
|
||||
|
||||
// enabled
|
||||
if (default_value != DefaultValue::AlwaysEnabled)
|
||||
sec->Get(group + "Enabled", &enabled, default_value != DefaultValue::Disabled);
|
||||
if (HasEnabledSetting())
|
||||
enabled_setting->LoadFromIni(*sec, group);
|
||||
|
||||
for (auto& setting : numeric_settings)
|
||||
setting->LoadFromIni(*sec, group);
|
||||
@ -79,7 +86,8 @@ void ControlGroup::SaveConfig(Common::IniFile::Section* sec, const std::string&
|
||||
const std::string group(base + name + "/");
|
||||
|
||||
// enabled
|
||||
sec->Set(group + "Enabled", enabled, default_value != DefaultValue::Disabled);
|
||||
if (HasEnabledSetting())
|
||||
enabled_setting->SaveToIni(*sec, group);
|
||||
|
||||
for (auto& setting : numeric_settings)
|
||||
setting->SaveToIni(*sec, group);
|
||||
@ -99,6 +107,9 @@ void ControlGroup::SaveConfig(Common::IniFile::Section* sec, const std::string&
|
||||
|
||||
void ControlGroup::UpdateReferences(ciface::ExpressionParser::ControlEnvironment& env)
|
||||
{
|
||||
if (HasEnabledSetting())
|
||||
enabled_setting->GetInputReference().UpdateReference(env);
|
||||
|
||||
for (auto& control : controls)
|
||||
control->control_ref->UpdateReference(env);
|
||||
|
||||
@ -126,4 +137,9 @@ void ControlGroup::AddOutput(Translatability translate, std::string name_)
|
||||
controls.emplace_back(std::make_unique<Output>(translate, std::move(name_)));
|
||||
}
|
||||
|
||||
bool ControlGroup::HasEnabledSetting() const
|
||||
{
|
||||
return enabled_setting != nullptr;
|
||||
}
|
||||
|
||||
} // namespace ControllerEmu
|
||||
|
Reference in New Issue
Block a user