summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp13
-rw-r--r--src/corelib/global/qsysinfo.h10
-rw-r--r--src/corelib/global/qsystemdetection.h14
3 files changed, 25 insertions, 12 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index e05b7874e5..71cf1da20a 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1946,6 +1946,8 @@ QSysInfo::MacVersion QSysInfo::macVersion()
return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor));
#elif defined(Q_OS_TVOS)
return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor));
+#elif defined(Q_OS_WATCHOS)
+ return QSysInfo::MacVersion(Q_MV_WATCHOS(version.major, version.minor));
#else
return QSysInfo::MV_Unknown;
#endif
@@ -2631,9 +2633,10 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, \macOS, iOS and tvOS note}: this function returns "macos" for macOS
- systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case
- the system could not be determined.
+ \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns
+ "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems,
+ "watchos" for watchOS systems, and "darwin" in case the system could not
+ be determined.
\b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
@@ -2667,6 +2670,8 @@ QString QSysInfo::productType()
return QStringLiteral("ios");
#elif defined(Q_OS_TVOS)
return QStringLiteral("tvos");
+#elif defined(Q_OS_WATCHOS)
+ return QStringLiteral("watchos");
#elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version();
if (version.major == 10 && version.minor < 12)
@@ -2754,6 +2759,8 @@ QString QSysInfo::prettyProductName()
return QLatin1String("iOS ") + productVersion();
#elif defined(Q_OS_TVOS)
return QLatin1String("tvOS ") + productVersion();
+#elif defined(Q_OS_WATCHOS)
+ return QLatin1String("watchOS ") + productVersion();
#elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version();
const char *name = osxVer_helper(version);
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index 31d78bca50..f01b45cbf9 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -122,6 +122,7 @@ public:
#define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0))
#define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor)
#define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor)
+#define Q_MV_WATCHOS(major, minor) (QSysInfo::MV_WATCHOS | major << 4 | minor)
enum MacVersion {
MV_None = 0xffff,
MV_Unknown = 0x0000,
@@ -182,7 +183,14 @@ public:
MV_TVOS_9_0 = Q_MV_TVOS(9, 0),
MV_TVOS_9_1 = Q_MV_TVOS(9, 1),
MV_TVOS_9_2 = Q_MV_TVOS(9, 2),
- MV_TVOS_10_0 = Q_MV_TVOS(10, 0)
+ MV_TVOS_10_0 = Q_MV_TVOS(10, 0),
+
+ /* watchOS */
+ MV_WATCHOS = 1 << 10,
+ MV_WATCHOS_2_0 = Q_MV_WATCHOS(2, 0),
+ MV_WATCHOS_2_1 = Q_MV_WATCHOS(2, 1),
+ MV_WATCHOS_2_2 = Q_MV_WATCHOS(2, 2),
+ MV_WATCHOS_3_0 = Q_MV_WATCHOS(3, 0)
};
#if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 90954b1eca..3b486b8f6f 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -102,17 +102,15 @@
# define Q_OS_DARWIN32
# endif
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+# define QT_PLATFORM_UIKIT
# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
# define Q_OS_WATCHOS
+# elif defined(TARGET_OS_TV) && TARGET_OS_TV
+# define Q_OS_TVOS
# else
-# define QT_PLATFORM_UIKIT
-# if defined(TARGET_OS_TV) && TARGET_OS_TV
-# define Q_OS_TVOS
-# else
-# // TARGET_OS_IOS is only available in newer SDKs,
-# // so assume any other iOS-based platform is iOS for now
-# define Q_OS_IOS
-# endif
+# // TARGET_OS_IOS is only available in newer SDKs,
+# // so assume any other iOS-based platform is iOS for now
+# define Q_OS_IOS
# endif
# else
# // TARGET_OS_OSX is only available in newer SDKs,