| 419 | } |
| 420 | |
| 421 | void GrabberWrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config) |
| 422 | { |
| 423 | if (type == settings::type::VIDEODETECTION && _grabber != nullptr) |
| 424 | { |
| 425 | // extract settings |
| 426 | const QJsonObject& obj = config.object(); |
| 427 | |
| 428 | QString signature = obj["signature"].toString(""); |
| 429 | int quality = obj["quality"].toInt(0); |
| 430 | int width = obj["width"].toInt(0); |
| 431 | int height = obj["height"].toInt(0); |
| 432 | QJsonArray sdr = obj["calibration_sdr"].toArray(QJsonArray()); |
| 433 | QJsonArray hdr = obj["calibration_hdr"].toArray(QJsonArray()); |
| 434 | std::vector<DetectionAutomatic::calibrationPoint> sdrVec, hdrVec; |
| 435 | |
| 436 | for (auto v : sdr) { |
| 437 | bool ok = false; |
| 438 | QJsonObject element = v.toObject(); |
| 439 | DetectionAutomatic::calibrationPoint p; |
| 440 | |
| 441 | p = parsePoint(width, height, element, ok); |
| 442 | |
| 443 | if (ok) |
| 444 | sdrVec.push_back(p); |
| 445 | else |
| 446 | Warning(_log, "Calibration data are damaged"); |
| 447 | } |
| 448 | |
| 449 | for (auto v : hdr) { |
| 450 | bool ok = false; |
| 451 | QJsonObject element = v.toObject(); |
| 452 | DetectionAutomatic::calibrationPoint p; |
| 453 | |
| 454 | p = parsePoint(width, height, element, ok); |
| 455 | |
| 456 | if (ok) |
| 457 | hdrVec.push_back(p); |
| 458 | else |
| 459 | Warning(_log, "Calibration data are damaged"); |
| 460 | } |
| 461 | |
| 462 | _grabber->setAutomaticCalibrationData(signature, quality, width, height, sdrVec, hdrVec); |
| 463 | } |
| 464 | |
| 465 | if (type == settings::type::VIDEOGRABBER && _grabber != nullptr) |
| 466 | { |
| 467 | try |
| 468 | { |
| 469 | _grabber->setBlocked(); |
| 470 | |
| 471 | // extract settings |
| 472 | const QJsonObject& obj = config.object(); |
| 473 | |
| 474 | // auto resume |
| 475 | if (_autoResume != obj["autoResume"].toBool(false)) |
| 476 | { |
| 477 | _autoResume = obj["autoResume"].toBool(false); |
| 478 | Debug(_log, "Auto resume is: %s", (_autoResume) ? "enabled" : "disabled"); |
nothing calls this directly
no test coverage detected