YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
modestreemanager.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6
7#ifndef MODESTREEMANAGER_H
8#define MODESTREEMANAGER_H
9
10#include <QObject>
11#include <QTreeWidget>
12#include <QVBoxLayout>
13#include <QIcon>
14#include <QTabWidget>
15#include <QTimer>
16#include <string>
17#include <unordered_map>
18#include "partitem.h"
19#include "robotWidgetTree.h"
20
21class ModesListWidget : public QTreeWidget
22{
24
25public:
26 ModesListWidget(QWidget * parent = nullptr);
27};
28
29class ModesTreeManager : public QObject
30{
32
33public:
34 ModesTreeManager(QHBoxLayout* layout, QWidget* parent = nullptr);
35
36 void addRobot(const std::string& robotName);
37
38 void addRobotPart(const std::string& robotName, const std::string &partName, int partIndex, PartItem* part);
39
40 void updateRobotPart(int index);
41
43
44 void sig_jointClicked(int partIndex, int jointIndex);
45
46 void sig_partDoubleClicked(int index);
47
48private slots:
49
50 void onTabChanged(int index);
51
52 void onJointClicked(int partIndex, int jointIndex);
53
54 void onJointHomeFromTree(int partIndex, int jointIndex);
55
56 void onJointRunFromTree(int partIndex, int jointIndex);
57
58 void onJointIdleFromTree(int partIndex, int jointIndex);
59
60 void onJointPIDFromTree(int partIndex, int jointIndex);
61
62 void onPartDoubleClicked(int partIndex);
63
64private:
65
66 void addRobotInList(const std::string& robotName);
67
68 void addRobotInWidget(const std::string& robotName);
69
70 void addRobotPartInList(const std::string& robotName, const std::string &partName, int partIndex, PartItem* part);
71
72 void addRobotPartInWidget(const std::string& robotName, const std::string &partName, int partIndex, PartItem* part);
73
74 void updateRobotPartInList(int index, const QVector<JointItem::JointState>& modes);
75
76 void updateRobotPartInWidget(int index, const QVector<JointItem::JointState>& modes);
77
78 struct PartPointers
79 {
80 PartItem* partItem;
81 QTreeWidgetItem* listWidget;
82 RobotWidgetTree* robotWidget;
83 };
84
85 QTabWidget* m_tabs;
86 ModesListWidget* m_list;
87 QVBoxLayout* m_widgetLayout;
88 std::unordered_map<std::string, QTreeWidgetItem*> m_robotMapList;
89 std::unordered_map<std::string, RobotWidgetTree*> m_robotMapWidget;
90 std::unordered_map<int, PartPointers> m_indexToPartMap;
91 QIcon m_okIcon;
92 QIcon m_warningIcon;
93};
94
95#endif // MODESTREEMANAGER_H
void sig_jointClicked(int partIndex, int jointIndex)
void updateRobotPart(int index)
void addRobotPart(const std::string &robotName, const std::string &partName, int partIndex, PartItem *part)
void addRobot(const std::string &robotName)
void sig_partDoubleClicked(int index)
A mini-server for performing network communication in the background.