diff options
author | Mike Krus <mike.krus@kdab.com> | 2016-02-16 14:29:59 +0000 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2016-05-17 16:11:23 +0000 |
commit | 03e9c6f4a62582837fc9f5961ecbccd0a3d1b5d6 (patch) | |
tree | c52961c92f5968a7355941fa224dfc74268ce150 /src | |
parent | 26d44fce3dfb9dbd3b5be2a031fff8c1bb903960 (diff) |
Add support for Apple tvOS
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ø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src')
55 files changed, 205 insertions, 91 deletions
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 163842e8fc..99c32ea672 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -143,8 +143,8 @@ contains(SHAPERS, coretext) { HEADERS += \ $$PWD/src/hb-coretext.h - ios: \ - # On iOS CoreText and CoreGraphics are stand-alone frameworks + uikit: \ + # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks LIBS_PRIVATE += -framework CoreText -framework CoreGraphics else: \ # On Mac OS they are part of the ApplicationServices umbrella framework, diff --git a/src/3rdparty/pcre/pcre.pro b/src/3rdparty/pcre/pcre.pro index 53405e0e46..fad82b80b1 100644 --- a/src/3rdparty/pcre/pcre.pro +++ b/src/3rdparty/pcre/pcre.pro @@ -11,7 +11,7 @@ DEFINES += HAVE_CONFIG_H # platform/compiler specific definitions win32: DEFINES += PCRE_STATIC -ios|qnx|winrt: DEFINES += PCRE_DISABLE_JIT +uikit|qnx|winrt: DEFINES += PCRE_DISABLE_JIT SOURCES += \ $$PWD/pcre16_byte_order.c \ diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index b87d5f4e5d..fdaec33c5a 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -40,7 +40,7 @@ contains(QT_CONFIG,icu) { codecs/qeuckrcodec.cpp \ codecs/qbig5codec.cpp - unix:!qnx:!mac:!ios:!linux-android-* { + unix:!qnx:!darwin:!linux-android-* { contains(QT_CONFIG, iconv) { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 46887b7188..aea3f54bb5 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -58,8 +58,8 @@ win32 { !winrt: LIBS_PRIVATE += -lwinmm } -mac|darwin { - !ios { +darwin { + osx { LIBS_PRIVATE += -framework ApplicationServices LIBS_PRIVATE += -framework CoreServices } diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index dd357e4b15..dc7f492bb1 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1918,6 +1918,8 @@ QSysInfo::MacVersion QSysInfo::macVersion() return QSysInfo::MacVersion(Q_MV_OSX(version.major, version.minor)); #elif defined(Q_OS_IOS) 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)); #else return QSysInfo::MV_Unknown; #endif @@ -2620,9 +2622,9 @@ QString QSysInfo::kernelVersion() to determine the distribution name and returns that. If determining the distribution name failed, it returns "unknown". - \b{Darwin, OS X and iOS note}: this function returns "osx" for OS X - systems, "ios" for iOS systems and "darwin" in case the system could not be - determined. + \b{Darwin, OS X, iOS and tvOS note}: this function returns "osx" for OS X + systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case + the system could not be determined. \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise. @@ -2652,6 +2654,8 @@ QString QSysInfo::productType() #elif defined(Q_OS_IOS) return QStringLiteral("ios"); +#elif defined(Q_OS_TVOS) + return QStringLiteral("tvos"); #elif defined(Q_OS_OSX) return QStringLiteral("osx"); #elif defined(Q_OS_DARWIN) @@ -2735,6 +2739,8 @@ QString QSysInfo::prettyProductName() { #if defined(Q_OS_IOS) return QLatin1String("iOS ") + productVersion(); +#elif defined(Q_OS_TVOS) + return QLatin1String("tvOS ") + productVersion(); #elif defined(Q_OS_OSX) // get the known codenames const char *basename = 0; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 808f433278..38ced26ea4 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -607,7 +607,7 @@ class QDataStream; # define QT_NO_SOCKS5 #endif -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) # define QT_NO_PROCESS #endif diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 141d45e0db..143e00a4c3 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -121,6 +121,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) enum MacVersion { MV_None = 0xffff, MV_Unknown = 0x0000, @@ -168,7 +169,12 @@ public: MV_IOS_8_2 = Q_MV_IOS(8, 2), MV_IOS_8_3 = Q_MV_IOS(8, 3), MV_IOS_8_4 = Q_MV_IOS(8, 4), - MV_IOS_9_0 = Q_MV_IOS(9, 0) + MV_IOS_9_0 = Q_MV_IOS(9, 0), + + /* tvOS */ + MV_TVOS = 1 << 9, + MV_TVOS_9_0 = Q_MV_TVOS(9, 0), + MV_TVOS_9_1 = Q_MV_TVOS(9, 1) }; #if defined(Q_OS_MAC) static const MacVersion MacintoshVersion; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index ee4b88cdbb..10f9068d0a 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -101,14 +101,17 @@ # define Q_OS_DARWIN32 # endif # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE -# if defined(TARGET_OS_TV) && TARGET_OS_TV -# define Q_OS_TVOS -# elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH +# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH # define Q_OS_WATCHOS # 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 +# 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 # endif # else # // there is no "real" OS X define (rdar://22640089), diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 052dc8408b..0b3a28944c 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -135,7 +135,7 @@ win32 { io/qprocess_unix.cpp \ io/qfilesystemiterator_unix.cpp - !integrity { + !integrity:!tvos { SOURCES += io/forkfd_qt.cpp HEADERS += \ ../3rdparty/forkfd/forkfd.h @@ -153,7 +153,7 @@ win32 { OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm HEADERS += io/qfilesystemwatcher_fsevents_p.h LIBS += -framework DiskArbitration -framework IOKit - } else:ios { + } else { LIBS += -framework MobileCoreServices } } else:android { diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 75797e58da..eebe5f1f94 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -61,7 +61,7 @@ #include <CoreServices/CoreServices.h> #endif -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) #include <MobileCoreServices/MobileCoreServices.h> #endif diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 8b11830fbe..1e22252217 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -58,7 +58,7 @@ # include "qfilesystemwatcher_win_p.h" #elif defined(USE_INOTIFY) # include "qfilesystemwatcher_inotify_p.h" -#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_IOS) +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(QT_PLATFORM_UIKIT) # include "qfilesystemwatcher_kqueue_p.h" #elif defined(Q_OS_OSX) # include "qfilesystemwatcher_fsevents_p.h" @@ -74,7 +74,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject // there is a chance that inotify may fail on Linux pre-2.6.13 (August // 2005), so we can't just new inotify directly. return QInotifyFileSystemWatcherEngine::create(parent); -#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_IOS) +#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(QT_PLATFORM_UIKIT) return QKqueueFileSystemWatcherEngine::create(parent); #elif defined(Q_OS_OSX) return QFseventsFileSystemWatcherEngine::create(parent); diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 03dc5fc660..ba59ea8341 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -70,7 +70,7 @@ # include <cstdio> #elif defined(Q_OS_HAIKU) # include <kernel/OS.h> -#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS) +#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT) # include <sys/user.h> # if defined(__GLIBC__) && defined(__FreeBSD_kernel__) # include <sys/cdefs.h> @@ -285,7 +285,7 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) if (get_thread_info(pid, &info) != B_OK) return QString(); return QFile::decodeName(info.name); -#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS) +#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT) # if defined(__GLIBC__) && defined(__FreeBSD_kernel__) int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid }; size_t len = 0; diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index fea5a4c967..227241b208 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2531,7 +2531,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #if defined(Q_OS_MACX) # include <crt_externs.h> # define environ (*_NSGetEnviron()) -#elif defined(Q_OS_IOS) +#elif defined(QT_PLATFORM_UIKIT) static char *qt_empty_environ[] = { 0 }; #define environ qt_empty_environ #elif !defined(Q_OS_WIN) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 8c5589538d..1d425653a3 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -322,7 +322,7 @@ QT_END_INCLUDE_NAMESPACE QProcessEnvironment QProcessEnvironment::systemEnvironment() { QProcessEnvironment env; -#if !defined(Q_OS_IOS) +#if !defined(QT_PLATFORM_UIKIT) const char *entry; for (int count = 0; (entry = environ[count]); ++count) { const char *equal = strchr(entry, '='); diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 831658befc..ed3273eb2e 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -109,7 +109,7 @@ using namespace ABI::Windows::Storage; #define Q_XDG_PLATFORM #endif -#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(Q_OS_IOS)) +#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(QT_PLATFORM_UIKIT)) #define QSETTINGS_USE_QSTANDARDPATHS #endif diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index f08a6dac53..dc3d7737b6 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -117,7 +117,7 @@ static QString baseWritableLocation(QStandardPaths::StandardLocation type, case QStandardPaths::TempLocation: path = QDir::tempPath(); break; -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) // These locations point to non-existing write-protected paths. Use sensible fallbacks. case QStandardPaths::MusicLocation: path = pathForDirectory(NSDocumentDirectory, mask) + QLatin1String("/Music"); @@ -204,7 +204,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) { QStringList dirs; -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) if (type == PicturesLocation) dirs << writableLocation(PicturesLocation) << QLatin1String("assets-library://"); #endif diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index aa60e1686c..60252a51ed 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -111,7 +111,7 @@ mac { osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit - ios { + uikit { # We need UIKit for UIDevice LIBS_PRIVATE += -framework UIKit } diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index de491dd43d..068b6b0440 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -47,7 +47,7 @@ #include <qdebug.h> -#ifdef Q_OS_IOS +#if defined(Q_OS_IOS) #import <UIKit/UIKit.h> #endif @@ -101,7 +101,7 @@ QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TY QAppleOperatingSystemVersion qt_apple_os_version() { QAppleOperatingSystemVersion v = {0, 0, 0}; -#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS) if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) { NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; v.major = osv.majorVersion; diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 319914a99d..b08571223f 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -284,8 +284,8 @@ static inline int qt_safe_close(int fd) #undef QT_CLOSE #define QT_CLOSE qt_safe_close -// - VxWorks doesn't have processes -#if !defined(Q_OS_VXWORKS) +// - VxWorks & iOS/tvOS don't have processes +#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS) static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) { diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index e5e268ace3..7932b9a2dc 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -553,7 +553,7 @@ bool QClipboard::ownsFindBuffer() const bool QClipboard::supportsMode(Mode mode) const { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); - return clipboard->supportsMode(mode); + return clipboard && clipboard->supportsMode(mode); } /*! @@ -565,7 +565,7 @@ bool QClipboard::supportsMode(Mode mode) const bool QClipboard::ownsMode(Mode mode) const { QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); - return clipboard->ownsMode(mode); + return clipboard && clipboard->ownsMode(mode); } /*! diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 239c5e135b..a125b39d67 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1054,7 +1054,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) \li \c eglfs is a platform plugin for running Qt5 applications on top of EGL and OpenGL ES 2.0 without an actual windowing system (like X11 or Wayland). For more information, see \l{EGLFS}. - \li \c ios + \li \c ios (also used for tvOS) \li \c kms is an experimental platform plugin using kernel modesetting and \l{http://dri.freedesktop.org/wiki/DRM}{DRM} (Direct Rendering Manager). diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 283b6643b9..2f927aeddb 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -104,8 +104,8 @@ AVX2_SOURCES += painting/qdrawhelper_avx2.cpp NEON_SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S -!ios:contains(QT_ARCH, "arm"): CONFIG+=no_clang_integrated_as -!ios:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS +!uikit:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as +!uikit:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp MIPS_DSP_HEADERS += painting/qdrawhelper_mips_dsp_p.h painting/qt_mips_asm_dsp_p.h diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 17897ca869..94f8b7cbc0 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -74,7 +74,7 @@ SOURCES += \ mac: LIBS_PRIVATE += -framework Security -ios { +uikit { HEADERS += \ access/qnetworkreplynsurlconnectionimpl_p.h diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index ed586c1de5..0abc48a99c 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -56,7 +56,7 @@ #include "qnetworkreplydataimpl_p.h" #include "qnetworkreplyfileimpl_p.h" -#if defined(Q_OS_IOS) && defined(QT_NO_SSL) +#if defined(QT_PLATFORM_UIKIT) && defined(QT_NO_SSL) #include "qnetworkreplynsurlconnectionimpl_p.h" #endif @@ -1205,7 +1205,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera } // Use NSURLConnection for https on iOS when OpenSSL is disabled. -#if defined(Q_OS_IOS) && defined(QT_NO_SSL) +#if defined(QT_PLATFORM_UIKIT) && defined(QT_NO_SSL) if (scheme == QLatin1String("https")) return new QNetworkReplyNSURLConnectionImpl(this, request, op, outgoingData); #endif diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 811d8b6f0d..b50ca0d1c4 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -53,10 +53,10 @@ win32: { mac { LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation - !ios: LIBS_PRIVATE += -framework CoreServices + !uikit: LIBS_PRIVATE += -framework CoreServices } -mac:!ios:SOURCES += kernel/qnetworkproxy_mac.cpp +osx:SOURCES += kernel/qnetworkproxy_mac.cpp else:win32:SOURCES += kernel/qnetworkproxy_win.cpp else:contains(QT_CONFIG, libproxy) { SOURCES += kernel/qnetworkproxy_libproxy.cpp diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index c164342166..96a3bfb571 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -351,7 +351,7 @@ bool QSslSocketPrivate::s_loadedCiphersAndCerts = false; bool QSslSocketPrivate::s_loadRootCertsOnDemand = false; -#ifndef Q_OS_IOS // dhparam is not used on iOS. (see the SSLSetDiffieHellmanParams call below) +#if !defined(QT_PLATFORM_UIKIT) // dhparam is not used on iOS or tvOS. (see the SSLSetDiffieHellmanParams call below) static const uint8_t dhparam[] = "\x30\x82\x01\x08\x02\x82\x01\x01\x00\x97\xea\xd0\x46\xf7\xae\xa7\x76\x80" "\x9c\x74\x56\x98\xd8\x56\x97\x2b\x20\x6c\x77\xe2\x82\xbb\xc8\x84\xbe\xe7" @@ -370,8 +370,8 @@ static const uint8_t dhparam[] = "\x90\x0b\x35\x64\xff\xd9\xe3\xac\xf2\xf2\xeb\x3a\x63\x02\x01\x02"; #endif -// No ioErr on iOS. (defined in MacErrors.h on OS X) -#ifdef Q_OS_IOS +// No ioErr on iOS/tvOS. (defined in MacErrors.h on OS X) +#if defined(QT_PLATFORM_UIKIT) # define ioErr -36 #endif @@ -1011,7 +1011,7 @@ bool QSslSocketBackendPrivate::initSslContext() return false; } } -#ifndef Q_OS_IOS +#if !defined(QT_PLATFORM_UIKIT) // No SSLSetDiffieHellmanParams on iOS; calling it is optional according to docs. SSLSetDiffieHellmanParams(context, dhparam, sizeof(dhparam)); #endif diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm index 2ad734b8b9..d8e46bdbc6 100644 --- a/src/platformsupport/clipboard/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -43,7 +43,7 @@ #import <AppKit/AppKit.h> #endif -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) #import <UIKit/UIKit.h> #endif diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri index d9ffb85f96..272e7591ba 100644 --- a/src/platformsupport/fontdatabases/mac/coretext.pri +++ b/src/platformsupport/fontdatabases/mac/coretext.pri @@ -7,8 +7,8 @@ contains(QT_CONFIG, freetype) { SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp } -ios: \ - # On iOS CoreText and CoreGraphics are stand-alone frameworks +uikit: \ + # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks LIBS_PRIVATE += -framework CoreText -framework CoreGraphics else: \ # On Mac OS they are part of the ApplicationServices umbrella framework, diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index df39dcf6be..bea32950be 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -44,7 +44,7 @@ #if defined(Q_OS_OSX) #import <AppKit/AppKit.h> #import <IOKit/graphics/IOGraphicsLib.h> -#elif defined(Q_OS_IOS) +#elif defined(QT_PLATFORM_UIKIT) #import <UIKit/UIFont.h> #endif @@ -191,7 +191,7 @@ static CFArrayRef availableFamilyNames() { #if defined(Q_OS_OSX) return CTFontManagerCopyAvailableFontFamilyNames(); -#elif defined(Q_OS_IOS) +#elif defined(QT_PLATFORM_UIKIT) return (CFArrayRef) [[UIFont familyNames] retain]; #endif } @@ -847,7 +847,7 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f) static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f) { -#ifdef Q_OS_IOS +#if defined(QT_PLATFORM_UIKIT) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) { // Use Dynamic Type to resolve theme fonts if possible, to get // correct font sizes and style based on user configuration. @@ -881,7 +881,7 @@ static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f) return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc)); } } -#endif // Q_OS_IOS +#endif // Q_OS_IOS, Q_OS_TVOS // OSX default case and iOS fallback case CTFontUIFontType fontType = fontTypeFromTheme(f); diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 2cc6b09a15..d3f891fd4d 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -59,7 +59,7 @@ #include <qpa/qplatformtheme.h> #include <private/qcore_mac_p.h> -#ifndef Q_OS_IOS +#ifdef Q_OS_OSX #include <ApplicationServices/ApplicationServices.h> #else #include <CoreText/CoreText.h> diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index bbc5cf0c8f..88d80d19ae 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -181,7 +181,7 @@ void QCoreTextFontEngine::init() synthesisFlags = 0; CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont); -#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait)) glyphFormat = QFontEngine::Format_ARGB; else @@ -568,7 +568,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition if (!im.width() || !im.height()) return im; -#ifndef Q_OS_IOS +#ifdef Q_OS_OSX CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); #else CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); @@ -617,7 +617,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1); } } -#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 else if (supportsColorGlyphs()) { // CGContextSetTextMatrix does not work with color glyphs, so we use // the CTM instead. This means we must translate the CTM as well, to diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index 8a487f0ff0..27289239c6 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -54,7 +54,7 @@ #include <private/qfontengine_p.h> #include <private/qcore_mac_p.h> -#ifndef Q_OS_IOS +#ifdef Q_OS_OSX #include <ApplicationServices/ApplicationServices.h> #else #include <CoreText/CoreText.h> @@ -118,7 +118,7 @@ public: static bool supportsColorGlyphs() { -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) return true; #elif MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index 81c7faa389..8fb05be3fa 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -25,6 +25,6 @@ contains(QT_CONFIG, dbus) { include(dbusmenu/dbusmenu.pri) include(dbustray/dbustray.pri) } -ios: include(graphics/graphics.pri) +uikit: include(graphics/graphics.pri) load(qt_module) diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro index 7b0a573ffa..2c85a68f0b 100644 --- a/src/plugins/platforms/ios/ios.pro +++ b/src/plugins/platforms/ios/ios.pro @@ -1,7 +1,7 @@ TARGET = qios QT += core-private gui-private platformsupport-private -LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AssetsLibrary -framework AudioToolbox +LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AudioToolbox OBJECTIVE_SOURCES = \ plugin.mm \ @@ -19,15 +19,9 @@ OBJECTIVE_SOURCES = \ qiosglobal.mm \ qiosservices.mm \ quiview.mm \ - qiosclipboard.mm \ quiaccessibilityelement.mm \ qiosplatformaccessibility.mm \ - qiostextresponder.mm \ - qiosmenu.mm \ - qiosfileengineassetslibrary.mm \ - qiosfiledialog.mm \ - qiosmessagedialog.mm \ - qiostextinputoverlay.mm + qiostextresponder.mm HEADERS = \ qiosintegration.h \ @@ -44,16 +38,28 @@ HEADERS = \ qiosglobal.h \ qiosservices.h \ quiview.h \ - qiosclipboard.h \ quiaccessibilityelement.h \ qiosplatformaccessibility.h \ qiostextresponder.h \ - qiosmenu.h \ - qiosfileenginefactory.h \ - qiosfileengineassetslibrary.h \ - qiosfiledialog.h \ - qiosmessagedialog.h \ - qiostextinputoverlay.h + qiosfileenginefactory.h + +!tvos { + LIBS += -framework AssetsLibrary + OBJECTIVE_SOURCES += \ + qiosclipboard.mm \ + qiosmenu.mm \ + qiosfileengineassetslibrary.mm \ + qiosfiledialog.mm \ + qiosmessagedialog.mm \ + qiostextinputoverlay.mm + HEADERS += \ + qiosclipboard.h \ + qiosmenu.h \ + qiosfileengineassetslibrary.h \ + qiosfiledialog.h \ + qiosmessagedialog.h \ + qiostextinputoverlay.h +} OTHER_FILES = \ quiview_textinput.mm \ diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index b854dfdaa0..83760f2f39 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -54,8 +54,10 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive)) + if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive) + || !system.compare(QLatin1String("tvos"), Qt::CaseInsensitive)) { return new QIOSIntegration; + } return 0; } diff --git a/src/plugins/platforms/ios/qiosfileenginefactory.h b/src/plugins/platforms/ios/qiosfileenginefactory.h index b71fa64460..87665ac603 100644 --- a/src/plugins/platforms/ios/qiosfileenginefactory.h +++ b/src/plugins/platforms/ios/qiosfileenginefactory.h @@ -51,8 +51,12 @@ public: { static QLatin1String assetsScheme("assets-library:"); +#ifndef Q_OS_TVOS if (fileName.toLower().startsWith(assetsScheme)) return new QIOSFileEngineAssetsLibrary(fileName); +#else + Q_UNUSED(fileName); +#endif return 0; } diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h index 0fe81ceb91..c374dcfc6b 100644 --- a/src/plugins/platforms/ios/qiosglobal.h +++ b/src/plugins/platforms/ios/qiosglobal.h @@ -66,8 +66,10 @@ QRectF fromCGRect(const CGRect &rect); CGPoint toCGPoint(const QPointF &point); QPointF fromCGPoint(const CGPoint &point); +#ifndef Q_OS_TVOS Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation); UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation); +#endif int infoPlistValue(NSString* key, int defaultValue); diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index c2f3d6b9e1..57e86538ed 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -78,6 +78,7 @@ QPointF fromCGPoint(const CGPoint &point) return QPointF(point.x, point.y); } +#ifndef Q_OS_TVOS Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation) { Qt::ScreenOrientation qtOrientation; @@ -124,6 +125,7 @@ UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation) } return uiOrientation; } +#endif int infoPlistValue(NSString* key, int defaultValue) { diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index d553d16698..20d1670681 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -84,6 +84,7 @@ static QUIView *focusView() self.cancelsTouchesInView = NO; self.delaysTouchesEnded = NO; +#ifndef Q_OS_TVOS NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self @@ -101,6 +102,7 @@ static QUIView *focusView() [notificationCenter addObserver:self selector:@selector(keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil]; +#endif } return self; @@ -342,6 +344,9 @@ void QIOSInputContext::clearCurrentFocusObject() void QIOSInputContext::updateKeyboardState(NSNotification *notification) { +#ifdef Q_OS_TVOS + Q_UNUSED(notification); +#else static CGRect currentKeyboardRect = CGRectZero; KeyboardState previousState = m_keyboardState; @@ -395,6 +400,7 @@ void QIOSInputContext::updateKeyboardState(NSNotification *notification) emitAnimatingChanged(); if (m_keyboardState.keyboardRect != previousState.keyboardRect) emitKeyboardRectChanged(); +#endif } bool QIOSInputContext::isInputPanelVisible() const @@ -514,7 +520,11 @@ void QIOSInputContext::scroll(int y) if (keyboardScrollIsActive && !originalWindowLevels.contains(window)) originalWindowLevels.insert(window, window.windowLevel); +#ifndef Q_OS_TVOS UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0; +#else + UIWindowLevel windowLevelAdjustment = 0; +#endif window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment; if (!keyboardScrollIsActive) diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index a50d9aa571..8009a37edb 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -102,7 +102,9 @@ public: private: QPlatformFontDatabase *m_fontDatabase; +#ifndef Q_OS_TVOS QPlatformClipboard *m_clipboard; +#endif QPlatformInputContext *m_inputContext; QTouchDevice *m_touchDevice; QIOSApplicationState m_applicationState; diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index fa12d54b28..297b549ec2 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -45,7 +45,9 @@ #include "qiosscreen.h" #include "qiosplatformaccessibility.h" #include "qioscontext.h" +#ifndef Q_OS_TVOS #include "qiosclipboard.h" +#endif #include "qiosinputcontext.h" #include "qiostheme.h" #include "qiosservices.h" @@ -72,7 +74,9 @@ QIOSIntegration *QIOSIntegration::instance() QIOSIntegration::QIOSIntegration() : m_fontDatabase(new QCoreTextFontDatabase) +#ifndef Q_OS_TVOS , m_clipboard(new QIOSClipboard) +#endif , m_inputContext(0) , m_platformServices(new QIOSServices) , m_accessibility(0) @@ -127,8 +131,10 @@ QIOSIntegration::~QIOSIntegration() delete m_fontDatabase; m_fontDatabase = 0; +#ifndef Q_OS_TVOS delete m_clipboard; m_clipboard = 0; +#endif QMacInternalPasteboardMime::destroyMimeTypes(); delete m_inputContext; @@ -217,7 +223,11 @@ QPlatformFontDatabase * QIOSIntegration::fontDatabase() const QPlatformClipboard *QIOSIntegration::clipboard() const { +#ifndef Q_OS_TVOS return m_clipboard; +#else + return 0; +#endif } QPlatformInputContext *QIOSIntegration::inputContext() const 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) diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index eb12739e98..ecc8d1ab1c 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -896,6 +896,7 @@ // text instead of just guessing... } +#ifndef Q_OS_TVOS - (NSDictionary *)textStylingAtPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction { Q_UNUSED(position); @@ -915,6 +916,7 @@ return [NSDictionary dictionary]; return [NSDictionary dictionaryWithObject:uifont forKey:UITextInputTextFontKey]; } +#endif - (NSDictionary *)markedTextStyle { diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm index 486c146af9..83a8176478 100644 --- a/src/plugins/platforms/ios/qiostheme.mm +++ b/src/plugins/platforms/ios/qiostheme.mm @@ -51,9 +51,11 @@ #include <UIKit/UIFont.h> #include <UIKit/UIInterface.h> +#ifndef Q_OS_TVOS #include "qiosmenu.h" #include "qiosfiledialog.h" #include "qiosmessagedialog.h" +#endif QT_BEGIN_NAMESPACE @@ -80,12 +82,20 @@ const QPalette *QIOSTheme::palette(QPlatformTheme::Palette type) const QPlatformMenuItem* QIOSTheme::createPlatformMenuItem() const { +#ifdef Q_OS_TVOS + return 0; +#else return new QIOSMenuItem(); +#endif } QPlatformMenu* QIOSTheme::createPlatformMenu() const { +#ifdef Q_OS_TVOS + return 0; +#else return new QIOSMenu(); +#endif } bool QIOSTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const @@ -102,12 +112,14 @@ bool QIOSTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const QPlatformDialogHelper *QIOSTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const { switch (type) { +#ifndef Q_OS_TVOS case FileDialog: return new QIOSFileDialog(); break; case MessageDialog: return new QIOSMessageDialog(); break; +#endif default: return 0; } diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h index e97aeb32ed..92c4e59d1a 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.h +++ b/src/plugins/platforms/ios/qiosviewcontroller.h @@ -46,12 +46,16 @@ class QIOSScreen; - (id)initWithQIOSScreen:(QIOSScreen *)screen; - (void)updateProperties; +#ifndef Q_OS_TVOS @property (nonatomic, assign) UIInterfaceOrientation lockedOrientation; +#endif // UIViewController @property (nonatomic, assign) BOOL prefersStatusBarHidden; +#ifndef Q_OS_TVOS @property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation; @property (nonatomic, assign) UIStatusBarStyle preferredStatusBarStyle; +#endif @end diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index e975793d9c..77b0716cab 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include "qiosglobal.h" #import "qiosviewcontroller.h" #include <QtCore/qscopedvaluerollback.h> @@ -253,13 +254,15 @@ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent]; #endif - self.lockedOrientation = UIInterfaceOrientationUnknown; self.changingOrientation = NO; +#ifndef Q_OS_TVOS + self.lockedOrientation = UIInterfaceOrientationUnknown; // Status bar may be initially hidden at startup through Info.plist self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false); self.preferredStatusBarUpdateAnimation = UIStatusBarAnimationNone; self.preferredStatusBarStyle = UIStatusBarStyle(infoPlistValue(@"UIStatusBarStyle", UIStatusBarStyleDefault)); +#endif m_focusWindowChangeConnection = QObject::connect(qApp, &QGuiApplication::focusWindowChanged, [self]() { [self updateProperties]; @@ -284,6 +287,7 @@ { [super viewDidLoad]; +#ifndef Q_OS_TVOS NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(willChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification @@ -292,6 +296,7 @@ [center addObserver:self selector:@selector(didChangeStatusBarOrientation:) name:UIApplicationDidChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]]; +#endif } - (void)viewDidUnload @@ -304,7 +309,11 @@ - (BOOL)shouldAutorotate { +#ifndef Q_OS_TVOS return m_screen && m_screen->uiScreen() == [UIScreen mainScreen] && !self.lockedOrientation; +#else + return NO; +#endif } #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0) @@ -436,6 +445,7 @@ // All decisions are based on the the top level window focusWindow = qt_window_private(focusWindow)->topLevelWindow(); +#ifndef Q_OS_TVOS UIApplication *uiApplication = [UIApplication sharedApplication]; // -------------- Status bar style and visbility --------------- @@ -513,6 +523,7 @@ [UIViewController attemptRotationToDeviceOrientation]; } } +#endif } @end diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index e38be68343..b199f28149 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -44,7 +44,9 @@ #include "qiosviewcontroller.h" #include "qiostextresponder.h" #include "qioswindow.h" +#ifndef Q_OS_TVOS #include "qiosmenu.h" +#endif #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qwindow_p.h> @@ -78,7 +80,9 @@ if (isQtApplication()) self.hidden = YES; +#ifndef Q_OS_TVOS self.multipleTouchEnabled = YES; +#endif if (QIOSIntegration::instance()->debugWindowManagement()) { static CGFloat hue = 0.0; @@ -324,6 +328,7 @@ // Touch positions are expected to be in QScreen global coordinates, and // as we already have the QWindow positioned at the right place, we can // just map from the local view position to global coordinates. + // tvOS: all touches start at the center of the screen and move from there. QPoint localViewPosition = fromCGPoint([uiTouch locationInView:self]).toPoint(); QPoint globalScreenPosition = m_qioswindow->mapToGlobal(localViewPosition); @@ -439,14 +444,24 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { +#ifndef Q_OS_TVOS // Check first if QIOSMenu should handle the action before continuing up the responder chain return [QIOSMenu::menuActionTarget() targetForAction:action withSender:sender] != 0; +#else + Q_UNUSED(action) + Q_UNUSED(sender) + return false; +#endif } - (id)forwardingTargetForSelector:(SEL)selector { Q_UNUSED(selector) +#ifndef Q_OS_TVOS return QIOSMenu::menuActionTarget(); +#else + return nil; +#endif } @end diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index cb3764f5df..a63fc28a66 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -10,10 +10,8 @@ contains(QT_CONFIG, xcb) { SUBDIRS += xcb } -mac { - ios: SUBDIRS += ios - else: SUBDIRS += cocoa -} +uikit: SUBDIRS += ios +osx: SUBDIRS += cocoa win32:!winrt: SUBDIRS += windows winrt: SUBDIRS += winrt diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h index ed9e8e272b..199d8aef63 100644 --- a/src/printsupport/kernel/qprint_p.h +++ b/src/printsupport/kernel/qprint_p.h @@ -56,7 +56,7 @@ #include <QtCore/qstring.h> #include <QtCore/qlist.h> -#if (defined Q_OS_MAC && !defined Q_OS_IOS) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) +#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) #include <cups/ppd.h> // Use for type defs only, don't want to actually link in main module #endif @@ -244,7 +244,7 @@ public: return QByteArray(); } -#if (defined Q_OS_MAC && !defined Q_OS_IOS) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) +#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS) // PPD utilities shared by CUPS and Mac plugins requiring CUPS headers // May turn into a proper internal QPpd class if enough shared between Mac and CUPS, diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index e891150330..4435b509be 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -86,6 +86,9 @@ static QSet<QByteArray> keywords() #ifdef Q_OS_IOS << "ios" #endif +#ifdef Q_OS_TVOS + << "tvos" +#endif #ifdef Q_OS_ANDROID << "android" #endif diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 04f51cbb03..bf44049a0e 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1378,7 +1378,9 @@ FatalSignalHandler::FatalSignalHandler() act.sa_flags = SA_RESETHAND; #endif -#ifdef SA_ONSTACK +// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as +// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h) +#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) // Let the signal handlers use an alternate stack // This is necessary if SIGSEGV is to catch a stack overflow # if defined(Q_CC_GNU) && defined(Q_OF_ELF) diff --git a/src/testlib/qxctestlogger.mm b/src/testlib/qxctestlogger.mm index c50b50eb06..ffabe88db2 100644 --- a/src/testlib/qxctestlogger.mm +++ b/src/testlib/qxctestlogger.mm @@ -191,7 +191,7 @@ private: name:[NSString stringWithFormat:@"%@DidFinishLaunchingNotification", #if defined(Q_OS_OSX) @"NSApplication" - #elif defined(Q_OS_IOS) + #else @"UIApplication" #endif ] diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 47aa886568..1bf7a47efb 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -118,7 +118,7 @@ mac { LIBS += -framework Foundation osx: LIBS_PRIVATE += -framework CoreServices - ios: LIBS_PRIVATE += -framework UIKit + uikit: LIBS_PRIVATE += -framework UIKit } macx { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 217a075b07..495af34c60 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9525,7 +9525,7 @@ void QWidget::focusOutEvent(QFocusEvent *) if (focusPolicy() != Qt::NoFocus || !isWindow()) update(); -#ifndef Q_OS_IOS +#if !defined(QT_PLATFORM_UIKIT) // FIXME: revisit autoSIP logic, QTBUG-42906 if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled)) QGuiApplication::inputMethod()->hide(); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 8a768443d1..1ac28f548b 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3624,7 +3624,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW case SH_Menu_SupportsSections: return 1; -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) case SH_ComboBox_UseNativePopup: return 1; #endif |