YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
applicationviewwidget.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef APPLICATIONVIEWWIDGET_H
7#define APPLICATIONVIEWWIDGET_H
8
9#include <QWidget>
11#include <yarp/manager/module.h>
12#include <QTreeWidgetItem>
13#include "safe_manager.h"
14#include "genericviewwidget.h"
15#include "stdoutwindow.h"
16#include <QList>
17#include <QDockWidget>
18#include "yarpbuilderlib.h"
19#include <customtreewidget.h>
20
21namespace Ui {
23}
24
29{
30 Q_OBJECT
31
32public:
34 yarp::manager::Manager *lazyManager,
35 yarp::os::Property* config,
36 bool editingMode = false,
37 QWidget *parent = nullptr);
38 ~ApplicationViewWidget() override;
39
40 void runApplicationSet(bool onlySelected);
41 void stopApplicationSet(bool onlySelected);
42 void killApplicationSet(bool onlySelected);
43 void connectConnectionSet(bool onlySelected);
44 void disconnectConnectionSet(bool onlySelected);
45 void refresh();
46 void selectAll();
47 void exportGraph();
48
49 bool isRunning();
50
51 void onModStart(int which) override;
52 void onModStop(int which) override;
53 void onModStdout(int which, const char* msg) override;
54 void onConConnect(int which) override;
55 void onConDisconnect(int which) override;
56 void onResAvailable(int which) override;
57 void onResUnAvailable(int which) override;
58 void onConAvailable(int from, int to) override;
59 void onConUnAvailable(int from, int to) override;
60 void onError() override;
61 void onLoadBalance() override;
62 void closeManager();
63 QToolBar* getBuilderToolBar();
65 void showBuilder(bool);
66
67 bool anyModuleSelected();
69
72
73 bool save();
74 QString getFileName();
75 void setFileName(QString filename);
76 QString getAppName();
77 void setAppName(QString appName);
78
79 bool isEditingMode();
80
81private:
82 bool getConRowByID(int id, int *row);
83 bool getResRowByID(int id, int *row);
84 QTreeWidgetItem *getModRowByID(int id, QTreeWidgetItem *parent = NULL);
85 void reportErrors();
86 void prepareManagerFrom(yarp::manager::Manager* lazy);
87 void updateApplicationWindow();
88 bool isEditable(QTreeWidgetItem *it,int col);
89 void selectAllModule(bool check);
90 void selectAllConnections(bool check);
91 void selectAllResources(bool check);
92 void createModulesViewContextMenu();
93 void createConnectionsViewContextMenu();
94 void createResourcesViewContextMenu();
95 bool timeout(double base, double timeout);
96 bool areAllShutdown();
97 void runNestedApplication(QTreeWidgetItem *it,std::vector<int> *MIDs);
98 void stopNestedApplication(QTreeWidgetItem *it,std::vector<int> *MIDs);
99 void killNestedApplication(QTreeWidgetItem *it,std::vector<int> *MIDs);
100 void refreshNestedApplication(QTreeWidgetItem *it,std::vector<int> *MIDs);
101 bool areAllNestedApplicationShutdown(QTreeWidgetItem *it);
102 void closeNestedApplicationStdOut(QTreeWidgetItem *it,int id);
103 void assignHostNestedApplication(QTreeWidgetItem *it);
104 void attachStdOutNestedApplication(QTreeWidgetItem *it,std::vector<int> *MIDs);
105 void modStdOutNestedApplication(QTreeWidgetItem *it, int id,QString s);
106 void selectAllNestedApplicationModule(QTreeWidgetItem *it, bool check);
107 bool scanAvailableCarriers(QString carrier, bool isConnection = true);
108 void updateConnection(int index, std::vector<int> &CIDs);
109 void updateConnectionItem(QTreeWidgetItem *it);
110
111
112
113private:
114 QMainWindow *builderWindowContainer;
115 QDockWidget *builderWidget;
116 BuilderWindow *builder;
117 QToolBar *builderToolBar;
118 QStringList stringLst;
119
120 Ui::ApplicationViewWidget *ui;
121 SafeManager safeManager;
124 yarp::os::Property* m_pConfig;
126
127 QAction *modRunAction;
128 QAction *modStopAction;
129 QAction *modkillAction;
130 QAction *modSeparator;
131 QAction *modRefreshAction;
132 QAction *modSelectAllAction;
133 QAction *modAttachAction;
134 QAction *modAssignAction;
135
136 QMenu *connContex;
137 QMenu *connSubMenu;
138 QAction *connConnectAction;
139 QAction *connDisconnectAction;
140 QAction *connSeparatorAction;
141 QAction *connRefreshAction;
142 QAction *connSelectAllAction;
143 QAction *conn1SeparatorAction;
144 QAction *connInspectAction;
145 QAction *connYARPViewAction;
146 QAction *connYARPReadAction;
147 QAction *connYARPHearAction;
148 QAction *connYARPScopeAction;
149
150 QAction *resRefreshAction;
151 QAction *resSelectAllAction;
152
153 QList <StdoutWindow*> stdoutWinList;
154
155 bool editingMode;
156
157 std::vector<std::string> listOfResourceNames;
158
159
160private slots:
161 void onAssignHost();
162 void onCloseStdOut(int);
163 void onAttachStdout();
164 void onDetachStdout();
165 void onYARPView();
166 void onYARPHear();
167 void onYARPRead();
168 void onYARPScope();
169 void onResourceItemSelectionChanged();
170 void onConnectionItemSelectionChanged();
171 void onModuleItemSelectionChanged();
172 void selectAllModule();
173 void selectAllConnections();
174 void selectAllResources();
175 void onItemDoubleClicked(QTreeWidgetItem*,int);
176 void onItemChanged(QTreeWidgetItem*,int);
177 bool onRun();
178 bool onStop();
179 bool onKill();
180 bool onConnect();
181 bool onDisconnect();
182 bool onRefresh();
183
184 void onSelfSafeLoadBalance();
185 void onSelfConnect(int which);
186 void onSelfDisconnect(int which);
187 void onSelfResAvailable(int which);
188 void onSelfResUnavailable(int which);
189 void onSelfStart(int which);
190 void onSelfStop(int which);
191
192 void onRefreshApplication();
193 void onModuleSelected(QList<int> ids);
194 void onConnectionSelected(QList<int> id);
195
196 void onModuleItemChanged(QTreeWidgetItem*,int);
197
198signals:
199 void logWarning(QString);
200 void logError(QString);
201
203 void selfConnect(int);
204 void selfDisconnect(int);
207 void selfStart(int);
208 void selfStop(int);
209
210
211};
212
213#endif // APPLICATIONVIEWWIDGET_H
The Application View Widget.
void onError() override
Called when an error occurred.
void selfResAvailable(int)
void connectConnectionSet(bool onlySelected)
Connect all modules in the application to their ports using connections list.
void selfResUnavailable(int)
void selectAll()
Select all element in the widget (modules, connections, resources)
void setFileName(QString filename)
void runApplicationSet(bool onlySelected)
Run all modules in the application.
void onConConnect(int which) override
Called when a connection has been performed.
void exportGraph()
Export the current Graph.
void logWarning(QString)
void onConAvailable(int from, int to) override
Called when a connection become available.
bool isRunning()
Tells if a modules is in running state.
void onModStart(int which) override
Called when a modlue has been started.
void onLoadBalance() override
Refresh all and reports errors.
void onModStop(int which) override
Called when a modlue has been stopped.
void killApplicationSet(bool onlySelected)
Kill all running modules in the application.
void onConUnAvailable(int from, int to) override
Called when a connection become unavailable.
CustomTreeWidget * getConnectionList()
void setAppName(QString appName)
void onResUnAvailable(int which) override
Called when a resource become unavailable.
void logError(QString)
void disconnectConnectionSet(bool onlySelected)
Disconnect all modules in the application to their ports using connections list.
void onConDisconnect(int which) override
Called when a disconnection has been performed.
CustomTreeWidget * getModuleList()
void onModStdout(int which, const char *msg) override
Called when a modlue has writes on stdout.
void onResAvailable(int which) override
Called when a resource became available.
void stopApplicationSet(bool onlySelected)
Stop all modules in the application.
A custom QTreeWidget.
Generic View Widget.
Class Application.
Class Manager.
Definition manager.h:20
A class for storing options and configuration information.
Definition Property.h:33
std::string ids(size_t indent)
Definition aboutdlg.h:11