Add convenience method to check Windows 11 availability

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-11-05 17:02:14 +09:00 коммит произвёл Matthieu Gallien
Родитель 1f4f7c7d0f
Коммит 7c2102547d
1 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -33,6 +33,10 @@
#include <QJsonDocument>
#include <QJsonArray>
#ifdef Q_OS_WIN
#include <windows.h>
#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 {