DashboardItem now listens to paramter 'enabled' in constructor

This commit is contained in:
Adam Rohdin
2023-02-13 16:09:07 +01:00
parent e69ec8ac4d
commit 756ade4e7d
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ public:
virtual glm::vec2 size() const = 0;
protected:
properties::BoolProperty _isEnabled;
properties::BoolProperty _enabled;
};
} // openspace
+6 -3
View File
@@ -46,6 +46,8 @@ namespace {
std::string identifier;
std::optional<std::string> guiName;
std::optional<bool> enabled;
};
#include "dashboarditem_codegen.cpp"
} // namespace
@@ -71,7 +73,7 @@ std::unique_ptr<DashboardItem> DashboardItem::createFromDictionary(
DashboardItem::DashboardItem(const ghoul::Dictionary& dictionary)
: properties::PropertyOwner({ "", "" })
, _isEnabled(EnabledInfo, true)
, _enabled(EnabledInfo, true)
{
const Parameters p = codegen::bake<Parameters>(dictionary);
@@ -80,11 +82,12 @@ DashboardItem::DashboardItem(const ghoul::Dictionary& dictionary)
setGuiName(*p.guiName);
}
addProperty(_isEnabled);
_enabled = p.enabled.value_or(_enabled);
addProperty(_enabled);
}
bool DashboardItem::isEnabled() const {
return _isEnabled;
return _enabled;
}
} // namespace openspace