From 7c2102547d2264087cc2badc4ebfe3a474d4cafd Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 5 Nov 2024 17:02:14 +0900 Subject: [PATCH] Add convenience method to check Windows 11 availability Signed-off-by: Claudio Cambra --- src/libsync/theme.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index e699cf4d1..2f9944b92 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -33,6 +33,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + #include "nextcloudtheme.h" #ifdef THEME_INCLUDE @@ -62,6 +66,24 @@ bool shouldPreferSvg() return QByteArray(APPLICATION_ICON_SET).toUpper() == QByteArrayLiteral("SVG"); } +#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; +} +#endif + } namespace OCC {