MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / lutDownloaded

Method lutDownloaded

sources/api/HyperAPI.cpp:536–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536void HyperAPI::lutDownloaded(QNetworkReply* reply, int hardware_brightness, int hardware_contrast, int hardware_saturation, qint64 time)
537{
538 QString fileName = QDir::cleanPath(_instanceManager->getRootPath() + QDir::separator() + "lut_lin_tables.3d");
539 QString error = installLut(reply, fileName, hardware_brightness, hardware_contrast, hardware_saturation, time);
540
541 if (error == nullptr)
542 {
543 Info(_log, "Reloading LUT...");
544 BaseAPI::setVideoModeHdr(0);
545 BaseAPI::setVideoModeHdr(1);
546
547 QJsonDocument newSet;
548 SAFE_CALL_1_RET(_hyperhdr.get(), getSetting, QJsonDocument, newSet, settings::type, settings::type::VIDEOGRABBER);
549 QJsonObject grabber = QJsonObject(newSet.object());
550 grabber["hardware_brightness"] = hardware_brightness;
551 grabber["hardware_contrast"] = hardware_contrast;
552 grabber["hardware_saturation"] = hardware_saturation;
553 QString newConfig = QJsonDocument(grabber).toJson(QJsonDocument::Compact);
554 BLOCK_CALL_2(_hyperhdr.get(), setSetting, settings::type, settings::type::VIDEOGRABBER, QString, newConfig);
555
556 Info(_log, "New LUT has been installed as: %s (from: %s)", QSTRING_CSTR(fileName), QSTRING_CSTR(reply->url().toString()));
557 }
558 else
559 {
560 Error(_log, "Error occured while installing new LUT: %s", QSTRING_CSTR(error));
561 }
562
563 QJsonObject report;
564 report["status"] = (error == nullptr) ? 1 : 0;
565 report["error"] = error;
566 sendSuccessDataReply(QJsonDocument(report), "lut-install-update");
567}
568
569void HyperAPI::handleLutInstallCommand(const QJsonObject& message, const QString& command, int tan)
570{

Callers

nothing calls this directly

Calls 4

installLutFunction · 0.85
getRootPathMethod · 0.80
getMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected