summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosscreen.mm
Commit message (Collapse)AuthorAgeFilesLines
* iOS: Compare similar types when setting up QPlatformScreenTor Arne Vestbø2013-09-211-1/+1
| | | | | | | [NSArray count] returns an NSUInteger (unsigned long). Change-Id: I3b1c6720e9503ed181f01a7e737de07a277f7bde Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* iOS: Use right DPI for all iPad Minis, not just the WiFi versionTor Arne Vestbø2013-05-271-1/+1
| | | | | | | | The 3G versions are iPad2,6 and iPad2,7. Change-Id: I43a00e84535d494550bca8a533a6d16af4be6722 Reviewed-by: Ian Dean <ian@mediator-software.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Don't use -1 as magic value for UIDeviceOrientationFaceUp/DownTor Arne Vestbø2013-04-301-3/+12
| | | | | | | | | | | | | | | | | | | The check in [QIOSOrientationListener orientationChanged] ensured we never reported the two unsupported orientations through QPA, but we were reporting back the orientation through QIOSScreen::orientation() as well, and that didn't have a guard for -1. This resulted in crashes in client code that assumed the range of QScreen::orientation() was defined by the enum, such as the paintedwindow example. The listener now ignores the two unsupported orientations, which leaves us at the previous orientation. For the conversion function, we still have to support all UIDeviceOrientations, so we fall back to portrait for the two unsupported orientations. In the future we should consider caching the previous value explicitly, or fall back to the interface orientation. Change-Id: Ic19d0ce86b4ddea250ea927d5e8664396b2b68fd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: use an explicit pointer to qiosViewControllerRichard Moe Gustavsen2013-04-191-1/+1
| | | | | | | | | | | | | As it stood, we always relied on the root view controller being a QIOSViewController if isQtApplication() returned true. For mixed application, this might not always be true as native code can choose to replace the root view controller at times, or even rip it out, and place it as a child of another (e.g UISplitViewController). This change will give an extra protection against that. Change-Id: I0cb85796a8b82f9037c32f9e85e04e1dc7aad8e2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@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: Don't crash on landscape mode startupMorten Johan Sørvig2013-02-271-1/+1
| | | | | | | | | fromPortraitToPrimary is called from the QIOSScreen constructor. This is probably to early to call QGuiApplication functions. Change-Id: I882304fd641df13dc530491990245ba9ad495377 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Enable retina resolution for stylesMorten Johan Sørvig2013-02-271-0/+5
| | | | | | | | | | The QStyle code uses the global qApp->devicePixelRatio(), which queries the screen, not the window. Implement QIOSScreen::devicePixelRatio(). Change-Id: I0091e5793f8d07ab7a46b6de443edd9457dcff85 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Use 72 DPI for font size conversionTor Arne Vestbø2013-02-271-0/+5
| | | | | | | This matches how UIKit behaves Change-Id: I13fd2578cac84e57b6be29c42ddee414b7ee9cb9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: add convenience function to get to the root QIOSViewControllerRichard Moe Gustavsen2013-02-271-2/+2
| | | | | | | | | | | | | | | It seems that we need to access our view controller from many places, and the syntax to do so is tricky to remember. So lets just add it to our global functions, with the added bonus of a using a little cache. Note: many of these functions could be made inline, but since one concern of the plugin will be the end size of the app, I prefer to trade size for speed at this point. We can always change this later. Change-Id: I578ea9ae8218d23d635b7728a930763ca53c4eaa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: report changes to keyboard rect back to QtRichard Moe Gustavsen2013-02-271-3/+1
| | | | | | | | | QInputContext expects us to report whenever the input panel changes geometry. This patch implements this. Change-Id: I9162f0d48da6925274a7489c9bcb6adab9afae82 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: add global function 'isQtApplication'Richard Moe Gustavsen2013-02-271-1/+1
| | | | | | | | | | Several places in the code we need to check if the plugin is running as a cross-platform Qt application or inside a native app. So we refactor this function to qiosglobal so we can access it from everywhere. Change-Id: I78db0dcde71b7d281868ce304867c8f876caef2a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: refactor general convenience functions into new file 'qiosglobal'Richard Moe Gustavsen2013-02-271-48/+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: let QIOSScreen use correct orientation at startupRichard Moe Gustavsen2013-02-271-0/+7
| | | | | | | | When QScreen is created, we need to check if the application is already in landscape. Change-Id: I653c622154a5c23ec93e89ec3e80fefb6b1f1bdd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: refactor QIOSOrientationListener into QIOSScreenRichard Moe Gustavsen2013-02-271-1/+89
| | | | | | | | | | | | 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-4/+28
| | | | | | | | | | | 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: let QIOSScreen start/stop listening for device orientationRichard Moe Gustavsen2013-02-271-0/+27
| | | | | | | | From the qpa docs, we only need to listen for device orientation if orientationUpdateMask is non-zero Change-Id: Id5e828cdff9a08794c8a029e11763cc037e1b959 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: insert Digia license headersRichard Moe Gustavsen2013-02-271-24/+24
| | | | | | | Remove Nokia. Change-Id: Iec7095ef4e3099453b6103814e826039b377ecce Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Implement QPlatformScreen::availableGeometry()Tor Arne Vestbø2013-02-271-2/+6
| | | | | | | | | | | This will sadly not work as expected until we've found a way to kick off the iOS event loop before QApplication is initialized, as UIScreen does not seem to report the correct applicationFrame (taking the status bar into account) until after the UIApplication has been set up by UIApplicationMain(). Change-Id: I0eaa3b8bca4129d1c4183a202ad2ecd0d8bc52d0 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Flesh out initial QPlatformScreen implementationTor Arne Vestbø2013-02-271-49/+56
| | | | | | | | | | | | | | | | | | We check the device's model identifier to tweak the screen values based on the precense of older iPhone/iPod touch models, or the iPad Mini. This does not work when running under the simulator, which reports its model identifier as the architecture of the host platform. There doesn't appear to be any APIs to get the simulated device of the simulator, but if this becomes an issue we can always look at the UIDevice model and screen resolution and apply a few heuristics. We do not update the screen geometry on orientation-changes. This matches what UIScreen reports for bounds, but may not be the most intuitive solution from a Qt perspective compared to the way other platform-plugins work. Change-Id: I74783e053601de9ce805f8b52b944c116f9a1e3e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* iOS: Keep UIScreen* for current QIOSScreen instead of looking up each timeTor Arne Vestbø2013-02-271-6/+6
| | | | | | | Also, add enum for screen numbers, for better code readability. Change-Id: Id5162c34e80ff5efb149ae86b49f51df183d1c1d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: copy brute-force port of Qt4 uikit plugin into Qt5.Richard Moe Gustavsen2013-02-261-0/+120
The plugin has been renamed from uikit to ios. Other than that, the plugin will now build, but do nothing. Most of the Qt4 code is preserved, with a rough translation into the Qt5 qpa API. A lot of code has simply been commented out so far, and most lacking at the moment is the event dispatcher which will need to be rewritten, and the opengl paint device implementation. But it should suffice as a starting ground. Also: The plugin will currently not automatically build when building Qt, this needs to be enabled from configure first. Change-Id: I0d229a453a8477618e06554655bffc5505203b44 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>