Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
0f699161cd
commit
356c11960d
|
@ -367,11 +367,14 @@ QColor Utilities::getColorizationColor()
|
||||||
{
|
{
|
||||||
DWORD color = 0;
|
DWORD color = 0;
|
||||||
BOOL opaqueBlend = FALSE;
|
BOOL opaqueBlend = FALSE;
|
||||||
if (FAILED(DwmGetColorizationColor(&color, &opaqueBlend))) {
|
if (SUCCEEDED(DwmGetColorizationColor(&color, &opaqueBlend))) {
|
||||||
qWarning() << "DwmGetColorizationColor failed.";
|
return QColor::fromRgba(color);
|
||||||
return Qt::darkGray;
|
|
||||||
}
|
}
|
||||||
return QColor::fromRgba(color);
|
qWarning() << "DwmGetColorizationColor failed, reading from the registry instead.";
|
||||||
|
bool ok = false;
|
||||||
|
const QSettings settings(g_dwmRegistryKey, QSettings::NativeFormat);
|
||||||
|
const DWORD value = settings.value(QStringLiteral("ColorizationColor"), 0).toULongLong(&ok);
|
||||||
|
return ok ? QColor::fromRgba(value) : Qt::darkGray;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utilities::isLightThemeEnabled()
|
bool Utilities::isLightThemeEnabled()
|
||||||
|
@ -392,7 +395,7 @@ bool Utilities::isDarkThemeEnabled()
|
||||||
if (win32Data()->ShouldSystemUseDarkModePFN) {
|
if (win32Data()->ShouldSystemUseDarkModePFN) {
|
||||||
return win32Data()->ShouldSystemUseDarkModePFN();
|
return win32Data()->ShouldSystemUseDarkModePFN();
|
||||||
}
|
}
|
||||||
// Read the registry directly if Win32 APIs are not available.
|
qDebug() << "ShouldSystemUseDarkMode() not available, reading from the registry instead.";
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const QSettings settings(g_personalizeRegistryKey, QSettings::NativeFormat);
|
const QSettings settings(g_personalizeRegistryKey, QSettings::NativeFormat);
|
||||||
const bool lightThemeEnabled = settings.value(QStringLiteral("AppsUseLightTheme"), 0).toULongLong(&ok) != 0;
|
const bool lightThemeEnabled = settings.value(QStringLiteral("AppsUseLightTheme"), 0).toULongLong(&ok) != 0;
|
||||||
|
|
Loading…
Reference in New Issue