diff --git a/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp b/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp index 49e3a18bfd97551baddd860f9cc3ffea0774ef3c..bb7ac21c9ac4c7bcdf630744d93533e2c1e07c54 100644 --- a/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp +++ b/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp @@ -160,16 +160,17 @@ namespace armarx &QPushButton::clicked, this, &SkillManagerMonitorWidgetController::executeSkill); - // connect(widget.pushButtonStopSkill, - // &QPushButton::clicked, - // this, - // &SkillManagerMonitorWidgetController::stopSkill); connect(widget.treeWidgetSkills, &QTreeWidget::currentItemChanged, this, &SkillManagerMonitorWidgetController::skillSelectionChanged); + connect(widget.treeWidgetSkillExecutions, + &QTreeWidget::currentItemChanged, + this, + &SkillManagerMonitorWidgetController::skillExecutionSelectionChanged); + connect(widget.pushButtonRefreshNow, &QPushButton::clicked, this, @@ -487,7 +488,8 @@ namespace armarx void SkillManagerMonitorWidgetController::stopSkill() { - ARMARX_IMPORTANT << "Stop skill triggered"; + std::string c = selectedSkill.skillExecutionId.skillId.skillName; + ARMARX_IMPORTANT << "Stop skill triggered: " << c; // std::scoped_lock l(updateMutex); // if (selectedSkill.skillId.fullySpecified()) // { @@ -505,6 +507,24 @@ namespace armarx // manager->abortSkill(selectedSkill.skillId); } + void + SkillManagerMonitorWidgetController::skillExecutionSelectionChanged(QTreeWidgetItem* current, + QTreeWidgetItem*) + { + std::scoped_lock l(updateMutex); + widget.groupBoxSkillExecutions->setEnabled(false); + + if (!current) + { + // gui has died? + return; + } + + auto c = static_cast<SkillExecutionInfoTreeWidgetItem*>(current); + selectedSkill.skillExecutionId = c->executionId; + widget.groupBoxSkillExecutions->setEnabled(true); + } + void SkillManagerMonitorWidgetController::skillSelectionChanged(QTreeWidgetItem* current, QTreeWidgetItem*) diff --git a/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.h b/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.h index c894f30c2807dd4482d29197cb3e38618e5f7d4e..6d35a527996a77536ee369a0061aab7915dc51e2 100644 --- a/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.h +++ b/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.h @@ -116,6 +116,7 @@ namespace armarx private slots: void skillSelectionChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous); + void skillExecutionSelectionChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous); void stopSkill(); void executeSkill(); @@ -155,9 +156,14 @@ namespace armarx struct SelectedSkill { skills::SkillID skillId; + skills::SkillExecutionID skillExecutionId; // make default constructable - SelectedSkill() : skillId({skills::SkillID::UNKNOWN}, skills::SkillID::UNKNOWN) + SelectedSkill() : + skillId({skills::SkillID::UNKNOWN}, skills::SkillID::UNKNOWN), + skillExecutionId({{skills::SkillID::UNKNOWN}, skills::SkillID::UNKNOWN}, + skills::SkillExecutionID::UNKNOWN, + armarx::core::time::DateTime::Invalid()) { } } selectedSkill; diff --git a/source/RobotAPI/libraries/skills/core/SkillExecutionID.h b/source/RobotAPI/libraries/skills/core/SkillExecutionID.h index 7ba3ea9872806f3b52c8033aa68714850e6d9351..a39d82bd2c951ddbf3617e04791094cdf3c3c59f 100644 --- a/source/RobotAPI/libraries/skills/core/SkillExecutionID.h +++ b/source/RobotAPI/libraries/skills/core/SkillExecutionID.h @@ -21,6 +21,7 @@ namespace armarx SkillID skillId; std::string executorName; armarx::core::time::DateTime executionStartedTime; + static const constexpr char* UNKNOWN = "UNKNOWN"; SkillExecutionID() = delete; SkillExecutionID(const SkillID&,