src/gui/kernel/qapplication.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/src/gui/kernel/qapplication.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/kernel/qapplication.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -121,8 +121,10 @@
 
 static void initResources()
 {
-#ifdef Q_WS_WINCE
+#if defined(Q_WS_WINCE)
     Q_INIT_RESOURCE(qstyle_wince);
+#elif defined(Q_OS_SYMBIAN)
+    Q_INIT_RESOURCE(qstyle_s60);
 #else
     Q_INIT_RESOURCE(qstyle);
 #endif
@@ -177,6 +179,7 @@
     directPainters = 0;
 #endif
 
+    gestureManager = 0;
     gestureWidget = 0;
 
     if (!self)
@@ -889,6 +892,14 @@
 {
     QWidgetPrivate::mapper = new QWidgetMapper;
     QWidgetPrivate::allWidgets = new QWidgetSet;
+
+#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) && !defined(Q_CC_NOKIAX86)
+    // initialize the graphics system - on X11 this is initialized inside
+    // qt_init() in qapplication_x11.cpp because of several reasons.
+    // On QWS, the graphics system is set by the QScreen plugin.
+    graphics_system = QGraphicsSystemFactory::create(graphics_system_name);
+#endif
+
     if (qt_appType != QApplication::Tty)
         (void) QApplication::style();  // trigger creation of application style
     // trigger registering of QVariant's GUI types
@@ -923,12 +934,13 @@
     // Set up which span functions should be used in raster engine...
     qInitDrawhelperAsm();
 
-#if !defined(Q_WS_X11) && !defined(Q_WS_QWS)
-    // initialize the graphics system - on X11 this is initialized inside
-    // qt_init() in qapplication_x11.cpp because of several reasons.
-    // On QWS, the graphics system is set by the QScreen plugin.
+#if defined(Q_CC_NOKIAX86)
+    // initialize the graphics system - For symbian emulator, we create graphics system here, since
+    // there is some unknown error launching the emulator with openVg when 
+    // graphics system is created before style instance.
     graphics_system = QGraphicsSystemFactory::create(graphics_system_name);
 #endif
+
 #ifndef QT_NO_WHEELEVENT
     QApplicationPrivate::wheel_scroll_lines = 3;
 #endif
@@ -3632,7 +3644,7 @@
     }
 
     // walk through parents and check for gestures
-    if (qt_gestureManager) {
+    if (d->gestureManager) {
         switch (e->type()) {
         case QEvent::Paint:
         case QEvent::MetaCall:
@@ -3664,13 +3676,13 @@
             break;
         default:
             if (receiver->isWidgetType()) {
-                if (qt_gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
+                if (d->gestureManager->filterEvent(static_cast<QWidget *>(receiver), e))
                     return true;
             } else {
                 // a special case for events that go to QGesture objects.
                 // We pass the object to the gesture manager and it'll figure
                 // out if it's QGesture or not.
-                if (qt_gestureManager->filterEvent(receiver, e))
+                if (d->gestureManager->filterEvent(receiver, e))
                     return true;
             }
         }
@@ -5230,6 +5242,8 @@
 {
     Q_D(const QApplication);
     Q_UNUSED(d);// only static members being used.
+    if (QApplicationPrivate::is_app_closing)
+        return d->inputContext;
 #ifdef Q_WS_X11
     if (!X11)
         return 0;
@@ -5676,6 +5690,14 @@
     QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints);
 }
 
+QGestureManager* QGestureManager::instance()
+{
+    QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+    if (!qAppPriv->gestureManager)
+        qAppPriv->gestureManager = new QGestureManager(qApp);
+    return qAppPriv->gestureManager;
+}
+
 QT_END_NAMESPACE
 
 #include "moc_qapplication.cpp"