StatechartViewerController.h
Go to the documentation of this file.
1/*
2* This file is part of ArmarX.
3*
4* ArmarX is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License version 2 as
6* published by the Free Software Foundation.
7*
8* ArmarX is distributed in the hope that it will be useful, but
9* WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
15*
16* @package Mirko Waechter
17* @author (waechter at kit dot edu)
18* @date 2014
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22#pragma once
23
24#include <mutex>
25
26#include <QTimer>
27#include <QToolBar>
28
29#include <ArmarXCore/interface/statechart/RemoteStateOffererIce.h> //RemoteStateOffererInterfacePrx
30
33
34#include "IceStateConverter.h"
35#include "StateWatcher.h"
36#include "layout/LayoutThread.h"
37#include "view/StatechartView.h"
38
39namespace Ui
40{
41 class StatechartViewer;
42}
43
44namespace armarx
45{
46
47
48 template <typename ProxyType>
49 class IceProxyFinder;
50
51 class StatechartView;
52
53 /*!
54 \class StatechartViewerController
55 \ingroup ArmarXGui-ArmarXGuiPlugins ArmarXGuiPlugins
56 \see StatechartViewerGuiPlugin
57 */
59 public ArmarXComponentWidgetControllerTemplate<StatechartViewerController>
60 {
61 Q_OBJECT
62
63 public:
66 // inherited from Component
67 void onInitComponent() override;
68 void onConnectComponent() override;
69 void onDisconnectComponent() override;
70 void onExitComponent() override;
71
72 // inherited of ArmarXWidget
73 static QString
75 {
76 return "Statecharts.StatechartViewer";
77 }
78
79 static QIcon
81 {
82 return QIcon("://icons/statechartviewer.svg");
83 }
84
85 void loadSettings(QSettings* settings) override;
86 void saveSettings(QSettings* settings) override;
87
88 // ArmarXWidgetController interface
89 // QPointer<QWidget> getWidget();
90 void updateStatechart();
91 public slots:
92
93 void connectToStateTab(int index);
96 QPoint mouseScreenPos,
97 QPointF mouseItemPos);
98 signals:
100
101 private slots:
102 void connectToIce();
103 void updateStatechartView(StateIceBasePtr stateptr, IceStateConverterPtr converter);
104 void displayParameters(statechartmodel::StateInstancePtr selectedStateInstance);
105 void addNewStateView(QString proxyName, QString stateName);
106 void addNewStateView();
107 void followActiveState();
108 void updateStateComboBox();
109 void updateStateFollower();
110 void removeTab(int index);
111
112 private:
113 Ui::StatechartViewer* ui;
115 RemoteStateOffererInterfacePrx m_statechartHandler;
116 StateWatcherPtr watcher;
118
119 struct RemoteStateData
120 {
121 IceStateConverterPtr converter;
122 QString proxyName;
123 QString globalStateName;
124 };
125
126 QMap<QPointer<StatechartView>, RemoteStateData> converters;
127 QVector<QPair<QString, QString>> delayedConverterAdding;
128 ActiveStateFollower* follower;
129 QPointer<QToolBar> customToolbar;
130 QAction* autoFollowAction;
131 QAction* centerActiveStateAction;
132 std::recursive_mutex mutex;
133 bool shutdown = false;
134 // ArmarXWidgetController interface
135 public:
136 QPointer<QWidget> getCustomTitlebarWidget(QWidget* parent) override;
137 };
138
139} // namespace armarx
uint8_t index
Widget to conveniently retrieve a proxy instance name of a specific interface type (the template para...
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
void onInitComponent() override
Pure virtual hook for the subclass.
void showTransitionContextMenu(statechartmodel::TransitionCPtr transition, statechartmodel::StatePtr state, QPoint mouseScreenPos, QPointF mouseItemPos)
QPointer< QWidget > getCustomTitlebarWidget(QWidget *parent) override
getTitleToolbar returns a pointer to the a toolbar widget of this controller.
void onDisconnectComponent() override
Hook for subclass.
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void onConnectComponent() override
Pure virtual hook for the subclass.
void onExitComponent() override
Hook for subclass.
ArmarX Headers.
std::shared_ptr< State > StatePtr
Definition State.h:48
std::shared_ptr< StateInstance > StateInstancePtr
std::shared_ptr< const Transition > TransitionCPtr
Definition Transition.h:91
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< IceStateConverter > IceStateConverterPtr
IceInternal::Handle< StateWatcher > StateWatcherPtr