Vuo  2.0.1
VuoInputEditorRealRegulation.cc
Go to the documentation of this file.
1 
11 
12 extern "C"
13 {
14  #include "VuoHeap.h"
15  #include "VuoRealRegulation.h"
16 }
17 
22 {
23  return new VuoInputEditorRealRegulation();
24 }
25 
30  : VuoInputEditorWithLineEditList(false, 100)
31 {
32  row = 0;
33 }
34 
38 QLayout *VuoInputEditorRealRegulation::setUpRow(QDialog &dialog, QLineEdit *lineEdit)
39 {
40  QHBoxLayout *rowLayout = static_cast<QHBoxLayout *>(VuoInputEditorWithLineEditList::setUpRow(dialog, lineEdit));
41 
42  if (row != 0)
43  {
44  lineEdit->setValidator(new QDoubleValidator(this));
45  lineEdit->setFixedWidth(50);
46 
47  QLabel *label = new QLabel(&dialog);
48  label->setText(tr("seconds"));
49  label->setFont(getDefaultFont());
50  if (row != 4)
51  label->setStyleSheet("QLabel { color: transparent; }");
52  rowLayout->addWidget(label);
53  }
54 
55  QLabel *label = new QLabel(&dialog);
56  const char *texts[] = {"Name", "Minimum", "Maximum", "Default", "Smooth"};
57  label->setText(texts[row]);
58  label->setFont(getDefaultFont());
59  label->setFixedWidth(50);
60  rowLayout->insertWidget(0, label);
61 
62  ++row;
63  return rowLayout;
64 }
65 
69 QList<QString> VuoInputEditorRealRegulation::convertToLineEditListFormat(json_object *value)
70 {
72 
73  QList<QString> lineEditTexts;
74  lineEditTexts.append(reg.name);
75  lineEditTexts.append(QLocale().toString(reg.minimumValue));
76  lineEditTexts.append(QLocale().toString(reg.maximumValue));
77  lineEditTexts.append(QLocale().toString(reg.defaultValue));
78  lineEditTexts.append(QLocale().toString(reg.smoothDuration));
79  return lineEditTexts;
80 }
81 
85 json_object * VuoInputEditorRealRegulation::convertFromLineEditListFormat(const QList<QString> &lineEditTexts)
86 {
88  VuoText_make(lineEditTexts[0].toUtf8().data()),
89  QLocale().toDouble(lineEditTexts[1]),
90  QLocale().toDouble(lineEditTexts[2]),
91  QLocale().toDouble(lineEditTexts[3]),
92  QLocale().toDouble(lineEditTexts[4]));
93 
97  return value;
98 }