YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
MainWindow.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: GPL-3.0-or-later
4 */
5
6#ifndef MAINWINDOW_H
7#define MAINWINDOW_H
8
9#include <QMainWindow>
10#include <QGVScene.h>
11#include <QProgressDialog>
12#include <QStringList>
13#include <QStringListModel>
14#include <QTreeWidgetItem>
15
17
19 MODULE = 1,
20 PORT = 2,
21 MACHINE = 3};
22
23
24class NodeWidgetItem : public QTreeWidgetItem {
25public:
26 NodeWidgetItem(QTreeWidgetItem* parent, yarp::profiler::graph::Vertex* vertex, int type)
27 : QTreeWidgetItem(parent, QStringList(vertex->property.find("name").asString().c_str()), type)
28 {
30 std::stringstream label;
31 label << vertex->property.find("name").asString().c_str()
32 << " (" << vertex->property.find("pid").asInt32() << ")";
33 setText(0, label.str().c_str());
34 }
35 else if(dynamic_cast<yarp::profiler::graph::MachineVertex*> (vertex))
36 {
37 std::stringstream label;
38 label << vertex->property.find("hostname").asString().c_str()
39 << " (" << vertex->property.find("os").asString() << ")";
40 setText(0, label.str().c_str());
41 }
42 checkFlag = false;
44 }
45
46 void check(bool flag) {
47 checkFlag = flag;
48 setCheckState( 0, (flag == true) ? Qt::Checked : Qt::Unchecked);
49 if (!checkFlag) {
50 {
51 vertex->property.put("hidden", true);
52 }
53 } else {
54 {
55 vertex->property.put("hidden", false);
56 }
57 }
58 }
59
60 bool checked() { return checkFlag; }
62
63public:
66};
67
68namespace Ui {
69class MainWindow;
70}
71
73{
74 Q_OBJECT
75
76public:
77 explicit MainWindow(QWidget *parent = 0);
80
81public:
82 void onProgress(unsigned int percentage) override;
83
84private:
85 void initScene();
86 void onNodeContextMenuPort(QGVNode *node, yarp::profiler::graph::GraphicVertex* vertex);
87 void updateNodeWidgetItems();
88 void populateTreeWidget();
89
90private slots:
91 void nodeContextMenu(QGVNode* node);
92 void edgeContextMenu(QGVEdge* edge);
93 void nodeDoubleClick(QGVNode* node);
94 void onProfileYarpNetwork();
95 void onHighlightLoops();
96 void onLayoutOrthogonal();
97 void onLayoutPolyline();
98 void onLayoutLine();
99 void onLayoutCurved();
100 void onUpdateGraph();
101 void onNodesTreeItemClicked(QTreeWidgetItem *item, int column);
102 void onWindowMessageBox();
103 void onWindowItem();
104 void onExportScene();
105 void onExportConList();
106 void onUpdateQosStatus();
107 void onConfigureConsQos();
108 void onProfilePortsRate();
109 void onSubGraphContextMenuProcess(QGVSubGraph *node);
110 void onAbout();
111 void onBackgroundGrid();
112
113private:
114 Ui::MainWindow *ui;
115 QGVScene *scene;
116 QProgressDialog* progressDlg;
117 QStringList messages;
118 QStringListModel stringModel;
121 yarp::profiler::graph::Graph* currentGraph;
122 std::string layoutStyle;
123 bool layoutSubgraph;
124 QTreeWidgetItem *moduleParentItem;
125 QTreeWidgetItem *portParentItem;
126 QTreeWidgetItem *machinesParentItem;
127 std::map<std::string, QGVSubGraph*> sceneSubGraphMap;
128 std::map<std::string, QGVNode*> sceneNodeMap;
129};
130
131#endif // MAINWINDOW_H
NodeItemType
Definition MainWindow.h:18
@ UNKNOWN
Definition MainWindow.h:18
@ PORT
Definition MainWindow.h:20
@ MODULE
Definition MainWindow.h:19
@ MACHINE
Definition MainWindow.h:21
MainWindow class.
Definition display.h:22
QGraphicsScene * scene
Definition display.h:37
MainWindow(QWidget *parent=0)
void drawGraph(yarp::profiler::graph::Graph &graph)
void onProgress(unsigned int percentage) override
void check(bool flag)
Definition MainWindow.h:46
yarp::profiler::graph::Vertex * vertex
Definition MainWindow.h:65
yarp::profiler::graph::Vertex * getVertex()
Definition MainWindow.h:61
NodeWidgetItem(QTreeWidgetItem *parent, yarp::profiler::graph::Vertex *vertex, int type)
Definition MainWindow.h:26
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition Property.cpp:987
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition Value.cpp:204
virtual std::string asString() const
Get string value.
Definition Value.cpp:234
The yarp::profiler::graph::Graph class.
Definition Graph.h:104
The yarp::profiler::graph::Vertex class.
Definition Graph.h:72
yarp::os::Property property
Definition Graph.h:89
Definition aboutdlg.h:11