save alert dock's visibility on exit

This commit is contained in:
AdenKoperczak 2024-09-12 10:04:06 -04:00
parent ef6494f4c3
commit 3ab18392b3
4 changed files with 24 additions and 4 deletions

View file

@ -19,6 +19,7 @@ public:
level3ProductsExpanded_.SetDefault(true);
mapSettingsExpanded_.SetDefault(true);
timelineExpanded_.SetDefault(true);
alertDockVisible_.SetDefault(false);
}
~UiSettingsImpl() {}
@ -28,6 +29,7 @@ public:
SettingsVariable<bool> level3ProductsExpanded_ {"level3_products_expanded"};
SettingsVariable<bool> mapSettingsExpanded_ {"map_settings_expanded"};
SettingsVariable<bool> timelineExpanded_ {"timeline_expanded"};
SettingsVariable<bool> alertDockVisible_ {"alert_dock_visible"};
};
UiSettings::UiSettings() :
@ -37,7 +39,8 @@ UiSettings::UiSettings() :
&p->level2SettingsExpanded_,
&p->level3ProductsExpanded_,
&p->mapSettingsExpanded_,
&p->timelineExpanded_});
&p->timelineExpanded_,
&p->alertDockVisible_});
SetDefaults();
}
UiSettings::~UiSettings() = default;
@ -70,6 +73,11 @@ SettingsVariable<bool>& UiSettings::timeline_expanded() const
return p->timelineExpanded_;
}
SettingsVariable<bool>& UiSettings::alert_dock_visible() const
{
return p->alertDockVisible_;
}
bool UiSettings::Shutdown()
{
bool dataChanged = false;
@ -80,6 +88,7 @@ bool UiSettings::Shutdown()
dataChanged |= p->level3ProductsExpanded_.Commit();
dataChanged |= p->mapSettingsExpanded_.Commit();
dataChanged |= p->timelineExpanded_.Commit();
dataChanged |= p->alertDockVisible_.Commit();
return dataChanged;
}
@ -96,7 +105,8 @@ bool operator==(const UiSettings& lhs, const UiSettings& rhs)
lhs.p->level2SettingsExpanded_ == rhs.p->level2SettingsExpanded_ &&
lhs.p->level3ProductsExpanded_ == rhs.p->level3ProductsExpanded_ &&
lhs.p->mapSettingsExpanded_ == rhs.p->mapSettingsExpanded_ &&
lhs.p->timelineExpanded_ == rhs.p->timelineExpanded_);
lhs.p->timelineExpanded_ == rhs.p->timelineExpanded_ &&
lhs.p->alertDockVisible_ == rhs.p->alertDockVisible_);
}
} // namespace settings