EventSenderConfig.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 /* ArmarX headers */
27 
28 #include "TreeBox.h"
29 
30 /* Qt headers */
31 #include <QTableWidget>
32 #include <QWidget>
33 #include <QComboBox>
34 #include <QList>
35 #include <QSettings>
36 #include <QDialog>
37 
38 /* ArmarX Headers */
40 #include "StateItemModel.h"
41 
42 namespace Ui
43 {
44  class EventSenderConfigDialog;
45 }
46 
47 
48 namespace armarx
49 {
50  class StateParameterEditor;
51 
53  {
54  QString eventSenderName;
55  QString description;
56  QString componentName;
58  std::string globalStateIdentifier;
59 
60 
63  {
64  eventSenderName = source.eventSenderName;
65  description = source.description;
66  componentName = source.componentName;
67  globalStateIdentifier = source.globalStateIdentifier;
68 
69 
70  if (source.event)
71  {
72  event = source.event->clone();
73  }
74  else
75  {
76  event = new Event(EVENTTOALL, "dummyEvent");
77  }
78  }
80 
81  void saveSettings(QSettings* settings);
82  void loadSettings(QSettings* settings);
83 
84  };
85 
87  public QDialog,
88  virtual public Logging
89  // public Component
90 
91  {
92  Q_OBJECT
93 
94  public:
95 
96  Ui::EventSenderConfigDialog* ui;
97 
98  EventSenderConfigDialog(QWidget* parent = 0);
99  ~EventSenderConfigDialog() override;
100 
101 
102 
103 
104  void setEventSender(QString first, QString second);
105 
106  QStringList getPossibleEvents(StateIceBasePtr state);
107 
108  // data retrieval functions
109  QString getSelectedComponentName();
110  QString getSelectedState();
112  void setConfig(const EventSenderConfig& config);
113  const QModelIndex getRowOfItem(QStandardItemModel* model, QString searchString, int userDataRole = 0, QVariant userData = QVariant()) const;
114  const QModelIndex getRowOfItem(QStandardItem* item, QString searchString, int userDataRole = 0, QVariant userData = QVariant()) const;
115  void setIceManager(IceManagerPtr iceManager);
116  public slots:
117  void send();
118  void eventBox(int index);
119  void saveEventSender();
120  void populateStateTreeList();
121  void stateSelected(int index);
122  protected:
123  void setupUi();
124 
125 
126  void getTopLevelStates(std::string componentName, std::vector<StateIceBasePtr>& baseStateList, std::vector<StateIceBasePtr>& instanceStateList);
127  private:
128  int mdiId;
129  TreeBox* treeBox;
130  StateItemModel* model;
131  IceManagerPtr iceManager;
132  // StateParameterEditor* paramEditor;
133 
134 
135  };
137 
138 }
139 
140 
armarx::EventSenderConfigDialog::setupUi
void setupUi()
Definition: EventSenderConfig.cpp:625
armarx::EventSenderConfigDialog::ui
Ui::EventSenderConfigDialog * ui
Definition: EventSenderConfig.h:96
armarx::EventSenderConfig::loadSettings
void loadSettings(QSettings *settings)
Definition: EventSenderConfig.cpp:101
armarx::EventSenderConfig::componentName
QString componentName
Definition: EventSenderConfig.h:56
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::EventSenderConfigDialog::getRowOfItem
const QModelIndex getRowOfItem(QStandardItemModel *model, QString searchString, int userDataRole=0, QVariant userData=QVariant()) const
Definition: EventSenderConfig.cpp:325
armarx::EventSenderConfigDialog::saveEventSender
void saveEventSender()
Definition: EventSenderConfig.cpp:459
armarx::EventSenderConfig::eventSenderName
QString eventSenderName
Definition: EventSenderConfig.h:54
armarx::EventSenderConfig::saveSettings
void saveSettings(QSettings *settings)
Definition: EventSenderConfig.cpp:72
armarx::StateItemModel
Definition: StateItemModel.h:50
armarx::EventSenderConfigDialog::EventSenderConfigDialog
EventSenderConfigDialog(QWidget *parent=0)
Definition: EventSenderConfig.cpp:159
armarx::EventSenderConfig
Definition: EventSenderConfig.h:52
armarx::EventSenderConfigDialog::setIceManager
void setIceManager(IceManagerPtr iceManager)
Definition: EventSenderConfig.cpp:368
armarx::EventSenderConfigDialog::stateSelected
void stateSelected(int index)
Definition: EventSenderConfig.cpp:593
IceInternal::Handle< Event >
armarx::Event
An Event is used to communicate between e.g. condition handlers and statecharts.
Definition: Event.h:52
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:54
armarx::EventSenderConfigDialog::~EventSenderConfigDialog
~EventSenderConfigDialog() override
Definition: EventSenderConfig.cpp:166
StateItemModel.h
armarx::EventSenderConfigDialog::send
void send()
Definition: EventSenderConfig.cpp:189
armarx::EventSenderConfig::globalStateIdentifier
std::string globalStateIdentifier
Definition: EventSenderConfig.h:58
TreeBox
Definition: TreeBox.h:44
armarx::EventSenderConfigDialog::getSelectedState
QString getSelectedState()
Definition: EventSenderConfig.cpp:674
armarx::EventSenderConfig::event
EventPtr event
Definition: EventSenderConfig.h:57
armarx::EventSenderConfigDialog
Definition: EventSenderConfig.h:86
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
Component.h
TreeBox.h
armarx::EventSenderConfig::description
QString description
Definition: EventSenderConfig.h:55
armarx::EventSenderConfig::operator=
EventSenderConfig & operator=(const EventSenderConfig &)=default
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
armarx::EventSenderConfigDialog::setEventSender
void setEventSender(QString first, QString second)
Definition: EventSenderConfig.cpp:395
IceUtil::Handle< IceManager >
armarx::EventSenderConfig::EventSenderConfig
EventSenderConfig()
Definition: EventSenderConfig.cpp:66
armarx::EventSenderConfigDialog::populateStateTreeList
void populateStateTreeList()
Definition: EventSenderConfig.cpp:515
armarx::EventSenderConfigDialog::getPossibleEvents
QStringList getPossibleEvents(StateIceBasePtr state)
Definition: EventSenderConfig.cpp:378
armarx::EventSenderConfigDialog::eventBox
void eventBox(int index)
Definition: EventSenderConfig.cpp:176
armarx::EventSenderConfigDialog::getTopLevelStates
void getTopLevelStates(std::string componentName, std::vector< StateIceBasePtr > &baseStateList, std::vector< StateIceBasePtr > &instanceStateList)
Definition: EventSenderConfig.cpp:563
armarx::EventSenderConfigDialog::setConfig
void setConfig(const EventSenderConfig &config)
Definition: EventSenderConfig.cpp:275
armarx::EventSenderConfigDialog::getSelectedEvent
EventPtr getSelectedEvent()
Definition: EventSenderConfig.cpp:216
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::EventSenderConfig::EventSenderConfig
EventSenderConfig(const EventSenderConfig &source)
Definition: EventSenderConfig.h:62
EVENTTOALL
#define EVENTTOALL
Definition: StateBase.h:42
armarx::EventSenderConfigDialog::getSelectedComponentName
QString getSelectedComponentName()
Definition: EventSenderConfig.cpp:668