From 03e9c6f4a62582837fc9f5961ecbccd0a3d1b5d6 Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Tue, 16 Feb 2016 14:29:59 +0000 Subject: Add support for Apple tvOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass -xplatform macx-tvos-clang to configure to build. Builds device and simulator by default. Added ‘uikit’ platform with the common setup. Also added QT_PLATFORM_UIKIT define (undocumented). qmake config defines tvos (but not ios). tvOS is 64bits only (QT_ARCH is arm64) and requires bitcode to be embedded in the binary. A new ‘bitcode’ configuration was added. For ReleaseDevice builds (which get archived and push to the store), bitcode is actually embedded (-fembed-bitcode passed to clang). For all other configurations, only using bitcode markers to keep file size down (-fembed-bitcode-marker). Build disables Widgets in qtbase, and qtscript (unsupported, would require fixes to JavaScriptCore source code). Qpa same as on iOS but disables device orientation, status bar, clipboard, menus, dialogs which are not supported on tvOS. Change-Id: I645804fd933be0befddeeb43095a74d2c178b2ba Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosscreen.mm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/ios/qiosscreen.mm') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index bfd22abaa4..285b90bcd1 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -120,21 +120,25 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen) self = [super init]; if (self) { m_screen = screen; +#ifndef Q_OS_TVOS [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +#endif } return self; } - (void)dealloc { +#ifndef Q_OS_TVOS [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +#endif [super dealloc]; } @@ -228,8 +232,13 @@ void QIOSScreen::updateProperties() QRect previousAvailableGeometry = m_availableGeometry; m_geometry = fromCGRect(m_uiScreen.bounds).toRect(); +#ifndef Q_OS_TVOS m_availableGeometry = fromCGRect(m_uiScreen.applicationFrame).toRect(); +#else + m_availableGeometry = fromCGRect(m_uiScreen.bounds).toRect(); +#endif +#ifndef Q_OS_TVOS if (m_uiScreen == [UIScreen mainScreen]) { Qt::ScreenOrientation statusBarOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation)); @@ -257,6 +266,7 @@ void QIOSScreen::updateProperties() m_availableGeometry = transform.mapRect(m_availableGeometry); } } +#endif if (m_geometry != previousGeometry) { QRectF physicalGeometry; @@ -335,7 +345,7 @@ qreal QIOSScreen::devicePixelRatio() const Qt::ScreenOrientation QIOSScreen::nativeOrientation() const { CGRect nativeBounds = -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) +#if !defined(Q_OS_TVOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0) QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 ? m_uiScreen.nativeBounds : #endif m_uiScreen.bounds; @@ -348,6 +358,9 @@ Qt::ScreenOrientation QIOSScreen::nativeOrientation() const Qt::ScreenOrientation QIOSScreen::orientation() const { +#ifdef Q_OS_TVOS + return Qt::PrimaryOrientation; +#else // Auxiliary screens are always the same orientation as their primary orientation if (m_uiScreen != [UIScreen mainScreen]) return Qt::PrimaryOrientation; @@ -372,6 +385,7 @@ Qt::ScreenOrientation QIOSScreen::orientation() const } return toQtScreenOrientation(deviceOrientation); +#endif } void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) -- cgit v1.2.3