| 500 | |
| 501 | |
| 502 | void ConfigWindow::updateSolverConfig(SolverConfiguration* sc) |
| 503 | { |
| 504 | // Make sure if anything was being edited, we defocus to update the value |
| 505 | auto* focus = focusWidget(); |
| 506 | if (focus && focus->hasFocus()) { |
| 507 | focus->clearFocus(); |
| 508 | focus->setFocus(); |
| 509 | } |
| 510 | |
| 511 | if (!sc->modified) { |
| 512 | return; |
| 513 | } |
| 514 | |
| 515 | auto cfgs = ui->sync_checkBox->isChecked() ? configs : (QList<SolverConfiguration*>() << sc); |
| 516 | for (auto s : cfgs) { |
| 517 | s->timeLimit = ui->timeLimit_checkBox->isChecked() ? static_cast<int>(ui->timeLimit_doubleSpinBox->value() * 1000.0) : 0; |
| 518 | if (ui->defaultBehavior_radioButton->isChecked()) { |
| 519 | s->printIntermediate = true; |
| 520 | s->numSolutions = 1; |
| 521 | s->numOptimal = 1; |
| 522 | } else { |
| 523 | s->printIntermediate = ui->intermediateSolutions_checkBox->isChecked(); |
| 524 | s->numSolutions = ui->numSolutions_checkBox->isChecked() ? ui->numSolutions_spinBox->value() : 0; |
| 525 | s->numOptimal = ui->numOptimal_checkBox->isChecked() ? ui->numOptimal_spinBox->value() : 0; |
| 526 | } |
| 527 | |
| 528 | s->verboseCompilation = ui->verboseCompilation_checkBox->isChecked(); |
| 529 | s->verboseSolving = ui->verboseSolving_checkBox->isChecked(); |
| 530 | s->compilationStats = ui->compilationStats_checkBox->isChecked(); |
| 531 | s->solvingStats = ui->solvingStats_checkBox->isChecked(); |
| 532 | s->outputTiming = ui->timingInfo_checkBox->isChecked(); |
| 533 | s->outputObjective = ui->outputObjective_checkBox->isChecked(); |
| 534 | } |
| 535 | |
| 536 | sc->optimizationLevel = ui->optimizationLevel_comboBox->currentIndex(); |
| 537 | QString additionalData = ui->additionalData_plainTextEdit->toPlainText(); |
| 538 | sc->additionalData = additionalData.length() > 0 ? additionalData.split("\n") : QStringList(); |
| 539 | sc->numThreads = ui->numThreads_spinBox->value(); |
| 540 | sc->randomSeed = ui->randomSeed_checkBox->isChecked() ? ui->randomSeed_lineEdit->text() : QVariant(); |
| 541 | sc->freeSearch = ui->freeSearch_checkBox->isChecked(); |
| 542 | |
| 543 | sc->extraOptions.clear(); |
| 544 | for (int row = 0; row < ui->extraParams_tableWidget->rowCount(); row++) { |
| 545 | auto keyItem = ui->extraParams_tableWidget->item(row, 0); |
| 546 | auto flagTypeWidget = static_cast<QComboBox*>(ui->extraParams_tableWidget->cellWidget(row, 1)); |
| 547 | auto valueItem = ui->extraParams_tableWidget->item(row, 3); |
| 548 | if (keyItem && valueItem) { |
| 549 | auto key = keyItem->data(Qt::UserRole).isNull() ? |
| 550 | keyItem->data(Qt::DisplayRole).toString() : |
| 551 | qvariant_cast<SolverFlag>(keyItem->data(Qt::UserRole)).name; |
| 552 | auto value = valueItem->data(Qt::DisplayRole); |
| 553 | if (flagTypeWidget && flagTypeWidget->currentIndex() == 1) { |
| 554 | sc->solverBackendOptions.insert(key, value); |
| 555 | } else { |
| 556 | sc->extraOptions.insert(key, value); |
| 557 | } |
| 558 | } |
| 559 | } |
nothing calls this directly
no test coverage detected