From 8e2176c170a027d458244c052ff752a7fc39a27c Mon Sep 17 00:00:00 2001 From: Peter Albrecht <albrecpe@gmail.com> Date: Thu, 11 Jan 2024 12:52:24 +0100 Subject: [PATCH] Added placeholder check for changed defaults --- .../skill_details/SkillDetailsTreeWidget.cpp | 15 +++++++++++++++ .../skill_details/SkillDetailsTreeWidget.h | 2 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.cpp b/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.cpp index 57b150a18..4cf1ffffa 100644 --- a/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.cpp +++ b/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.cpp @@ -34,6 +34,21 @@ namespace armarx::skills::gui // dont touch the widget if the skill id didn't change if (shownSkill.has_value() && skillId == shownSkill.value().skillId) return; + + // check the parameters: did they change? + if (shownSkill.has_value()) + { + auto remDesc = shownSkill.value().skillDescr; + if (descr.rootProfileDefaults != remDesc.rootProfileDefaults) + { + // TODO: ask the user if they want to reset to defaults + // for now, we just overwrite without asking... (and do nothing) + } + // other cases: if the parameter types change, we *have* to reset; else the skill + // (probably) can't be started with the parameters. + // same goes for the result type. + } + this->resetWidget(); auto aron_args = descr.parametersType; diff --git a/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.h b/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.h index 277be11e9..d10855dbc 100644 --- a/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.h +++ b/source/RobotAPI/libraries/skills_gui/skill_details/SkillDetailsTreeWidget.h @@ -39,8 +39,6 @@ namespace armarx::skills::gui std::optional<ShownSkill> shownSkill; - // check for update - skills::SkillDescription shownDescription; AronTreeWidgetControllerPtr aronTreeWidgetController = nullptr; void setupUi(); }; -- GitLab