Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -165,6 +165,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 164 unmodified lines | ||
| 165 | 165 | area->setWidget(container); |
| 166 | 166 | |
| 167 | 167 | QVector<QLineEdit*> edits; |
| 168 | + QVector<QComboBox*> combos; | |
| 168 | 169 | QVector<QPushButton*> directories; |
| 169 | 170 | for (int i = 0; i < form.property("length").toInt32(); ++i) { |
| 170 | 171 | QScriptValue item = form.property(i); |
| @@ -201,7 +202,15 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 30 unmodified lines | ||
| 201 | 202 | |
| 202 | 203 | formLayout->addRow(new QLabel(item.property("label").toString()), directory); |
| 203 | 204 | connect(directory, SIGNAL(clicked(bool)), SLOT(chooseDirectory())); |
| 204 | − | |
| 205 | + } else if (item.property("options").isArray()) { | |
| 206 | + QComboBox* combo = new QComboBox(); | |
| 207 | + combo->setMinimumWidth(200); | |
| 208 | + QStringList options = item.property("options").toVariant().toStringList(); | |
| 209 | + for (QStringList::const_iterator it = options.begin(); it != options.end(); it += 1) { | |
| 210 | + combo->addItem(*it); | |
| 211 | + } | |
| 212 | + combos.push_back(combo); | |
| 213 | + formLayout->addRow(new QLabel(item.property("label").toString()), combo); | |
| 205 | 214 | } else { |
| 206 | 215 | QLineEdit* edit = new QLineEdit(item.property("value").toString()); |
| 207 | 216 | edit->setMinimumWidth(200); |
| @@ -222,6 +231,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 14 unmodified lines | ||
| 222 | 231 | if (result == QDialog::Accepted) { |
| 223 | 232 | int e = -1; |
| 224 | 233 | int d = -1; |
| 234 | + int c = -1; | |
| 225 | 235 | for (int i = 0; i < form.property("length").toInt32(); ++i) { |
| 226 | 236 | QScriptValue item = form.property(i); |
| 227 | 237 | QScriptValue value = item.property("value"); |
| @@ -233,6 +243,10 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 5 unmodified lines | ||
| 233 | 243 | value = directories.at(d)->property("path").toString(); |
| 234 | 244 | item.setProperty("directory", value); |
| 235 | 245 | form.setProperty(i, item); |
| 246 | + } else if (item.property("options").isArray()) { | |
| 247 | + c += 1; | |
| 248 | + item.setProperty("value", combos.at(c)->currentText()); | |
| 249 | + form.setProperty(i, item); | |
| 236 | 250 | } else { |
| 237 | 251 | e += 1; |
| 238 | 252 | bool ok = true; |