summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosviewcontroller.mm
Commit message (Collapse)AuthorAgeFilesLines
* iOS: Update statusbar style based on MaximizeUsingFullscreenGeometryHintTor Arne Vestbø2015-03-271-13/+17
| | | | | | | | | | | | When Qt::MaximizeUsingFullscreenGeometryHint is enabled for the focus window we are likely to have window content under the statusbar, in which case we revert to the default iOS statusbar style which is black text. If this style doesn't fit the user application, the style can be set in the Info.plist, or progammatically using native APIs, in combination with UIViewControllerBasedStatusBarAppearance = NO. Change-Id: I97576ae091bbfcb8718f980c25e91cc7ca605f03 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
* iOS: Add platform plugin option to debug window managementTor Arne Vestbø2015-03-161-0/+51
| | | | | | | | | | | | When the 'debugWindowManagement' option is enabled, e.g. by passing the argument -platform ios:debugWindowManagement to the application, the plugin will add a background color and outline to all QUIViews, as well as draw a grid for the underlying QUIViewController. This makes it easier to see where windows are placed when the window itself doesn't draw anything, e.g. in unit tests. Change-Id: If9a59822e0b320b154ad8e338f9fb5ec7cf191a2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
* iOS: Handle an QIOSViewController outliving its related QIOSScreenTor Arne Vestbø2015-03-101-1/+1
| | | | | | | | | | | We release the UIWindow that retains QIOSViewController in the QIOSScreen destructor, but other parts of the OS may have retained the view controller, so the dealloc may not happen until later. In the meantime we may receive calls to shouldAutorotate, so we need to guard this code for the situation that m_screen has been deleted. Change-Id: Iefeb75f4fc698b5e80417ffd3a971b7de625bcd5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-22/+14
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* iOS: Track QIOSViewController -> QIOSScreen using QPointerTor Arne Vestbø2015-02-021-3/+4
| | | | | | | | | We may receive viewWillLayoutSubviews calls for the view controller even if QIOSScreen has released the UIWindow that retains the view controller. Change-Id: I0cc7c50dbb5ee00224aec46d070b04efe069e85a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Disconnect focusWindowChanged connection on QIOSViewController deallocTor Arne Vestbø2015-02-021-1/+8
| | | | | | Change-Id: I6acac4c926fcf5459364133b6cc58baff0519074 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Limit auto-rotation to device screen (excludes external screens)Tor Arne Vestbø2015-01-241-1/+1
| | | | | | | | | | | An external screen should always stay in the native orientation of the screen, and not be affected by rotations of the device. If the user requires the external content to follow the device rotation, this can be done explicitly by listening to orientation changes of the main screen, or using QSensors. Change-Id: I3a98655d11915f0db107930e7d97a24417656bc9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* Track QPlatformScreen -> QScreen using QPointerTor Arne Vestbø2015-01-241-0/+3
| | | | | | | | | | Allows the QPlatformScreen to verify that the QScreen is alive before sending events to QPA for the given screen (which will assert if the screen is being destroyed). Change-Id: Ie77674fead3e0a4d4f6fedbf1f7f3c98364c7485 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Associate UIScreen and show UIWindow on initial QWindow mappingTor Arne Vestbø2015-01-231-7/+43
| | | | | | | | | | | | We delay showing the UIWindow until the first QWindow is created and mapped to the screen. This allows external screens to stay in mirror mode until a QWindow has been explicitly created on that screen. We also remove the screen-association when the last QWindow on that screen has been removed, which will return the external screen to mirror mode. Change-Id: Iccecb297281d0c4f397f69f2494debff051ade01 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Base [QIOSViewController shouldAutorotate] on the locked orientationTor Arne Vestbø2015-01-231-10/+10
| | | | | | | | | Instead of keeping a separate property for the auto-rotation. Allows us to override shouldAutorotate later on to make the decision even more fine grained. Change-Id: I9a3cd6c1316f2a5485a94ef8d9b633df87f46f5f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Ignore statusbar changes for windows on external screensTor Arne Vestbø2015-01-231-0/+5
| | | | | Change-Id: Ib7919abb2da324f6ffa058e8b215bf566ff43e40 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Don't re-apply window state during QIOSWindow constructionTor Arne Vestbø2015-01-231-1/+5
| | | | | | | | | | | We set the parent of the window as part of constructing it, which will cause a layout of the QIOSDesktopManagerView's subviews, but in this case we don't need to re-set the window state as that's taken care of later on in the QIOSWindow constructor. Change-Id: Ic197c9a50394908c8aa2155abdc97bc322937a85 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Prevent recursion when updating/syncing QIOSViewController propertiesTor Arne Vestbø2015-01-091-0/+12
| | | | | | Change-Id: I22f1eaa892cba23c498ae210a9a483e468268581 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Fix QWindow::reportContentOrientationChange on iOS6+Tor Arne Vestbø2015-01-091-13/+80
| | | | | | | | | | | | | On iOS 6 and above, [UIViewController supportedInterfaceOrientations] needs to return 0 for [UIApplication setStatusBarOrientation] to work. This means once you report a content orientation other than the primary orientation, you'll disable auto-rotation. Reporting the orientation as Qt::PrimaryOrientation restores the auto-rotation behavior. Change-Id: I1b8c765c507728fdbc5b828e0b4215324014e221 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Move implementation details of QIOSViewController to class extensionTor Arne Vestbø2015-01-081-0/+6
| | | | | | Change-Id: I602d8f1c9f20d3bfed4db3405460021146b546d8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Raise window level instead of hiding statusbar during VKB scrollTor Arne Vestbø2015-01-071-7/+1
| | | | | | | | | | | | | | | | | | Hiding the statusbar using the normal iOS APIs result in QScreen reporting new availableGeometry, which is not what we want. The scroll of the screen is a purely visual effect, and shouldn't have any effect on observable Qt APIs besides the keyboard rect changing. Instead of actually hiding the statusbar, we achieve the same effect by raising the key window (and any other application windows, including the keyboard) to the level of the statusbar, effectively putting them above the statusbar. This still leaves popups and alert windows above the key window, as normal. Change-Id: Ib7694240ca86cfb9000de35bf0c49343ffb37e32 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* iOS: Fade out statusbar when scrolling view due to VKBTor Arne Vestbø2014-10-201-41/+49
| | | | | Change-Id: I86923a2b2aa2d17d79ba3a11cabf37e615eaf4cc Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Move statusbar visibility handling to QIOSViewControllerTor Arne Vestbø2014-10-021-12/+50
| | | | | | | | | | | | | It doesn't belong in QIOScreen, and simplifies the flow when changing the focus window or the window state of the focus window. Both will result in calling updateProperties on the view-controller, which will re-configure the statusbar visibility and hide/show it as appropriate, before triggering a re-layout of its own view, which will in turn trigger an update of the screen properties based on the new statusbar state, before re-layouting of QWindow based on the new screen state. Change-Id: I89077a3fb5f843949ce833e4e727d2c753ea2eb6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Don't update screen properties for statusbar frame while rotatingTor Arne Vestbø2014-09-241-0/+25
| | | | | | | | | | The rotation will already result in laying out of the root viewcontroller, so we don't need to send explicit geometry changes for the statubar change. The properties of the screen at that point are also not consistent, as the screen is about to rotate. Change-Id: I1b45bee1c1224ca56f9e37068d68c4ee1bfeb9b6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Reflect changes in statusbar height as QScreen availableGeometryTor Arne Vestbø2014-09-241-0/+36
| | | | | | | | | | | We detect changes to the statusbar height, eg. when the in-call 40px tall statusbar is active, and ensure that the root viewcontroller view is laid out again with new screen properties applied. To make the layout match the animation of the statusbar height we apply the layout inside a animation block. Change-Id: I751d9d1273e833ef052a3a4f3d2777e1dffec7dd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Ensure root view controller always matches size of containing windowTor Arne Vestbø2014-09-241-0/+35
| | | | | Change-Id: I249d847a1f4785b3e63e46759baed340b0d6362e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Move top level window management out of QIOSScreen to ↵Tor Arne Vestbø2014-09-241-0/+38
| | | | | | | | | | | | | | | | QIOSDesktopManagerView The logic of how to deal with top level windows in the presence of rotation or status bar changes should be confined to our custom QIOSViewController that acts as a desktop manager for regular Qt applications. We no longer treat windows with full-screen or maximized geometry but without the matching window state flag as being targeted for auto-resizing. In the future we might detect this case and warn the user that windows should have the appropriate flags to be able to auto-resize on orientation changes. Change-Id: Ibab09de5cf37e77c356fbf51a54a2fcec4bb5c51 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Update screen properties more consistentlyTor Arne Vestbø2014-09-241-5/+2
| | | | | | | | | | | Instead of updating screen properties (and hence laying out top level windows) in willAnimateRotationToInterfaceOrientation, we do it in the more catch-all viewWillLayoutSubviews, which also handles changes to the orientation while the application is in the background, as well as changes to the statusbar frame/size, eg. while being in a call. Change-Id: Ib4a08af2f3a56db426a10ff1ed819867895b5a5a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Let QScreen manage UIWindow and root view-controllerTor Arne Vestbø2014-07-231-2/+30
| | | | | | | | | | Instead of having the application delegate set up a UIWindow and root view-controller, we move the responsibility to QScreen, since in a multi screen scenario we will need one UIWindow per screen, as well as one root viewcontroller per window. Change-Id: If5b0d44b8f8a697d830b33b4fe420bff56a7629b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Add QWindowPrivate::topLevelWindow() helper functionTor Arne Vestbø2014-01-301-3/+5
| | | | | | | | Might be useful to expose to QWindow in 5.3, but for now it's private so it can be used by platform plugins. Change-Id: Iad96d7e249a7b85695668f8d7e8918164ec67442 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* iOS: don't show statusbar if hidden from Info.plistRichard Moe Gustavsen2013-12-041-0/+3
| | | | | | | | | | | | | | | | Currently there is no way to always hide the statusbar on iOS other than showing a window in fullscreen. This patch will check if the statusbar is (initially) hidden from the Info.plist, and respect that in the application. SubAttack is an example of an app that (because of styling issues with MainWindow margins) manually sets the geometry larger than fullsreen, and calls showNormal(). In that case we still want the statusbar to be hidden. Change-Id: Ia365d14971978360d0b39621ff0f8f82f74b57e2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Handle statusbar changes to child windowsTor Arne Vestbø2013-12-041-3/+3
| | | | | | | | | Going through the platform window failed when the parent wasn't created yet. We can still get the window state of an yet-to-be-created top level window. Change-Id: Iaa61ddc50df037ac0bd2fd0884884c2bfce1dd9a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Fix build against iOS 5 SDK and auto-rotation on iOS 5Tor Arne Vestbø2013-11-221-0/+10
| | | | | Change-Id: I3acc2d3780a9440bedf48db3fed0046b06300b9e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Change show() to imply maximize, and showFullScreen() to hide status barTor Arne Vestbø2013-11-221-0/+25
| | | | | | | | | | | | Matches the Android behavior, and gives an easy and predictable way to show true fullscreen windows that is similar to how one would do it on a desktop platform. We keep the statusbar visibility in sync with the window state of the active window. Change-Id: Ia4b99e03f83e19f9ef56cc99b9d477cc6da4c734 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Prepare platform screen for reacting to dynamic updates to propertiesTor Arne Vestbø2013-11-201-6/+3
| | | | | Change-Id: Idb378416da2b559ed88eb5a764cacff149264f70 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Remove background color for UIWindow and UIViewController's root viewTor Arne Vestbø2013-11-141-8/+0
| | | | | | | | They were handy while debugging the iOS platform plugin, but should not affect users who link against debug libraries, so let's just remove them. Change-Id: I61b157e81130e5d951c22892e00f71e593082b1d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* qios: always auto rotate as specified in Info.plistRichard Moe Gustavsen2013-09-231-8/+3
| | | | | | | | | | | | | Before this patch, we would only rotate if no autoRotationMask was set. This was a temporary way to lock orientation from code until a better API for this was in place. But this causes problems for applications that both wants to auto rotate but at the same time sets a mask to get QScreen::orientation updates. So remove this heuristic before application code starts to depend on it. Change-Id: Idb54abd471b33afd866322738f4860c57bc9dcf7 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Don't try to set screen orientation before QApplication startupTor Arne Vestbø2013-04-241-0/+4
| | | | | | | | | | | | | | | | We create our QIOSViewController in didFinishLaunchingWithOptions, and schedule a timer to run the user's main. If the device is placed in landscape orientation at startup, we will receive a willRotateToInterfaceOrientation message before the timer is triggered to run the user's main, which means we do not yet have a QApplication. To fix this crash we exit early, but we might have to store the new orientation for later, and make sure the initial QScreen is then created with the correct orientation. Change-Id: I0cc02f0d36b992d190736e98858dc7d002d595b7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* iOS: Handle UIDeviceOrientation vs UIInterfaceOrientationTor Arne Vestbø2013-04-041-1/+1
| | | | | | | | | | The former represents the physical device orientation, the latter the UI orientation. We need to explicitly cast between them, as they are different enums, but with compatible values for the subset we use. Change-Id: I2926068802f35680cb6de5ced6dcf286014fdb2e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Enable autorotate on startup.Morten Johan Sørvig2013-02-271-1/+1
| | | | | | | | | | | | | The qobject_cast to QGuiAppplication will always fail at startup since QGuiApplication is not ready yet. Return YES in that case. Allowed orientations can then be controlled by setting "Supported Interface Orientations" in Xcode or the Info.plist file. Change-Id: Ifd86bbcedabc716e63563bbb7cb0c1c6833fd6c7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Move debug background color setting and guard for release buildsTor Arne Vestbø2013-02-271-0/+8
| | | | | Change-Id: Ie9131c3dfe16045805b37bf8af9381f4f9929da6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: update primary orientation when the rotation startsRichard Moe Gustavsen2013-02-271-3/+3
| | | | | | | | | We need to update primary orientation when the rotation starts, and not when it ends, so that we are in sync with the resize that happens to the backingstore upon layoutSubviews. Change-Id: I466a2d135e6c15550c6207c9659871629d748b73 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: refactor general convenience functions into new file 'qiosglobal'Richard Moe Gustavsen2013-02-271-0/+1
| | | | | | | | Some functions are needed across several files and classes. Lets place them in a common file for all to use. Change-Id: I5f9b578f948d66d10e57a835b80b5c493e07fb4c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: refactor QIOSOrientationListener into QIOSScreenRichard Moe Gustavsen2013-02-271-1/+1
| | | | | | | | | | | | Clean up a bit. The orientation conversion functions belongs to QIOSScreen more than QIOSOrientationListener. And rename them in the same go to follow toQRect/fromQRect standard. The orientation listener itself is tightly coupled to QIOSScreen, and does not make much sense on its own, so move it into QIOSScreen to follow the same patteren already implemented for QIOSInputContext. Change-Id: I8b6b4d08a42349b4232749d59d46748297083536 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: let QIOSScreen change geometry according to interface rotationTor Arne Vestbø2013-02-271-0/+12
| | | | | | | | | | | Qt expects the screen to change geometry when the "desktop" rotates. On iOS, we interpret this as when the root view controller changes orientation, since after all, this is the surface we place QWindows on top of. Change-Id: Ia00e68c8f9f0a65aefcc60518ee544fb260d4595 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Enable auto-rotation if no orientation update-mask has been setTor Arne Vestbø2013-02-271-2/+11
| | | | | | | | This is an intermediate heuristic until we have a proper API in Qt to deal with auto-rotation and orientation locking. Change-Id: I433992fa1c18d1670987f79e405a4501b6e5d365 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Remove requestWindowOrientation from QIOSWindowTor Arne Vestbø2013-02-271-21/+1
| | | | | | | The API is scheduled to be removed in qtbase in time for Qt 5.0. Change-Id: Ie34d6cb79fcd81b0ce02892529e3e7184ddfa096 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: implement requestWindowOrientationRichard Moe Gustavsen2013-02-271-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | The application is normally supposed to rotate the content on its own, but can call requestWindowOrientation to ask the window manager to do it instead. This way of integrating orientation with the OS is fragile, because: 1. In some cases, you cannot stop the OS from rotating at all (tablets). 2. It would be more safe to inform the window manager up-front which orientations it could rotate into, rather that relying on a function you call call to force this later on. 3. When the QML application starts, its a bit late to inform the platform plugin that it supports e.g landscape. If the OS is in landscape already, the plugin must still assume that the app operates in portrait (doing rotating on its own) until requestWindowOrientation is called. This might cause the app to first start up in portrait, just to rotate into landscape. On iOS, it seems like we can handle the first two cases. The third need some more investigation. We should anyway investigate if we need some adjustment to the Qt API. Change-Id: I50638b78d469ab70820a787de86a2f1981470786 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: add QIOSViewControllerRichard Moe Gustavsen2013-02-271-0/+60
We need our own viewcontroller to better control which orientations iOS can enter, and also ito be able to stop auto-rotation. We stop auto-rotation to happend by default, since this is how Qt wants it (it is seen as the responsibility of the application). Change-Id: Id07a96e355396752fffd28984af528aeb0b7c3e3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>