summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-10-08 10:33:42 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-10-08 10:33:42 (GMT)
commite086a153c25d3bd5d58d72c34384d8452cb3b3be (patch)
tree1ec8e8bfa3fc3a99b1285cc863e61ec65a97ee48 /tools
parenta780773292c3a59e1500f5e36c3de729a8f45f1c (diff)
parent392ecc76cdbcef37ee492400a1b783106a37ad36 (diff)
downloadQt-e086a153c25d3bd5d58d72c34384d8452cb3b3be.zip
Qt-e086a153c25d3bd5d58d72c34384d8452cb3b3be.tar.gz
Qt-e086a153c25d3bd5d58d72c34384d8452cb3b3be.tar.bz2
Merge remote branch 'qt/master' into earth/file-engine-refactor
Conflicts: src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtGuiu.def
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/plugins/plugins.pro2
-rw-r--r--tools/qdoc3/test/qt-html-templates.qdocconf40
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp9
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h7
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro4
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoliveimage.cpp115
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoliveimage.h106
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoliveimage_p.h63
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp150
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.h35
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h11
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.cpp92
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.h11
-rw-r--r--tools/qml/deviceorientation_harmattan.cpp161
-rw-r--r--tools/qml/qml.pri5
-rw-r--r--tools/qtconfig/paletteeditoradvanced.cpp1
16 files changed, 373 insertions, 439 deletions
diff --git a/tools/designer/src/plugins/plugins.pro b/tools/designer/src/plugins/plugins.pro
index cf4fa8a..bcebb82 100644
--- a/tools/designer/src/plugins/plugins.pro
+++ b/tools/designer/src/plugins/plugins.pro
@@ -3,7 +3,7 @@ CONFIG += ordered
REQUIRES = !CONFIG(static,shared|static)
contains(QT_CONFIG, qt3support): SUBDIRS += widgets
-win32:!contains(QT_EDITION, OpenSource):SUBDIRS += activeqt
+win32: SUBDIRS += activeqt
# contains(QT_CONFIG, opengl): SUBDIRS += tools/view3d
contains(QT_CONFIG, webkit): SUBDIRS += qwebview
contains(QT_CONFIG, phonon): SUBDIRS += phononwidgets
diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf
index af4bfe3..58cee4f 100644
--- a/tools/qdoc3/test/qt-html-templates.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates.qdocconf
@@ -26,37 +26,6 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
" </a></li>\n" \
" </ul>\n" \
" </div>\n" \
- " <ul class=\"sf-menu sf-js-enabled sf-shadow\" id=\"narrowmenu\"> \n" \
- " <li><a href=\"#\">API Lookup</a> \n" \
- " <ul id=\"topmenuLook\"> \n" \
- " <li><a href=\"classes.html\">Class index</a></li> \n" \
- " <li><a href=\"functions.html\">Function index</a></li> \n" \
- " <li><a href=\"modules.html\">Modules</a></li> \n" \
- " <li><a href=\"namespaces.html\">Namespaces</a></li> \n" \
- " <li><a href=\"qtglobal.html\">Global Declarations</a></li> \n" \
- " <li><a href=\"licensing.html\">Licenses and Credits</a></li> \n" \
- " </ul> \n" \
- " </li> \n" \
- " <li><a href=\"#\">Qt Topics</a> \n" \
- " <ul id=\"topmenuTopic\"> \n" \
- " <li><a href=\"qt-basic-concepts.html\">Programming with Qt</a></li> \n" \
- " <li><a href=\"qtquick.html\">Device UIs &amp; Qt Quick</a></li> \n" \
- " <li><a href=\"qt-gui-concepts.html\">UI Design with Qt</a></li> \n" \
- " <li><a href=\"developing-with-qt.html\">Cross-platform and Platform-specific</a></li> \n" \
- " <li><a href=\"platform-specific.html\">Platform-specific info</a></li> \n" \
- " <li><a href=\"technology-apis.html\">Qt and Key Technologies</a></li> \n" \
- " <li><a href=\"best-practices.html\">How-To's and Best Practices</a></li> \n" \
- " </ul> \n" \
- " </li> \n" \
- " <li><a href=\"#\">Examples</a> \n" \
- " <ul id=\"topmenuexample\"> \n" \
- " <li><a href=\"all-examples.html\">Examples</a></li> \n" \
- " <li><a href=\"tutorials.html\">Tutorials</a></li> \n" \
- " <li><a href=\"demos.html\">Demos</a></li> \n" \
- " <li><a href=\"qdeclarativeexamples.html\">QML Examples</a></li> \n" \
- " </ul> \n" \
- " </li> \n" \
- " </ul> \n" \
" </div>\n" \
" </div>\n" \
" <div class=\"wrapper\">\n" \
@@ -71,6 +40,13 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
" <form id=\"qtdocsearch\" action=\"\" onsubmit=\"return false;\">\n" \
" <fieldset>\n" \
" <input type=\"text\" name=\"searchstring\" id=\"pageType\" value=\"\" />\n" \
+ " <div id=\"resultdialog\"> \n" \
+ " <a href=\"#\" id=\"resultclose\">Close</a> \n" \
+ " <p id=\"resultlinks\" class=\"all\"><a href=\"#\" id=\"showallresults\">All</a> | <a href=\"#\" id=\"showapiresults\">API</a> | <a href=\"#\" id=\"showarticleresults\">Articles</a> | <a href=\"#\" id=\"showexampleresults\">Examples</a></p> \n" \
+ " <p id=\"searchcount\" class=\"all\"><span id=\"resultcount\"></span><span id=\"apicount\"></span><span id=\"articlecount\"></span><span id=\"examplecount\"></span>&nbsp;results:</p> \n" \
+ " <ul id=\"resultlist\" class=\"all\"> \n" \
+ " </ul> \n" \
+ " </div> \n" \
" </fieldset>\n" \
" </form>\n" \
" </div>\n" \
@@ -135,7 +111,7 @@ HTML.postpostheader = " </ul>\n" \
" </ul>\n" \
" </div>\n" \
" </div>\n" \
- " <div class=\"content\">\n"
+ " <div class=\"content mainContent\">\n"
HTML.footer = "" \
" <div class=\"feedback t_button\">\n" \
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
index 0670ac4..d348e70 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
@@ -68,6 +68,11 @@ bool QMeeGoGraphicsSystemHelper::isRunningMeeGo()
return (runningGraphicsSystemName() == QLatin1String("meego"));
}
+bool QMeeGoGraphicsSystemHelper::isRunningRuntime()
+{
+ return (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime"));
+}
+
void QMeeGoGraphicsSystemHelper::switchToMeeGo()
{
if (isRunningMeeGo())
@@ -105,13 +110,13 @@ QPixmap QMeeGoGraphicsSystemHelper::pixmapFromEGLSharedImage(Qt::HANDLE handle,
// This function is supported when not running meego too. A raster-backed
// pixmap will be created... but when you switch back to 'meego', it'll
// be replaced with a EGL shared image backing.
- return QMeeGoRuntime::pixmapFromEGLSharedImage(handle, softImage);
+ return QPixmap(QMeeGoRuntime::pixmapDataFromEGLSharedImage(handle, softImage));
}
QPixmap QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(int w, int h)
{
ENSURE_RUNNING_MEEGO;
- return QMeeGoRuntime::pixmapWithGLTexture(w, h);
+ return QPixmap(QMeeGoRuntime::pixmapDataWithGLTexture(w, h));
}
bool QMeeGoGraphicsSystemHelper::destroyEGLSharedImage(Qt::HANDLE handle)
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
index 02f2fa2..2bb75eb 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
@@ -89,6 +89,13 @@ public:
switching is 'meego'.
*/
static bool isRunningMeeGo();
+
+ //! Returns true if running with a 'runtime' graphicssystem.
+ /*!
+ This function can be used in combination with ::runningGraphicsSystemName to figure out
+ the existing situation.
+ */
+ static bool isRunningRuntime();
//! Switches to meego graphics system.
/*!
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
index 1e6e233..4d69fac 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
@@ -6,5 +6,5 @@ include(../../src/qbase.pri)
QT += gui
INCLUDEPATH += '../../src/plugins/graphicssystems/meego'
-HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoliveimage.h qmeegoruntime.h qmeegoliveimage_p.h qmeegolivepixmap_p.h
-SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegoliveimage.cpp
+HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h
+SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp
diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp b/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp
deleted file mode 100644
index 83a1e28..0000000
--- a/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmeegoliveimage.h"
-#include "qmeegoliveimage_p.h"
-#include "qmeegolivepixmap.h"
-#include "qmeegolivepixmap_p.h"
-
-/* QMeeGoLiveImagePrivate */
-
-QMeeGoLiveImagePrivate::QMeeGoLiveImagePrivate()
-{
-}
-
-QMeeGoLiveImagePrivate::~QMeeGoLiveImagePrivate()
-{
- if (attachedPixmaps.length() > 0)
- qWarning("Destroying QMeeGoLiveImage but it still has QMeeGoLivePixmaps attached!");
-}
-
-void QMeeGoLiveImagePrivate::attachPixmap(QMeeGoLivePixmap* pixmap)
-{
- attachedPixmaps << pixmap;
-}
-
-void QMeeGoLiveImagePrivate::detachPixmap(QMeeGoLivePixmap* pixmap)
-{
- attachedPixmaps.removeAll(pixmap);
-}
-
-/* QMeeGoLiveImage */
-
-QMeeGoLiveImage* QMeeGoLiveImage::liveImageWithSize(int w, int h, Format format, int buffers)
-{
- if (format != Format_ARGB32_Premultiplied) {
- qWarning("Only _ARGB32_Premultiplied format is supported for live images now!");
- return 0;
- }
-
- if (buffers != 1) {
- qWarning("Only single-buffer streams are supported at the moment");
- return 0;
- }
-
- QMeeGoLiveImage *liveImage = new QMeeGoLiveImage(w, h);
- return liveImage;
-}
-
-QMeeGoLiveImage::QMeeGoLiveImage(int w, int h) : QImage(w, h, QImage::Format_ARGB32_Premultiplied), d_ptr(new QMeeGoLiveImagePrivate())
-{
- Q_D(QMeeGoLiveImage);
- d->q_ptr = this;
-}
-
-QMeeGoLiveImage::~QMeeGoLiveImage()
-{
-}
-
-void QMeeGoLiveImage::lock(int buffer)
-{
- if (buffer != 0)
- qWarning("Only locking 0 buffer is supported at the moment!");
-}
-
-void QMeeGoLiveImage::release(int buffer)
-{
- Q_D(QMeeGoLiveImage);
-
- if (buffer != 0) {
- qWarning("Only locking 0 buffer is supported at the moment!");
- return;
- }
-
- // We need to copy the update image to all the client QMeeGoLivePixmap's
- foreach (QMeeGoLivePixmap* livePixmap, d->attachedPixmaps)
- livePixmap->d_ptr->copyBackFrom((const void *) bits());
-}
diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage.h b/tools/qmeegographicssystemhelper/qmeegoliveimage.h
deleted file mode 100644
index 1e21e7b..0000000
--- a/tools/qmeegographicssystemhelper/qmeegoliveimage.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEEGOLIVEIMAGE_H
-#define QMEEGOLIVEIMAGE_H
-
-#include <QImage>
-
-class QMeeGoLivePixmap;
-class QMeeGoLiveImagePrivate;
-
-//! A streamable QImage subclass.
-/*!
-*/
-
-class QMeeGoLiveImage : public QImage
-{
-public:
- //! Format specifier.
- /*!
- Used to specify the format of the underlying image data for QMeeGoLiveImage.
- */
- enum Format {
- Format_ARGB32_Premultiplied //! 32bit, AARRGGBB format. The typical Qt format.
- };
-
- //! Locks the access to the image.
- /*!
- All drawing/access to the underlying image data needs to happen between
- ::lock() and ::unlock() pairs.
- */
- void lock(int buffer = 0);
-
- //! Unlocks the access to the image.
- /*!
- All drawing/access to the underlying image data needs to happen between
- ::lock() and ::unlock() pairs.
- */
- void release(int buffer = 0);
-
- //! Destroys the image.
- /*!
- It's a mistake to destroy an image before destroying all the QMeeGoLivePixmaps
- built on top of it. You should first destroy all the QMeeGoLivePixmaps.
- */
- virtual ~QMeeGoLiveImage();
-
- //! Creates and returns a new live image with the given parameters.
- /*!
- The new image is created with the given width w and the given height h.
- The format specifies the color format used by the image. Optionally, a
- number of buffers can be specfied for a stream-like behavior.
- */
- static QMeeGoLiveImage* liveImageWithSize(int w, int h, Format format, int buffers = 1);
-
-private:
- QMeeGoLiveImage(int w, int h); //! Private bits.
- Q_DISABLE_COPY(QMeeGoLiveImage)
- Q_DECLARE_PRIVATE(QMeeGoLiveImage)
-
-protected:
- QScopedPointer<QMeeGoLiveImagePrivate> d_ptr;
-
- friend class QMeeGoLivePixmap;
- friend class QMeeGoLivePixmapPrivate;
-};
-
-#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h b/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h
deleted file mode 100644
index 085fed4..0000000
--- a/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmeegoliveimage.h"
-
-#ifndef QMEEGOLIVEIMAGE_P_H
-#define QMEEGOLIVEIMAGE_P_H
-
-class QMeeGoLiveImagePrivate
-{
-public:
- Q_DECLARE_PUBLIC(QMeeGoLiveImage);
- QMeeGoLiveImagePrivate();
- virtual ~QMeeGoLiveImagePrivate();
- void attachPixmap(QMeeGoLivePixmap* pixmap);
- void detachPixmap(QMeeGoLivePixmap* pixmap);
-
- QList <QMeeGoLivePixmap*> attachedPixmaps;
- QMeeGoLiveImage *q_ptr;
-
- friend class QMeeGoLivePixmap;
- friend class QMeeGoLivePixmapPrivate;
-};
-
-#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
index 2a1c04b..b9dbb2b 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
@@ -43,121 +43,101 @@
#include <private/qimage_p.h>
#include <private/qpixmap_raster_p.h>
#include "qmeegolivepixmap_p.h"
-#include "qmeegoliveimage_p.h"
+#include "qmeegoruntime.h"
#include <QSharedMemory>
/* QMeeGoLivePixmapPrivate */
-QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate() : shm(0), shmSerial(0), owns(true), parentImage(0)
+QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate(Qt::HANDLE h) : handle(h)
{
}
-void QMeeGoLivePixmapPrivate::copyBackFrom(const void *raw)
+QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate()
{
- Q_Q(QMeeGoLivePixmap);
-
- q->detach();
- shm->lock();
- uchar *dest = ((uchar *) shm->data()) + (2 * sizeof(int));
- memcpy(dest, raw, q->width() * q->height() * 4);
- shm->unlock();
}
-QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate()
+/* QMeeGoLivePixmap */
+
+QMeeGoLivePixmap* QMeeGoLivePixmap::livePixmapWithSize(int w, int h, Format format)
{
- Q_Q(QMeeGoLivePixmap);
+ QImage::Format qtFormat;
+ if (format == Format_RGB16)
+ qtFormat = QImage::Format_RGB16;
+ else if (format == Format_ARGB32_Premultiplied)
+ qtFormat = QImage::Format_ARGB32_Premultiplied;
+ else {
+ qWarning("Unsupported live pixmap format!");
+ return 0;
+ }
- if (parentImage)
- parentImage->d_ptr->detachPixmap(q);
-
- if (shm)
- shm->detach();
-
- if (owns)
- delete shm;
-}
+ Qt::HANDLE liveTextureHandle = QMeeGoRuntime::createLiveTexture(w, h, qtFormat);
+ if (! liveTextureHandle) {
+ qWarning("Failed to create a live texture with given size!");
+ return NULL;
+ }
-/* QMeeGoLivePixmap */
+ return QMeeGoLivePixmap::fromHandle(liveTextureHandle);
+}
-QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate())
+QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p, Qt::HANDLE h) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate(h))
{
Q_D(QMeeGoLivePixmap);
d->q_ptr = this;
}
-QMeeGoLivePixmap* QMeeGoLivePixmap::fromLiveImage(QMeeGoLiveImage *liveImage)
+QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE liveTextureHandle)
{
- static int counter = 100;
- QSharedMemory *shm = NULL;
- uchar* imgData = NULL;
- int *header = NULL;
- int w = liveImage->width();
- int h = liveImage->height();
-
- counter++;
- shm = new QSharedMemory(QString(QLatin1String("QMeeGoLivePixmap%1")).arg(counter));
- shm->create((w * h * 4) + 2 * sizeof(int)); // +2 to store width & height
- shm->attach();
-
- imgData = ((uchar *) shm->data()) + (2 * sizeof(int));
- header = (int *) shm->data();
-
- header[0] = w;
- header[1] = h;
-
- QImage img(imgData, w, h, QImage::Format_ARGB32_Premultiplied);
-
- QPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType);
- pmd->fromImage(img, Qt::NoOpaqueDetection);
-
- QMeeGoLivePixmap *livePixmap = new QMeeGoLivePixmap(pmd);
- livePixmap->d_ptr->shm = shm;
- livePixmap->d_ptr->owns = true;
- livePixmap->d_ptr->shmSerial = counter;
- livePixmap->d_ptr->parentImage = liveImage;
-
- liveImage->d_ptr->attachPixmap(livePixmap);
+ Qt::HANDLE eglImage = QMeeGoRuntime::liveTextureToEGLImage(liveTextureHandle);
+ if (! eglImage) {
+ qWarning("Failed to bind the live texture as an egl image!");
+ return NULL;
+ }
- return livePixmap;
+ QPixmapData *pmd = QMeeGoRuntime::pixmapDataFromEGLImage(eglImage);
+ if (! pmd) {
+ qWarning("Failed to allocate a pixmap data from a given live texture egl image!");
+ return NULL;
+ }
+
+ return new QMeeGoLivePixmap(pmd, liveTextureHandle);
}
-QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE handle)
+Qt::HANDLE QMeeGoLivePixmap::handle()
{
- QSharedMemory *shm = NULL;
- int *header;
- int width;
- int height;
- uchar* imgData;
-
- shm = new QSharedMemory(QString(QLatin1String("QMeeGoLivePixmap%1")).arg(handle));
- shm->attach();
-
- shm->lock();
- header = (int *) shm->data();
- width = header[0];
- height = header[1];
- shm->unlock();
-
- imgData = ((uchar *) shm->data()) + (2 * sizeof(int));
- QImage img(imgData, width, height, QImage::Format_ARGB32_Premultiplied);
-
- QPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType);
- pmd->fromImage(img, Qt::NoOpaqueDetection);
-
- QMeeGoLivePixmap *livePixmap = new QMeeGoLivePixmap(pmd);
- livePixmap->d_ptr->shm = shm;
- livePixmap->d_ptr->owns = false;
- livePixmap->d_ptr->shmSerial = handle;
-
- return livePixmap;
+ Q_D(QMeeGoLivePixmap);
+ return d->handle;
}
QMeeGoLivePixmap::~QMeeGoLivePixmap()
{
}
-Qt::HANDLE QMeeGoLivePixmap::handle()
+QImage* QMeeGoLivePixmap::lock()
+{
+ Q_D(QMeeGoLivePixmap);
+
+ void *data = NULL;
+ int pitch = 0;
+
+ if (! QMeeGoRuntime::lockLiveTexture(d->handle)) {
+ qWarning("Failed to lock a live texture!");
+ return new QImage();
+ }
+
+ QMeeGoRuntime::queryLiveTexture(d->handle, &data, &pitch);
+ if (data == NULL || pitch == 0) {
+ qWarning("Failed to query the live texture!");
+ return new QImage();
+ }
+
+ // FIXME Bug here! FIX FIX FIX FIX FIX FIX
+ return new QImage((uchar *) data, width(), height(), QImage::Format_RGB16);
+}
+
+void QMeeGoLivePixmap::release(QImage *img)
{
Q_D(QMeeGoLivePixmap);
- return d->shmSerial;
+ // FIXME Make sure we're locked!
+ QMeeGoRuntime::unlockLiveTexture(d->handle);
+ delete img;
}
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
index 2fa9db2..12fe994 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
@@ -43,7 +43,6 @@
#define QMEEGOLIVEPIXMAP_H
#include <QPixmap>
-#include "qmeegoliveimage.h"
class QMeeGoLivePixmapPrivate;
class QSharedMemory;
@@ -56,13 +55,17 @@ class QImage;
class QMeeGoLivePixmap : public QPixmap
{
public:
- //! Creates new pixmap from the given QMeeGoLiveImage.
- /*!
- The created QMeeGoLivePixmap will be attached to the given QMeeGoLiveImage.
- Updates to the QMeeGoLiveImage will be represented on this newly created
- QMeeGoLivePixmap.
+ enum Format {
+ Format_RGB16, //! 16bit, 5-6-5 RGB format.
+ Format_ARGB32_Premultiplied //! 32bit, AARRGGBB format. The typical Qt format.
+ };
+
+ //! Creates and returns a new live pixmap with the given parameters.
+ /*!
+ The new pixmap is created with the given width w and the given height h.
+ The format specifies the color format used by the pixmap.
*/
- static QMeeGoLivePixmap* fromLiveImage(QMeeGoLiveImage *liveImage);
+ static QMeeGoLivePixmap* livePixmapWithSize(int w, int h, Format format);
//! Creates a new QMeeGoLivePixmap from the specified handle.
/*!
@@ -75,24 +78,30 @@ public:
The handle can be used to share QMeeGoLivePixmap cross-process.
*/
Qt::HANDLE handle();
+
+ //! Locks the access to the pixmap.
+ /*!
+ The returned image can be used for direct access.
+ */
+ QImage* lock();
+
+ //! Unlocks the access to the pixmap.
+ /*!
+ */
+ void release(QImage *img);
//! Destroys the QMeeGoLivePixmap.
/*!
- All QMeeGoLivePixmaps attached to a given QMeeGoLiveImage have to be destroyed
- before the QMeeGoLiveImage itself is destroyed.
*/
virtual ~QMeeGoLivePixmap();
private:
- QMeeGoLivePixmap(QPixmapData *p);
+ QMeeGoLivePixmap(QPixmapData *p, Qt::HANDLE h);
Q_DISABLE_COPY(QMeeGoLivePixmap)
Q_DECLARE_PRIVATE(QMeeGoLivePixmap)
protected:
QScopedPointer<QMeeGoLivePixmapPrivate> d_ptr; //! Private bits.
-
- friend class QMeeGoLiveImage;
- friend class QMeeGoLiveImagePrivate;
};
#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
index c2591dc..22347d6 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
@@ -48,19 +48,12 @@ class QMeeGoLivePixmapPrivate
{
public:
Q_DECLARE_PUBLIC(QMeeGoLivePixmap);
- QMeeGoLivePixmapPrivate();
- void copyBackFrom(const void *raw);
+ QMeeGoLivePixmapPrivate(Qt::HANDLE handle);
virtual ~QMeeGoLivePixmapPrivate();
- QSharedMemory *shm;
- int shmSerial;
- bool owns;
- QMeeGoLiveImage *parentImage;
+ Qt::HANDLE handle;
QMeeGoLivePixmap *q_ptr;
-
- friend class QMeeGoLiveImage;
- friend class QMeeGoLiveImagePrivate;
};
#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
index 70b5dc1..44f9f58 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
@@ -51,21 +51,36 @@ bool QMeeGoRuntime::initialized = false;
typedef int (*QMeeGoImageToEglSharedImageFunc) (const QImage&);
typedef QPixmapData* (*QMeeGoPixmapDataFromEglSharedImageFunc) (Qt::HANDLE handle, const QImage&);
+typedef QPixmapData* (*QMeeGoPixmapDataFromEglImageFunc) (Qt::HANDLE handle);
typedef QPixmapData* (*QMeeGoPixmapDataWithGLTextureFunc) (int w, int h);
typedef bool (*QMeeGoDestroyEGLSharedImageFunc) (Qt::HANDLE handle);
typedef void (*QMeeGoUpdateEglSharedImagePixmapFunc) (QPixmap*);
typedef void (*QMeeGoSetSurfaceFixedSizeFunc) (int w, int h);
typedef void (*QMeeGoSetSurfaceScalingFunc) (int x, int y, int w, int h);
typedef void (*QMeeGoSetTranslucentFunc) (bool translucent);
+typedef Qt::HANDLE (*QMeeGoLiveTextureCreateFunc) (int w, int h, QImage::Format format);
+typedef bool (*QMeeGoLiveTextureLockFunc) (Qt::HANDLE h);
+typedef bool (*QMeeGoLiveTextureUnlockFunc) (Qt::HANDLE h);
+typedef void (*QMeeGoLiveTextureDestroyFunc) (Qt::HANDLE h);
+typedef void (*QMeeGoLiveTextureQueryFunc) (Qt::HANDLE h, void **data, int *pitch);
+typedef Qt::HANDLE (*QMeeGoLiveTextureToEglImageFunc) (Qt::HANDLE h);
static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL;
static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL;
+static QMeeGoPixmapDataFromEglImageFunc qt_meego_pixmapdata_from_egl_image = NULL;
static QMeeGoPixmapDataWithGLTextureFunc qt_meego_pixmapdata_with_gl_texture = NULL;
static QMeeGoDestroyEGLSharedImageFunc qt_meego_destroy_egl_shared_image = NULL;
static QMeeGoUpdateEglSharedImagePixmapFunc qt_meego_update_egl_shared_image_pixmap = NULL;
static QMeeGoSetSurfaceFixedSizeFunc qt_meego_set_surface_fixed_size = NULL;
static QMeeGoSetSurfaceScalingFunc qt_meego_set_surface_scaling = NULL;
static QMeeGoSetTranslucentFunc qt_meego_set_translucent = NULL;
+static QMeeGoLiveTextureCreateFunc qt_meego_live_texture_create = NULL;
+static QMeeGoLiveTextureLockFunc qt_meego_live_texture_lock = NULL;
+static QMeeGoLiveTextureUnlockFunc qt_meego_live_texture_unlock = NULL;
+static QMeeGoLiveTextureDestroyFunc qt_meego_live_texture_destroy = NULL;
+static QMeeGoLiveTextureQueryFunc qt_meego_live_texture_query = NULL;
+static QMeeGoLiveTextureToEglImageFunc qt_meego_live_texture_to_egl_image = NULL;
+
void QMeeGoRuntime::initialize()
{
@@ -80,17 +95,26 @@ void QMeeGoRuntime::initialize()
if (success) {
qt_meego_image_to_egl_shared_image = (QMeeGoImageToEglSharedImageFunc) library.resolve("qt_meego_image_to_egl_shared_image");
- qt_meego_pixmapdata_from_egl_shared_image = (QMeeGoPixmapDataFromEglSharedImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_shared_image");
+ qt_meego_pixmapdata_from_egl_shared_image = (QMeeGoPixmapDataFromEglSharedImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_shared_image");
+ qt_meego_pixmapdata_from_egl_image = (QMeeGoPixmapDataFromEglImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_image");
qt_meego_pixmapdata_with_gl_texture = (QMeeGoPixmapDataWithGLTextureFunc) library.resolve("qt_meego_pixmapdata_with_gl_texture");
qt_meego_destroy_egl_shared_image = (QMeeGoDestroyEGLSharedImageFunc) library.resolve("qt_meego_destroy_egl_shared_image");
qt_meego_update_egl_shared_image_pixmap = (QMeeGoUpdateEglSharedImagePixmapFunc) library.resolve("qt_meego_update_egl_shared_image_pixmap");
qt_meego_set_surface_fixed_size = (QMeeGoSetSurfaceFixedSizeFunc) library.resolve("qt_meego_set_surface_fixed_size");
qt_meego_set_surface_scaling = (QMeeGoSetSurfaceScalingFunc) library.resolve("qt_meego_set_surface_scaling");
qt_meego_set_translucent = (QMeeGoSetTranslucentFunc) library.resolve("qt_meego_set_translucent");
-
- 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_live_texture_create = (QMeeGoLiveTextureCreateFunc) library.resolve("qt_meego_live_texture_create");
+ qt_meego_live_texture_lock = (QMeeGoLiveTextureLockFunc) library.resolve("qt_meego_live_texture_lock");
+ qt_meego_live_texture_unlock = (QMeeGoLiveTextureUnlockFunc) library.resolve("qt_meego_live_texture_unlock");
+ qt_meego_live_texture_destroy = (QMeeGoLiveTextureDestroyFunc) library.resolve("qt_meego_live_texture_destroy");
+ qt_meego_live_texture_query = (QMeeGoLiveTextureQueryFunc) library.resolve("qt_meego_live_texture_query");
+ qt_meego_live_texture_to_egl_image = (QMeeGoLiveTextureToEglImageFunc) library.resolve("qt_meego_live_texture_to_egl_image");
+
+ if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_from_egl_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_live_texture_create && qt_meego_live_texture_lock && qt_meego_live_texture_unlock &&
+ qt_meego_live_texture_destroy && qt_meego_live_texture_query && qt_meego_live_texture_to_egl_image)
{
qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion));
}
@@ -108,18 +132,25 @@ Qt::HANDLE QMeeGoRuntime::imageToEGLSharedImage(const QImage &image)
return qt_meego_image_to_egl_shared_image(image);
}
-QPixmap QMeeGoRuntime::pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
+QPixmapData* QMeeGoRuntime::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
{
ENSURE_INITIALIZED;
Q_ASSERT(qt_meego_pixmapdata_from_egl_shared_image);
- return QPixmap(qt_meego_pixmapdata_from_egl_shared_image(handle, softImage));
+ return qt_meego_pixmapdata_from_egl_shared_image(handle, softImage);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataFromEGLImage(Qt::HANDLE handle)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_pixmapdata_from_egl_image);
+ return qt_meego_pixmapdata_from_egl_image(handle);
}
-QPixmap QMeeGoRuntime::pixmapWithGLTexture(int w, int h)
+QPixmapData* QMeeGoRuntime::pixmapDataWithGLTexture(int w, int h)
{
ENSURE_INITIALIZED;
Q_ASSERT(qt_meego_pixmapdata_with_gl_texture);
- return QPixmap(qt_meego_pixmapdata_with_gl_texture(w, h));
+ return qt_meego_pixmapdata_with_gl_texture(w, h);
}
bool QMeeGoRuntime::destroyEGLSharedImage(Qt::HANDLE handle)
@@ -156,3 +187,46 @@ void QMeeGoRuntime::setTranslucent(bool translucent)
Q_ASSERT(qt_meego_set_translucent);
qt_meego_set_translucent(translucent);
}
+
+Qt::HANDLE QMeeGoRuntime::createLiveTexture(int w, int h, QImage::Format format)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_create);
+ return qt_meego_live_texture_create(w, h, format);
+}
+
+bool QMeeGoRuntime::lockLiveTexture(Qt::HANDLE h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_lock);
+ return qt_meego_live_texture_lock(h);
+}
+
+bool QMeeGoRuntime::unlockLiveTexture(Qt::HANDLE h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_unlock);
+ return qt_meego_live_texture_unlock(h);
+}
+
+void QMeeGoRuntime::destroyLiveTexture(Qt::HANDLE h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_destroy);
+ qt_meego_live_texture_destroy(h);
+}
+
+void QMeeGoRuntime::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_query);
+ qt_meego_live_texture_query(h, data, pitch);
+}
+
+Qt::HANDLE QMeeGoRuntime::liveTextureToEGLImage(Qt::HANDLE handle)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_to_egl_image);
+ return qt_meego_live_texture_to_egl_image(handle);
+}
+
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h
index 82fdb52..048b9be 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.h
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h
@@ -48,13 +48,20 @@ public:
static void initialize();
static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
- static QPixmap pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
- static QPixmap pixmapWithGLTexture(int w, int h);
+ static QPixmapData* pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+ static QPixmapData* pixmapDataFromEGLImage(Qt::HANDLE handle);
+ static QPixmapData* pixmapDataWithGLTexture(int w, int h);
static bool destroyEGLSharedImage(Qt::HANDLE handle);
static void updateEGLSharedImagePixmap(QPixmap *p);
static void setSurfaceFixedSize(int w, int h);
static void setSurfaceScaling(int x, int y, int w, int h);
static void setTranslucent(bool translucent);
+ static Qt::HANDLE createLiveTexture(int w, int h, QImage::Format format);
+ static bool lockLiveTexture(Qt::HANDLE h);
+ static bool unlockLiveTexture(Qt::HANDLE h);
+ static void destroyLiveTexture(Qt::HANDLE h);
+ static void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch);
+ static Qt::HANDLE liveTextureToEGLImage(Qt::HANDLE);
private:
static bool initialized;
diff --git a/tools/qml/deviceorientation_harmattan.cpp b/tools/qml/deviceorientation_harmattan.cpp
new file mode 100644
index 0000000..22f9f4c
--- /dev/null
+++ b/tools/qml/deviceorientation_harmattan.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deviceorientation.h"
+#include <QtDBus>
+#include <QDebug>
+
+#define ORIENTATION_SERVICE "com.nokia.SensorService"
+#define ORIENTATION_PATH "/org/maemo/contextkit/Screen/TopEdge"
+#define CONTEXT_INTERFACE "org.maemo.contextkit.Property"
+#define CONTEXT_CHANGED "ValueChanged"
+#define CONTEXT_SUBSCRIBE "Subscribe"
+#define CONTEXT_UNSUBSCRIBE "Unsubscribe"
+#define CONTEXT_GET "Get"
+
+
+class HarmattanOrientation : public DeviceOrientation
+{
+ Q_OBJECT
+public:
+ HarmattanOrientation()
+ : o(UnknownOrientation), sensorEnabled(false)
+ {
+ resumeListening();
+ // connect to the orientation change signal
+ bool ok = QDBusConnection::systemBus().connect(ORIENTATION_SERVICE, ORIENTATION_PATH,
+ CONTEXT_INTERFACE,
+ CONTEXT_CHANGED,
+ this,
+ SLOT(deviceOrientationChanged(QList<QVariant>,quint64)));
+// qDebug() << "connection OK" << ok;
+ QDBusMessage reply = QDBusConnection::systemBus().call(
+ QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+ CONTEXT_INTERFACE, CONTEXT_GET));
+ if (reply.type() != QDBusMessage::ErrorMessage) {
+ QList<QVariant> args;
+ qvariant_cast<QDBusArgument>(reply.arguments().at(0)) >> args;
+ deviceOrientationChanged(args, 0);
+ }
+ }
+
+ ~HarmattanOrientation()
+ {
+ // unsubscribe from the orientation sensor
+ if (sensorEnabled)
+ QDBusConnection::systemBus().call(
+ QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+ CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE));
+ }
+
+ inline Orientation orientation() const
+ {
+ return o;
+ }
+
+ void setOrientation(Orientation)
+ {
+ }
+
+ void pauseListening() {
+ if (sensorEnabled) {
+ // unsubscribe from the orientation sensor
+ QDBusConnection::systemBus().call(
+ QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+ CONTEXT_INTERFACE, CONTEXT_UNSUBSCRIBE));
+ sensorEnabled = false;
+ }
+ }
+
+ void resumeListening() {
+ if (!sensorEnabled) {
+ // subscribe to the orientation sensor
+ QDBusMessage reply = QDBusConnection::systemBus().call(
+ QDBusMessage::createMethodCall(ORIENTATION_SERVICE, ORIENTATION_PATH,
+ CONTEXT_INTERFACE, CONTEXT_SUBSCRIBE));
+
+ if (reply.type() == QDBusMessage::ErrorMessage) {
+ qWarning("Unable to retrieve device orientation: %s", qPrintable(reply.errorMessage()));
+ } else {
+ sensorEnabled = true;
+ }
+ }
+ }
+
+private Q_SLOTS:
+ void deviceOrientationChanged(QList<QVariant> args,quint64)
+ {
+ if (args.count() == 0)
+ return;
+ Orientation newOrientation = toOrientation(args.at(0).toString());
+ if (newOrientation != o) {
+ o = newOrientation;
+ emit orientationChanged();
+ }
+// qDebug() << "orientation" << args.at(0).toString();
+ }
+
+private:
+ static Orientation toOrientation(const QString &nativeOrientation)
+ {
+ if (nativeOrientation == "top")
+ return Landscape;
+ else if (nativeOrientation == "left")
+ return Portrait;
+ else if (nativeOrientation == "bottom")
+ return LandscapeInverted;
+ else if (nativeOrientation == "right")
+ return PortraitInverted;
+ return UnknownOrientation;
+ }
+
+private:
+ Orientation o;
+ bool sensorEnabled;
+};
+
+DeviceOrientation* DeviceOrientation::instance()
+{
+ static HarmattanOrientation *o = new HarmattanOrientation;
+ return o;
+}
+
+#include "deviceorientation_harmattan.moc"
diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri
index e5b2c7f..5db7678 100644
--- a/tools/qml/qml.pri
+++ b/tools/qml/qml.pri
@@ -29,6 +29,11 @@ symbian:!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
SOURCES += $$PWD/deviceorientation_maemo5.cpp
FORMS = $$PWD/recopts_maemo5.ui \
$$PWD/proxysettings_maemo5.ui
+} else:linux-g++-maemo {
+ QT += dbus
+ SOURCES += $$PWD/deviceorientation_harmattan.cpp
+ FORMS = $$PWD/recopts.ui \
+ $$PWD/proxysettings.ui
} else {
SOURCES += $$PWD/deviceorientation.cpp
FORMS = $$PWD/recopts.ui \
diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp
index 2728557..f59584e 100644
--- a/tools/qtconfig/paletteeditoradvanced.cpp
+++ b/tools/qtconfig/paletteeditoradvanced.cpp
@@ -182,6 +182,7 @@ QColorGroup::ColorRole PaletteEditorAdvanced::centralFromItem( int item )
}
QColorGroup::ColorRole PaletteEditorAdvanced::effectFromItem( int item )
+
{
switch( item ) {
case 0: