Privacy
An open-source, flexible 3D physical simulation framework
DataWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014, DFKI GmbH Robotics Innovation Center
3  *
4  * This file is part of the MARS simulation framework.
5  *
6  * MARS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3
9  * of the License, or (at your option) any later version.
10  *
11  * MARS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with MARS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
27 #ifndef DATA_WIDGET_H
28 #define DATA_WIDGET_H
29 
30 #ifdef _PRINT_HEADER_
31 #warning "DataWidget.h"
32 #endif
33 
34 #include <mars/main_gui/PropertyDialog.h>
35 #include <configmaps/ConfigData.h>
36 
37 #include <vector>
38 #include <set>
39 
40 #include <QWidget>
41 #include <QCloseEvent>
42 #include <QMutex>
43 #include <QComboBox>
44 #include <QLineEdit>
45 
46 namespace mars {
47 
48  using namespace std;
49 
50  namespace config_map_gui {
51 
52  class DataWidget : public QWidget,
54 
55  Q_OBJECT;
56 
57  public:
58  DataWidget(void* backwardCFG = 0, QWidget *parent = 0, bool onlyCompactView = false, bool allowAdd = true);
59  ~DataWidget();
60 
61  virtual void valueChanged(QtProperty *property, const QVariant &value);
62 
64  void setConfigMap(const std::string &name,
65  const configmaps::ConfigMap &map);
66  void setEditPattern(const std::vector<std::string> &pattern);
67  void setColorPattern(const std::vector<std::string> &pattern);
68  void setFilePattern(const std::vector<std::string> &pattern);
69  void setCheckablePattern(const std::vector<std::string> &pattern);
70  void setDropDownPattern(const std::vector<std::string> &pattern,
71  const std::vector<std::vector<std::string> > &values);
72  void setFilterPattern(const std::vector<std::string> &pattern);
73  void setBlackFilterPattern(const std::vector<std::string> &pattern);
74  void addConfigMap(const std::string &name, configmaps::ConfigMap &map);
75  void addConfigAtom(const std::string &name, configmaps::ConfigAtom &v);
76  void addConfigVector(const std::string &name, configmaps::ConfigVector &v);
77  void updateConfigMap(const std::string &name,
78  const configmaps::ConfigMap &map);
79  void updateConfigMapI(const std::string &name,
81  void updateConfigAtomI(const std::string &name,
83  void updateConfigVectorI(const std::string &name,
85  const configmaps::ConfigMap& getConfigMap();
86  void clearGUI();
87  void setGroupChecked(const std::string &name, bool value);
88 
89  signals:
90  void mapChanged();
91  void valueChanged(std::string, std::string);
92  void checkChanged(std::string, bool);
93  void colorChanged(std::string, float r, float g, float b, float a);
94 
95  private:
96  QMutex addMutex;
98  std::vector<std::string> editPattern, colorPattern, filePattern, dropDownPattern, checkablePattern, filterPattern, blackFilterPattern;
99  std::vector<std::vector<std::string> > dropDownValues;
100  map<QtVariantProperty*, configmaps::ConfigAtom*> dataMap;
101  map<QtVariantProperty*, configmaps::ConfigMap*> addMap, colorMap;
102  map<QtVariantProperty*, configmaps::ConfigVector*> addVector;
103  map<QtVariantProperty*, std::string> checkMap;
104  map<std::string, QtVariantProperty*> propMap;
105  map<QtVariantProperty*, std::string> nameMap;
106  std::string addKeyStr, cname;
108  QtVariantProperty* addProperty;
109  QComboBox *typeBox;
110  QLineEdit *keyEdit, *valueEdit;
111 
112  int checkInPattern(const std::string &v,
113  const std::vector<std::string> &pattern);
114 
115  private slots:
116  void addKey();
117  void addKey2();
118 
119  protected slots:
120  void timerEvent(QTimerEvent* event);
121  virtual void accept();
122  virtual void reject();
123 
124  };
125 
126  } // end of namespace config_map_gui
127 
128 } // end of namespace mars
129 
130 #endif // DATA_WIDGET_H
131 
configmaps::ConfigMap config
Definition: DataWidget.h:97
u_int8_t b
Definition: CameraSensor.h:43
map< QtVariantProperty *, configmaps::ConfigMap * > colorMap
Definition: DataWidget.h:101
u_int8_t r
Definition: CameraSensor.h:41
map< std::string, QtVariantProperty * > propMap
Definition: DataWidget.h:104
map< QtVariantProperty *, configmaps::ConfigVector * > addVector
Definition: DataWidget.h:102
main_gui::PropertyDialog * pDialog
Definition: DataWidget.h:63
u_int8_t a
Definition: CameraSensor.h:44
map< QtVariantProperty *, std::string > checkMap
Definition: DataWidget.h:103
Copyright 2012, DFKI GmbH Robotics Innovation Center.
QtVariantProperty * addProperty
Definition: DataWidget.h:108
u_int8_t g
Definition: CameraSensor.h:42
Introduced for Windows compatibility.
The PropertyDialog provides the QtProperty functionality.
map< QtVariantProperty *, std::string > nameMap
Definition: DataWidget.h:105
std::vector< std::vector< std::string > > dropDownValues
Definition: DataWidget.h:99
map< QtVariantProperty *, configmaps::ConfigAtom * > dataMap
Definition: DataWidget.h:100
std::vector< std::string > filterPattern
Definition: DataWidget.h:98