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 <QComboBox>
32 #include <QDialog>
33 #include <QList>
34 #include <QSettings>
35 #include <QTableWidget>
36 #include <QWidget>
37 
38 /* ArmarX Headers */
40 
41 #include "StateItemModel.h"
42 
43 namespace Ui
44 {
45  class EventSenderConfigDialog;
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 
62 
64  {
65  eventSenderName = source.eventSenderName;
66  description = source.description;
67  componentName = source.componentName;
68  globalStateIdentifier = source.globalStateIdentifier;
69 
70 
71  if (source.event)
72  {
73  event = source.event->clone();
74  }
75  else
76  {
77  event = new Event(EVENTTOALL, "dummyEvent");
78  }
79  }
80 
82 
83  void saveSettings(QSettings* settings);
84  void loadSettings(QSettings* settings);
85  };
86 
87  class EventSenderConfigDialog : public QDialog, virtual public Logging
88  // public Component
89 
90  {
91  Q_OBJECT
92 
93  public:
94  Ui::EventSenderConfigDialog* ui;
95 
96  EventSenderConfigDialog(QWidget* parent = 0);
97  ~EventSenderConfigDialog() override;
98 
99 
100  void setEventSender(QString first, QString second);
101 
102  QStringList getPossibleEvents(StateIceBasePtr state);
103 
104  // data retrieval functions
105  QString getSelectedComponentName();
106  QString getSelectedState();
108  void setConfig(const EventSenderConfig& config);
109  const QModelIndex getRowOfItem(QStandardItemModel* model,
110  QString searchString,
111  int userDataRole = 0,
112  QVariant userData = QVariant()) const;
113  const QModelIndex getRowOfItem(QStandardItem* item,
114  QString searchString,
115  int userDataRole = 0,
116  QVariant userData = QVariant()) const;
117  void setIceManager(IceManagerPtr iceManager);
118  public slots:
119  void send();
120  void eventBox(int index);
121  void saveEventSender();
122  void populateStateTreeList();
123  void stateSelected(int index);
124 
125  protected:
126  void setupUi();
127 
128 
129  void getTopLevelStates(std::string componentName,
130  std::vector<StateIceBasePtr>& baseStateList,
131  std::vector<StateIceBasePtr>& instanceStateList);
132 
133  private:
134  int mdiId;
135  TreeBox* treeBox;
136  StateItemModel* model;
137  IceManagerPtr iceManager;
138  // StateParameterEditor* paramEditor;
139  };
141 
142 } // namespace armarx
armarx::EventSenderConfigDialog::setupUi
void setupUi()
Definition: EventSenderConfig.cpp:644
armarx::EventSenderConfigDialog::ui
Ui::EventSenderConfigDialog * ui
Definition: EventSenderConfig.h:94
armarx::EventSenderConfig::loadSettings
void loadSettings(QSettings *settings)
Definition: EventSenderConfig.cpp:103
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:327
armarx::EventSenderConfigDialog::saveEventSender
void saveEventSender()
Definition: EventSenderConfig.cpp:468
armarx::EventSenderConfig::eventSenderName
QString eventSenderName
Definition: EventSenderConfig.h:54
armarx::EventSenderConfig::saveSettings
void saveSettings(QSettings *settings)
Definition: EventSenderConfig.cpp:74
armarx::StateItemModel
Definition: StateItemModel.h:47
armarx::EventSenderConfigDialog::EventSenderConfigDialog
EventSenderConfigDialog(QWidget *parent=0)
Definition: EventSenderConfig.cpp:160
armarx::EventSenderConfig
Definition: EventSenderConfig.h:52
armarx::EventSenderConfigDialog::setIceManager
void setIceManager(IceManagerPtr iceManager)
Definition: EventSenderConfig.cpp:376
armarx::EventSenderConfigDialog::stateSelected
void stateSelected(int index)
Definition: EventSenderConfig.cpp:609
IceInternal::Handle< Event >
armarx::Event
An Event is used to communicate between e.g. condition handlers and statecharts.
Definition: Event.h:50
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:54
armarx::EventSenderConfigDialog::~EventSenderConfigDialog
~EventSenderConfigDialog() override
Definition: EventSenderConfig.cpp:167
StateItemModel.h
armarx::EventSenderConfigDialog::send
void send()
Definition: EventSenderConfig.cpp:185
armarx::EventSenderConfig::globalStateIdentifier
std::string globalStateIdentifier
Definition: EventSenderConfig.h:58
TreeBox
Definition: TreeBox.h:45
armarx::EventSenderConfigDialog::getSelectedState
QString getSelectedState()
Definition: EventSenderConfig.cpp:694
armarx::EventSenderConfig::event
EventPtr event
Definition: EventSenderConfig.h:57
armarx::EventSenderConfigDialog
Definition: EventSenderConfig.h:87
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:661
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:239
armarx::EventSenderConfigDialog::setEventSender
void setEventSender(QString first, QString second)
Definition: EventSenderConfig.cpp:405
IceUtil::Handle< IceManager >
armarx::EventSenderConfig::EventSenderConfig
EventSenderConfig()
Definition: EventSenderConfig.cpp:68
armarx::EventSenderConfigDialog::populateStateTreeList
void populateStateTreeList()
Definition: EventSenderConfig.cpp:524
armarx::EventSenderConfigDialog::getPossibleEvents
QStringList getPossibleEvents(StateIceBasePtr state)
Definition: EventSenderConfig.cpp:387
armarx::EventSenderConfigDialog::eventBox
void eventBox(int index)
Definition: EventSenderConfig.cpp:174
armarx::EventSenderConfigDialog::getTopLevelStates
void getTopLevelStates(std::string componentName, std::vector< StateIceBasePtr > &baseStateList, std::vector< StateIceBasePtr > &instanceStateList)
Definition: EventSenderConfig.cpp:577
armarx::EventSenderConfigDialog::setConfig
void setConfig(const EventSenderConfig &config)
Definition: EventSenderConfig.cpp:273
armarx::EventSenderConfigDialog::getSelectedEvent
EventPtr getSelectedEvent()
Definition: EventSenderConfig.cpp:213
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::EventSenderConfig::EventSenderConfig
EventSenderConfig(const EventSenderConfig &source)
Definition: EventSenderConfig.h:63
EVENTTOALL
#define EVENTTOALL
Definition: StateBase.h:42
armarx::EventSenderConfigDialog::getSelectedComponentName
QString getSelectedComponentName()
Definition: EventSenderConfig.cpp:687