SystemStateMonitorWidget.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX::Gui
19 * @author Jan Issac ( jan.issac at gmail dot com )
20 * @date 2012
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#pragma once
27
28#include <mutex>
29
30#include <QTimer>
31#include <QWidget>
32
36
37#include <ArmarXGui/gui-plugins/SystemStateMonitorPlugin/ui_SystemStateMonitorWidget.h>
41
42#include "ArmarXManagerModel.h"
44
45namespace Ui
46{
47 class SystemStateMonitorWidget;
48}
49
50namespace armarx
51{
52
53 /**
54 \page ArmarXGui-GuiPlugins-SystemStateMonitor SystemStateMonitor
55 \brief The SystemStateMonitor allows you to inspect the properties of the running ArmarX components.
56
57 \image html SystemStateMonitor.png
58 To inspect a component, press the button at the bottom with the wrench symbol.
59 Select any component you wish to inspect from the appearing list.
60 Every component that is waiting for dependencies or is currently starting is yellow. If it was successfully started, it will be green. The dependencies of components are shown in the subtree of each component. Available dependencies are green while missing dependencies are red.
61
62 \see SystemStateMonitorWidget
63 \see SystemStateMonitorPlugin
64 */
65
66 /**
67 \class SystemStateMonitorWidget
68 \brief The SystemStateMonitor allows you to inspect the properties of the running ArmarX components.
69 \see SystemStateMonitorPlugin
70 */
72 public ArmarXComponentWidgetControllerTemplate<SystemStateMonitorWidget>
73 {
74 Q_OBJECT
75
76 public:
77 explicit SystemStateMonitorWidget();
79
80 /**
81 * View setup
82 */
83 void setupView();
84
85 /**
86 * Model setup
87 */
88 void setupModel();
89
90 /**
91 * Load stored manager models
92 */
93 void loadSettings(QSettings* settings) override;
94
95 /**
96 * Saves the manager models
97 */
98 void saveSettings(QSettings* settings) override;
99
100 /**
101 * Returns the Widget name displayed in the ArmarXGui to create an
102 * instance of this.
103 */
104 static QString
106 {
107 return "Meta.SystemStateMonitor";
108 }
109
110 /**
111 * @see armarx::Component::onInitComponent()
112 */
113 void onInitComponent() override;
114
115 /**
116 * @see armarx::Component::onConnectComponent()
117 */
118 void onConnectComponent() override;
119
120 void onDisconnectComponent() override;
121
122 void onExitComponent() override;
123
125
126 bool retrieveManagerObjectsState(ArmarXManagerInterfacePrx prx,
127 ArmarXManagerItem::ObjectMap& objectStates);
128 bool retrieveManagerData(ArmarXManagerInterfacePrx prx,
129 ArmarXManagerItem::ManagerData& managerData);
130
131 signals:
132
134 public slots:
136 /**
137 * Updates the states of the managers stated in the monitored list
138 */
140
141 /**
142 * Accept config changes
143 */
144 void acceptConfig();
145
146 /**
147 * Retrieves the online managers
148 */
150
151 /**
152 * Opens the config dialog
153 */
155 void addArmarXManagers(QStringList managerNames);
156
157 private slots:
158 /**
159 * Prefills the widgets view with all currently existing components
160 */
161 void prefillView();
162 void expandFilterSelection(QString filterStr);
163 void delayedFilterExpansion();
164 void on_btnProblematicOnly_toggled(bool checked);
165
166 private:
167 void fillLegendLayout(QHBoxLayout* layout, ArmarXManagerModel& model) const;
168
169 private:
170 /**
171 * Active monitored managers model
172 */
173 ArmarXManagerModel* monitoredManagerModel;
174
175 /**
176 * Passive manager repository
177 */
178 ArmarXManagerModel* managerRepositoryModel;
179
180 std::mutex managerPrxMapMutex;
181 ManagerPrxMap currentManagerPrxMap;
182 QTimer filterExpansionTimer;
183 /**
184 * Main widget
185 */
186 Ui::SystemStateMonitorWidget ui;
187
188 /**
189 * Config dialog
190 */
191 ArmarXManagerRepositoryDialog* managerRepositoryDialog;
192 QPointer<InfixFilterModel> filterModel;
193
194 /**
195 * Monitored managers state update periodic task
196 */
198
199 /**
200 * Fetches the online managers
201 */
202 QStringList fetchOnlineManagers();
203
204
205 // ArmarXWidgetController interface
206 public:
207 static QIcon
209 {
210 return QIcon(":icons/activity_monitor.png");
211 }
212 };
213
214
215} // namespace armarx
#define ARMARXCOMPONENT_IMPORT_EXPORT
std::map< QString, ManagerData > ManagerDataMap
QMap< QString, ManagedIceObjectItem > ObjectMap
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
void updateManagerStatesSignal(const ArmarXManagerItem::ManagerDataMap &)
bool retrieveManagerData(ArmarXManagerInterfacePrx prx, ArmarXManagerItem::ManagerData &managerData)
void loadSettings(QSettings *settings) override
Load stored manager models.
void updateManagerStates(const ArmarXManagerItem::ManagerDataMap &managerData)
Updates the states of the managers stated in the monitored list.
void saveSettings(QSettings *settings) override
Saves the manager models.
void openManagerRepositoryDialog()
Opens the config dialog.
void retrieveManagerObjectsState(ArmarXManagerItem *item)
void addArmarXManagers(QStringList managerNames)
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this.
void acceptConfig()
Accept config changes.
void retrieveOnlineManagers()
Retrieves the online managers.
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< QString, ArmarXManagerInterfacePrx > ManagerPrxMap