StatechartEditorController.cpp
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  */
25 
28 
29 #include "model/StateTreeModel.h"
30 #include "io/GroupXmlReader.h"
31 #include "io/GroupXmlWriter.h"
35 
36 #include "../StatechartViewerPlugin/view/StatechartView.h"
37 #include "../StatechartViewerPlugin/view/StateItem.h"
40 #include <ArmarXCore/interface/statechart/RemoteStateOffererIce.h>
41 
42 #include <IceUtil/UUID.h>
43 
44 #include <QCoreApplication>
45 #include <QInputDialog>
46 #include <QLabel>
47 #include <QMessageBox>
48 #include <QTimer>
49 
50 #include <SimoxUtility/algorithm/string/string_tools.h>
51 
52 #include <filesystem>
53 
54 namespace armarx
55 {
56 
58  // editor(NULL)
59  watcher(NULL)
60  {
61  // For jsonobject double/float serilization on german/spanish pcs....
62  setlocale(LC_ALL, "C");
63 
64  QSettings s("KIT", "ArmarXStatechartEditor");
65  config.lockRemoteStates = s.value("lockRemoteStates", true).toBool();
66  config.searchPaths = s.value("searchPaths").toStringList();
67 
68 
69  }
70 
71 
73  {
75  }
76 
78  {
79  ARMARX_INFO << "Updating auto-storage config";
80  QSettings s("KIT", "ArmarXStatechartEditor");
81  s.setValue("lockRemoteStates", config.lockRemoteStates);
82  s.setValue("searchPaths", config.searchPaths);
83  }
84 
86  {
87  QStringList result;
88  if (basePath.isEmpty())
89  {
90  return result;
91  }
92  try
93  {
94  int i = 0;
95 
96  for (std::filesystem::recursive_directory_iterator end, dir(basePath.toUtf8().data());
97  dir != end && getState() < eManagedIceObjectExiting; ++dir, i++)
98  {
99  std::string path(dir->path().c_str());
100  // search for all statechart group xml files
101  if (dir->path().extension() == ".scgxml")
102  {
103  // skip groups in deprecated folders
104  if (path.find("deprecated") != std::string::npos)
105  {
106  ARMARX_INFO << "Skipping deprecated Statechart Group " << path;
107  }
108  else
109  {
110  result << dir->path().c_str();
111  }
112  }
113 
114  if (i % 100 == 0)
115  {
116  QCoreApplication::processEvents();
117  }
118  }
119  }
120  catch (std::exception& e)
121  {
122  ARMARX_WARNING << "Invalid filepath: " << e.what();
123  }
124 
125  return result;
126  }
127 
129  {
130  packageTool.reset(new ArmarXPackageToolInterface());
131 
132  }
133 
135  {
136  QTimer::singleShot(0, this, SLOT(initWidget()));
137  stateWatcher = new StateWatcher();
138  getArmarXManager()->addObject(stateWatcher, "StateWatcher" + IceUtil::generateUUID(), false);
139  }
140 
142  {
143  }
144 
146  {
147  if (executionStatusTask)
148  {
149  executionStatusTask->stop();
150  }
151  }
152 
154  {
155  // searchPaths = settings->value("paths").toStringList();
156  // int size = settings->beginReadArray("groups");
157  // for(int row = 0; row < size; row++)
158  // {
159  // settings->setArrayIndex(row);
160  // config.groupsToLoad.push_back(settings->value("path").toString());
161  // }
162  // settings->endArray();
163  if (!profiles)
164  {
165  profiles = StatechartProfiles::ReadProfileFiles(Application::getInstance()->getDefaultPackageNames());
166  }
167 
168  if (settings->contains("selectedProfile"))
169  {
170  config.selectedProfile = profiles->getProfileByName(settings->value("selectedProfile").toString().toStdString());
171  }
172  else if (getConfigDialog(getWidget())->exec() == QDialog::Accepted)
173  {
174  configured();
175  }
176  else
177  {
178  config.selectedProfile = profiles->getProfileByName(profiles->GetRootName());
179  }
180 
181  config.openAllStatesWasSelected = settings->value("openAllStatesSelected", false).toBool();
182  }
183 
185  {
186  // settings->setValue("paths", searchPaths);
187  // if(treeController)
188  // {
189  // settings->beginWriteArray("groups");
190  // for(int row = 0; row < treeController->rowCount(); row++)
191  // {
192  // QModelIndex index = treeController->index(row, 0);
193  // auto node = treeController->getNode(index);
194  //
195  // settings->setArrayIndex(row);
196  // settings->setValue("path", node->getGroup()->getDefinitionFilePath());
197  // }
198  // settings->endArray();
199  // }
200 
202  {
203  settings->setValue("selectedProfile", QString::fromStdString(config.selectedProfile->getName()));
204  }
205 
206  settings->setValue("openAllStatesSelected", config.openAllStatesWasSelected);
207 
208  }
209 
210 
212  {
213  StateTreeNodePtr node = treeController->getNode(index);
214 
215  if (node && node->getState())
216  {
217  int index = editor->getStateTabWidget()->getStateTab(node->getState());
218  getTipDialog()->showMessage("You can move states by holding the SHIFT + left click button. You can move the scene by holding ALT + move mouse.", "State Interaction");
219 
220  if (index < 0)
221  {
222  editor->getStateTabWidget()->addStateTab(node->getState());
223  }
224  else
225  {
226  editor->getStateTabWidget()->setCurrentIndex(index);
227  }
228  }
229 
230  }
231 
233  {
234  treeController->saveAll();
235  }
236 
238  {
239  StatechartView* view = editor->getUI()->stateTabWidget->stateview(index);
240 
241  if (view && view->getStateInstance() && view->getStateInstance()->getStateClass())
242  {
243  treeController->selectNodeByState(view->getStateInstance()->getStateClass());
245  view->showSubSubstates(editor->ui->actionShow_Subsubstates->isChecked());
246  }
247  }
248 
250  {
251  QList<QString> selectedProxies;
252  // enable statechart context generation for new groups by default
253  EditStatechartGroupDialog d(EditStatechartGroupDialog::NewGroup, "", packageTool, variantInfo, selectedProxies, true, profiles);
254 
255  if (d.exec() == QDialog::Accepted)
256  {
258  }
259  }
260 
262  {
266  if (d.exec() == QDialog::Accepted)
267  {
269  config.searchPaths.removeDuplicates();
271  // d.setPaths(config.searchPaths);
272  // d.setRemoteStatesLocked(config.lockRemoteStates);
273  // if(d.exec() == QDialog::Accepted)
274  // {
275  // config.searchPaths = d.getPaths();
276  // searchAndAddPaths(config.searchPaths);
278  stateEditorController->setLockRemoteStatesByDefault(config.lockRemoteStates);
280  }
281  }
282 
284  {
285  editor->getUI()->treeViewProgressBar->show();
286  editor->getUI()->treeViewProgressBar->setMaximum(groups.size());
287  int i = 1;
288  foreach (QString groupPath, groups)
289  {
290  treeController->onOpenGroup(groupPath);
291  editor->getUI()->treeViewProgressBar->setValue(i);
292  i++;
293  qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
294  }
295  editor->getUI()->treeViewProgressBar->hide();
296  }
297 
299  {
300  paths.removeDuplicates();
301  QStringList groups;
302  foreach (QString path, paths)
303  {
304  groups.append(findAllStatechartGroupDefinitions(path.trimmed()));
305  }
306  openStatechartGroups(groups);
307  }
308 
309 
311  {
312  StatechartView* view = editor->getUI()->stateTabWidget->currentStateview();
313 
314  if (view)
315  {
316  connect(view, SIGNAL(selectedStateChanged(statechartmodel::StateInstancePtr)), this, SLOT(showStateCode(statechartmodel::StateInstancePtr)));
317  }
318  }
319 
321  {
322  if (stateInstance && stateInstance->getStateClass())
323  {
324  StateTreeNodePtr node = treeController->getNodeByState(stateInstance->getStateClass());
325 
326  if (node)
327  {
328  std::string filePath = node->getBoostCppFilePath().c_str();
329  showCodeFileContent(QString::fromStdString(filePath));
330  }
331  }
332 
333  }
334 
336  {
337  watcher->removePath(path);
338  std::string fileContent;
339 
340  if (std::filesystem::exists(path.toUtf8().data()))
341  {
342  watcher->addPath(path);
343  fileContent = RapidXmlReader::ReadFileContents(path.toUtf8().data());
344  }
345  else
346  {
347  fileContent = "<cpp missing>";
348  }
349 
350  int line = editor->getUI()->textEditCppCode->textCursor().blockNumber();
351  QTextCursor cursor = editor->getUI()->textEditCppCode->textCursor();
352  cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, line);
353  editor->getUI()->textEditCppCode->setText(QString::fromUtf8(fileContent.c_str()));
354  editor->getUI()->textEditCppCode->setTextCursor(cursor);
355 
356  }
357 
358 
360  {
361  editor->getUI()->textEditCppCode->find("::CreateInstance(");
362  editor->getUI()->textEditCppCode->find("::onEnter()", QTextDocument::FindBackward);
363  }
364 
366  {
367  editor->getUI()->textEditCppCode->find("::CreateInstance(");
368  editor->getUI()->textEditCppCode->find("::run()", QTextDocument::FindBackward);
369 
370  }
371 
373  {
374  editor->getUI()->textEditCppCode->find("::CreateInstance(");
375  editor->getUI()->textEditCppCode->find("::onBreak()", QTextDocument::FindBackward);
376 
377  }
378 
380  {
381  editor->getUI()->textEditCppCode->find("::CreateInstance(");
382  editor->getUI()->textEditCppCode->find("::onExit()", QTextDocument::FindBackward);
383 
384  }
385 
387  {
389 
390  if (editor->getUI()->stateTabWidget->currentStateview())
391  {
392 
393  auto selection = editor->getUI()->stateTabWidget->currentStateview()->getScene()->selectedItems();
394 
395  for (QGraphicsItem* item : selection)
396  {
397  StateItem* stateItem = dynamic_cast<StateItem*>(item);
398 
399  if (stateItem)
400  {
401  if (stateItem->getStateInstance())
402  {
403  state = stateItem->getStateInstance()->getStateClass();
404 
405  if (state)
406  {
407  break;
408  }
409  }
410 
411  }
412  }
413 
414  }
415 
416  if (state)
417  {
418  auto node = treeController->getNodeByState(state);
419 
420  if (node && node->isState())
421  {
422  treeController->openStateCPP(node);
423  }
424  }
425  else
426  {
427  showMessageBox("No state with a StateClass is selected");
428  }
429 
430  }
431 
433  {
434  editor->getStateTabWidget()->clear();
435  }
436 
438  {
439  StatechartView* view = editor->getUI()->stateTabWidget->currentStateview();
440  if (!executedOpenedGroup)
441  {
442  if (view)
443  {
444  auto node = treeController->getNodeByState(view->getStateInstance()->getStateClass());
445  if (node)
446  {
447  if (node->isPublic())
448  {
449  treeController->executeGroupWithDependencies(node->getGroup(), view->getStateInstance()->getStateClass()->getStateName());
450  executedOpenedGroup = node->getGroup();
451  editor->getUI()->toolButtonRunState->setIcon(QIcon(":/icons/delete.ico"));
452  editor->getUI()->toolButtonRunState->setToolTip("Stop the Statechart Group");
453  editor->getUI()->toolButtonWatchStateExecution->setEnabled(false);
454  editor->getUI()->labelExecutionState->setVisible(true);
455  alreadyWatchingState = false;
456  executionStatusTask->start();
457  }
458  else
459  {
460  QMessageBox::warning(editor, "Execution not possible", "You can only execute public state. Right-click on the state in the tree view on the left and select 'Public State'.");
461  }
462  }
463  }
464  else
465  {
466  QMessageBox::warning(editor, "Execution not possible", "You need to open a state before executing it with this button.");
467  }
468  }
469  else
470  {
471  if (executedOpenedGroup)
472  {
473  treeController->stopGroupExecutionWithDependencies(executedOpenedGroup);
474  executedOpenedGroup.reset();
475  executionStatusTask->stop();
476  editor->getUI()->labelExecutionState->setVisible(false);
477  }
478  editor->getUI()->toolButtonRunState->setToolTip("Start the Statechart Group");
479  editor->getUI()->toolButtonRunState->setIcon(QIcon(":/icons/run.svg"));
480  editor->getUI()->toolButtonWatchStateExecution->setEnabled(true);
481  if (view)
482  {
483  view->getScene()->clearActiveSubstates();
484  }
485  std::function<void(StateItem* state)> unsubscriptionLamba;
486  unsubscriptionLamba = [&](StateItem * state)
487  {
488  stateWatcher->unsubscribeState(state);
489  for (auto stateInstance : state->getSubstateItems())
490  {
491  if (stateInstance)
492  {
493  unsubscriptionLamba(stateInstance);
494  }
495  }
496  };
497  unsubscriptionLamba(view->getScene()->getTopLevelStateItem());
498  }
499 
500  }
501 
502  void StatechartEditorController::updateExecutionButtonStatus()
503  {
504  bool changeToWaiting = false;
505  QString labelText = "";
506  if (executedOpenedGroup)
507  {
508  std::string proxyName = executedOpenedGroup->getName().toStdString() + "StateComponentAppManager";
509  std::string objName = config.selectedProfile->getName() + executedOpenedGroup->getName().toStdString() + "RemoteStateOfferer";
510  ArmarXManagerInterfacePrx stateComponentProxy = getProxy<ArmarXManagerInterfacePrx>(proxyName, false, "", false);
511  try
512  {
513  if (getArmarXManager()->getIceManager()->isObjectReachable(objName))
514  {
515  // Dont need to do anything, the RemoteStateOfferer is already running.
516  }
517  else if (stateComponentProxy)
518  {
519  auto state = stateComponentProxy->getObjectState(objName);
520  if (state != eManagedIceObjectStarted)
521  {
522  Ice::StringSeq deps;
523  for (auto elem : stateComponentProxy->getObjectConnectivity(objName).dependencies)
524  {
525  ManagedIceObjectDependencyBasePtr dep = elem.second;
526  if (!dep->getResolved())
527  {
528  if (deps.size() >= 2)
529  {
530  deps.push_back("...");
531  break;
532  }
533  else
534  {
535  deps.push_back(dep->getName());
536  }
537  }
538  }
539  labelText = "Waiting for dependencies: " + QString::fromStdString(simox::alg::join(deps, ", "));
540  changeToWaiting = true;
541  }
542  }
543  else
544  {
545  labelText = "Waiting for statechart group to start";
546  changeToWaiting = true;
547  }
548  }
549  catch (const Ice::Exception& e)
550  {
551  labelText = "Waiting for statechart group to start (ice-exception catched)";
552  changeToWaiting = true;
553  }
554 
555  catch (...)
556  {
557  labelText = "Waiting for statechart group to start (exception catched)";
558  changeToWaiting = true;
559  }
560 
561  if (!changeToWaiting)
562  {
563  labelText = "Statechart group is running";
564  if (editor->getUI()->toolButtonWatchStateExecution->isChecked() && !alreadyWatchingState)
565  {
566  watchState(objName);
567  }
568  }
569  }
570  QMetaObject::invokeMethod(editor->getUI()->labelExecutionState, "setText", Qt::QueuedConnection, Q_ARG(QString, labelText));
571  // editor->getUI()->labelExecutionState->setText(labelText);
572 
573  }
574 
575  void StatechartEditorController::watchState(const std::string& objName)
576  {
577  RemoteStateOffererInterfacePrx statechartHandler = getProxy<RemoteStateOffererInterfacePrx>(objName, false, "", false);
578  // ARMARX_INFO << deactivateSpam(4) << "getting proxy for " << objName;
579  StatechartView* view = editor->getUI()->stateTabWidget->currentStateview();
580  if (view)
581  {
582  std::string globalStateName = "TopLevel->" + view->getStateInstance()->getStateClass()->getStateName().toStdString();
583  QMap<QString, StateInstanceData> instanceData = view->getScene()->getStateInstanceData();
584  auto toplevelPathString = view->getScene()->getTopLevelStateItem()->getFullStatePath();
585  auto asyncResult = statechartHandler->begin_getStatechartInstanceByGlobalIdStr(globalStateName);
586  while (!asyncResult->isCompleted())
587  {
588  if (getState() >= eManagedIceObjectExiting)
589  {
590  return;
591  }
592  usleep(10000);
593  // qApp->processEvents();
594  }
595  armarx::StateIceBasePtr stateptr = statechartHandler->end_getStatechartInstanceByGlobalIdStr(asyncResult);
596  if (!stateptr)
597  {
598  // ARMARX_WARNING_S << deactivateSpam(4) << "Could not find state with name " << globalStateName;
599  }
600  else
601  {
602 
603 
604  std::function<void(StateIceBasePtr iceState, StateItem* state)> subscriptionLamba;
605  subscriptionLamba = [&](StateIceBasePtr iceState, StateItem * state)
606  {
607  stateWatcher->subscribeToState(iceState, state);
608  size_t i = 0;
609  for (auto stateInstance : state->getSubstateItems())
610  {
611  if (stateInstance->getStateInstance()->getStateClass() && iceState->subStateList.size() > i)
612  {
613  subscriptionLamba(StateIceBasePtr::dynamicCast(iceState->subStateList.at(i)), stateInstance);
614  }
615  i++;
616  }
617  };
618  subscriptionLamba(stateptr, view->getScene()->getTopLevelStateItem());
619 
620  alreadyWatchingState = true;
621  }
622  }
623  }
624 
626  {
627  if (!editor)
628  {
629  // QWidget* w = qobject_cast<QWidget*>(new StatechartEditorMainWindow());
630  editor = new StatechartEditorMainWindow();
631  }
632 
633  return qobject_cast<QWidget*>(editor);
634  }
635 
636  void StatechartEditorController::initWidget()
637  {
638  getWidget()->setFocusPolicy(Qt::WheelFocus);
639 
640 
641  ARMARX_INFO << "selectedProfile: " << config.selectedProfile->getFullName();
642  ARMARX_INFO << "profile packages: " << config.selectedProfile->getAllPackages();
643  variantInfo = VariantInfo::ReadInfoFiles({"ArmarXCore"}, true, false); // read core variantinfo file in case the root profile is selected
644  for (auto p : config.selectedProfile->getAllPackages())
645  {
646  variantInfo = VariantInfo::ReadInfoFilesRecursive(p, "", true, variantInfo);
647  }
648  editor->setCommunicator(getIceManager()->getCommunicator());
649  editor->setVariantInfo(variantInfo);
650  editor->setCurrentProfile(config.selectedProfile);
651  editor->getUI()->toolBarViewControl->addWidget(new QLabel(QString::fromStdString("Selected Profile: " + config.selectedProfile->getFullName())));
652  editor->getUI()->toolBarViewControl->insertWidget(editor->getUI()->actionEdit_State_Properties, new QLabel("Active State:"));
653 
654  QList<QVariant> header;
655  header.push_back(QString("TEST"));
656  treeController.reset(new StateTreeController(getIceManager()->getCommunicator(), variantInfo, header, editor->getUI()->treeViewGroups, editor->getUI()->lineEditStateSearch, packageTool, profiles, config.selectedProfile, this));
657 
658 
659  QStringList searchPaths;
661  {
662  for (std::string package : config.selectedProfile->getAllPackages())
663  {
664  for (const auto& includePath : CMakePackageFinder(package).getIncludePathList())
665  {
666  std::filesystem::path packageStatechartPath(includePath.c_str());
667  packageStatechartPath /= package;
668  packageStatechartPath /= "statecharts";
669 
670  if (std::filesystem::exists(packageStatechartPath)
671  && !std::filesystem::exists(packageStatechartPath / "cmake_install.cmake")) // do not add the build dir
672  {
673  ARMARX_VERBOSE << "Adding statechart search path: " << packageStatechartPath.string();
674  searchPaths.push_back(packageStatechartPath.c_str());
675  }
676  }
677  }
678 
679  }
680  config.searchPaths.removeDuplicates();
681 
682 
683 
684 
685  connect(editor->getUI()->actionNew_State_Definition, SIGNAL(triggered()), treeController.get(), SLOT(onNewStateDefinition()));
686  connect(editor->getUI()->actionDelete_State_Definition, SIGNAL(triggered()), treeController.get(), SLOT(onDeleteNode()));
687  connect(editor->getUI()->treeViewGroups, SIGNAL(doubleClicked(QModelIndex)), SLOT(treeviewGroupsDoubleClicked(QModelIndex)));
688  connect(editor->getUI()->actionSave_State, SIGNAL(triggered()), SLOT(requestSave()));
689  connect(editor->getUI()->stateTabWidget, SIGNAL(currentChanged(int)), SLOT(onStateTabChanged(int)));
690  connect(editor->getUI()->actionNew_Statechart_Group, SIGNAL(triggered()), this, SLOT(showNewStatechartGroupDialog()));
691  connect(editor->getUI()->actionOpenStatechartGroup, SIGNAL(triggered()), treeController.get(), SLOT(onOpenGroup()));
692  connect(editor->getUI()->actionSettings, SIGNAL(triggered()), this, SLOT(showStatechartEditorSettingsDialog()));
693  connect(editor->getUI()->toolButtonRunState, SIGNAL(clicked(bool)), this, SLOT(executeOpenedState(bool)));
694 
695  connect(treeController.get(), SIGNAL(closeAllTabsRequested()), this, SLOT(closeAllTabs()));
696 
697  // setup plugin specific shortcuts
698  editor->getUI()->actionOpenStatechartGroup->setShortcutContext(Qt::WidgetWithChildrenShortcut);
699  editor->getUI()->actionOpenStatechartGroup->setShortcut(tr("Ctrl+O"));
700  getWidget()->addAction(editor->getUI()->actionOpenStatechartGroup);
701 
702 
703  stateEditorController.reset(new StateEditorController(editor, treeController, getIceManager()->getCommunicator(), variantInfo, config.selectedProfile, getTipDialog()));
704  stateEditorController->setLockRemoteStatesByDefault(config.lockRemoteStates);
705  connect(editor->getUI()->stateTabWidget, SIGNAL(currentChanged(int)), this, SLOT(connectToView(int)), Qt::UniqueConnection);
706  connect(editor->getUI()->radioOnEnter, SIGNAL(clicked()), this, SLOT(showOnEnterFunction()), Qt::UniqueConnection);
707  connect(editor->getUI()->radioOnBreak, SIGNAL(clicked()), this, SLOT(showOnBreakFunction()), Qt::UniqueConnection);
708  connect(editor->getUI()->radioRun, SIGNAL(clicked()), this, SLOT(showRunFunction()), Qt::UniqueConnection);
709  connect(editor->getUI()->radioOnExit, SIGNAL(clicked()), this, SLOT(showOnExitFunction()), Qt::UniqueConnection);
710 
711 
712  connect(editor->getUI()->btnOpenCppCode, SIGNAL(clicked()), this, SLOT(openSelectedState()));
713 
714  watcher = new QFileSystemWatcher(editor);
715  connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(showCodeFileContent(QString)));
716 
717  searchAndOpenPaths(config.searchPaths + searchPaths);
718  // OpenStatechartGroups(config.groupsToLoad);
719  // config.groupsToLoad.clear();
720  treeController->collapseAll();
721  executionStatusTask = new PeriodicTask<StatechartEditorController>(this, &StatechartEditorController::updateExecutionButtonStatus, 300);
722  }
723 
724 
725 
727  {
728  // QSettings s("KIT", "ArmarXStatechartEditor");
729  // saveSettings(&s);
731  }
732 
734  {
735  StatechartEditorConfigDialog* dialog = qobject_cast<StatechartEditorConfigDialog*>(getConfigDialog(getWidget()));
738  }
739 
740 }
741 QPointer<QDialog> armarx::StatechartEditorController::getConfigDialog(QWidget* parent)
742 {
743  if (!dialog)
744  {
745  profiles = StatechartProfiles::ReadProfileFiles(Application::getInstance()->getDefaultPackageNames());
746  dialog = new StatechartEditorConfigDialog(profiles, parent);
747  }
748 
749  return qobject_cast<StatechartEditorConfigDialog*>(dialog);
750 }
armarx::StatechartEditorConfigDialog::getSelectedProfile
StatechartProfilePtr getSelectedProfile()
Definition: StatechartEditorConfigDialog.cpp:52
armarx::StatechartView::getScene
StateScene * getScene() const
Definition: StatechartView.h:54
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::ManagedIceObject::getIceManager
IceManagerPtr getIceManager() const
Returns the IceManager.
Definition: ManagedIceObject.cpp:353
armarx::StatechartEditorController::Config::lockRemoteStates
bool lockRemoteStates
Definition: StatechartEditorController.h:213
armarx::StatechartEditorController::treeviewGroupsDoubleClicked
void treeviewGroupsDoubleClicked(QModelIndex index)
Definition: StatechartEditorController.cpp:211
armarx::EditStatechartGroupDialog::getProxies
QList< QString > getProxies() const
Definition: EditStatechartGroupDialog.cpp:252
armarx::StatechartEditorSettingsDialog::setPaths
void setPaths(QStringList paths)
Definition: StatechartEditorSettingsDialog.cpp:62
armarx::RapidXmlReader::ReadFileContents
static std::string ReadFileContents(const std::string &path)
Definition: RapidXmlReader.h:462
armarx::StateScene::clearActiveSubstates
void clearActiveSubstates()
Definition: StateScene.cpp:69
armarx::StateTreeNodePtr
std::shared_ptr< StateTreeNode > StateTreeNodePtr
Definition: StatechartGroupDefs.h:31
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
armarx::StateItem::getStateInstance
statechartmodel::StateInstancePtr getStateInstance() const
Definition: StateItem.h:70
armarx::StatechartEditorSettingsDialog::setRemoteStatesLocked
void setRemoteStatesLocked(bool locked)
Definition: StatechartEditorSettingsDialog.cpp:52
armarx::ManagedIceObject::getArmarXManager
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
Definition: ManagedIceObject.cpp:348
armarx::ManagedIceObject::getState
int getState() const
Retrieve current state of the ManagedIceObject.
Definition: ManagedIceObject.cpp:725
armarx::StateWatcher
Definition: StateWatcher.h:36
armarx::StatechartEditorSettingsDialog::getPaths
QStringList getPaths() const
Definition: StatechartEditorSettingsDialog.cpp:47
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
StatechartEditorMainWindow.h
armarx::StatechartEditorController::searchAndOpenPaths
void searchAndOpenPaths(QStringList paths)
Definition: StatechartEditorController.cpp:298
EditStatechartGroupDialog.h
armarx::ArmarXPackageToolInterface
The ArmarXPackageToolInterface class.
Definition: ArmarXPackageToolInterface.h:38
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
armarx::ArmarXWidgetController::getTipDialog
QPointer< TipDialog > getTipDialog() const
Returns the default instance for the TipDialog used by all widgets (if not set otherwise).
Definition: ArmarXWidgetController.cpp:130
armarx::StateScene::getTopLevelStateItem
StateItem * getTopLevelStateItem() const
Definition: StateScene.cpp:130
armarx::StatechartView
Definition: StatechartView.h:44
armarx::StatechartEditorController::showNewStatechartGroupDialog
void showNewStatechartGroupDialog()
Definition: StatechartEditorController.cpp:249
armarx::StatechartEditorSettingsDialog
Definition: StatechartEditorSettingsDialog.h:34
armarx::StatechartEditorController::closeAllTabs
void closeAllTabs()
Definition: StatechartEditorController.cpp:432
armarx::EditStatechartGroupDialog
Definition: EditStatechartGroupDialog.h:44
armarx::VariantInfo::ReadInfoFilesRecursive
static VariantInfoPtr ReadInfoFilesRecursive(const std::string &rootPackageName, const std::string &rootPackagePath, bool showErrors, VariantInfoPtr variantInfo=VariantInfoPtr())
Definition: VariantInfo.cpp:345
armarx::StatechartEditorController::connectToView
void connectToView(int tabIndex)
Definition: StatechartEditorController.cpp:310
armarx::StatechartEditorSettingsDialog::getRemoteStatesLocked
bool getRemoteStatesLocked() const
Definition: StatechartEditorSettingsDialog.cpp:57
armarx::StatechartView::showSubSubstates
void showSubSubstates(bool show=true)
Definition: StatechartView.cpp:169
StateTreeModel.h
armarx::StatechartEditorController::requestSave
void requestSave()
Definition: StatechartEditorController.cpp:232
armarx::StatechartEditorController::showOnExitFunction
void showOnExitFunction()
Definition: StatechartEditorController.cpp:379
armarx::Application::getInstance
static ApplicationPtr getInstance()
Retrieve shared pointer to the application object.
Definition: Application.cpp:288
armarx::StatechartEditorController::getWidget
QPointer< QWidget > getWidget() override
getWidget returns a pointer to the a widget of this controller.
Definition: StatechartEditorController.cpp:625
armarx::VariantInfo::ReadInfoFiles
static VariantInfoPtr ReadInfoFiles(const std::vector< std::string > &packages, bool showErrors=true, bool throwOnError=true)
Definition: VariantInfo.cpp:409
GroupXmlWriter.h
armarx::EditStatechartGroupDialog::getConfigurations
QMap< QString, QString > getConfigurations() const
Definition: EditStatechartGroupDialog.cpp:274
armarx::StatechartEditorController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: StatechartEditorController.cpp:184
armarx::EditStatechartGroupDialog::getGroupDescription
QString getGroupDescription() const
Definition: EditStatechartGroupDialog.cpp:203
armarx::StatechartGroupPtr
std::shared_ptr< StatechartGroup > StatechartGroupPtr
Definition: StatechartGroupDefs.h:34
armarx::EditStatechartGroupDialog::getGroupPath
QString getGroupPath() const
Definition: EditStatechartGroupDialog.cpp:174
armarx::StatechartEditorMainWindow
Definition: StatechartEditorMainWindow.h:46
armarx::EditStatechartGroupDialog::contextGenerationEnabled
bool contextGenerationEnabled() const
Definition: EditStatechartGroupDialog.cpp:269
armarx::StatechartEditorController::config
struct armarx::StatechartEditorController::Config config
armarx::StatechartEditorController::showOnBreakFunction
void showOnBreakFunction()
Definition: StatechartEditorController.cpp:372
armarx::ArmarXWidgetController::showMessageBox
static int showMessageBox(const QString &msg)
Definition: ArmarXWidgetController.cpp:166
armarx::StatechartEditorController::showRunFunction
void showRunFunction()
Definition: StatechartEditorController.cpp:365
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
StatechartEditorSettingsDialog.h
armarx::StatechartEditorController::executeOpenedState
void executeOpenedState(bool)
Definition: StatechartEditorController.cpp:437
armarx::EditStatechartGroupDialog::NewGroup
@ NewGroup
Definition: EditStatechartGroupDialog.h:49
StateTabWidget.h
armarx::EditStatechartGroupDialog::getGroupName
QString getGroupName() const
Definition: EditStatechartGroupDialog.cpp:169
GroupXmlReader.h
armarx::EditStatechartGroupDialog::getPackageName
QString getPackageName() const
Definition: EditStatechartGroupDialog.cpp:208
armarx::StatechartEditorController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: StatechartEditorController.cpp:141
armarx::statechartmodel::StatePtr
std::shared_ptr< State > StatePtr
Definition: State.h:46
armarx::StateItem
Definition: StateItem.h:58
TipDialog.h
armarx::StatechartView::getStateInstance
statechartmodel::StateInstancePtr getStateInstance() const
Definition: StatechartView.cpp:86
armarx::StatechartProfiles::ReadProfileFiles
static StatechartProfilesPtr ReadProfileFiles(const std::vector< std::string > &packages)
Definition: StatechartProfiles.cpp:47
StatechartEditorController.h
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
ArmarXDataPath.h
armarx::ManagedIceObject::getCommunicator
Ice::CommunicatorPtr getCommunicator() const
Definition: ManagedIceObject.cpp:431
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::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:31
armarx::ArmarXComponentWidgetController::onClose
bool onClose() override
If you overwrite this method, make sure to call this implementation at the end of your implementation...
Definition: ArmarXComponentWidgetController.cpp:42
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::StatechartEditorConfigDialog
Definition: StatechartEditorConfigDialog.h:33
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
Application.h
armarx::StatechartEditorConfigDialog::openAllStatesIsSelected
bool openAllStatesIsSelected()
Definition: StatechartEditorConfigDialog.cpp:66
armarx::StateItem::getSubstateItems
QVector< StateItem * > getSubstateItems() const
Definition: StateItem.cpp:680
armarx::StatechartEditorController::showStateCode
void showStateCode(statechartmodel::StateInstancePtr stateInstance)
Definition: StatechartEditorController.cpp:320
armarx::StatechartEditorController::onStateTabChanged
void onStateTabChanged(int index)
Definition: StatechartEditorController.cpp:237