summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-03-31 07:41:39 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-03-31 09:32:07 (GMT)
commita93f6b21f636df4840f86099c76d287afb978001 (patch)
treedc85d58ebc1ac7ee9d653157f42242cbc379a636 /src/gui/painting
parenta31270b5fc88460d6923ac1f2b5b6e90da59c9c8 (diff)
downloadQt-a93f6b21f636df4840f86099c76d287afb978001.zip
Qt-a93f6b21f636df4840f86099c76d287afb978001.tar.gz
Qt-a93f6b21f636df4840f86099c76d287afb978001.tar.bz2
Refactoring GraphicsSystem to QPlatformIntegration
QPlatformIntegration is the "main" integration class which needs to be subclassed. This is done so that we don't pollute GraphicsSystem with functionality that really does not belong there. In lighthouse applications needs now to be started with -platform some_platform
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/painting.pri6
-rw-r--r--src/gui/painting/qcolormap_lite.cpp8
-rw-r--r--src/gui/painting/qgraphicssystem.cpp54
-rw-r--r--src/gui/painting/qgraphicssystem_lite.cpp62
-rw-r--r--src/gui/painting/qgraphicssystem_lite_p.h70
-rw-r--r--src/gui/painting/qgraphicssystem_p.h27
-rw-r--r--src/gui/painting/qgraphicssystemcursor_lite.cpp2
-rw-r--r--src/gui/painting/qgraphicssystemcursor_lite.h5
8 files changed, 149 insertions, 85 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 3273cb3..c4e8f7a 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -187,9 +187,11 @@ embedded_lite {
SOURCES += \
painting/qcolormap_lite.cpp \
painting/qpaintdevice_lite.cpp \
- painting/qgraphicssystemcursor_lite.cpp
+ painting/qgraphicssystemcursor_lite.cpp \
+ painting/qgraphicssystem_lite.cpp
HEADERS += \
- painting/qgraphicssystemcursor_lite.h
+ painting/qgraphicssystemcursor_lite.h \
+ painting/qgraphicssystem_lite_p.h
}
symbian {
diff --git a/src/gui/painting/qcolormap_lite.cpp b/src/gui/painting/qcolormap_lite.cpp
index 1c1e9cf..1f4fea8 100644
--- a/src/gui/painting/qcolormap_lite.cpp
+++ b/src/gui/painting/qcolormap_lite.cpp
@@ -67,12 +67,8 @@ void QColormap::initialize()
{
screenMap = new QColormapPrivate;
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (!gs)
- return;
- QList<QGraphicsSystemScreen *> screens = gs->screens();
- if (screens.isEmpty())
- return;
+ QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QList<QPlatformScreen*> screens = pi->screens();
screenMap->depth = screens[0]->depth();
if (screenMap->depth < 8) {
diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp
index ebc504b..c9866ae 100644
--- a/src/gui/painting/qgraphicssystem.cpp
+++ b/src/gui/painting/qgraphicssystem.cpp
@@ -51,9 +51,7 @@
# include <private/qpixmap_mac_p.h>
#endif
#ifdef Q_WS_LITE
-# include <private/qpixmap_raster_p.h>
-# include <qapplication.h>
-# include <qdesktopwidget.h>
+# include <QtGui/private/qapplication_p.h>
#endif
#ifdef Q_WS_S60
# include <private/qpixmap_s60_p.h>
@@ -65,6 +63,9 @@ QGraphicsSystem::~QGraphicsSystem()
{
}
+QBlittable *QGraphicsSystem::createBlittable(const QSize &) const
+{ return 0; }
+
QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType type)
{
#ifdef Q_WS_QWS
@@ -77,7 +78,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ
#elif defined(Q_WS_MAC)
return new QMacPixmapData(type);
#elif defined(Q_WS_LITE)
- return new QRasterPixmapData(type);
+ return QApplicationPrivate::platformIntegration()->createPixmapData(type);
#elif defined(Q_WS_S60)
return new QS60PixmapData(type);
#elif !defined(Q_WS_QWS)
@@ -86,49 +87,4 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ
return 0;
}
-#ifdef Q_WS_LITE
-QWidget *QGraphicsSystemScreen::topLevelAt(const QPoint & pos) const
-{
- QWidgetList list = QApplication::topLevelWidgets();
- for (int i = list.size()-1; i >= 0; --i) {
- QWidget *w = list[i];
- //### mask is ignored
- if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos))
- return w;
- }
-
- return 0;
-}
-
-QList<QGraphicsSystemScreen *> QGraphicsSystem::screens() const
-{
- return QList<QGraphicsSystemScreen *>();
-}
-
-QPixmap QGraphicsSystem::grabWindow(WId window, int x, int y, int width, int height) const
-{
- Q_UNUSED(window);
- Q_UNUSED(x);
- Q_UNUSED(y);
- Q_UNUSED(width);
- Q_UNUSED(height);
- return QPixmap();
-}
-
-
-QGraphicsSystemScreen::QGraphicsSystemScreen(QObject *parent)
- : QObject(parent)
-{}
-
-QGraphicsSystemScreen::~QGraphicsSystemScreen()
-{
-}
-
-QRect QGraphicsSystemScreen::availableGeometry() const
-{
- return geometry();
-}
-
-#endif //Q_WS_LITE
-
QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_lite.cpp b/src/gui/painting/qgraphicssystem_lite.cpp
new file mode 100644
index 0000000..42e7238
--- /dev/null
+++ b/src/gui/painting/qgraphicssystem_lite.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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 QtGui module 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 "qgraphicssystem_lite_p.h"
+#include <QtGui/private/qapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QPixmapData *QLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
+{
+ return QApplicationPrivate::platformIntegration()->createPixmapData(type);
+}
+
+QWindowSurface *QLiteGraphicsSystem::createWindowSurface(QWidget *widget) const
+{
+ return QApplicationPrivate::platformIntegration()->createWindowSurface(widget);
+}
+
+QBlittable *QLiteGraphicsSystem::createBlittable(const QSize &size) const
+{
+ return QApplicationPrivate::platformIntegration()->createBlittable(size);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qgraphicssystem_lite_p.h b/src/gui/painting/qgraphicssystem_lite_p.h
new file mode 100644
index 0000000..e29fa83
--- /dev/null
+++ b/src/gui/painting/qgraphicssystem_lite_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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 QtGui module 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 QGRAPHICSSYSTEM_MAC_P_H
+#define QGRAPHICSSYSTEM_MAC_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qgraphicssystem_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QLiteGraphicsSystem : public QGraphicsSystem
+{
+public:
+ QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
+ QWindowSurface *createWindowSurface(QWidget *widget) const;
+ QBlittable *createBlittable(const QSize &size) const;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h
index 03b0f48..e1e15e0 100644
--- a/src/gui/painting/qgraphicssystem_p.h
+++ b/src/gui/painting/qgraphicssystem_p.h
@@ -64,37 +64,14 @@ QT_BEGIN_NAMESPACE
class QPixmapFilter;
class QBlittable;
-#ifdef Q_WS_LITE
-class Q_GUI_EXPORT QGraphicsSystemScreen : public QObject
-{
- Q_OBJECT
-public:
- QGraphicsSystemScreen(QObject *parent = 0);
- virtual ~QGraphicsSystemScreen();
-
- virtual QRect geometry() const = 0;
- virtual QRect availableGeometry() const;
- virtual int depth() const = 0;
- virtual QImage::Format format() const = 0;
- virtual QSize physicalSize() const = 0;
- virtual void setDirty(const QRect &) {}
- virtual QWidget *topLevelAt(const QPoint &point) const;
-};
-#endif // Q_WS_LITE
-
class Q_GUI_EXPORT QGraphicsSystem
{
public:
virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0;
virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0;
- virtual QBlittable *createBlittable(const QSize &) const { return 0; }
-
- virtual ~QGraphicsSystem() = 0;
+ virtual QBlittable *createBlittable(const QSize &size) const;
-#ifdef Q_WS_LITE
- virtual QList<QGraphicsSystemScreen *> screens() const;
- virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
-#endif
+ virtual ~QGraphicsSystem();
//### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed
// to have a graphics system.
diff --git a/src/gui/painting/qgraphicssystemcursor_lite.cpp b/src/gui/painting/qgraphicssystemcursor_lite.cpp
index 76b7d97..fdb026c 100644
--- a/src/gui/painting/qgraphicssystemcursor_lite.cpp
+++ b/src/gui/painting/qgraphicssystemcursor_lite.cpp
@@ -94,7 +94,7 @@ QPointer<QGraphicsSystemCursor> QGraphicsSystemCursor::instance = 0;
Constructs a QGraphicsSystemCursor
*/
-QGraphicsSystemCursor::QGraphicsSystemCursor(QGraphicsSystemScreen *scr )
+QGraphicsSystemCursor::QGraphicsSystemCursor(QPlatformScreen *scr )
: screen(scr)
{
instance = this;
diff --git a/src/gui/painting/qgraphicssystemcursor_lite.h b/src/gui/painting/qgraphicssystemcursor_lite.h
index 0d57d52..5288b83 100644
--- a/src/gui/painting/qgraphicssystemcursor_lite.h
+++ b/src/gui/painting/qgraphicssystemcursor_lite.h
@@ -47,6 +47,7 @@
#include <QPointer>
#include <QObject>
#include "qgraphicssystem_p.h"
+#include <QPlatformScreen>
QT_BEGIN_NAMESPACE
@@ -68,7 +69,7 @@ private:
class Q_GUI_EXPORT QGraphicsSystemCursor : public QObject {
public:
- QGraphicsSystemCursor(QGraphicsSystemScreen *);
+ QGraphicsSystemCursor(QPlatformScreen *);
// input methods
virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
@@ -79,7 +80,7 @@ public:
protected:
static QPointer<QGraphicsSystemCursor> instance; // limit 1 cursor at a time
- QGraphicsSystemScreen * screen; // Where to request an update
+ QPlatformScreen* screen; // Where to request an update
};
QT_END_NAMESPACE