#include namespace scwx { namespace qt { namespace settings { static const std::string logPrefix_ = "scwx::qt::settings::ui_settings"; class UiSettingsImpl { public: explicit UiSettingsImpl() { level2ProductsExpanded_.SetDefault(false); level2SettingsExpanded_.SetDefault(true); level3ProductsExpanded_.SetDefault(true); mapSettingsExpanded_.SetDefault(true); timelineExpanded_.SetDefault(true); alertDockVisible_.SetDefault(false); } ~UiSettingsImpl() {} SettingsVariable level2ProductsExpanded_ {"level2_products_expanded"}; SettingsVariable level2SettingsExpanded_ {"level2_settings_expanded"}; SettingsVariable level3ProductsExpanded_ {"level3_products_expanded"}; SettingsVariable mapSettingsExpanded_ {"map_settings_expanded"}; SettingsVariable timelineExpanded_ {"timeline_expanded"}; SettingsVariable alertDockVisible_ {"alert_dock_visible"}; }; UiSettings::UiSettings() : SettingsCategory("ui"), p(std::make_unique()) { RegisterVariables({&p->level2ProductsExpanded_, &p->level2SettingsExpanded_, &p->level3ProductsExpanded_, &p->mapSettingsExpanded_, &p->timelineExpanded_, &p->alertDockVisible_}); SetDefaults(); } UiSettings::~UiSettings() = default; UiSettings::UiSettings(UiSettings&&) noexcept = default; UiSettings& UiSettings::operator=(UiSettings&&) noexcept = default; SettingsVariable& UiSettings::level2_products_expanded() const { return p->level2ProductsExpanded_; } SettingsVariable& UiSettings::level2_settings_expanded() const { return p->level2SettingsExpanded_; } SettingsVariable& UiSettings::level3_products_expanded() const { return p->level3ProductsExpanded_; } SettingsVariable& UiSettings::map_settings_expanded() const { return p->mapSettingsExpanded_; } SettingsVariable& UiSettings::timeline_expanded() const { return p->timelineExpanded_; } SettingsVariable& UiSettings::alert_dock_visible() const { return p->alertDockVisible_; } bool UiSettings::Shutdown() { bool dataChanged = false; // Commit settings that are managed separate from the settings dialog dataChanged |= p->level2ProductsExpanded_.Commit(); dataChanged |= p->level2SettingsExpanded_.Commit(); dataChanged |= p->level3ProductsExpanded_.Commit(); dataChanged |= p->mapSettingsExpanded_.Commit(); dataChanged |= p->timelineExpanded_.Commit(); dataChanged |= p->alertDockVisible_.Commit(); return dataChanged; } UiSettings& UiSettings::Instance() { static UiSettings uiSettings_; return uiSettings_; } bool operator==(const UiSettings& lhs, const UiSettings& rhs) { return (lhs.p->level2ProductsExpanded_ == rhs.p->level2ProductsExpanded_ && 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->alertDockVisible_ == rhs.p->alertDockVisible_); } } // namespace settings } // namespace qt } // namespace scwx