Skip to content
Snippets Groups Projects
Verified Commit 7b3269c5 authored by Peter Albrecht's avatar Peter Albrecht :monkey:
Browse files

Add dead skill detection in details widget

parent 4be72e84
No related branches found
No related tags found
1 merge request!512Skill-Gui Stability and QOL
This commit is part of merge request !512. Comments created here will be created in the context of that merge request.
...@@ -137,6 +137,10 @@ namespace armarx::skills::gui ...@@ -137,6 +137,10 @@ namespace armarx::skills::gui
&SkillDetailGroupBox::disconnectGui, &SkillDetailGroupBox::disconnectGui,
skillDetailsTreeWidget, skillDetailsTreeWidget,
&SkillDetailsTreeWidget::disconnectGui); &SkillDetailsTreeWidget::disconnectGui);
connect(this,
&SkillDetailGroupBox::updateGui,
skillDetailsTreeWidget,
&SkillDetailsTreeWidget::updateGui);
// profile buttons // profile buttons
connect(profileMenuWidget->copyArgsToClipboard, connect(profileMenuWidget->copyArgsToClipboard,
......
...@@ -33,6 +33,8 @@ namespace armarx::skills::gui ...@@ -33,6 +33,8 @@ namespace armarx::skills::gui
signals: signals:
void disconnectGui(); void disconnectGui();
void updateGui(SkillManagerWrapper::Snapshot update);
public slots: public slots:
/** /**
* @brief Notify subwidgets of an updated skill selection. * @brief Notify subwidgets of an updated skill selection.
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <QHeaderView> #include <QHeaderView>
#include <QResizeEvent> #include <QResizeEvent>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <ArmarXCore/core/logging/Logging.h>
#include <RobotAPI/libraries/aron/converter/json/NLohmannJSONConverter.h> #include <RobotAPI/libraries/aron/converter/json/NLohmannJSONConverter.h>
...@@ -80,7 +81,7 @@ namespace armarx::skills::gui ...@@ -80,7 +81,7 @@ namespace armarx::skills::gui
} }
void void
SkillDetailsTreeWidget::updateGui() SkillDetailsTreeWidget::updateGui(SkillManagerWrapper::Snapshot update)
{ {
if (!shownSkill.has_value()) if (!shownSkill.has_value())
return; return;
...@@ -120,6 +121,31 @@ namespace armarx::skills::gui ...@@ -120,6 +121,31 @@ namespace armarx::skills::gui
setColumnHidden(3, true); setColumnHidden(3, true);
} }
void SkillDetailsTreeWidget::checkIfShownSkillIsAvailable(SkillManagerWrapper::Snapshot& update)
{
if (this->shownSkill.has_value())
{
// iterate over all available skill ids
for (auto& availableProviderMap : update.skills)
{
for (auto& availableSkill : availableProviderMap.second)
{
// if we find a matching skill id, we return
if (availableSkill.first == this->shownSkill->skillId)
{
return;
}
}
}
// in this case, no matching skill id has been found
// -> reset this view, as the shown skill is invalid
ARMARX_INFO << deactivateSpam(10)
<< "The currently shown skill in the details widget has not been found in the latest manager update. Resetting the widget...";
this->resetWidget();
}
}
/** /**
* Problem: columns 0 and 1 have arbitrary size; so we want to limit their size, to make sure * Problem: columns 0 and 1 have arbitrary size; so we want to limit their size, to make sure
......
#ifndef SKILLDETAILSTREEWIDGET_H #ifndef SKILLDETAILSTREEWIDGET_H
#define SKILLDETAILSTREEWIDGET_H #define SKILLDETAILSTREEWIDGET_H
#include <vector>
#include <QTreeWidget> #include <QTreeWidget>
#include "RobotAPI/libraries/skills/core/SkillID.h"
#include "RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetController.h" #include "RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetController.h"
#include "../memory/MemoryCommunicatorBase.h" #include "../memory/MemoryCommunicatorBase.h"
...@@ -28,7 +30,7 @@ namespace armarx::skills::gui ...@@ -28,7 +30,7 @@ namespace armarx::skills::gui
// this will reset the args to the profile defaults // this will reset the args to the profile defaults
void resetCurrentConfig(); void resetCurrentConfig();
void disconnectGui(); void disconnectGui();
void updateGui(); void updateGui(SkillManagerWrapper::Snapshot update);
void resizeContents(); void resizeContents();
private: private:
...@@ -46,6 +48,7 @@ namespace armarx::skills::gui ...@@ -46,6 +48,7 @@ namespace armarx::skills::gui
AronTreeWidgetControllerPtr aronTreeWidgetController = nullptr; AronTreeWidgetControllerPtr aronTreeWidgetController = nullptr;
void setupUi(); void setupUi();
void checkIfShownSkillIsAvailable(SkillManagerWrapper::Snapshot& update);
}; };
} // namespace armarx::skills::gui } // namespace armarx::skills::gui
......
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