summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/doc/assistant.qdocconf4
-rw-r--r--tools/designer/src/components/formeditor/qdesigner_resource.cpp2
-rw-r--r--tools/designer/src/lib/shared/widgetfactory.cpp6
-rw-r--r--tools/qdoc3/doc/files/qt.qdocconf8
-rw-r--r--tools/qdoc3/test/assistant.qdocconf4
-rw-r--r--tools/qdoc3/test/designer.qdocconf4
-rw-r--r--tools/qdoc3/test/linguist.qdocconf4
-rw-r--r--tools/qdoc3/test/qdeclarative.qdocconf8
-rw-r--r--tools/qdoc3/test/qmake.qdocconf4
-rw-r--r--tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf8
-rw-r--r--tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf8
-rw-r--r--tools/qdoc3/test/qt-project.qdocconf10
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp49
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h36
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.cpp60
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.h7
16 files changed, 145 insertions, 77 deletions
diff --git a/tools/assistant/tools/assistant/doc/assistant.qdocconf b/tools/assistant/tools/assistant/doc/assistant.qdocconf
index 57abeae..45ad76a 100644
--- a/tools/assistant/tools/assistant/doc/assistant.qdocconf
+++ b/tools/assistant/tools/assistant/doc/assistant.qdocconf
@@ -10,7 +10,7 @@ description = "Qt Assistant"
HTML.{postheader,address} = ""
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
- "<td width=\"30%\" align=\"left\">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; 2011 Nokia Corporation and/or its subsidiary(-ies)</td>\n" \
"<td width=\"40%\" align=\"center\">Trademarks</td>\n" \
- "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.7.2</div></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">Qt 4.7.4</div></td>\n" \
"</tr></table></div></address>"
diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
index 430b070..6d718bb 100644
--- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -1190,7 +1190,7 @@ QWidget *QDesignerResource::createWidget(const QString &widgetName, QWidget *par
parentWidget->setProperty("_q_widgetOrder", qVariantFromValue(list));
QList<QWidget *> zOrder = qVariantValue<QWidgetList>(parentWidget->property("_q_zOrder"));
zOrder.append(w);
- parentWidget->setProperty("_q_zOrder", qVariantFromValue(list));
+ parentWidget->setProperty("_q_zOrder", qVariantFromValue(zOrder));
}
} else {
core()->metaDataBase()->add(w);
diff --git a/tools/designer/src/lib/shared/widgetfactory.cpp b/tools/designer/src/lib/shared/widgetfactory.cpp
index 887bb04..36f795e 100644
--- a/tools/designer/src/lib/shared/widgetfactory.cpp
+++ b/tools/designer/src/lib/shared/widgetfactory.cpp
@@ -412,8 +412,10 @@ QWidget *WidgetFactory::createWidget(const QString &widgetName, QWidget *parentW
// Currently happens in the case of Q3-Support widgets
baseClass =fallBackBaseClass;
}
- w = createWidget(baseClass, parentWidget);
- promoteWidget(core(),w,widgetName);
+ if (QWidget *promotedWidget = createWidget(baseClass, parentWidget)) {
+ promoteWidget(core(), promotedWidget, widgetName);
+ return promotedWidget; // Do not initialize twice.
+ }
} while (false);
Q_ASSERT(w != 0);
diff --git a/tools/qdoc3/doc/files/qt.qdocconf b/tools/qdoc3/doc/files/qt.qdocconf
index 44cfbc1..377f0f1 100644
--- a/tools/qdoc3/doc/files/qt.qdocconf
+++ b/tools/qdoc3/doc/files/qt.qdocconf
@@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api
qhp.projects = Qt
qhp.Qt.file = qt.qhp
-qhp.Qt.namespace = com.trolltech.qt.472
+qhp.Qt.namespace = com.trolltech.qt.474
qhp.Qt.virtualFolder = qdoc
qhp.Qt.indexTitle = Qt Reference Documentation
qhp.Qt.indexRoot =
@@ -36,9 +36,9 @@ qhp.Qt.extraFiles = classic.css \
images/dynamiclayouts-example.png \
images/stylesheet-coffee-plastique.png
-qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc
-qhp.Qt.customFilters.Qt.name = Qt 4.7.2
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qt.filterAttributes = qt 4.7.4 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.7.4
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.4
qhp.Qt.subprojects = classes overviews examples
qhp.Qt.subprojects.classes.title = Classes
qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf
index 0e9a2a8..4141a03 100644
--- a/tools/qdoc3/test/assistant.qdocconf
+++ b/tools/qdoc3/test/assistant.qdocconf
@@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Assistant
qhp.Assistant.file = assistant.qhp
-qhp.Assistant.namespace = com.trolltech.assistant.472
+qhp.Assistant.namespace = com.trolltech.assistant.474
qhp.Assistant.virtualFolder = qdoc
qhp.Assistant.indexTitle = Qt Assistant Manual
qhp.Assistant.extraFiles = images/bg_l.png \
@@ -50,7 +50,7 @@ qhp.Assistant.extraFiles = images/bg_l.png \
style/style_ie8.css \
style/style.css
-qhp.Assistant.filterAttributes = qt 4.7.2 tools assistant
+qhp.Assistant.filterAttributes = qt 4.7.4 tools assistant
qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual
qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant
qhp.Assistant.subprojects = manual examples
diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf
index 637399b..6c98ddf 100644
--- a/tools/qdoc3/test/designer.qdocconf
+++ b/tools/qdoc3/test/designer.qdocconf
@@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Designer
qhp.Designer.file = designer.qhp
-qhp.Designer.namespace = com.trolltech.designer.472
+qhp.Designer.namespace = com.trolltech.designer.474
qhp.Designer.virtualFolder = qdoc
qhp.Designer.indexTitle = Qt Designer Manual
qhp.Designer.extraFiles = images/bg_l.png \
@@ -50,7 +50,7 @@ qhp.Designer.extraFiles = images/bg_l.png \
style/style_ie8.css \
style/style.css
-qhp.Designer.filterAttributes = qt 4.7.2 tools designer
+qhp.Designer.filterAttributes = qt 4.7.4 tools designer
qhp.Designer.customFilters.Designer.name = Qt Designer Manual
qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer
qhp.Designer.subprojects = manual examples
diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf
index 8ee298e..c9d6751 100644
--- a/tools/qdoc3/test/linguist.qdocconf
+++ b/tools/qdoc3/test/linguist.qdocconf
@@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Linguist
qhp.Linguist.file = linguist.qhp
-qhp.Linguist.namespace = com.trolltech.linguist.472
+qhp.Linguist.namespace = com.trolltech.linguist.474
qhp.Linguist.virtualFolder = qdoc
qhp.Linguist.indexTitle = Qt Linguist Manual
qhp.Linguist.extraFiles = images/bg_l.png \
@@ -50,7 +50,7 @@ qhp.Linguist.extraFiles = images/bg_l.png \
style/style_ie8.css \
style/style.css
-qhp.Linguist.filterAttributes = qt 4.7.2 tools linguist
+qhp.Linguist.filterAttributes = qt 4.7.4 tools linguist
qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual
qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist
qhp.Linguist.subprojects = manual examples
diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf
index e68a935..8fe9034 100644
--- a/tools/qdoc3/test/qdeclarative.qdocconf
+++ b/tools/qdoc3/test/qdeclarative.qdocconf
@@ -21,7 +21,7 @@ edition.DesktopLight.groups = -graphicsview-api
qhp.projects = Qml
qhp.Qml.file = qml.qhp
-qhp.Qml.namespace = com.trolltech.qml.472
+qhp.Qml.namespace = com.trolltech.qml.474
qhp.Qml.virtualFolder = qdoc
qhp.Qml.indexTitle = Qml Reference
@@ -61,9 +61,9 @@ qhp.Qml.extraFiles = images/bg_l.png \
style/style_ie8.css \
style/style.css
-qhp.Qml.filterAttributes = qt 4.7.2 qtrefdoc
-qhp.Qml.customFilters.Qt.name = Qt 4.7.2
-qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qml.filterAttributes = qt 4.7.4 qtrefdoc
+qhp.Qml.customFilters.Qt.name = Qt 4.7.4
+qhp.Qml.customFilters.Qt.filterAttributes = qt 4.7.4
qhp.Qml.subprojects = classes
qhp.Qml.subprojects.classes.title = Elements
qhp.Qml.subprojects.classes.indexTitle = Qml Elements
diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf
index b5bc96c..c5a0f40 100644
--- a/tools/qdoc3/test/qmake.qdocconf
+++ b/tools/qdoc3/test/qmake.qdocconf
@@ -13,7 +13,7 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = qmake
qhp.qmake.file = qmake.qhp
-qhp.qmake.namespace = com.trolltech.qmake.472
+qhp.qmake.namespace = com.trolltech.qmake.474
qhp.qmake.virtualFolder = qdoc
qhp.qmake.indexTitle = QMake Manual
qhp.qmake.extraFiles = images/bg_l.png \
@@ -50,7 +50,7 @@ qhp.qmake.extraFiles = images/bg_l.png \
style/style_ie8.css \
style/style.css
-qhp.qmake.filterAttributes = qt 4.7.2 tools qmake
+qhp.qmake.filterAttributes = qt 4.7.4 tools qmake
qhp.qmake.customFilters.qmake.name = qmake Manual
qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake
qhp.qmake.subprojects = manual
diff --git a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf
index 24696d5..ef3f78b 100644
--- a/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf
+++ b/tools/qdoc3/test/qt-build-docs_ja_JP.qdocconf
@@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Qt
qhp.Qt.file = qt.qhp
-qhp.Qt.namespace = com.trolltech.qt.472
+qhp.Qt.namespace = com.trolltech.qt.474
qhp.Qt.virtualFolder = qdoc
qhp.Qt.title = Qt
qhp.Qt.indexTitle = Qt
qhp.Qt.selectors = fake:example
-qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc ja_JP
-qhp.Qt.customFilters.Qt.name = Qt 4.7.2
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qt.filterAttributes = qt 4.7.4 qtrefdoc ja_JP
+qhp.Qt.customFilters.Qt.name = Qt 4.7.4
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.4
# Files not referenced in any qdoc file (last four are needed by qtdemo)
# See also extraimages.HTML
diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf
index 7789bf7..3eef92c 100644
--- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf
+++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf
@@ -17,15 +17,15 @@ indexes = $QT_BUILD_TREE/doc-build/html-qt/qt.index
qhp.projects = Qt
qhp.Qt.file = qt.qhp
-qhp.Qt.namespace = com.trolltech.qt.472
+qhp.Qt.namespace = com.trolltech.qt.474
qhp.Qt.virtualFolder = qdoc
qhp.Qt.title = 教程
qhp.Qt.indexTitle = 教程
qhp.Qt.selectors = fake:example
-qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc zh_CN
-qhp.Qt.customFilters.Qt.name = Qt 4.7.2
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qt.filterAttributes = qt 4.7.4 qtrefdoc zh_CN
+qhp.Qt.customFilters.Qt.name = Qt 4.7.4
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.4
# Files not referenced in any qdoc file (last four are needed by qtdemo)
# See also extraimages.HTML
diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf
index 3ed7cff..3091cf8 100644
--- a/tools/qdoc3/test/qt-project.qdocconf
+++ b/tools/qdoc3/test/qt-project.qdocconf
@@ -6,7 +6,7 @@ include(qt-defines.qdocconf)
project = Qt
description = Qt Reference Documentation
url = http://qt.nokia.com/doc/4.7
-version = 4.7.2
+version = 4.7.3
sourceencoding = UTF-8
outputencoding = UTF-8
@@ -15,14 +15,14 @@ naturallanguage = en_US
qhp.projects = Qt
qhp.Qt.file = qt.qhp
-qhp.Qt.namespace = com.trolltech.qt.472
+qhp.Qt.namespace = com.trolltech.qt.474
qhp.Qt.virtualFolder = qdoc
qhp.Qt.indexTitle = Qt Reference Documentation
qhp.Qt.indexRoot =
-qhp.Qt.filterAttributes = qt 4.7.2 qtrefdoc
-qhp.Qt.customFilters.Qt.name = Qt 4.7.2
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.2
+qhp.Qt.filterAttributes = qt 4.7.4 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.7.4
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.4
qhp.Qt.subprojects = classes overviews examples
qhp.Qt.subprojects.classes.title = Classes
qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
index ac32995..6778bd5 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
@@ -47,7 +47,6 @@
#include <private/qpixmap_raster_p.h>
#include <private/qwindowsurface_gl_p.h>
#include "qmeegoruntime.h"
-#include "qmeegoswitchevent.h"
QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName()
{
@@ -77,46 +76,12 @@ bool QMeeGoGraphicsSystemHelper::isRunningRuntime()
void QMeeGoGraphicsSystemHelper::switchToMeeGo()
{
- if (isRunningMeeGo())
- return;
-
- if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
- qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system.");
- else {
- QMeeGoSwitchEvent willSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::WillSwitch);
- foreach (QWidget *widget, QApplication::topLevelWidgets())
- QCoreApplication::sendEvent(widget, &willSwitchEvent);
-
- QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
- app->setGraphicsSystem(QLatin1String("meego"));
-
- QMeeGoSwitchEvent didSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::DidSwitch);
- foreach (QWidget *widget, QApplication::topLevelWidgets())
- QCoreApplication::sendEvent(widget, &didSwitchEvent);
- }
+ QMeeGoRuntime::switchToMeeGo();
}
void QMeeGoGraphicsSystemHelper::switchToRaster()
{
- if (runningGraphicsSystemName() == QLatin1String("raster"))
- return;
-
- if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
- qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system.");
- else {
- QMeeGoSwitchEvent willSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::WillSwitch);
- foreach (QWidget *widget, QApplication::topLevelWidgets())
- QCoreApplication::sendEvent(widget, &willSwitchEvent);
-
- QApplication *app = static_cast<QApplication *>(QCoreApplication::instance());
- app->setGraphicsSystem(QLatin1String("raster"));
-
- QMeeGoRuntime::invalidateLiveSurfaces();
-
- QMeeGoSwitchEvent didSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::DidSwitch);
- foreach (QWidget *widget, QApplication::topLevelWidgets())
- QCoreApplication::sendEvent(widget, &didSwitchEvent);
- }
+ QMeeGoRuntime::switchToRaster();
}
Qt::HANDLE QMeeGoGraphicsSystemHelper::imageToEGLSharedImage(const QImage &image)
@@ -170,3 +135,13 @@ void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode)
else if (mode == KillSwap)
QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap;
}
+
+void QMeeGoGraphicsSystemHelper::setSwitchPolicy(SwitchPolicy policy)
+{
+ QMeeGoRuntime::setSwitchPolicy(policy);
+}
+
+void QMeeGoGraphicsSystemHelper::enableSwitchEvents()
+{
+ QMeeGoRuntime::enableSwitchEvents();
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
index 5a3b57e..4612190 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
@@ -97,14 +97,22 @@ public:
*/
static bool isRunningRuntime();
+ //! Enables the sending of QMeeGoSwitchEvent's when the graphicssystem switches.
+ /*!
+ An application that wishes to start receive QMeegoSwitchEvents must call this function.
+ */
+ static void enableSwitchEvents();
+
//! Switches to meego graphics system.
/*!
When running with the 'runtime' graphics system, sets the currently active
system to 'meego'. The window surface and all the resources are automatically
migrated to OpenGL. Will fail if the active graphics system is not 'runtime'.
Calling this function will emit QMeeGoSwitchEvent to the top level widgets.
- Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch)
- and one after the switch (QMeeGoSwitchEvent::DidSwitch).
+ If switch events are enabled, two events will be emitted for each switch --
+ one before the switch (QMeeGoSwitchEvent::WillSwitch) and one after the
+ switch (QMeeGoSwitchEvent::DidSwitch).
+ If the switch policy is set to NoSwitch, this function has no effect.
*/
static void switchToMeeGo();
@@ -114,12 +122,30 @@ public:
system to 'raster'. The window surface and the graphics resources (including the
EGL shared image resources) are automatically migrated back to the CPU. All OpenGL
resources (surface, context, cache, font cache) are automaticall anihilated.
- Calling this function will emit QMeeGoSwitchEvent to the top level widgets.
- Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch)
- and one after the switch (QMeeGoSwitchEvent::DidSwitch).
+ Calling this function will emit QMeeGoSwitchEvent to the top level widgets. If switch
+ events are enabled, two events will be emitted for each switch -- one before the
+ switch (QMeeGoSwitchEvent::WillSwitch) and one after the switch (QMeeGoSwitchEvent::DidSwitch).
+ If the switch policy is set to NoSwitch, this function has no effect.
*/
static void switchToRaster();
+ //! Used to specify the policy for graphics system switching.
+ enum SwitchPolicy {
+ AutomaticSwitch, /**< Automatic switching */
+ ManualSwitch, /**< Switching is controleld by the application */
+ NoSwitch /**< Switching is disabled completely */
+ };
+
+ //! Sets the policy of graphicssystem switching
+ /*!
+ By default, the switch to raster happens automatically when all windows are either
+ minimized or when the last window is destroyed. This function lets the application
+ change the graphicssystem switching policy to prevent the switching from happening
+ automatically (that is if the application doesn't want switching at all or wishes
+ to control the switching manually).
+ */
+ static void setSwitchPolicy(SwitchPolicy policy);
+
//! Returns the name of the active graphics system
/*!
Returns the name of the currently active system. If running with 'runtime' graphics
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
index 7c81d51..928d01a 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
@@ -41,6 +41,11 @@
#include "qmeegoruntime.h"
+#include "qmeegoswitchevent.h"
+
+#include <QtGui/QApplication>
+#include <QtGui/QWidget>
+
#include <private/qlibrary_p.h>
#include <private/qfactoryloader_p.h>
#include <private/qgraphicssystemplugin_p.h>
@@ -49,6 +54,7 @@
#define ENSURE_INITIALIZED {if (!initialized) initialize();}
bool QMeeGoRuntime::initialized = false;
+bool QMeeGoRuntime::switchEventsEnabled = false;
typedef int (*QMeeGoImageToEglSharedImageFunc) (const QImage&);
typedef QPixmapData* (*QMeeGoPixmapDataFromEglSharedImageFunc) (Qt::HANDLE handle, const QImage&);
@@ -66,6 +72,10 @@ typedef Qt::HANDLE (*QMeeGoLiveTextureGetHandleFunc) (QPixmap*);
typedef void* (*QMeeGoCreateFenceSyncFunc) (void);
typedef void (*QMeeGoDestroyFenceSyncFunc) (void *fs);
typedef void (*QMeeGoInvalidateLiveSurfacesFunc) (void);
+typedef void (*QMeeGoSwitchToRasterFunc) (void);
+typedef void (*QMeeGoSwitchToMeeGoFunc) (void);
+typedef void (*QMeeGoRegisterSwitchCallbackFunc) (void (*callback)(int type, const char *name));
+typedef void (*QMeeGoSetSwitchPolicyFunc) (int policy);
static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL;
static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL;
@@ -83,6 +93,17 @@ static QMeeGoLiveTextureGetHandleFunc qt_meego_live_texture_get_handle = NULL;
static QMeeGoCreateFenceSyncFunc qt_meego_create_fence_sync = NULL;
static QMeeGoDestroyFenceSyncFunc qt_meego_destroy_fence_sync = NULL;
static QMeeGoInvalidateLiveSurfacesFunc qt_meego_invalidate_live_surfaces = NULL;
+static QMeeGoSwitchToRasterFunc qt_meego_switch_to_raster = NULL;
+static QMeeGoSwitchToMeeGoFunc qt_meego_switch_to_meego = NULL;
+static QMeeGoRegisterSwitchCallbackFunc qt_meego_register_switch_callback = NULL;
+static QMeeGoSetSwitchPolicyFunc qt_meego_set_switch_policy = NULL;
+
+extern "C" void handleSwitch(int type, const char *name)
+{
+ QMeeGoSwitchEvent switchEvent((QLatin1String(name)), QMeeGoSwitchEvent::State(type));
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ QCoreApplication::sendEvent(widget, &switchEvent);
+}
void QMeeGoRuntime::initialize()
{
@@ -112,13 +133,19 @@ void QMeeGoRuntime::initialize()
qt_meego_create_fence_sync = (QMeeGoCreateFenceSyncFunc) library.resolve("qt_meego_create_fence_sync");
qt_meego_destroy_fence_sync = (QMeeGoDestroyFenceSyncFunc) library.resolve("qt_meego_destroy_fence_sync");
qt_meego_invalidate_live_surfaces = (QMeeGoInvalidateLiveSurfacesFunc) library.resolve("qt_meego_invalidate_live_surfaces");
+ qt_meego_switch_to_raster = (QMeeGoSwitchToRasterFunc) library.resolve("qt_meego_switch_to_raster");
+ qt_meego_switch_to_meego = (QMeeGoSwitchToMeeGoFunc) library.resolve("qt_meego_switch_to_meego");
+ qt_meego_register_switch_callback = (QMeeGoRegisterSwitchCallbackFunc) library.resolve("qt_meego_register_switch_callback");
+ qt_meego_set_switch_policy = (QMeeGoSetSwitchPolicyFunc) library.resolve("qt_meego_set_switch_policy");
if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image &&
qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap &&
qt_meego_set_surface_fixed_size && qt_meego_set_surface_scaling && qt_meego_set_translucent &&
qt_meego_pixmapdata_with_new_live_texture && qt_meego_pixmapdata_from_live_texture_handle &&
qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle &&
- qt_meego_create_fence_sync && qt_meego_destroy_fence_sync && qt_meego_invalidate_live_surfaces)
+ qt_meego_create_fence_sync && qt_meego_destroy_fence_sync && qt_meego_invalidate_live_surfaces &&
+ qt_meego_switch_to_raster && qt_meego_switch_to_meego && qt_meego_register_switch_callback &&
+ qt_meego_set_switch_policy)
{
qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion));
} else {
@@ -242,3 +269,34 @@ void QMeeGoRuntime::invalidateLiveSurfaces()
Q_ASSERT(qt_meego_invalidate_live_surfaces);
qt_meego_invalidate_live_surfaces();
}
+
+void QMeeGoRuntime::switchToRaster()
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_switch_to_raster);
+ qt_meego_switch_to_raster();
+}
+
+void QMeeGoRuntime::switchToMeeGo()
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_switch_to_meego);
+ qt_meego_switch_to_meego();
+}
+
+void QMeeGoRuntime::enableSwitchEvents()
+{
+ ENSURE_INITIALIZED;
+ if (!switchEventsEnabled) {
+ Q_ASSERT(qt_meego_register_switch_callback);
+ qt_meego_register_switch_callback(handleSwitch);
+ switchEventsEnabled = true;
+ }
+}
+
+void QMeeGoRuntime::setSwitchPolicy(QMeeGoGraphicsSystemHelper::SwitchPolicy policy)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_set_switch_policy);
+ qt_meego_set_switch_policy(int(policy));
+}
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h
index b91efae..b898699 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.h
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h
@@ -42,6 +42,8 @@
#include <QPixmap>
#include <QImage>
+#include "qmeegographicssystemhelper.h"
+
class QMeeGoRuntime
{
public:
@@ -63,7 +65,12 @@ public:
static void* createFenceSync();
static void destroyFenceSync(void *fs);
static void invalidateLiveSurfaces();
+ static void switchToRaster();
+ static void switchToMeeGo();
+ static void enableSwitchEvents();
+ static void setSwitchPolicy(QMeeGoGraphicsSystemHelper::SwitchPolicy policy);
private:
static bool initialized;
+ static bool switchEventsEnabled;
};