Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -220,6 +220,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 219 unmodified lines | |||
| 220 | if (_formResult == QDialog::Accepted) { | 220 | if (_formResult == QDialog::Accepted) { |
| 221 | int e = -1; | 221 | int e = -1; |
| 222 | int d = -1; | 222 | int d = -1; |
| 223 | int c = -1; | ||
| 223 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { | 224 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { |
| 224 | QScriptValue item = _form.property(i); | 225 | QScriptValue item = _form.property(i); |
| 225 | QScriptValue value = item.property("value"); | 226 | QScriptValue value = item.property("value"); |
| @@ -235,6 +236,10 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 9 unmodified lines | |||
| 235 | value = _directories.at(d)->property("path").toString(); | 236 | value = _directories.at(d)->property("path").toString(); |
| 236 | item.setProperty("directory", value); | 237 | item.setProperty("directory", value); |
| 237 | _form.setProperty(i, item); | 238 | _form.setProperty(i, item); |
| 239 | } else if (item.property("options").isArray()) { | ||
| 240 | c += 1; | ||
| 241 | item.setProperty("value", _combos.at(c)->currentText()); | ||
| 242 | _form.setProperty(i, item); | ||
| 238 | } else { | 243 | } else { |
| 239 | e += 1; | 244 | e += 1; |
| 240 | bool ok = true; | 245 | bool ok = true; |
| @@ -288,6 +293,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 47 unmodified lines | |||
| 288 | if (result == QDialog::Accepted) { | 293 | if (result == QDialog::Accepted) { |
| 289 | int e = -1; | 294 | int e = -1; |
| 290 | int d = -1; | 295 | int d = -1; |
| 296 | int c = -1; | ||
| 291 | for (int i = 0; i < form.property("length").toInt32(); ++i) { | 297 | for (int i = 0; i < form.property("length").toInt32(); ++i) { |
| 292 | QScriptValue item = form.property(i); | 298 | QScriptValue item = form.property(i); |
| 293 | QScriptValue value = item.property("value"); | 299 | QScriptValue value = item.property("value"); |
| @@ -303,6 +309,10 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 9 unmodified lines | |||
| 303 | value = _directories.at(d)->property("path").toString(); | 309 | value = _directories.at(d)->property("path").toString(); |
| 304 | item.setProperty("directory", value); | 310 | item.setProperty("directory", value); |
| 305 | form.setProperty(i, item); | 311 | form.setProperty(i, item); |
| 312 | } else if (item.property("options").isArray()) { | ||
| 313 | c += 1; | ||
| 314 | item.setProperty("value", _combos.at(c)->currentText()); | ||
| 315 | _form.setProperty(i, item); | ||
| 306 | } else { | 316 | } else { |
| 307 | e += 1; | 317 | e += 1; |
| 308 | bool ok = true; | 318 | bool ok = true; |
| @@ -405,6 +415,15 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue · 96 unmodified lines | |||
| 405 | 415 | ||
| 406 | } else if (item.property("type").toString() == "header") { | 416 | } else if (item.property("type").toString() == "header") { |
| 407 | formLayout->addRow(new QLabel(item.property("label").toString())); | 417 | formLayout->addRow(new QLabel(item.property("label").toString())); |
| 418 | } else if (item.property("options").isArray()) { | ||
| 419 | QComboBox* combo = new QComboBox(); | ||
| 420 | combo->setMinimumWidth(200); | ||
| 421 | QStringList options = item.property("options").toVariant().toStringList(); | ||
| 422 | for (QStringList::const_iterator it = options.begin(); it != options.end(); it += 1) { | ||
| 423 | combo->addItem(*it); | ||
| 424 | } | ||
| 425 | _combos.push_back(combo); | ||
| 426 | formLayout->addRow(new QLabel(item.property("label").toString()), combo); | ||
| 408 | } else { | 427 | } else { |
| 409 | QLineEdit* edit = new QLineEdit(item.property("value").toString()); | 428 | QLineEdit* edit = new QLineEdit(item.property("value").toString()); |
| 410 | edit->setMinimumWidth(200); | 429 | edit->setMinimumWidth(200); |