Commit line settings changes on apply

This commit is contained in:
Dan Paulat 2024-09-21 23:31:47 -05:00
parent 8212d24d34
commit 6b0aaea773
5 changed files with 53 additions and 0 deletions

View file

@ -68,6 +68,34 @@ void SettingsCategory::SetDefaults()
}
}
bool SettingsCategory::Commit()
{
bool committed = false;
// Commit subcategory arrays
for (auto& subcategoryArray : p->subcategoryArrays_)
{
for (auto& subcategory : subcategoryArray.second)
{
committed |= subcategory->Commit();
}
}
// Commit subcategories
for (auto& subcategory : p->subcategories_)
{
committed |= subcategory->Commit();
}
// Commit variables
for (auto& variable : p->variables_)
{
committed |= variable->Commit();
}
return committed;
}
bool SettingsCategory::ReadJson(const boost::json::object& json)
{
bool validated = true;

View file

@ -33,6 +33,15 @@ public:
*/
void SetDefaults();
/**
* Sets the current value of all variables to the staged
* value.
*
* @return true if any staged value was committed, false if no staged values
* are present.
*/
bool Commit();
/**
* Reads the variables from the JSON object.
*