StatechartEditorController.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
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 #include "StateEditorController.h"
27 #include "StateTreeController.h"
28 
30 
32 
33 #include <QFileSystemWatcher>
34 
36 
38 
40 
42 
43 namespace armarx
44 {
45  class StatechartEditorMainWindow;
46 
135  public ArmarXComponentWidgetControllerTemplate<StatechartEditorController>
136  {
137  Q_OBJECT
138 
139  public:
141  ~StatechartEditorController() override;
142 
143  QStringList findAllStatechartGroupDefinitions(const QString& basePath);
144 
145  public slots:
146  void treeviewGroupsDoubleClicked(QModelIndex index);
147  void requestSave();
148  void onStateTabChanged(int index);
151  void searchAndOpenPaths(QStringList paths);
152 
153  void connectToView(int tabIndex);
155  void showCodeFileContent(const QString& path);
156  void showOnEnterFunction();
157  void showRunFunction();
158  void showOnBreakFunction();
159  void showOnExitFunction();
160  void openSelectedState();
161  void closeAllTabs();
162  void executeOpenedState(bool);
163  public:
164  // inherited from Component
165  void onInitComponent() override;
166  void onConnectComponent() override;
167  void onDisconnectComponent() override;
168  void onExitComponent() override;
169 
170  // inherited of ArmarXWidget
171  static QString GetWidgetName()
172  {
173  return "Statecharts.StatechartEditor";
174  }
175  static QIcon GetWidgetIcon()
176  {
177  return QIcon(":/statechart-editor/states.svg");
178  }
179  static QIcon GetWidgetCategoryIcon()
180  {
181  return QIcon(":/statechart-editor/states.svg");
182  }
183  void loadSettings(QSettings* settings) override;
184  void saveSettings(QSettings* settings) override;
185 
186  // ArmarXWidgetController interface
187  QPointer<QWidget> getWidget() override;
188  void openStatechartGroups(QStringList groups);
189  private slots:
190  void initWidget();
191  private:
192  void updateExecutionButtonStatus();
193  void watchState(const std::string& objName);
194  QPointer<StatechartEditorMainWindow> editor;
195  StateEditorControllerPtr stateEditorController;
196  StateTreeControllerPtr treeController;
197  ArmarXPackageToolInterfacePtr packageTool;
198  QFileSystemWatcher* watcher;
199  StateWatcherPtr stateWatcher;
200  bool alreadyWatchingState = false;
201  VariantInfoPtr variantInfo;
202  StatechartProfilesPtr profiles;
203  QPointer<StatechartEditorConfigDialog> dialog;
204  StatechartGroupPtr executedOpenedGroup;
206  // ArmarXWidgetController interface
207  public:
208  QPointer<QDialog> getConfigDialog(QWidget* parent) override;
209  struct Config
210  {
211  QStringList searchPaths;
212  QStringList groupsToLoad;
216  } config;
217 
218 
219 
220  // ArmarXWidgetController interface
221  bool onClose() override;
222  void configured() override;
223  void storeAutoSaveSettings();
224 
225  };
226 
227 }
228 
armarx::StatechartEditorController::Config
Definition: StatechartEditorController.h:209
armarx::StatechartEditorController::Config::lockRemoteStates
bool lockRemoteStates
Definition: StatechartEditorController.h:213
armarx::StatechartEditorController::treeviewGroupsDoubleClicked
void treeviewGroupsDoubleClicked(QModelIndex index)
Definition: StatechartEditorController.cpp:211
armarx::StatechartEditorController::Config::groupsToLoad
QStringList groupsToLoad
Definition: StatechartEditorController.h:212
armarx::StateEditorControllerPtr
std::shared_ptr< StateEditorController > StateEditorControllerPtr
Definition: StateEditorController.h:93
armarx::StatechartEditorController::GetWidgetCategoryIcon
static QIcon GetWidgetCategoryIcon()
Definition: StatechartEditorController.h:179
armarx::ArmarXPackageToolInterfacePtr
std::shared_ptr< ArmarXPackageToolInterface > ArmarXPackageToolInterfacePtr
Definition: ArmarXPackageToolInterface.h:55
armarx::StatechartEditorController::showCodeFileContent
void showCodeFileContent(const QString &path)
Definition: StatechartEditorController.cpp:335
armarx::StatechartEditorController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: StatechartEditorController.cpp:741
PeriodicTask.h
StateEditorController.h
armarx::StatechartProfilePtr
std::shared_ptr< class StatechartProfile > StatechartProfilePtr
Definition: StatechartContext.h:52
armarx::StatechartEditorController::showStatechartEditorSettingsDialog
void showStatechartEditorSettingsDialog()
Definition: StatechartEditorController.cpp:261
armarx::StatechartEditorController::~StatechartEditorController
~StatechartEditorController() override
Definition: StatechartEditorController.cpp:72
armarx::StatechartEditorController::openStatechartGroups
void openStatechartGroups(QStringList groups)
Definition: StatechartEditorController.cpp:283
armarx::StatechartEditorController::searchAndOpenPaths
void searchAndOpenPaths(QStringList paths)
Definition: StatechartEditorController.cpp:298
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
armarx::StatechartEditorController::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: StatechartEditorController.cpp:145
armarx::StatechartEditorController::Config::selectedProfile
StatechartProfilePtr selectedProfile
Definition: StatechartEditorController.h:215
armarx::StatechartEditorController::onClose
bool onClose() override
onClose is called before the DockWidget is closed.
Definition: StatechartEditorController.cpp:726
armarx::StatechartEditorController::Config::openAllStatesWasSelected
bool openAllStatesWasSelected
Definition: StatechartEditorController.h:214
armarx::statechartmodel::StateInstancePtr
std::shared_ptr< StateInstance > StateInstancePtr
Definition: StateInstance.h:138
armarx::StatechartEditorController::Config::searchPaths
QStringList searchPaths
Definition: StatechartEditorController.h:211
armarx::StatechartEditorController::StatechartEditorController
StatechartEditorController()
Definition: StatechartEditorController.cpp:57
armarx::StatechartEditorController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: StatechartEditorController.cpp:733
IceInternal::Handle< StateWatcher >
armarx::StatechartProfilesPtr
std::shared_ptr< StatechartProfiles > StatechartProfilesPtr
Definition: StatechartProfiles.h:35
armarx::StatechartEditorController::showNewStatechartGroupDialog
void showNewStatechartGroupDialog()
Definition: StatechartEditorController.cpp:249
ArmarXPackageToolInterface.h
ArmarXComponentWidgetController.h
armarx::StatechartEditorController::closeAllTabs
void closeAllTabs()
Definition: StatechartEditorController.cpp:432
StateTreeController.h
armarx::StatechartEditorController::connectToView
void connectToView(int tabIndex)
Definition: StatechartEditorController.cpp:310
StatechartProfiles.h
armarx::StatechartEditorController::requestSave
void requestSave()
Definition: StatechartEditorController.cpp:232
armarx::StatechartEditorController::showOnExitFunction
void showOnExitFunction()
Definition: StatechartEditorController.cpp:379
armarx::StatechartEditorController::getWidget
QPointer< QWidget > getWidget() override
getWidget returns a pointer to the a widget of this controller.
Definition: StatechartEditorController.cpp:625
armarx::StatechartEditorController
The StatechartEditorController class is the controller of the main widget of the Statechart Editor.
Definition: StatechartEditorController.h:134
armarx::StatechartEditorController::GetWidgetName
static QString GetWidgetName()
Definition: StatechartEditorController.h:171
armarx::StatechartEditorController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: StatechartEditorController.cpp:184
armarx::StatechartGroupPtr
std::shared_ptr< StatechartGroup > StatechartGroupPtr
Definition: StatechartGroupDefs.h:34
StatechartEditorConfigDialog.h
armarx::StatechartEditorController::config
struct armarx::StatechartEditorController::Config config
armarx::StatechartEditorController::showOnBreakFunction
void showOnBreakFunction()
Definition: StatechartEditorController.cpp:372
armarx::StatechartEditorController::showRunFunction
void showRunFunction()
Definition: StatechartEditorController.cpp:365
armarx::StatechartEditorController::executeOpenedState
void executeOpenedState(bool)
Definition: StatechartEditorController.cpp:437
armarx::StatechartEditorController::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: StatechartEditorController.h:175
IceUtil::Handle
Definition: forward_declarations.h:29
StateWatcher.h
armarx::VariantInfoPtr
std::shared_ptr< VariantInfo > VariantInfoPtr
Definition: VariantInfo.h:39
armarx::StatechartEditorController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: StatechartEditorController.cpp:141
armarx::StatechartEditorController::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: StatechartEditorController.cpp:153
armarx::StatechartEditorController::showOnEnterFunction
void showOnEnterFunction()
Definition: StatechartEditorController.cpp:359
armarx::StatechartEditorController::openSelectedState
void openSelectedState()
Definition: StatechartEditorController.cpp:386
armarx::StatechartEditorController::storeAutoSaveSettings
void storeAutoSaveSettings()
Definition: StatechartEditorController.cpp:77
armarx::StatechartEditorController::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: StatechartEditorController.cpp:134
armarx::StatechartEditorController::findAllStatechartGroupDefinitions
QStringList findAllStatechartGroupDefinitions(const QString &basePath)
Definition: StatechartEditorController.cpp:85
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::StatechartEditorController::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: StatechartEditorController.cpp:128
armarx::StateTreeControllerPtr
std::shared_ptr< StateTreeController > StateTreeControllerPtr
Definition: StateEditorController.h:46
armarx::StatechartEditorController::showStateCode
void showStateCode(statechartmodel::StateInstancePtr stateInstance)
Definition: StatechartEditorController.cpp:320
armarx::StatechartEditorController::onStateTabChanged
void onStateTabChanged(int index)
Definition: StatechartEditorController.cpp:237