Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -248,6 +248,7 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue · 247 unmodified lines | |||
| 248 | int e = -1; | 248 | int e = -1; |
| 249 | int d = -1; | 249 | int d = -1; |
| 250 | int c = -1; | 250 | int c = -1; |
| 251 | int h = -1; | ||
| 251 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { | 252 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { |
| 252 | QScriptValue item = _form.property(i); | 253 | QScriptValue item = _form.property(i); |
| 253 | QScriptValue value = item.property("value"); | 254 | QScriptValue value = item.property("value"); |
| @@ -271,6 +272,11 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue · 17 unmodified lines | |||
| 271 | array.engine()->undefinedValue() | 272 | array.engine()->undefinedValue() |
| 272 | ); | 273 | ); |
| 273 | _form.setProperty(i, item); | 274 | _form.setProperty(i, item); |
| 275 | } else if (item.property("type").toString() == "checkbox") { | ||
| 276 | h++; | ||
| 277 | value = _checks.at(h)->checkState() == Qt::Checked; | ||
| 278 | item.setProperty("value", value); | ||
| 279 | _form.setProperty(i, item); | ||
| 274 | } else { | 280 | } else { |
| 275 | e += 1; | 281 | e += 1; |
| 276 | bool ok = true; | 282 | bool ok = true; |
| @@ -305,6 +311,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 28 unmodified lines | |||
| 305 | int e = -1; | 311 | int e = -1; |
| 306 | int d = -1; | 312 | int d = -1; |
| 307 | int c = -1; | 313 | int c = -1; |
| 314 | int h = -1; | ||
| 308 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { | 315 | for (int i = 0; i < _form.property("length").toInt32(); ++i) { |
| 309 | QScriptValue item = _form.property(i); | 316 | QScriptValue item = _form.property(i); |
| 310 | QScriptValue value = item.property("value"); | 317 | QScriptValue value = item.property("value"); |
| @@ -328,6 +335,11 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 17 unmodified lines | |||
| 328 | array.engine()->undefinedValue() | 335 | array.engine()->undefinedValue() |
| 329 | ); | 336 | ); |
| 330 | _form.setProperty(i, item); | 337 | _form.setProperty(i, item); |
| 338 | } else if (item.property("type").toString() == "checkbox") { | ||
| 339 | h++; | ||
| 340 | value = _checks.at(h)->checkState() == Qt::Checked; | ||
| 341 | item.setProperty("value", value); | ||
| 342 | _form.setProperty(i, item); | ||
| 331 | } else { | 343 | } else { |
| 332 | e += 1; | 344 | e += 1; |
| 333 | bool ok = true; | 345 | bool ok = true; |
| @@ -358,6 +370,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a · 24 unmodified lines | |||
| 358 | _edits.clear(); | 370 | _edits.clear(); |
| 359 | _directories.clear(); | 371 | _directories.clear(); |
| 360 | _combos.clear(); | 372 | _combos.clear(); |
| 373 | _checks.clear(); | ||
| 361 | 374 | ||
| 362 | array = _form; | 375 | array = _form; |
| 363 | return (_formResult == QDialog::Accepted); | 376 | return (_formResult == QDialog::Accepted); |
| @@ -383,6 +396,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 19 unmodified lines | |||
| 383 | int e = -1; | 396 | int e = -1; |
| 384 | int d = -1; | 397 | int d = -1; |
| 385 | int c = -1; | 398 | int c = -1; |
| 399 | int h = -1; | ||
| 386 | for (int i = 0; i < form.property("length").toInt32(); ++i) { | 400 | for (int i = 0; i < form.property("length").toInt32(); ++i) { |
| 387 | QScriptValue item = form.property(i); | 401 | QScriptValue item = form.property(i); |
| 388 | QScriptValue value = item.property("value"); | 402 | QScriptValue value = item.property("value"); |
| @@ -406,6 +420,11 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 17 unmodified lines | |||
| 406 | form.engine()->undefinedValue() | 420 | form.engine()->undefinedValue() |
| 407 | ); | 421 | ); |
| 408 | form.setProperty(i, item); | 422 | form.setProperty(i, item); |
| 423 | } else if (item.property("type").toString() == "checkbox") { | ||
| 424 | h++; | ||
| 425 | value = _checks.at(h)->checkState() == Qt::Checked; | ||
| 426 | item.setProperty("value", value); | ||
| 427 | form.setProperty(i, item); | ||
| 409 | } else { | 428 | } else { |
| 410 | e += 1; | 429 | e += 1; |
| 411 | bool ok = true; | 430 | bool ok = true; |
| @@ -432,6 +451,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 20 unmodified lines | |||
| 432 | 451 | ||
| 433 | delete editDialog; | 452 | delete editDialog; |
| 434 | _combos.clear(); | 453 | _combos.clear(); |
| 454 | _checks.clear(); | ||
| 435 | _edits.clear(); | 455 | _edits.clear(); |
| 436 | _directories.clear(); | 456 | _directories.clear(); |
| 437 | return (result == QDialog::Accepted); | 457 | return (result == QDialog::Accepted); |
| @@ -518,6 +538,12 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue · 80 unmodified lines | |||
| 518 | } | 538 | } |
| 519 | _combos.push_back(combo); | 539 | _combos.push_back(combo); |
| 520 | formLayout->addRow(new QLabel(item.property("label").toString()), combo); | 540 | formLayout->addRow(new QLabel(item.property("label").toString()), combo); |
| 541 | } else if (item.property("type").toString() == "checkbox") { | ||
| 542 | QCheckBox* check = new QCheckBox(); | ||
| 543 | check->setTristate(false); | ||
| 544 | check->setCheckState(item.property("value").toString() == "true" ? Qt::Checked : Qt::Unchecked); | ||
| 545 | _checks.push_back(check); | ||
| 546 | formLayout->addRow(new QLabel(item.property("label").toString()), check); | ||
| 521 | } else { | 547 | } else { |
| 522 | QLineEdit* edit = new QLineEdit(item.property("value").toString()); | 548 | QLineEdit* edit = new QLineEdit(item.property("value").toString()); |
| 523 | edit->setMinimumWidth(200); | 549 | edit->setMinimumWidth(200); |