mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 00:08:02 +00:00
Use VersionHelper API for Windows version.
This commit is contained in:
parent
ef364e998f
commit
271d929ad6
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/win/wrapper_windows_h.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <VersionHelpers.h>
|
||||
|
||||
namespace Platform {
|
||||
namespace {
|
||||
@ -22,15 +23,20 @@ QString DeviceModel() {
|
||||
}
|
||||
|
||||
QString SystemVersion() {
|
||||
switch (QSysInfo::windowsVersion()) {
|
||||
case QSysInfo::WV_XP: return "Windows XP";
|
||||
case QSysInfo::WV_2003: return "Windows 2003";
|
||||
case QSysInfo::WV_VISTA: return "Windows Vista";
|
||||
case QSysInfo::WV_WINDOWS7: return "Windows 7";
|
||||
case QSysInfo::WV_WINDOWS8: return "Windows 8";
|
||||
case QSysInfo::WV_WINDOWS8_1: return "Windows 8.1";
|
||||
case QSysInfo::WV_WINDOWS10: return "Windows 10";
|
||||
default: return "Windows";
|
||||
if (IsWindows10OrGreater()) {
|
||||
return "Windows 10";
|
||||
} else if (IsWindows8Point1OrGreater()) {
|
||||
return "Windows 8.1";
|
||||
} else if (IsWindows8OrGreater()) {
|
||||
return "Windows 8";
|
||||
} else if (IsWindows7OrGreater()) {
|
||||
return "Windows 7";
|
||||
} else if (IsWindowsVistaOrGreater()) {
|
||||
return "Windows Vista";
|
||||
} else if (IsWindowsXPOrGreater()) {
|
||||
return "Windows XP";
|
||||
} else {
|
||||
return QSysInfo::prettyProductName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include <windows.ui.notifications.h>
|
||||
|
||||
#include <Windowsx.h>
|
||||
#include <VersionHelpers.h>
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a, b) ((a) < (b) ? (b) : (a))
|
||||
@ -925,7 +926,7 @@ void MainWindow::psUpdateMargins() {
|
||||
}
|
||||
if (!_themeInited) {
|
||||
_themeInited = true;
|
||||
if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8) {
|
||||
if (!IsWindows8OrGreater()) {
|
||||
if (Dlls::SetWindowTheme != nullptr) {
|
||||
Dlls::SetWindowTheme(ps_hWnd, L" ", L" ");
|
||||
QApplication::setStyle(QStyleFactory::create(qsl("Windows")));
|
||||
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "platform/win/windows_dlls.h"
|
||||
|
||||
#include <VersionHelpers.h>
|
||||
#include <QtCore/QSysInfo>
|
||||
|
||||
namespace Platform {
|
||||
@ -76,8 +77,7 @@ void start() {
|
||||
LibUxTheme = LoadLibrary(L"UXTHEME.DLL");
|
||||
load(LibUxTheme, "SetWindowTheme", SetWindowTheme);
|
||||
|
||||
auto version = QSysInfo::windowsVersion();
|
||||
if (version >= QSysInfo::WV_VISTA) {
|
||||
if (IsWindowsVistaOrGreater()) {
|
||||
LibWtsApi32 = LoadLibrary(L"WTSAPI32.DLL");
|
||||
load(LibWtsApi32, "WTSRegisterSessionNotification", WTSRegisterSessionNotification);
|
||||
load(LibWtsApi32, "WTSUnRegisterSessionNotification", WTSUnRegisterSessionNotification);
|
||||
@ -86,7 +86,7 @@ void start() {
|
||||
load(LibPropSys, "PropVariantToString", PropVariantToString);
|
||||
load(LibPropSys, "PSStringFromPropertyKey", PSStringFromPropertyKey);
|
||||
|
||||
if (version >= QSysInfo::WV_WINDOWS8) {
|
||||
if (IsWindows8OrGreater()) {
|
||||
LibComBase = LoadLibrary(L"COMBASE.DLL");
|
||||
load(LibComBase, "RoGetActivationFactory", RoGetActivationFactory);
|
||||
load(LibComBase, "WindowsCreateStringReference", WindowsCreateStringReference);
|
||||
|
Loading…
Reference in New Issue
Block a user