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

Method handleSettingsUpdate

sources/base/SystemWrapper.cpp:135–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void SystemWrapper::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
136{
137 if (type == settings::type::SYSTEMGRABBER && _grabber != nullptr)
138 {
139 try
140 {
141 _grabber->setBlocked();
142
143 // extract settings
144 const QJsonObject& obj = config.object();
145
146 // crop for video
147 _grabber->setCropping(
148 obj["cropLeft"].toInt(0),
149 obj["cropRight"].toInt(0),
150 obj["cropTop"].toInt(0),
151 obj["cropBottom"].toInt(0));
152
153 // device resolution
154 int videoMode = obj["videoMode"].toInt(512);
155 _grabber->setWidthHeight(videoMode, videoMode);
156
157 // device framerate
158 _grabber->setFramerate(obj["fps"].toInt(10));
159
160#ifdef ENABLE_DX
161 // HDR tone mapping
162 setHdrToneMappingEnabled(obj["hdrToneMapping"].toBool(false) ? 1 : 0);
163#endif
164
165 // signal
166 _grabber->setSignalDetectionEnable(obj["signalDetection"].toBool(false));
167
168 _grabber->enableHardwareAcceleration(obj["hardware"].toBool(false));
169
170 _grabber->setMonitorNits(obj["monitor_nits"].toInt(200));
171
172 _grabber->setReorderDisplays(obj["reorder_displays"].toInt(0));
173
174 _grabber->setSignalDetectionOffset(
175 obj["sDHOffsetMin"].toDouble(0.25),
176 obj["sDVOffsetMin"].toDouble(0.25),
177 obj["sDHOffsetMax"].toDouble(0.75),
178 obj["sDVOffsetMax"].toDouble(0.75));
179
180 _grabber->setSignalThreshold(
181 obj["redSignalThreshold"].toDouble(0.0) / 100.0,
182 obj["greenSignalThreshold"].toDouble(0.0) / 100.0,
183 obj["blueSignalThreshold"].toDouble(0.0) / 100.0,
184 obj["noSignalCounterThreshold"].toInt(50));
185
186 _grabber->setDeviceVideoStandard(obj["device"].toString(Grabber::AUTO_SETTING));
187
188 _grabber->unblockAndRestart(_configLoaded);
189 }
190 catch (...)
191 {
192 _grabber->unblockAndRestart(_configLoaded);

Callers

nothing calls this directly

Calls 13

setBlockedMethod · 0.80
setWidthHeightMethod · 0.80
setFramerateMethod · 0.80
setMonitorNitsMethod · 0.80
setReorderDisplaysMethod · 0.80
unblockAndRestartMethod · 0.80
setCroppingMethod · 0.45
setSignalThresholdMethod · 0.45

Tested by

no test coverage detected