/
0073-QSysInfo-prettyProductName-add-missing-macOS-product.patch
76 lines (70 loc) · 2.37 KB
/
0073-QSysInfo-prettyProductName-add-missing-macOS-product.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From 17dda295677c006c9b3462e4f9656f4e52b46fc6 Mon Sep 17 00:00:00 2001
From: Yuhang Zhao <2546789017@qq.com>
Date: Tue, 24 May 2022 14:05:10 +0800
Subject: [PATCH 073/144] QSysInfo::prettyProductName(): add missing macOS
product names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Pick-to: 6.2 6.3 6.4 5.15
Change-Id: I9163917187b7a4cbf48e443303313b25473b229f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 870cfa4e17c42698b77504cfc19728acfbf7d659)
---
src/corelib/global/qglobal.cpp | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 5ad82c259d..7428d8ec42 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -97,6 +97,10 @@
# include <private/qcore_mac_p.h>
#endif
+#if defined(Q_OS_MACOS)
+#include <QtCore/qversionnumber.h>
+#endif
+
#ifdef Q_OS_UNIX
#include <sys/utsname.h>
#include <private/qcore_unix_p.h>
@@ -2133,6 +2137,13 @@ QT_WARNING_POP
static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSystemVersion::current())
{
#ifdef Q_OS_MACOS
+ if (version.majorVersion() == 12)
+ return "Monterey";
+ // Compare against predefined constant to handle 10.16/11.0
+ if (QVersionNumber(QOperatingSystemVersion::MacOSBigSur.majorVersion(),
+ QOperatingSystemVersion::MacOSBigSur.minorVersion(), QOperatingSystemVersion::MacOSBigSur.microVersion()).isPrefixOf(
+ QVersionNumber(version.majorVersion(), version.minorVersion(), version.microVersion())))
+ return "Big Sur";
if (version.majorVersion() == 10) {
switch (version.minorVersion()) {
case 9:
@@ -2147,13 +2158,15 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst
return "High Sierra";
case 14:
return "Mojave";
+ case 15:
+ return "Catalina";
}
}
// unknown, future version
#else
Q_UNUSED(version);
#endif
- return 0;
+ return nullptr;
}
#endif
@@ -2278,7 +2291,7 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst
}
#undef Q_WINVER
// unknown, future version
- return 0;
+ return nullptr;
}
#endif
--
2.43.0