diff options
author | Jake Petroules <jake.petroules@qt.io> | 2016-09-23 16:15:36 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-01-09 10:11:48 +0000 |
commit | 6b7e6332484df1d16ad539631685687f76f86159 (patch) | |
tree | 721b4b8fadc18d690aa8df0bcf81662485d2b2b6 /src/corelib/global/qoperatingsystemversion_darwin.mm | |
parent | 747e569597348b47a9d2cbb469eb5c4af87f7ff2 (diff) |
Remove compatibility code paths for macOS < 10.10 and iOS < 8.0
Change-Id: I11bec0efc2b4d86adf64a58990260fee70f050ac
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/corelib/global/qoperatingsystemversion_darwin.mm')
-rw-r--r-- | src/corelib/global/qoperatingsystemversion_darwin.mm | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/src/corelib/global/qoperatingsystemversion_darwin.mm b/src/corelib/global/qoperatingsystemversion_darwin.mm index 3dd007cbb3..d8b927ff5d 100644 --- a/src/corelib/global/qoperatingsystemversion_darwin.mm +++ b/src/corelib/global/qoperatingsystemversion_darwin.mm @@ -40,61 +40,16 @@ #include "qoperatingsystemversion_p.h" #import <Foundation/Foundation.h> -#ifdef Q_OS_IOS -#import <UIKit/UIKit.h> -#endif - QT_BEGIN_NAMESPACE -typedef qint16 (*GestaltFunction)(quint32 selector, qint32 *response); - QOperatingSystemVersion QOperatingSystemVersion::current() { + NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; QOperatingSystemVersion v; v.m_os = currentType(); - v.m_major = -1; - v.m_minor = -1; - v.m_micro = -1; -#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS) || defined(Q_OS_WATCHOS) - if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) { - NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; - v.m_major = osv.majorVersion; - v.m_minor = osv.minorVersion; - v.m_micro = osv.patchVersion; - return v; - } -#endif - // Use temporary variables so we can return 0.0.0 (unknown version) - // in case of an error partway through determining the OS version - qint32 major = 0, minor = 0, patch = 0; -#if QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_10, __IPHONE_8_0) -#if defined(Q_OS_IOS) - @autoreleasepool { - NSArray *parts = [UIDevice.currentDevice.systemVersion componentsSeparatedByString:@"."]; - major = parts.count > 0 ? [[parts objectAtIndex:0] intValue] : 0; - minor = parts.count > 1 ? [[parts objectAtIndex:1] intValue] : 0; - patch = parts.count > 2 ? [[parts objectAtIndex:2] intValue] : 0; - } -#elif defined(Q_OS_MACOS) - static GestaltFunction pGestalt = 0; - if (!pGestalt) { - CFBundleRef b = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.CoreServices")); - pGestalt = reinterpret_cast<GestaltFunction>(CFBundleGetFunctionPointerForName(b, - CFSTR("Gestalt"))); - } - if (!pGestalt) - return v; - if (pGestalt('sys1', &major) != 0) - return v; - if (pGestalt('sys2', &minor) != 0) - return v; - if (pGestalt('sys3', &patch) != 0) - return v; -#endif -#endif - v.m_major = major; - v.m_minor = minor; - v.m_micro = patch; + v.m_major = osv.majorVersion; + v.m_minor = osv.minorVersion; + v.m_micro = osv.patchVersion; return v; } |