Inconsistent delection of KIRIGAMI_LOWPOWER_HARDWARE
Searching 207 files for "KIRIGAMI_LOWPOWER_HARDWARE"
~/kde/src6/kirigami/src/shadowedrectangle.cpp:
311
312 // Cache lowPower state so we only execute the full check once.
313: static bool lowPower = QByteArrayList{"1", "true"}.contains(qgetenv("KIRIGAMI_LOWPOWER_HARDWARE").toLower());
314 if (m_renderType == RenderType::LowQuality || (m_renderType == RenderType::Auto && lowPower)) {
315 shadowNode->setShaderType(ShadowedRectangleMaterial::ShaderType::LowPower);
~/kde/src6/kirigami/src/shadowedtexture.cpp:
65 }
66
67: if (qEnvironmentVariableIsSet("KIRIGAMI_LOWPOWER_HARDWARE")) {
68 shadowNode->setShaderType(ShadowedRectangleMaterial::ShaderType::LowPower);
69 }
2 matches across 2 files
There are two pieces of code to check for KIRIGAMI_LOWPOWER_HARDWARE
environment variable, and they do it differently.
Suggestion is to factor them out into a single (preferably public) function with a static bool variable in it.
Also, it seem that in Qt internals the convention is to use qEnvironmentVariableIntValue
which both checks for presence and for non-zero value. IMHO we should just drop that any-cased "true" string support. Just do it one way, and do it good.