SkillExecutionTreeWidget.h
Go to the documentation of this file.
1 #ifndef SKILLEXECUTIONTREEWIDGET_H
2 #define SKILLEXECUTIONTREEWIDGET_H
3 
4 #include <QTreeWidget>
5 
6 #include <ArmarXCore/core/time.h>
7 
8 #include "../memory/MemoryCommunicatorBase.h"
9 
10 namespace armarx::skills::gui
11 {
12  using StatusMap = std::map<skills::SkillExecutionID, skills::SkillStatusUpdate>;
13 
14  class SkillExecutionTreeWidget : public QTreeWidget, public MemoryCommunicatorBase
15  {
16  public:
17  SkillExecutionTreeWidget(std::shared_ptr<SkillManagerWrapper> _memory,
18  QWidget* parent = nullptr) :
19  QTreeWidget(parent), MemoryCommunicatorBase(_memory)
20  {
21  setupUi();
22  }
23 
25  {
27 
28  // make default constructable
31  .skillId = {.providerId = std::nullopt, .skillName = skills::SkillID::UNKNOWN},
32  .executorName = skills::SkillExecutionID::UNKNOWN,
33  .executionStartedTime = armarx::core::time::DateTime::Invalid()}
34  {
35  }
36  };
37 
38  SelectedExecution& getSelectedExecution();
39 
40  public slots:
41  void disconnectGui();
42  void updateGui(SkillManagerWrapper::Snapshot update);
43 
44  private slots:
45  void executionSelectionChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
46  void runContextMenu(const QPoint& pos);
47  void stopSelectedExecution();
48  void rerunSkillWithSimilarParams();
49 
50  private:
51  void setupUi();
52  void connectSignals();
53 
54  /**
55  * @brief Checks the validity of the selected item at run time.
56  * @return the validity.
57  */
58  bool selectionValid();
59  SelectedExecution selectedExecution;
60  };
61 } // namespace armarx::skills::gui
62 
63 #endif // SKILLEXECUTIONTREEWIDGET_H
armarx::skills::SkillExecutionID
Definition: SkillExecutionID.h:19
armarx::skills::gui::StatusMap
std::map< skills::SkillExecutionID, skills::SkillStatusUpdate > StatusMap
Definition: SkillExecutionTreeWidget.h:12
armarx::skills::gui::SkillExecutionTreeWidget::SelectedExecution::SelectedExecution
SelectedExecution()
Definition: SkillExecutionTreeWidget.h:29
armarx::skills::gui::SkillExecutionTreeWidget::SelectedExecution
Definition: SkillExecutionTreeWidget.h:24
armarx::skills::SkillID::providerId
std::optional< ProviderID > providerId
Definition: SkillID.h:59
armarx::skills::SkillID::UNKNOWN
static const constexpr char * UNKNOWN
Definition: SkillID.h:21
armarx::skills::SkillExecutionID::UNKNOWN
static const constexpr char * UNKNOWN
Definition: SkillExecutionID.h:25
armarx::skills::gui::SkillExecutionTreeWidget::disconnectGui
void disconnectGui()
Definition: SkillExecutionTreeWidget.cpp:84
armarx::skills::gui::SkillExecutionTreeWidget::getSelectedExecution
SelectedExecution & getSelectedExecution()
armarx::skills::gui::SkillExecutionTreeWidget::SelectedExecution::skillExecutionId
skills::SkillExecutionID skillExecutionId
Definition: SkillExecutionTreeWidget.h:26
armarx::skills::gui
Definition: PeriodicUpdateWidget.cpp:11
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
armarx::skills::SkillExecutionID::skillId
SkillID skillId
Definition: SkillExecutionID.h:21
armarx::skills::gui::SkillExecutionTreeWidget::updateGui
void updateGui(SkillManagerWrapper::Snapshot update)
Definition: SkillExecutionTreeWidget.cpp:143
time.h
armarx::skills::gui::SkillExecutionTreeWidget
Definition: SkillExecutionTreeWidget.h:14
armarx::skills::gui::SkillExecutionTreeWidget::SkillExecutionTreeWidget
SkillExecutionTreeWidget(std::shared_ptr< SkillManagerWrapper > _memory, QWidget *parent=nullptr)
Definition: SkillExecutionTreeWidget.h:17
armarx::core::time::DateTime::Invalid
static DateTime Invalid()
Definition: DateTime.cpp:60
armarx::skills::gui::MemoryCommunicatorBase
Definition: MemoryCommunicatorBase.h:14