Skip to content
Snippets Groups Projects
Commit 5abd29cf authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Merge branch 'aron-remote-gui-group-box-for-listz' into 'master'

Add a named group box for lists if element type not in implementedListDescriptors

See merge request !396
parents 882e71d7 c9d9a33f
No related branches found
No related tags found
1 merge request!396Add a named group box for lists if element type not in implementedListDescriptors
Pipeline #15839 passed
......@@ -167,39 +167,62 @@ namespace armarx::aron::component_config
MakeConfigGuiVisitor::visitListOnEnter(DataInput& o, TypeInput& t)
{
in_list_ = true;
auto group = RemoteGui::makeSimpleGridLayout(pathToName(o) + "_grid").cols(20);
auto data = data::List::DynamicCastAndCheck(o);
auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor();
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) ==
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
implementedListDescriptors.end())
{
return;
auto group = RemoteGui::makeSimpleGridLayout(pathToName(o) + "_grid").cols(20);
auto data = data::List::DynamicCastAndCheck(o);
for (const auto& el : data->getElements())
{
group.addChild(RemoteGui::makeLineEdit(pathToName(el))
.value(factories::VariantHelper::make(type)->to_string(el)),
10);
group.addHSpacer(8);
group.addChild(RemoteGui::makeButton(pathToName(el) + "_button")
.label("-")
.toolTip("Remove List Element"),
2);
}
group_hierarchy_.back()->addChild(
RemoteGui::makeGroupBox(pathToName(o) + "_grp")
.label(o->getPath().getLastElement())
.collapsed(true)
.addChild(group)
.addChild(RemoteGui::makeButton(pathToName(o) + "_add")
.label("+")
.toolTip("Add new list entry.")));
}
for (const auto& el : data->getElements())
else
{
group.addChild(RemoteGui::makeLineEdit(pathToName(el))
.value(factories::VariantHelper::make(type)->to_string(el)),
10);
group.addHSpacer(8);
group.addChild(RemoteGui::makeButton(pathToName(el) + "_button")
.label("-")
.toolTip("Remove List Element"),
2);
std::string name = pathToName(o);
group_hierarchy_.emplace_back(std::make_shared<RemoteGui::detail::GroupBoxBuilder>(
RemoteGui::makeGroupBox(name)));
}
group_hierarchy_.back()->addChild(
RemoteGui::makeGroupBox(pathToName(o) + "_grp")
.label(o->getPath().getLastElement())
.collapsed(true)
.addChild(group)
.addChild(RemoteGui::makeButton(pathToName(o) + "_add")
.label("+")
.toolTip("Add new list entry.")));
}
void
MakeConfigGuiVisitor::visitListOnExit(DataInput& /*unused*/, TypeInput& /*unused*/)
MakeConfigGuiVisitor::visitListOnExit(DataInput& /*unused*/, TypeInput& t)
{
in_list_ = false;
auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor();
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
implementedListDescriptors.end())
{
}
else
{
auto builder = *group_hierarchy_.back();
group_hierarchy_.pop_back();
if (not group_hierarchy_.empty())
{
group_hierarchy_.back()->addChild(builder);
}
}
}
void
......@@ -232,7 +255,7 @@ namespace armarx::aron::component_config
group.addChild(RemoteGui::makeLabel(name + "_label").value(q->getPath().getLastElement()));
group.addHSpacer();
if (cols == 4 && rows == 4)
if (cols == 4 and rows == 4)
{
// Poses
const auto& matrix = aron::data::converter::AronEigenConverter::ConvertToMatrix4f(data);
......@@ -488,36 +511,55 @@ namespace armarx::aron::component_config
GetValueFromMapVisitor::visitListOnEnter(DataInput& o, TypeInput& t)
{
in_list_ = true;
auto data = data::List::DynamicCastAndCheck(o);
auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor();
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) ==
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
implementedListDescriptors.end())
{
return;
}
const auto& elements = data->getElements();
for (const auto& [idx, el] : armarx::MakeIndexedContainer(elements))
{
if (proxy_->getButtonClicked(pathToName(el) + "_button"))
auto data = data::List::DynamicCastAndCheck(o);
const auto& elements = data->getElements();
for (const auto& [idx, el] : armarx::MakeIndexedContainer(elements))
{
data->removeElement(idx);
if (proxy_->getButtonClicked(pathToName(el) + "_button"))
{
data->removeElement(idx);
tab_rebuild_required_ = true;
}
auto gui_value = proxy_->getValue<std::string>(pathToName(el)).get();
factories::VariantHelper::make(type)->set_value_from_string(el, gui_value);
}
if (proxy_->getButtonClicked(pathToName(o) + "_add"))
{
data->addElement(factories::VariantHelper::make(type)->from_string(
"", o->getPath().withIndex(data->childrenSize())));
tab_rebuild_required_ = true;
}
auto gui_value = proxy_->getValue<std::string>(pathToName(el)).get();
factories::VariantHelper::make(type)->set_value_from_string(el, gui_value);
}
if (proxy_->getButtonClicked(pathToName(o) + "_add"))
else
{
data->addElement(factories::VariantHelper::make(type)->from_string(
"", o->getPath().withIndex(data->childrenSize())));
tab_rebuild_required_ = true;
// TODO? Adapt to additional GroupBoxBuilder added by
// MakeConfigGuiVisitor::visitListOnEnter in this case?
}
}
void
GetValueFromMapVisitor::visitListOnExit(DataInput&, TypeInput&)
GetValueFromMapVisitor::visitListOnExit(DataInput&, TypeInput& t)
{
in_list_ = false;
auto type = type::List::DynamicCast(t)->getAcceptedType()->getDescriptor();
if (std::find(implementedListDescriptors.begin(), implementedListDescriptors.end(), type) !=
implementedListDescriptors.end())
{
}
else
{
// TODO? Adapt to additional GroupBoxBuilder added by
// MakeConfigGuiVisitor::visitListOnEnter in this case?
}
}
bool
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment