mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
Input: Add optional "enable" setting to the ControlGroup class.
The setting is exposed as a check box in the QGroupBox instance that visualises the ControlGroup instance. The setting is saved under "[control group name]/Enabled", but only when it is "false". The default value is "true".
This commit is contained in:
@ -15,13 +15,16 @@
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
ControlGroup::ControlGroup(std::string name_, const GroupType type_)
|
||||
: name(name_), ui_name(std::move(name_)), type(type_)
|
||||
ControlGroup::ControlGroup(std::string name_, const GroupType type_, CanBeDisabled can_be_disabled_)
|
||||
: name(name_), ui_name(std::move(name_)), type(type_),
|
||||
can_be_disabled(can_be_disabled_ == CanBeDisabled::Yes)
|
||||
{
|
||||
}
|
||||
|
||||
ControlGroup::ControlGroup(std::string name_, std::string ui_name_, const GroupType type_)
|
||||
: name(std::move(name_)), ui_name(std::move(ui_name_)), type(type_)
|
||||
ControlGroup::ControlGroup(std::string name_, std::string ui_name_, const GroupType type_,
|
||||
CanBeDisabled can_be_disabled_)
|
||||
: name(std::move(name_)), ui_name(std::move(ui_name_)), type(type_),
|
||||
can_be_disabled(can_be_disabled_ == CanBeDisabled::Yes)
|
||||
{
|
||||
}
|
||||
|
||||
@ -43,6 +46,10 @@ void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,
|
||||
{
|
||||
const std::string group(base + name + "/");
|
||||
|
||||
// enabled
|
||||
if (can_be_disabled)
|
||||
sec->Get(group + "Enabled", &enabled, true);
|
||||
|
||||
for (auto& setting : numeric_settings)
|
||||
setting->LoadFromIni(*sec, group);
|
||||
|
||||
@ -88,6 +95,9 @@ void ControlGroup::SaveConfig(IniFile::Section* sec, const std::string& defdev,
|
||||
{
|
||||
const std::string group(base + name + "/");
|
||||
|
||||
// enabled
|
||||
sec->Set(group + "Enabled", enabled, true);
|
||||
|
||||
for (auto& setting : numeric_settings)
|
||||
setting->SaveToIni(*sec, group);
|
||||
|
||||
|
Reference in New Issue
Block a user