Privacy
An open-source, flexible 3D physical simulation framework
DataWidget.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014, 2017, 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 
21 #include "DataWidget.h"
22 
23 #include <mars/utils/misc.h>
24 
25 #include <QVBoxLayout>
26 #include <QLabel>
27 #include <QPushButton>
28 #include <cassert>
29 
30 namespace mars {
31 
32  using namespace configmaps;
33 
34  namespace config_map_gui {
35 
36 
37  DataWidget::DataWidget(void* backwardCFG, QWidget *parent, bool onlyCompactView,
38  bool allowAdd) :
39  QWidget(parent),
40  pDialog(new main_gui::PropertyDialog(parent)),
41  ignore_change(0) {
42 
43  (void)backwardCFG; // prevent paramter unsed warning
44  startTimer(500);
45 
46  QVBoxLayout *vLayout = new QVBoxLayout();
47  vLayout->addWidget(pDialog);
48  vLayout->setContentsMargins(0,0,0,0);
49  if(allowAdd) {
50  QHBoxLayout *hLayout = new QHBoxLayout();
51  QLabel *label = new QLabel("type:");
52  typeBox = new QComboBox();
53  typeBox->addItem("Map");
54  typeBox->addItem("Vector");
55  typeBox->addItem("Item");
56  hLayout->addWidget(label);
57  hLayout->addWidget(typeBox);
58  vLayout->addLayout(hLayout);
59  hLayout = new QHBoxLayout();
60  keyEdit = new QLineEdit();
61  valueEdit = new QLineEdit();
62  hLayout->addWidget(keyEdit);
63  hLayout->addWidget(valueEdit);
64  QPushButton *button = new QPushButton("add");
65  connect(button, SIGNAL(clicked()), this, SLOT(addKey2()));
66  hLayout->addWidget(button);
67  hLayout->setSpacing(4);
68  vLayout->addLayout(hLayout);
69  }
70  vLayout->setSpacing(0);
71  setLayout(vLayout);
72 
73  addProperty = 0;
74  if(onlyCompactView) {
77  }
80  //pDialog->addGenericButton("add key", this, SLOT(addKey()));
81  pDialog->setPropCallback(dynamic_cast<main_gui::PropertyCallback*>(this));
82  }
83 
85  }
86 
87  void DataWidget::setEditPattern(const std::vector<std::string> &pattern) {
88  editPattern = pattern;
89  }
90 
91  void DataWidget::setColorPattern(const std::vector<std::string> &pattern) {
92  colorPattern = pattern;
93  }
94 
95  void DataWidget::setFilePattern(const std::vector<std::string> &pattern) {
96  filePattern = pattern;
97  }
98 
99  void DataWidget::setDropDownPattern(const std::vector<std::string> &pattern,
100  const std::vector<std::vector<std::string> > &values) {
101  dropDownPattern = pattern;
102  dropDownValues = values;
103  }
104 
105  void DataWidget::setCheckablePattern(const std::vector<std::string> &pattern) {
106  checkablePattern = pattern;
107  }
108 
109  void DataWidget::setFilterPattern(const std::vector<std::string> &pattern) {
110  filterPattern = pattern;
111  }
112 
113  void DataWidget::setBlackFilterPattern(const std::vector<std::string> &pattern) {
114  blackFilterPattern = pattern;
115  }
116 
117  void DataWidget::setConfigMap(const std::string &name,
118  const ConfigMap &map) {
119  ignore_change = 1;
120  clearGUI();
121  if(&config != &map) {
122  config = map;
123  cname = name;
124  }
125  std::string n = name;
126  for(size_t i=0; i<n.size(); ++i) {
127  if(n[i] == '/') {
128  n.insert(n.begin()+i, '/');
129  ++i;
130  }
131  }
132  // config.toYamlFile("foo.yml");
133  std::string path = "..";
134  if(!n.empty()) {
135  path += "/" + n;
136  }
137  addConfigMap(path, config);
138  ignore_change = 0;
139  }
140 
141  void DataWidget::addConfigMap(const std::string &name,
142  ConfigMap &map) {
143  ConfigMap::iterator it = map.begin();
144  QtVariantProperty *guiElem;
145  if(checkInPattern(name, colorPattern)) {
146  QColor c;
147  c.setRgbF(map["r"],map["g"], map["b"], map["a"]);
148  guiElem = pDialog->addGenericProperty(name, QVariant::Color, c);
149  //addMap[tmp] = &map;
150  colorMap[guiElem] = &map;
151  nameMap[guiElem] = name;
152  propMap[name] = guiElem;
153  pDialog->expandTree(guiElem);
154  return;
155  }
156  if(checkInPattern(name, checkablePattern)) {
157  guiElem = pDialog->addGenericProperty(name,
158  QVariant::Bool,
159  0);
160  checkMap[guiElem] = name;
161  }
162  else {
163  guiElem = pDialog->addGenericProperty(name,
164  QtVariantPropertyManager::groupTypeId(),
165  0);
166  }
167 
168  for(;it!=map.end(); ++it) {
169  std::string n = it->first;
171  continue;
172  }
173  if(filterPattern.empty() || checkInPattern(n, filterPattern)) {
174  for(size_t i=0; i<n.size(); ++i) {
175  if(n[i] == '/') {
176  n.insert(n.begin()+i, '/');
177  ++i;
178  }
179  }
180 
181  if(it->second.isVector()) {
182  addConfigVector(name+"/"+n, it->second);
183  }
184  else if(it->second.isMap()) {
185  addConfigMap(name+"/"+n, it->second);
186  }
187  else if(it->second.isAtom()) {
188  addConfigAtom(name+"/"+n, it->second);
189  }
190  }
191  }
192  addMap[guiElem] = &map;
193  pDialog->expandTree(guiElem);
194  }
195 
196  void DataWidget::addConfigVector(const std::string &name,
197  ConfigVector &v) {
198  QtVariantProperty *guiElem;
199  if(checkInPattern(name, checkablePattern)) {
200  guiElem = pDialog->addGenericProperty(name,
201  QVariant::Bool,
202  0);
203  checkMap[guiElem] = name;
204  }
205  else {
206  guiElem = pDialog->addGenericProperty(name,
207  QtVariantPropertyManager::groupTypeId(),
208  0);
209  }
210  addVector[guiElem] = &v;
211  for(unsigned long i=0; i<(unsigned long)v.size(); ++i) {
212  char iText[64];
213  iText[0] = '\0';
214  sprintf(iText, "/%d", (int)i);
215  if(v[i].isAtom()) addConfigAtom(name + iText, v[i]);
216  else if(v[i].isVector()) addConfigVector(name + iText, v[i]);
217  else if(v[i].isMap()) addConfigMap(name + iText, v[i]);
218  else {
219  guiElem = pDialog->addGenericProperty(name+iText,
220  QtVariantPropertyManager::groupTypeId(),
221  0);
222  }
223  }
224  }
225 
226  int DataWidget::checkInPattern(const std::string &v,
227  const std::vector<std::string> &pattern) {
228  std::vector<std::string>::const_iterator it = pattern.begin();
229  int i=0;
230  for(; it!=pattern.end(); ++it, ++i) {
231  //fprintf(stderr, "check: %s pattern: %s\n", v.c_str(), it->c_str());
232  if(utils::matchPattern(*it, v)) {
233  return i+1;
234  }
235  }
236  return 0;
237  }
238 
239  void DataWidget::addConfigAtom(const std::string &name,
240  ConfigAtom &v) {
241  QtVariantProperty *guiElem;
242  std::map<QString, QVariant> attr;
243  ConfigAtom::ItemType type = v.getType();
244  if(propMap.find(name) == propMap.end()) {
245  bool editable = true;
246  if(!editPattern.empty()) {
247  editable = checkInPattern(name, editPattern);
248  }
249  if(type == ConfigAtom::UNDEFINED_TYPE) {
250  int type = QVariant::String;
251  if(checkInPattern(name, filePattern)) {
252  type = VariantManager::filePathTypeId();
253  attr["directory"] = ".";
254  }
255  int index = 0;
256  if((index = checkInPattern(name, dropDownPattern))) {
257  index -= 1;
258  QStringList enumNames;
259  std::string value = v.getUnparsedString();
260  int index2 = 0;
261  int i=0;
262  for(std::vector<std::string>::iterator it=dropDownValues[index].begin();
263  it!=dropDownValues[index].end(); ++it, ++i) {
264  enumNames << it->c_str();
265  if(value == *it) {
266  index2 = i;
267  }
268  }
269  guiElem = pDialog->addGenericProperty(name,
270  QtVariantPropertyManager::enumTypeId(),
271  index2, NULL, &enumNames);
272  }
273  else {
274  guiElem = pDialog->addGenericProperty(name, type,
275  QString::fromStdString(v.getUnparsedString()),
276  &attr);
277  }
278  }
279  else if(type == ConfigAtom::STRING_TYPE) {
280  int type = QVariant::String;
281  if(checkInPattern(name, filePattern)) {
282  type = VariantManager::filePathTypeId();
283  attr["directory"] = ".";
284  }
285  int index;
286  if((index = checkInPattern(name, dropDownPattern))) {
287  index -= 1;
288  QStringList enumNames;
289  std::string value = v.getString();
290  int index2 = 0;
291  int i=0;
292  for(std::vector<std::string>::iterator it=dropDownValues[index].begin();
293  it!=dropDownValues[index].end(); ++it, ++i) {
294  enumNames << it->c_str();
295  if(value == *it) {
296  index2 = i;
297  }
298  }
299  guiElem = pDialog->addGenericProperty(name,
300  QtVariantPropertyManager::enumTypeId(),
301  index2, NULL, &enumNames);
302  }
303  else {
304  guiElem = pDialog->addGenericProperty(name, type,
305  QString::fromStdString(v.getString()),
306  &attr);
307  }
308  }
309  else if(type == ConfigAtom::INT_TYPE) {
310  guiElem = pDialog->addGenericProperty(name,
311  QVariant::Int,
312  v.getInt(),
313  &attr);
314  }
315  else if(type == ConfigAtom::UINT_TYPE) {
316  guiElem = pDialog->addGenericProperty(name,
317  QVariant::Int,
318  (int)v.getUInt(),
319  &attr);
320  }
321  else if(type == ConfigAtom::DOUBLE_TYPE) {
322  attr["singleStep"] = 0.01;
323  attr["decimals"] = 7;
324  guiElem = pDialog->addGenericProperty(name,
325  QVariant::Double,
326  v.getDouble(),
327  &attr);
328  }
329  else if(type == ConfigAtom::ULONG_TYPE) {
330  guiElem = pDialog->addGenericProperty(name,
331  QVariant::Int,
332  (int)v.getULong(),
333  &attr);
334  }
335  else if(type == ConfigAtom::BOOL_TYPE) {
336  guiElem = pDialog->addGenericProperty(name,
337  QVariant::Bool,
338  v.getBool(),
339  &attr);
340  }
341  guiElem->setEnabled(editable);
342  dataMap[guiElem] = &v;
343  propMap[name] = guiElem;
344  nameMap[guiElem] = name;
345  }
346  }
347 
348  void DataWidget::updateConfigMap(const std::string &name,
349  const ConfigMap &map) {
350  ignore_change = 1;
351  ConfigMap tmpMap = map;
352  std::string path = "..";
353  std::string n = name;
354  for(size_t i=0; i<n.size(); ++i) {
355  if(n[i] == '/') {
356  n.insert(n.begin()+i, '/');
357  ++i;
358  }
359  }
360  if(!n.empty()) {
361  path += "/" + n;
362  }
363  updateConfigMapI(path, tmpMap);
364  ignore_change = 0;
365  }
366 
367  void DataWidget::updateConfigMapI(const std::string &name,
368  ConfigMap &map) {
369  // todo: hande color itmes
370  if(checkInPattern(name, colorPattern)) {
371  std::map<std::string, QtVariantProperty*>::iterator it = propMap.find(name);
372  if(it != propMap.end()) {
373  ConfigMap &cMap = *(colorMap[it->second]);
374  cMap = map;
375  QColor c;
376  c.setRgbF(map["r"],map["g"], map["b"], map["a"]);
377  it->second->setValue(c);
378  }
379  else { // add the element
380  std::vector<std::string> arrPath = utils::explodeString('/', name);
381  ConfigItem *item = config[arrPath[1]];
382  for(size_t i=2; i<arrPath.size(); ++i) {
383  if(item->isMap()) {
384  item = ((*item)[arrPath[i]]);
385  }
386  else if (item->isVector()) {
387  item = ((*item)[atoi(arrPath[i].c_str())]);
388  }
389  else {
390  fprintf(stderr, "ERROR: update configmap widget structure error!");
391  return;
392  }
393  }
394  *item = map;
395  addConfigMap(name, *item);
396  }
397  return;
398  }
399  ConfigMap::const_iterator it = map.begin();
400  std::string n;
401  for(;it!=map.end(); ++it) {
402  n = it->first;
403  for(size_t i=0; i<n.size(); ++i) {
404  if(n[i] == '/') {
405  n.insert(n.begin()+i, '/');
406  ++i;
407  }
408  }
409 
410  if(it->second.isAtom()) {
411  updateConfigAtomI(name+"/"+n, it->second);
412  }
413  else if(it->second.isVector()) {
414  updateConfigVectorI(name+"/"+n, it->second);
415  }
416  else if(it->second.isMap()) {
417  updateConfigMapI(name+"/"+n, it->second);
418  }
419  }
420  }
421 
422  void DataWidget::updateConfigVectorI(const std::string &name,
423  ConfigVector &v) {
424 
425  for(unsigned long i=0; i<(unsigned long)v.size(); ++i) {
426  char iText[64];
427  iText[0] = '\0';
428  sprintf(iText, "/%d", (int)i);
429  if(v[i].isAtom()) updateConfigAtomI(name + iText, v[i]);
430  else if(v[i].isVector()) updateConfigVectorI(name + iText, v[i]);
431  else if(v[i].isMap()) updateConfigMapI(name + iText, v[i]);
432  }
433  }
434 
435  void DataWidget::updateConfigAtomI(const std::string &name,
436  ConfigAtom &v) {
437 
438  if(propMap.find(name) != propMap.end()) {
439  QtVariantProperty *guiElem;
440  ConfigAtom atom = v;
441  ConfigAtom::ItemType type = atom.getType();
442  guiElem = propMap[name];
443  *(dataMap[guiElem]) = v;
444  // todo: handle dropDownPattern
445  if(type == ConfigAtom::UNDEFINED_TYPE) {
446  guiElem->setValue(QVariant(QString::fromStdString(atom.getUnparsedString())));
447  }
448  else if(type == ConfigAtom::STRING_TYPE) {
449  guiElem->setValue(QVariant(QString::fromStdString(atom.getString())));
450  }
451  else if(type == ConfigAtom::INT_TYPE) {
452  guiElem->setValue(QVariant(atom.getInt()));
453  }
454  else if(type == ConfigAtom::UINT_TYPE) {
455  guiElem->setValue(QVariant(atom.getUInt()));
456  }
457  else if(type == ConfigAtom::DOUBLE_TYPE) {
458  guiElem->setValue(QVariant(atom.getDouble()));
459  }
460  else if(type == ConfigAtom::ULONG_TYPE) {
461  guiElem->setValue(QVariant((int)atom.getULong()));
462  }
463  else if(type == ConfigAtom::BOOL_TYPE) {
464  guiElem->setValue(QVariant(atom.getBool()));
465  }
466  }
467  else { // add the element
468  std::vector<std::string> arrPath = utils::explodeString('/', name);
469  ConfigItem *item = config[arrPath[1]];
470  for(size_t i=2; i<arrPath.size(); ++i) {
471  if(item->isMap()) {
472  item = ((*item)[arrPath[i]]);
473  }
474  else if (item->isVector()) {
475  item = ((*item)[atoi(arrPath[i].c_str())]);
476  }
477  else {
478  fprintf(stderr, "ERROR: update configmap widget structure error!");
479  return;
480  }
481  }
482  *item = v;
483  addConfigAtom(name, *item);
484  }
485  }
486 
488  map<QtVariantProperty*, ConfigAtom*>::iterator it;
489  map<QtVariantProperty*, ConfigMap*>::iterator it2;
490  for(it=dataMap.begin(); it!=dataMap.end(); ++it) {
491  pDialog->removeGenericProperty(it->first);
492  }
493  for(it2=colorMap.begin(); it2!=colorMap.end(); ++it2) {
494  pDialog->removeGenericProperty(it2->first);
495  }
496  for(it2=addMap.begin(); it2!=addMap.end(); ++it2) {
497  pDialog->removeGenericProperty(it2->first);
498  }
499  dataMap.clear();
500  colorMap.clear();
501  nameMap.clear();
502  propMap.clear();
503  addMap.clear();
504  checkMap.clear();
505  addProperty = 0;
506  }
507 
509  return config;
510  }
511 
512  void DataWidget::timerEvent(QTimerEvent* event) {
513  (void)event;
514  }
515 
516  void DataWidget::valueChanged(QtProperty *property, const QVariant &value) {
517  if(ignore_change) return;
518 
519  {
520  // check for color property
521  QtVariantProperty *vp = dynamic_cast<QtVariantProperty*>(property);
522  if(vp->valueType() == QVariant::Color) {
523  map<QtVariantProperty*, ConfigMap*>::iterator it;
524  it = colorMap.find(vp);
525  if(it != colorMap.end()) {
526  QColor c = value.value<QColor>();
527  (*(it->second))["r"] = c.redF();
528  (*(it->second))["g"] = c.greenF();
529  (*(it->second))["b"] = c.blueF();
530  (*(it->second))["a"] = c.alphaF();
531  // emit colorChanged(nameMap[vp], c.redF(), c.greenF(),
532  // c.blueF(), c.alphaF());
533  std::string n = nameMap[vp];
534  emit valueChanged(n+"/r", (*(it->second))["r"].toString());
535  emit valueChanged(n+"/g", (*(it->second))["g"].toString());
536  emit valueChanged(n+"/b", (*(it->second))["b"].toString());
537  emit valueChanged(n+"/a", (*(it->second))["a"].toString());
538  }
539  }
540  else if(vp->propertyType() == QtVariantPropertyManager::enumTypeId()) {
541  map<QtVariantProperty*, ConfigAtom*>::iterator it;
542  it = dataMap.find((QtVariantProperty*)property);
543  if(it != dataMap.end()) {
544  ConfigAtom::ItemType type = it->second->getType();
545  if(type == ConfigAtom::UNDEFINED_TYPE) {
546  it->second->setUnparsedString(property->valueText().toStdString());
547  }
548  else if(type == ConfigAtom::STRING_TYPE) {
549  it->second->setString(property->valueText().toStdString());
550  }
551  emit valueChanged(nameMap[(QtVariantProperty*)property],
552  it->second->toString());
553  }
554  }
555  else {
556  map<QtVariantProperty*, ConfigAtom*>::iterator it;
557  it = dataMap.find((QtVariantProperty*)property);
558  if(it != dataMap.end()) {
559  ConfigAtom::ItemType type = it->second->getType();
560  if(type == ConfigAtom::UNDEFINED_TYPE) {
561  it->second->setUnparsedString(value.toString().toStdString());
562  }
563  else if(type == ConfigAtom::STRING_TYPE) {
564  it->second->setString(value.toString().toStdString());
565  }
566  else if(type == ConfigAtom::INT_TYPE) {
567  it->second->setInt(value.toInt());
568  }
569  else if(type == ConfigAtom::UINT_TYPE) {
570  it->second->setUInt(value.toUInt());
571  }
572  else if(type == ConfigAtom::DOUBLE_TYPE) {
573  it->second->setDouble(value.toDouble());
574  }
575  else if(type == ConfigAtom::ULONG_TYPE) {
576  it->second->setULong(value.toULongLong());
577  }
578  else if(type == ConfigAtom::BOOL_TYPE) {
579  it->second->setBool(value.toBool());
580  }
581  emit valueChanged(nameMap[(QtVariantProperty*)property],
582  it->second->toString());
583  }
584  else {
585  map<QtVariantProperty*, std::string>::iterator it;
586  it = checkMap.find((QtVariantProperty*)property);
587  if(it != checkMap.end()) {
588  emit checkChanged(it->second, value.toBool());
589  }
590  }
591  }
592  }
593  /*
594  {
595  map<QtVariantProperty*, ConfigMap*>::iterator it;
596  it = addMap.find((QtVariantProperty*)property);
597  if(it != addMap.end()) {
598  addKeyStr = value.toString().toStdString();
599  addProperty = it->first;
600  }
601  }
602  */
603  emit mapChanged();
604  }
605 
607  /*
608  if(addProperty) {
609  map<QtVariantProperty*, ConfigMap*>::iterator it;
610  it = addMap.find(addProperty);
611  if(it != addMap.end()) {
612  (*it->second)[addKeyStr] = "";
613  addProperty = 0;
614  }
615  setConfigMap(cname, config);
616  emit mapChanged();
617  }
618  */
619  }
620 
622  std::string key = keyEdit->text().toStdString();
623  std::string value = valueEdit->text().toStdString();
624  QtVariantProperty *prop = dynamic_cast<QtVariantProperty*>(pDialog->activeItem());
625  { // test for map
626  ConfigMap *m = NULL;
627  if(prop) {
628  map<QtVariantProperty*, ConfigMap*>::iterator it;
629  it = addMap.find(prop);
630  if(it != addMap.end()) {
631  m = it->second;
632  }
633  }
634  else {
635  fprintf(stderr, "use global config\n");
636  m = &config;
637  }
638  if(m) {
639  if(m->hasKey(key)) {
640  m->erase(key);
641  }
642  if(typeBox->currentIndex() == 0) { // map
643  (*m)[key] = ConfigMap();
644  }
645  else if(typeBox->currentIndex() == 1) { // vector
646  (*m)[key] = ConfigVector();
647  }
648  else {
649  (*m)[key] = value;
650  emit valueChanged(nameMap[prop]+"/"+key, value);
651  }
652  //config.toYamlFile("da.yml");
654  emit mapChanged();
655  }
656  }
657  if(prop) {
658  { // test for vector
659  map<QtVariantProperty*, ConfigVector*>::iterator it;
660  it = addVector.find(prop);
661  if(it != addVector.end()) {
662  if(typeBox->currentIndex() == 0) { // map
663  it->second->append(ConfigMap());
664  }
665  else if(typeBox->currentIndex() == 1) { // vector
666  it->second->append(ConfigVector());
667  }
668  else {
669  it->second->append(ConfigAtom(value));
670  char da[10];
671  sprintf(da, "/%d", (int)it->second->size()-1);
672  emit valueChanged(nameMap[prop]+da, value);
673  }
674  }
675  }
676  //config.toYamlFile("da.yml");
678  emit mapChanged();
679  }
680  }
681 
684 
685  void DataWidget::setGroupChecked(const std::string &name, bool value) {
686  ignore_change = 1;
687  map<QtVariantProperty*, std::string>::iterator it = checkMap.begin();
688  for(; it!=checkMap.end(); ++it) {
689  if(it->second == name) {
690  it->first->setValue(QVariant(value));
691  break;
692  }
693  }
694  ignore_change = 0;
695  }
696 
697  } // end of namespace config_map_widget
698 
699 } // end of namespace mars
void updateConfigVectorI(const std::string &name, configmaps::ConfigVector &map)
Definition: DataWidget.cpp:422
void addConfigVector(const std::string &name, configmaps::ConfigVector &v)
Definition: DataWidget.cpp:196
void setBlackFilterPattern(const std::vector< std::string > &pattern)
Definition: DataWidget.cpp:113
void checkChanged(std::string, bool)
void timerEvent(QTimerEvent *event)
Definition: DataWidget.cpp:512
map< QtVariantProperty *, configmaps::ConfigMap * > addMap
Definition: DataWidget.h:101
std::vector< std::string > filePattern
Definition: DataWidget.h:98
void setViewButtonVisibility(bool visible)
Sets the visibility of the view button.
unsigned int getUInt()
Definition: ConfigAtom.hpp:174
void addConfigAtom(const std::string &name, configmaps::ConfigAtom &v)
Definition: DataWidget.cpp:239
configmaps::ConfigMap config
Definition: DataWidget.h:97
void setPropCallback(PropertyCallback *pc)
Sets the callback object.
Definition: tsort.c:44
map< QtVariantProperty *, configmaps::ConfigMap * > colorMap
Definition: DataWidget.h:101
map< std::string, QtVariantProperty * > propMap
Definition: DataWidget.h:104
map< QtVariantProperty *, configmaps::ConfigVector * > addVector
Definition: DataWidget.h:102
void removeGenericProperty(QtVariantProperty *property)
Removes the property.
const configmaps::ConfigMap & getConfigMap()
Definition: DataWidget.cpp:508
std::vector< std::string > editPattern
Definition: DataWidget.h:98
main_gui::PropertyDialog * pDialog
Definition: DataWidget.h:63
Base object of the configmaps library!
Definition: ConfigItem.hpp:58
std::list< FIFOItem< std::string, ConfigItem > >::iterator iterator
Definition: FIFOMap.h:57
map< QtVariantProperty *, std::string > checkMap
Definition: DataWidget.h:103
void clearButtonBox(void)
Removes all buttons from the button box.
std::list< FIFOItem< std::string, ConfigItem > >::const_iterator const_iterator
Definition: FIFOMap.h:58
void setButtonBoxVisibility(bool visible)
Sets the visibility of the button box.
void setGroupChecked(const std::string &name, bool value)
Definition: DataWidget.cpp:685
void setConfigMap(const std::string &name, const configmaps::ConfigMap &map)
Definition: DataWidget.cpp:117
void updateConfigAtomI(const std::string &name, configmaps::ConfigAtom &map)
Definition: DataWidget.cpp:435
std::string getUnparsedString() const
Definition: ConfigAtom.hpp:212
std::vector< std::string > checkablePattern
Definition: DataWidget.h:98
void setDropDownPattern(const std::vector< std::string > &pattern, const std::vector< std::vector< std::string > > &values)
Definition: DataWidget.cpp:99
bool hasKey(std::string key)
Definition: ConfigMap.cpp:131
Copyright 2012, DFKI GmbH Robotics Innovation Center.
QtVariantProperty * addProperty
Definition: DataWidget.h:108
void setFilePattern(const std::vector< std::string > &pattern)
Definition: DataWidget.cpp:95
void setFilterPattern(const std::vector< std::string > &pattern)
Definition: DataWidget.cpp:109
std::vector< std::string > blackFilterPattern
Definition: DataWidget.h:98
void updateConfigMapI(const std::string &name, configmaps::ConfigMap &map)
Definition: DataWidget.cpp:367
void addConfigMap(const std::string &name, configmaps::ConfigMap &map)
Definition: DataWidget.cpp:141
void setColorPattern(const std::vector< std::string > &pattern)
Definition: DataWidget.cpp:91
bool matchPattern(const std::string &pattern, const std::string &str)
basic pattern matching function
Definition: misc.cpp:56
void expandTree(QtProperty *item)
Expands the branch of the property item.
void setViewMode(const ViewMode &mode)
Sets the view mode to either tree or button view mode.
QtProperty * activeItem(void)
Returns the item that is currently focused on.
std::string getString()
Definition: ConfigAtom.hpp:200
void setCheckablePattern(const std::vector< std::string > &pattern)
Definition: DataWidget.cpp:105
void setEditPattern(const std::vector< std::string > &pattern)
Definition: DataWidget.cpp:87
std::vector< std::string > dropDownPattern
Definition: DataWidget.h:98
map< QtVariantProperty *, std::string > nameMap
Definition: DataWidget.h:105
std::vector< std::vector< std::string > > dropDownValues
Definition: DataWidget.h:99
void updateConfigMap(const std::string &name, const configmaps::ConfigMap &map)
Definition: DataWidget.cpp:348
std::vector< std::string > colorPattern
Definition: DataWidget.h:98
map< QtVariantProperty *, configmaps::ConfigAtom * > dataMap
Definition: DataWidget.h:100
std::vector< std::string > explodeString(const char c, const std::string &s)
Definition: misc.cpp:225
QtVariantProperty * addGenericProperty(const std::string &path, int type, const QVariant &value, std::map< QString, QVariant > *attributes=NULL, QStringList *options=NULL)
Creates a property.
unsigned long getULong()
Definition: ConfigAtom.hpp:188
int checkInPattern(const std::string &v, const std::vector< std::string > &pattern)
Definition: DataWidget.cpp:226
virtual void valueChanged(QtProperty *property, const QVariant &value)
Called every time a property has changed its value.
Definition: DataWidget.cpp:516
std::vector< std::string > filterPattern
Definition: DataWidget.h:98
ItemType getType() const
Definition: ConfigAtom.hpp:121