Commit Graph

12475 Commits

Author SHA1 Message Date
Tor Arne Vestbø
e71ca36161 iOS: Ensure UIApplicationMain is started before QApplication by wrapping main()
For the typical Qt app the developer will have an existing main() that
looks something like:

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    return app.exec();
}

To support this, we provide our own 'main' function in the
qtmain static library that we link into the application, which calls
UIApplicationMain and redirects to the 'main' function of the application
after the event loop has started spinning. For this to work, the applications
'main' function needs to manually be renamed 'qt_main' for now. In a later
patch, this renaming will happen automatically by redefining main from either a
header file, or more likely, from the Makefile created by qmake.

For the case of an iOS developer wanting to use Qt in their existing app
the main will look something like:

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

This is supported right now by just linking in libqios.a without libqiosmain.a.
QGuiApplication should then be created e.g inside the native apps application
delegate (but QGuiApplication::exec should not be called).

In the future, we plan to but use a wrapper library that
brings in all the Qt dependencies into one single static library. This library will
not link against qtmain, so there won't be a symbol clash if the -ObjC linker option
is used. We should then add the required magic to the future Objective-C convenience
wrapper for QML to bring up a QGuiApplication, which would allow using Qt from
storyboards and NIBs. This would also be the place to inject our own
application delegate into the mix, while proxying the delegate callbacks
to the user's application delegate.

Change-Id: Iba5ade114b27216be8285f36100fd735a08b9d59
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:42 +01:00
Tor Arne Vestbø
3241f37711 iOS: Implement QPlatformWindow::setWindowState()
In both maximized and fullscreen modes we assume that we can use the
availableGeometry() of the QScreen, but of course this depends on us
showing or hiding the statusbar first, as well as QScreen actually
returning the right availableGeometry when the statusbar is shown.
The latter is not the case right now, as we initialize QScreen before
UIApplication has been set up and UIScreen has had a chance to init
itself based on the precense of a statusbar or not.

Change-Id: Id44dee3550f7135ffe2852b377bb6c7b6d522d68
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:42 +01:00
Tor Arne Vestbø
e123056c47 iOS: Implement QIOSWindow::setGeometry() and pick up UIView geometry changes
The best way to pick up geometry changes of the UIView seems to be to override
layoutSubviews(), but that will only be called if the size of the UIView
changes, not when the position (center) changes. This means that the position
reflected by the QWindow will not always be in sync with the position of the
native UIView. Fortunately the position of a QWindow is not used for anything
critical in Qt itself.

Another issue is that the frame property of a UIView is only valid if the
transform of the UIView is set to the identity transform. We try to catch
cases where this is not the case, and warn the user about this. We could
in theory react to changes in the UIView geometry by only updating the
size, since this is also reflected through the bounds property of the
UIView. This is left for when we know more about how these things
interact in practice.

Change-Id: I079162c059d377a77569fe3974e261d2e0671fd5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:42 +01:00
Tor Arne Vestbø
3d81b43aa4 iOS: Implement QPlatformScreen::availableGeometry()
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>
2013-02-27 23:55:41 +01:00
Morten Johan Sorvig
8d7238f57e iOS: Use default createPlatformPixmap implementation
No need to implement this one, the standard implementation
creates a raster pixmap.

Change-Id: I9bb25188bd95159d76e760b2be6870e0bede7b56
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:41 +01:00
Richard Moe Gustavsen
e936561a16 iOS: Add Q_IMPORT_PLUGIN(QIOSIntegrationPlugin) into the plugin itself
Since the plugin will always be linked in statically, we add this
necessary registration code into the plugin itself rather than
putting this burden onto the client application.

Change-Id: I8691d8080e41bdf0644bb960b5c7102e79a0f0d5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:41 +01:00
Tor Arne Vestbø
3bc6d7470a iOS: Pass QWindow geometry to initWithFrame on window creation
Allows the optimal pattern of setting the geometry of the QWindow
before showing (and hence creating) it.

Change-Id: I29206b5d9a70df0b01e8df8f7df8f35cced51121
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:40 +01:00
Tor Arne Vestbø
231796c98d iOS: Set background color of UIWindow and root UIView to burn your eyes
Convenient to aid debugging during development of the platform plugin.

Change-Id: Id429ca95e0452385ee8def1fe4a1bb7de175ba3e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:40 +01:00
Tor Arne Vestbø
caacccaaf0 iOS: Unset EAGL context if it's current when destroying QIOSContext
Change-Id: Ie0b27e6b0dafa2a7283b44d6676871fce15cc42a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:39 +01:00
Richard Moe Gustavsen
6bbe89e2b8 iOS: support stand-alone qApp->processEvents calls
Rough implementation to support stand-alone processEvent calls. We
probably need to revisit this code to fix corner-cases later on.

Change-Id: I72d5639dab599b4d0017aaa52b922f4185a50337
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:39 +01:00
Richard Moe Gustavsen
0dbee6a5e1 iOS: send mouse events (from touch events) from EAGLView
Change-Id: Ia6c955f2c5bcde8e41d5908bfb8fd52bd449b3ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:39 +01:00
Richard Moe Gustavsen
ea1e5ccd62 iOS: implement QEventLoop support in the event dispatcher
With this patch you can now expect the following code to work:

QEventLoop l;
QTimer::singleShot(1000, &l, SLOT(quit()));
l.exec();

Change-Id: Ic73e37affaadf8a859787d84ac02c15621ac7a29
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:38 +01:00
Richard Moe Gustavsen
19de726725 iOS: create top-level UIWindow and UIViewController
Create a UIWIndow with a view controller and a view
where we can reparent our QIOSWindow views inside.

Change-Id: Ic90707d3ebe1af970a3aa2aa0f8c0f4be192456a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:38 +01:00
Tor Arne Vestbø
09187f602c iOS: Implement QIOSBackingStore in terms of a QOpenGLPaintDevice
We build on top of the QPlatformOpenGLContext implementation to get
automatic support for QBackingStore-based painting. Since the OpenGL
renderer does not clear the backingstore between frames, we actually
also get support for partial updates, and we get the benefit of an
accelerated paint engine for Qt Quick 1 without setting a GLWidget
as the viewport, which would cause issues such as an extra QWindow.

This patch also removes the dependency to QtOpenGL and QtWidgets, which
were leftovers from the Qt4 platform plugin. In Qt5 the needed GL bits
are in QtGui.

Change-Id: Id9b736bfb2e4aec56c0fa9f5b7b4d8bff8e3d1dc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:37 +01:00
Tor Arne Vestbø
3c4f48f9e2 iOS: Implement QPlatformOpenGLContext
The iOS platform GL context is an EAGLContext, which is wrapped by
the new class QIOSContext. The class takes care of makeCurrent()
and swapBuffers(), but defers framebuffer management to the
corresponding QIOSWindow.

At the moment only a single framebuffer is created, and changing the
geometry of the QWindow does not trigger any sort of invalidation of
the buffers.

The implementation assumes OpenGL ES2.x support. Though strictly
speaking we could support ES1 for QtGui, it serves little purpose
as Qt Quick 2 requires ES2.

This patch also disabled touch event synthesization until we have
figured out where we will maintain the connection to UIWindow.

QPlatformOpenGLContext::getProcAddress() for getting extensions is
implemented by using dlsym() to look up the symbol. This should not
present any issues for App Store deployment, like dlopen() would.

Change-Id: I166f800f3ecc0d180133c590465371ac1642b0ec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:37 +01:00
Richard Moe Gustavsen
ac8d906a3a iOS: support killing timers
Implement the remaining timer functions in the event dispatcher

Change-Id: Ie323962c898a2ee95ea60a8ca63b93cbd4544fd1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:37 +01:00
Richard Moe Gustavsen
458382f35b iOS: call UIApplicationMain from event dispatcher, and add application delegate
This change will let you call QApplication::exec() instead of UiApplicationMain
from main. Also added an application delegate that we will need sooner
or later for catching application activation events.

Change-Id: I4edba5ce2059a804782d67c160755fc0e2e5267d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:36 +01:00
Tor Arne Vestbø
05d0f60ebe iOS: Flesh out initial QPlatformScreen implementation
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>
2013-02-27 23:55:36 +01:00
Tor Arne Vestbø
44c3ef790e iOS: Fix build on case sensitive filesystems
Change-Id: Ic7a2b38ffcc2bd83e268c5caf5bec17006879969
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:36 +01:00
Richard Moe Gustavsen
407cf7341e iOS: QIOSEventDispatcher: implement timer support
Change-Id: I1966a64e6535f32005681db37b4fe5d89dafc70c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:35 +01:00
Richard Moe Gustavsen
145abdc442 iOS: QIOSEventDispatcher: add runloop source for processing events
Change-Id: I6cd649a493dab9a982d71921f19d2a9252fc14b0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 23:55:35 +01:00
Tor Arne Vestbø
a685df0584 iOS: Add ability to get the UIView for a QWindow through QPlatformNativeInterface
Change-Id: Iab2742bbaa97ff345871ad07ef0162b12248506a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:34 +01:00
Tor Arne Vestbø
422eed16eb iOS: Style nitpicking, rename m_fontDb to m_fontDatabase
Change-Id: I9d92843af9018d51b73fadcc7c20d792fad772fa
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:34 +01:00
Tor Arne Vestbø
5e85aa9ab4 iOS: Keep UIScreen* for current QIOSScreen instead of looking up each time
Also, add enum for screen numbers, for better code readability.

Change-Id: Id5162c34e80ff5efb149ae86b49f51df183d1c1d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:34 +01:00
Tor Arne Vestbø
14e93f7e8e iOS: Add screen like other platform plugins
We may add support for external displays at a later point, but for now
we follow the same pattern as the other platform plugins. Either way we
should call screenAdded() to let the platform integration know about the
screen.

Change-Id: Id01785a5262df0180caf957c7de8ecbbf169f233
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:33 +01:00
Tor Arne Vestbø
6d36a83b41 iOS: Get rid of singleton instance accessor in platform plugin
None of the other platform plugins have one, and it's not used anywhere.

Change-Id: Id46ab5f75c9819511c3e9d123d0338c3c8799869
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:33 +01:00
Tor Arne Vestbø
3020d06fdb iOS: Change member variable style to be consistent with Qt's de facto standard
Change-Id: Idd65ad9cbb77114466c5b69a799b98a7fee5068f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:33 +01:00
Tor Arne Vestbø
9c8ce6afb0 iOS: Don't add to OBJECTIVE_HEADERS, there's no such thing
We should add to HEADERS, so that moc will realize it needs to run on
the headers.

Change-Id: I582e989e4faf0835c4bf9a677cbd8ac075559319
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-02-27 23:55:32 +01:00
Tor Arne Vestbø
8c00149078 iOS: Don't include QtPrintSupport dialogs on iOS
It pulls in a dependency on Cocoa.

Change-Id: I293063adfdef8b92f80ffda0c66ac6e6d12958ff
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:55:32 +01:00
Tor Arne Vestbø
c7fbff7bf2 iOS: Add required public dependencies of the CoreText font database
CoreText and CoreGraphics are available on iOS as stand-alone
frameworks, but on Mac OS X they are part of the ApplicationServices
umbrella framework.

Mac OS 10.8 actually introduced both as stand-alone frameworks,
but for simplicity we link to ApplicationServices, as there's
still symlinks from ApplicationServices to the real frameworks.

Change-Id: I7f7ef795629cc37da85857d5c42283754acc4474
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 23:54:56 +01:00
Paul Olav Tvete
01292ac849 Make -force-debug-info option work
Should be applied to Qt modules. Not interesting for third party
users.

Change-Id: I8fce821af397e3ace011a426c762319f6d30004f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2013-02-27 23:06:15 +01:00
Olivier Goffart
123ce761c0 QT_MESSAGE_OUTPUT: add support for condition depending on the type
The motivation is to enable coloration the way KDE currently does.
It can now  be achieved with a QT_MESSAGE_OUTPUT set to
"%{appname}(%{category}) \033[31m%{if-debug}\033[34m%{endif}%{function}\033[0m: %{message}"

I was thinking about supporting directly color using something like
%{begin-category-color} that would be smart and detect if we are running
on a terminal, but it would be less flexible in the way the colors van
be configured.

Changelog: QT_MESSAGE_OUTPUT can contain conditionals based on the type
of the message

Change-Id: Icd8de04734a94a3afcbf542a5b78b290a1914960
Reviewed-by: David Faure (KDE) <faure@kde.org>
2013-02-27 22:29:43 +01:00
Israel Lins
70bb34ccd5 ODBC: implementation of lastInsertId()
Implemented lastInsertId() for some ODBC compatible databases.

Change-Id: I0b75a8e68369af39e258e4761b384767ab8a371e
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2013-02-27 22:01:17 +01:00
Friedemann Kleint
e265a1a4bd Disable maximize button for fixed-size windows.
Task-number: QTBUG-28407

Change-Id: I5bab7fcf4ad3ecc7008ef02b9d3575d75893895d
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2013-02-27 20:17:25 +01:00
Friedemann Kleint
7867f03f8a Stabilize tst_qprogressbar.
- Wait for shown to ensure events are processed.
- Move away from screen corners/potential task bar areas.

Change-Id: I2c3aa9b675c6b33ca0da67ee99cc6f76c502098a
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2013-02-27 20:17:19 +01:00
BogDan Vatra
afaa6e42f0 Export QAbstractFileEngine[XXXX] classes.
We still need them for Android assets implementation.

Change-Id: I12bb809c05ac88f3c4a7d6796692b4dc3987027c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2013-02-27 18:02:50 +01:00
Paul Olav Tvete
023644cae1 Style fixes for android enablers
Change-Id: I0b942865c29f4bdf29f0e7f56af0d620acbc39c6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2013-02-27 18:02:34 +01:00
Paul Olav Tvete
1199136bd3 Fix test script
This script was completely broken, and seems to have been abandoned.

Change-Id: If307f001237609ccb054c0a469213290294161c9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2013-02-27 18:02:22 +01:00
BogDan Vatra
d88ec35b11 Fix compile on Android
This is a workaround for a broken compiler

Change-Id: I10c8c750caf56036419807ec4a2439bf14cf64d6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2013-02-27 18:02:10 +01:00
Paul Olav Tvete
660a615a37 Update the display to reflect changes by input method
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>

Change-Id: If3804f2a514ba4635f841de6377f2b328a4e928a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2013-02-27 18:01:56 +01:00
Gabriel de Dietrich
48d39a01a7 Cocoa: Remove qt_mac_toCGImage warnings
We got these because we were flushing the backing store with a
null QImage.

Change-Id: I372cb3fc7c82d3bdcfe735fcadfa72806d0ef39b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-02-27 17:50:57 +01:00
David Faure
e433553c1b tst_qfile: remove unused variable
Change-Id: I3c827b8a372158815cf234a548a85cf6165c189e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-02-27 16:00:08 +01:00
David Faure
2cb2a2e29e Add ISO 8859-11 as an alias for TIS-620
(qsimplecodec.cpp says so, but is unused when ICU is used)

ISO 8859-16 is still missing though...

Change-Id: Idbccedd7bad63f9788cec2f7fc1bbfcb7a891acc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-02-27 16:00:02 +01:00
Richard Moe Gustavsen
f6dc54ded4 iOS: network should not link against CoreServices on iOS
Change-Id: Ia3e21a3d73f696f0e77c427bdb263333646c48d3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-02-27 13:07:25 +01:00
Tor Arne Vestbø
8716c42ee2 iOS: Add missing QuartzCore dependency to platform plugin
Change-Id: Ic69a5a7faa9b7f9907d0325260b6b6e2389a4c3a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-02-27 13:07:25 +01:00
Tor Arne Vestbø
cb25d67f01 iOS: Don't link ios platform plugin to Cocoa
Change-Id: I2348b19617d3e342cd344bf7d0fa894118cbfae8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-02-27 13:07:24 +01:00
Tor Arne Vestbø
f2168f2688 iOS: Build platform plugin like other platform plugins
... by loading(qt_plugin)

Change-Id: I9be438b72be986a991a81c2cf1a3e5047bcf0a60
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-02-27 13:07:24 +01:00
Tor Arne Vestbø
e5111d5e02 iOS: Build ios platform plugin when appropriate
Defining QT_QPA_DEFAULT_PLATFORM_NAME in qplatformdefs.h is not
neccecary, as qconfig.h will already have this define written by
configure.

Change-Id: I89d9191533f6b4e6bfd5eade6cc0dced02b50f81
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-02-27 13:07:23 +01:00
Tor Arne Vestbø
a6286039ba iOS: Write default code signing identify for iOS in Xcode generator
Change-Id: Ic04da6063863585665c9133caba0279ba478fbb4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Ian Dean <ian@mediator-software.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-02-27 13:07:23 +01:00
Tor Arne Vestbø
5da648043d iOS: Target both iPhone and iPad by default
Change-Id: I3122b9391c6187da17389c889a456c58210dca09
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-02-27 13:07:23 +01:00