зеркало из https://github.com/nextcloud/desktop.git
Use QOperatingSystemVersion in Windows 11 check
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Родитель
5f6712f442
Коммит
e69b6cb4c6
|
@ -67,20 +67,8 @@ bool shouldPreferSvg()
|
|||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool IsWindows11OrGreater() {
|
||||
OSVERSIONINFOEX osvi = {};
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
osvi.dwMajorVersion = 10;
|
||||
osvi.dwMinorVersion = 0;
|
||||
osvi.dwBuildNumber = 22000;
|
||||
|
||||
DWORDLONG const conditionMask = VerSetConditionMask(
|
||||
VerSetConditionMask(
|
||||
VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL),
|
||||
VER_MINORVERSION, VER_GREATER_EQUAL),
|
||||
VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||
|
||||
return VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, conditionMask) != 0;
|
||||
bool isWindows11OrGreater() {
|
||||
return QOperatingSystemVersion::current().majorVersion() >= QOperatingSystemVersion::Windows11.majorVersion();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -971,7 +959,7 @@ void Theme::connectToPaletteSignal()
|
|||
if (const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance())) {
|
||||
#ifdef Q_OS_WIN
|
||||
// Windows 10 does not have proper dark mode support via Qt 6 so hack detection
|
||||
if (!IsWindows11OrGreater()) {
|
||||
if (!isWindows11OrGreater()) {
|
||||
connect(ptr, &QGuiApplication::paletteChanged, this, &Theme::darkModeChanged);
|
||||
} else
|
||||
#endif
|
||||
|
@ -988,7 +976,7 @@ QVariantMap Theme::systemPalette()
|
|||
connectToPaletteSignal();
|
||||
auto systemPalette = QGuiApplication::palette();
|
||||
#if defined(Q_OS_WIN)
|
||||
if (darkMode() && !IsWindows11OrGreater()) {
|
||||
if (darkMode() && !isWindows11OrGreater()) {
|
||||
systemPalette = reserveDarkPalette;
|
||||
}
|
||||
#else
|
||||
|
@ -1038,7 +1026,7 @@ bool Theme::darkMode()
|
|||
|
||||
#ifdef Q_OS_WIN
|
||||
static const auto darkModeSubkey = QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
if (!IsWindows11OrGreater() &&
|
||||
if (!isWindows11OrGreater() &&
|
||||
Utility::registryKeyExists(HKEY_CURRENT_USER, darkModeSubkey) &&
|
||||
!Utility::registryGetKeyValue(HKEY_CURRENT_USER, darkModeSubkey, QStringLiteral("AppsUseLightTheme")).toBool()) {
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче