summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-10-19 00:13:48 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-10-19 00:13:48 (GMT)
commit55bddd50925da27f7a106041db44c15057aac6c1 (patch)
treea5a1ca8f7867b692d0b73e252dd2b9815107425a /examples
parent81093ae5ba8260f5f5b79f317dd461128e76b5fd (diff)
parent1433a2c8682cb1c8f89ceaf97ad7a509ac686879 (diff)
downloadQt-55bddd50925da27f7a106041db44c15057aac6c1.zip
Qt-55bddd50925da27f7a106041db44c15057aac6c1.tar.gz
Qt-55bddd50925da27f7a106041db44c15057aac6c1.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts: configure.exe src/corelib/animation/qabstractanimation.cpp src/s60installs/qt.iby util/qlalr/cppgenerator.cpp
Diffstat (limited to 'examples')
-rw-r--r--examples/dialogs/standarddialogs/dialog.cpp5
-rw-r--r--examples/effects/effects.pro6
-rw-r--r--examples/examples.pro3
-rw-r--r--examples/gestures/gestures.pro2
-rw-r--r--examples/gestures/imagegestures/imagegestures.pro16
-rw-r--r--examples/gestures/imagegestures/imagewidget.cpp (renamed from examples/gestures/imageviewer/imagewidget.cpp)95
-rw-r--r--examples/gestures/imagegestures/imagewidget.h (renamed from examples/gestures/imageviewer/imagewidget.h)29
-rw-r--r--examples/gestures/imagegestures/main.cpp59
-rw-r--r--examples/gestures/imagegestures/mainwidget.cpp56
-rw-r--r--examples/gestures/imagegestures/mainwidget.h65
-rw-r--r--examples/gestures/imageviewer/imageviewer.pro11
-rw-r--r--examples/gestures/imageviewer/main.cpp90
-rw-r--r--examples/gestures/imageviewer/tapandholdgesture.cpp155
-rw-r--r--examples/gestures/imageviewer/tapandholdgesture.h74
-rw-r--r--examples/graphicsview/graphicsview.pro1
-rw-r--r--examples/multimedia/audio/audio.pro10
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp (renamed from examples/multimedia/audio/audiodevices/audiodevices.cpp)0
-rw-r--r--examples/multimedia/audiodevices/audiodevices.h (renamed from examples/multimedia/audio/audiodevices/audiodevices.h)0
-rw-r--r--examples/multimedia/audiodevices/audiodevices.pro (renamed from examples/multimedia/audio/audiodevices/audiodevices.pro)4
-rw-r--r--examples/multimedia/audiodevices/audiodevicesbase.ui (renamed from examples/multimedia/audio/audiodevices/audiodevicesbase.ui)0
-rw-r--r--examples/multimedia/audiodevices/main.cpp (renamed from examples/multimedia/audio/audiodevices/main.cpp)0
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp (renamed from examples/multimedia/audio/audioinput/audioinput.cpp)0
-rw-r--r--examples/multimedia/audioinput/audioinput.h (renamed from examples/multimedia/audio/audioinput/audioinput.h)0
-rw-r--r--examples/multimedia/audioinput/audioinput.pro (renamed from examples/multimedia/audio/audioinput/audioinput.pro)4
-rw-r--r--examples/multimedia/audioinput/main.cpp (renamed from examples/multimedia/audio/audioinput/main.cpp)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp (renamed from examples/multimedia/audio/audiooutput/audiooutput.cpp)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.h (renamed from examples/multimedia/audio/audiooutput/audiooutput.h)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.pro (renamed from examples/multimedia/audio/audiooutput/audiooutput.pro)4
-rw-r--r--examples/multimedia/audiooutput/main.cpp (renamed from examples/multimedia/audio/audiooutput/main.cpp)0
-rw-r--r--examples/multimedia/multimedia.pro14
-rw-r--r--examples/multimedia/videographicsitem/main.cpp (renamed from examples/video/videographicsitem/main.cpp)0
-rw-r--r--examples/multimedia/videographicsitem/videographicsitem.pro (renamed from examples/video/videographicsitem/videographicsitem.pro)4
-rw-r--r--examples/multimedia/videographicsitem/videoitem.cpp (renamed from examples/video/videographicsitem/videoitem.cpp)0
-rw-r--r--examples/multimedia/videographicsitem/videoitem.h (renamed from examples/video/videographicsitem/videoitem.h)0
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.cpp (renamed from examples/video/videographicsitem/videoplayer.cpp)0
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.h (renamed from examples/video/videographicsitem/videoplayer.h)0
-rw-r--r--examples/multimedia/videowidget/main.cpp (renamed from examples/video/videowidget/main.cpp)0
-rw-r--r--examples/multimedia/videowidget/videoplayer.cpp (renamed from examples/video/videowidget/videoplayer.cpp)0
-rw-r--r--examples/multimedia/videowidget/videoplayer.h (renamed from examples/video/videowidget/videoplayer.h)0
-rw-r--r--examples/multimedia/videowidget/videowidget.cpp (renamed from examples/video/videowidget/videowidget.cpp)0
-rw-r--r--examples/multimedia/videowidget/videowidget.h (renamed from examples/video/videowidget/videowidget.h)0
-rw-r--r--examples/multimedia/videowidget/videowidget.pro (renamed from examples/video/videowidget/videowidget.pro)6
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.cpp (renamed from examples/video/videowidget/videowidgetsurface.cpp)0
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.h (renamed from examples/video/videowidget/videowidgetsurface.h)0
-rw-r--r--examples/network/fortuneclient/fortuneclient.pro2
-rw-r--r--examples/network/fortuneserver/fortuneserver.pro2
-rw-r--r--examples/network/network-chat/network-chat.pro2
-rw-r--r--examples/network/network.pro4
-rw-r--r--examples/network/qftp/ftp.qrc (renamed from examples/network/ftp/ftp.qrc)0
-rw-r--r--examples/network/qftp/ftpwindow.cpp (renamed from examples/network/ftp/ftpwindow.cpp)0
-rw-r--r--examples/network/qftp/ftpwindow.h (renamed from examples/network/ftp/ftpwindow.h)0
-rw-r--r--examples/network/qftp/images/cdtoparent.png (renamed from examples/network/ftp/images/cdtoparent.png)bin139 -> 139 bytes
-rw-r--r--examples/network/qftp/images/dir.png (renamed from examples/network/ftp/images/dir.png)bin154 -> 154 bytes
-rw-r--r--examples/network/qftp/images/file.png (renamed from examples/network/ftp/images/file.png)bin129 -> 129 bytes
-rw-r--r--examples/network/qftp/main.cpp (renamed from examples/network/ftp/main.cpp)0
-rw-r--r--examples/network/qftp/qftp.pro (renamed from examples/network/ftp/ftp.pro)6
-rw-r--r--examples/network/qftp/sym_iap_util.h (renamed from examples/network/ftp/sym_iap_util.h)0
-rw-r--r--examples/opengl/hellogl/glwidget.cpp12
-rw-r--r--examples/opengl/hellogl/main.cpp10
-rw-r--r--examples/opengl/hellogl/window.cpp8
-rw-r--r--examples/opengl/hellogl/window.h3
-rw-r--r--examples/opengl/opengl.pro3
-rw-r--r--examples/opengl/pbuffers/cube.h2
-rw-r--r--examples/opengl/pbuffers/glwidget.h2
-rw-r--r--examples/opengl/shared/qtlogo.cpp6
-rw-r--r--examples/opengl/shared/qtlogo.h2
-rw-r--r--examples/phonon/phonon.pro2
-rw-r--r--examples/phonon/qmusicplayer/main.cpp (renamed from examples/phonon/musicplayer/main.cpp)0
-rw-r--r--examples/phonon/qmusicplayer/mainwindow.cpp (renamed from examples/phonon/musicplayer/mainwindow.cpp)0
-rw-r--r--examples/phonon/qmusicplayer/mainwindow.h (renamed from examples/phonon/musicplayer/mainwindow.h)0
-rw-r--r--examples/phonon/qmusicplayer/qmusicplayer.pro (renamed from examples/phonon/musicplayer/musicplayer.pro)4
-rw-r--r--examples/qws/ahigl/ahigl.pro16
-rw-r--r--examples/qws/ahigl/qscreenahigl_qws.cpp963
-rw-r--r--examples/qws/ahigl/qscreenahigl_qws.h91
-rw-r--r--examples/qws/ahigl/qscreenahiglplugin.cpp97
-rw-r--r--examples/qws/ahigl/qwindowsurface_ahigl.cpp349
-rw-r--r--examples/qws/ahigl/qwindowsurface_ahigl_p.h92
-rw-r--r--examples/richtext/textobject/svgtextobject.cpp4
-rw-r--r--examples/sql/drilldown/main.cpp3
-rw-r--r--examples/video/video.pro6
80 files changed, 363 insertions, 2041 deletions
diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp
index c29d2dd..6e06190 100644
--- a/examples/dialogs/standarddialogs/dialog.cpp
+++ b/examples/dialogs/standarddialogs/dialog.cpp
@@ -150,11 +150,6 @@ Dialog::Dialog(QWidget *parent)
native = new QCheckBox(this);
native->setText("Use native file dialog.");
native->setChecked(true);
-#ifndef Q_WS_WIN
-#ifndef Q_OS_MAC
- native->hide();
-#endif
-#endif
QGridLayout *layout = new QGridLayout;
layout->setColumnStretch(1, 1);
layout->setColumnMinimumWidth(1, 250);
diff --git a/examples/effects/effects.pro b/examples/effects/effects.pro
index 01fa293..2dec8d5 100644
--- a/examples/effects/effects.pro
+++ b/examples/effects/effects.pro
@@ -5,7 +5,11 @@ SUBDIRS = \
lighting \
fademessage
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2):SUBDIRS += customshader
+!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles1cl) {
+ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+ SUBDIRS += customshader
+ }
+}
# install
target.path = $$[QT_INSTALL_EXAMPLES]/effects
diff --git a/examples/examples.pro b/examples/examples.pro
index c53bc7d..11a4b4c 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -39,8 +39,7 @@ symbian: SUBDIRS = \
xml
contains(QT_CONFIG, multimedia) {
- SUBDIRS += video
- !static: SUBDIRS += multimedia
+ SUBDIRS += multimedia
}
contains(QT_CONFIG, script): SUBDIRS += script
diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro
index 09cd56a..e3978b6 100644
--- a/examples/gestures/gestures.pro
+++ b/examples/gestures/gestures.pro
@@ -1,7 +1,7 @@
TEMPLATE = \
subdirs
SUBDIRS = \
- imageviewer
+ imagegestures
# install
target.path = $$[QT_INSTALL_EXAMPLES]/gestures
diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro
new file mode 100644
index 0000000..7780ad9
--- /dev/null
+++ b/examples/gestures/imagegestures/imagegestures.pro
@@ -0,0 +1,16 @@
+HEADERS = imagewidget.h \
+ mainwidget.h
+SOURCES = imagewidget.cpp \
+ main.cpp \
+ mainwidget.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
+sources.files = $$SOURCES \
+ $$HEADERS \
+ $$RESOURCES \
+ $$FORMS \
+ imageviewer.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
+INSTALLS += target \
+ sources
diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp
index 3489b5b..95525c5 100644
--- a/examples/gestures/imageviewer/imagewidget.cpp
+++ b/examples/gestures/imagegestures/imagewidget.cpp
@@ -43,6 +43,7 @@
#include <QtGui>
+//! [constructor]
ImageWidget::ImageWidget(QWidget *parent)
: QWidget(parent),
position(0),
@@ -52,32 +53,24 @@ ImageWidget::ImageWidget(QWidget *parent)
scaleFactor(1)
{
- setObjectName("ImageWidget");
setMinimumSize(QSize(100,100));
- setAttribute(Qt::WA_PaintOnScreen);
- setAttribute(Qt::WA_OpaquePaintEvent);
- setAttribute(Qt::WA_NoSystemBackground);
-
- QGesture *panGesture = new QPanGesture(this);
- connect(panGesture, SIGNAL(started()), this, SLOT(panTriggered()));
- connect(panGesture, SIGNAL(finished()), this, SLOT(panTriggered()));
- connect(panGesture, SIGNAL(canceled()), this, SLOT(panTriggered()));
- connect(panGesture, SIGNAL(triggered()), this, SLOT(panTriggered()));
-
- QGesture *pinchGesture = new QPinchGesture(this);
- connect(pinchGesture, SIGNAL(started()), this, SLOT(pinchTriggered()));
- connect(pinchGesture, SIGNAL(finished()), this, SLOT(pinchTriggered()));
- connect(pinchGesture, SIGNAL(canceled()), this, SLOT(pinchTriggered()));
- connect(pinchGesture, SIGNAL(triggered()), this, SLOT(pinchTriggered()));
-
-//! [construct swipe gesture]
- QGesture *swipeGesture = new QSwipeGesture(this);
-//! [construct swipe gesture]
-//! [connect swipe gesture]
- connect(swipeGesture, SIGNAL(triggered()), this, SLOT(swipeTriggered()));
-//! [connect swipe gesture]
+//! [enable gestures]
+ grabGesture(Qt::PanGesture);
+ grabGesture(Qt::PinchGesture);
+ grabGesture(Qt::SwipeGesture);
+//! [enable gestures]
}
+//! [constructor]
+
+//! [event handler]
+bool ImageWidget::event(QEvent *event)
+{
+ if (event->type() == QEvent::Gesture)
+ return gestureEvent(static_cast<QGestureEvent*>(event));
+ return QWidget::event(event);
+}
+//! [event handler]
void ImageWidget::paintEvent(QPaintEvent*)
{
@@ -106,11 +99,27 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *)
update();
}
-void ImageWidget::panTriggered()
+//! [gesture event handler]
+bool ImageWidget::gestureEvent(QGestureEvent *event)
+{
+ if (QGesture *pan = event->gesture(Qt::PanGesture)) {
+ panTriggered(static_cast<QPanGesture*>(pan));
+ return true;
+ } else if (QGesture *pinch = event->gesture(Qt::PinchGesture)) {
+ pinchTriggered(static_cast<QPinchGesture*>(pinch));
+ return true;
+ } else if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) {
+ swipeTriggered(static_cast<QSwipeGesture*>(swipe));
+ return true;
+ }
+ return false;
+}
+//! [gesture event handler]
+
+void ImageWidget::panTriggered(QPanGesture *gesture)
{
- QPanGesture *pg = qobject_cast<QPanGesture*>(sender());
#ifndef QT_NO_CURSOR
- switch (pg->state()) {
+ switch (gesture->state()) {
case Qt::GestureStarted:
case Qt::GestureUpdated:
setCursor(Qt::SizeAllCursor);
@@ -119,33 +128,39 @@ void ImageWidget::panTriggered()
setCursor(Qt::ArrowCursor);
}
#endif
- horizontalOffset += pg->lastOffset().width();
- verticalOffset += pg->lastOffset().height();
+ QSizeF lastOffset = gesture->offset();
+ horizontalOffset += lastOffset.width();
+ verticalOffset += lastOffset.height();
update();
}
-void ImageWidget::pinchTriggered()
+void ImageWidget::pinchTriggered(QPinchGesture *gesture)
{
- QPinchGesture *pg = qobject_cast<QPinchGesture*>(sender());
- if (pg->whatChanged() & QPinchGesture::RotationAngleChanged)
- rotationAngle += pg->rotationAngle() - pg->lastRotationAngle();
- if (pg->whatChanged() & QPinchGesture::ScaleFactorChanged)
- scaleFactor += pg->scaleFactor() - pg->lastScaleFactor();
+ QPinchGesture::WhatChanged whatChanged = gesture->whatChanged();
+ if (whatChanged & QPinchGesture::RotationAngleChanged) {
+ qreal value = gesture->property("rotationAngle").toReal();
+ qreal lastValue = gesture->property("lastRotationAngle").toReal();
+ rotationAngle += value - lastValue;
+ }
+ if (whatChanged & QPinchGesture::ScaleFactorChanged) {
+ qreal value = gesture->property("scaleFactor").toReal();
+ qreal lastValue = gesture->property("lastScaleFactor").toReal();
+ scaleFactor += value - lastValue;
+ }
update();
}
-//! [swipe slot start]
-void ImageWidget::swipeTriggered()
+//! [swipe function]
+void ImageWidget::swipeTriggered(QSwipeGesture *gesture)
{
- QSwipeGesture *pg = qobject_cast<QSwipeGesture*>(sender());
- if (pg->horizontalDirection() == QSwipeGesture::Left
- || pg->verticalDirection() == QSwipeGesture::Up)
+ if (gesture->horizontalDirection() == QSwipeGesture::Left
+ || gesture->verticalDirection() == QSwipeGesture::Up)
goPrevImage();
else
goNextImage();
update();
}
-//! [swipe slot start]
+//! [swipe function]
void ImageWidget::resizeEvent(QResizeEvent*)
{
diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h
index 2a1bfca..56e2316 100644
--- a/examples/gestures/imageviewer/imagewidget.h
+++ b/examples/gestures/imagegestures/imagewidget.h
@@ -46,26 +46,35 @@
#include <QImage>
#include <QtGui>
+QT_BEGIN_NAMESPACE
+class QGestureEvent;
+class QPanGesture;
+class QPinchGesture;
+class QSwipeGesture;
+QT_END_NAMESPACE
+
+//! [class definition begin]
class ImageWidget : public QWidget
{
Q_OBJECT
public:
ImageWidget(QWidget *parent = 0);
-
void openDirectory(const QString &path);
protected:
- void paintEvent(QPaintEvent*);
- void resizeEvent(QResizeEvent*);
- void mouseDoubleClickEvent(QMouseEvent*);
-
-private slots:
- void panTriggered();
- void pinchTriggered();
- void swipeTriggered();
+ bool event(QEvent *event);
+ void paintEvent(QPaintEvent *event);
+ void resizeEvent(QResizeEvent *event);
+ void mouseDoubleClickEvent(QMouseEvent *event);
private:
+ bool gestureEvent(QGestureEvent *event);
+ void panTriggered(QPanGesture*);
+ void pinchTriggered(QPinchGesture*);
+ void swipeTriggered(QSwipeGesture*);
+//! [class definition begin]
+
void updateImage();
QImage loadImage(const QString &fileName);
void loadImage();
@@ -84,6 +93,8 @@ private:
float verticalOffset;
float rotationAngle;
float scaleFactor;
+//! [class definition end]
};
+//! [class definition end]
#endif
diff --git a/examples/gestures/imagegestures/main.cpp b/examples/gestures/imagegestures/main.cpp
new file mode 100644
index 0000000..9c99f31
--- /dev/null
+++ b/examples/gestures/imagegestures/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 <QtGui>
+
+#include "mainwidget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ MainWidget w;
+ w.show();
+
+ if (QApplication::arguments().size() > 1)
+ w.openDirectory(QApplication::arguments().at(1));
+ else
+ w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder"));
+
+ return app.exec();
+}
diff --git a/examples/gestures/imagegestures/mainwidget.cpp b/examples/gestures/imagegestures/mainwidget.cpp
new file mode 100644
index 0000000..51e9f1e
--- /dev/null
+++ b/examples/gestures/imagegestures/mainwidget.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 "imagewidget.h"
+#include "mainwidget.h"
+
+MainWidget::MainWidget(QWidget *parent)
+ : QMainWindow(parent)
+{
+ resize(400, 300);
+ imageWidget = new ImageWidget(this);
+ setCentralWidget(imageWidget);
+}
+
+void MainWidget::openDirectory(const QString &path)
+{
+ imageWidget->openDirectory(path);
+}
diff --git a/examples/gestures/imagegestures/mainwidget.h b/examples/gestures/imagegestures/mainwidget.h
new file mode 100644
index 0000000..71b09b0
--- /dev/null
+++ b/examples/gestures/imagegestures/mainwidget.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples 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 MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include <QMainWindow>
+
+class ImageWidget;
+
+class MainWidget : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWidget(QWidget *parent = 0);
+
+public slots:
+ void openDirectory(const QString &path);
+
+private:
+ bool loadImage(const QString &fileName);
+
+ ImageWidget *imageWidget;
+};
+
+#endif
diff --git a/examples/gestures/imageviewer/imageviewer.pro b/examples/gestures/imageviewer/imageviewer.pro
deleted file mode 100644
index 124175e..0000000
--- a/examples/gestures/imageviewer/imageviewer.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-HEADERS += imagewidget.h \
- tapandholdgesture.h
-SOURCES += imagewidget.cpp \
- tapandholdgesture.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS imageviewer.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imageviewer
-INSTALLS += target sources
diff --git a/examples/gestures/imageviewer/main.cpp b/examples/gestures/imageviewer/main.cpp
deleted file mode 100644
index c3d03f3..0000000
--- a/examples/gestures/imageviewer/main.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 <QtGui>
-
-#include "imagewidget.h"
-
-class MainWidget : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWidget(QWidget *parent = 0);
-
-public slots:
- void openDirectory(const QString &path);
-
-private:
- bool loadImage(const QString &fileName);
-
- ImageWidget *imageWidget;
-};
-
-MainWidget::MainWidget(QWidget *parent)
- : QMainWindow(parent)
-{
- resize(400, 300);
- imageWidget = new ImageWidget(this);
- setCentralWidget(imageWidget);
-}
-
-void MainWidget::openDirectory(const QString &path)
-{
- imageWidget->openDirectory(path);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- MainWidget w;
- w.show();
-
- if (QApplication::arguments().size() > 1)
- w.openDirectory(QApplication::arguments().at(1));
- else
- w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder"));
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/gestures/imageviewer/tapandholdgesture.cpp b/examples/gestures/imageviewer/tapandholdgesture.cpp
deleted file mode 100644
index a10c192..0000000
--- a/examples/gestures/imageviewer/tapandholdgesture.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 "tapandholdgesture.h"
-
-#include <QtGui/qevent.h>
-
-// #define TAPANDHOLD_USING_MOUSE
-
-/*!
- \class TapAndHoldGesture
- \since 4.6
-
- \brief The TapAndHoldGesture class represents a Tap-and-Hold gesture,
- providing additional information.
-*/
-
-const int TapAndHoldGesture::iterationCount = 40;
-const int TapAndHoldGesture::iterationTimeout = 50;
-
-/*!
- Creates a new Tap and Hold gesture handler object and marks it as a child
- of \a parent.
-
- On some platforms like Windows there is a system-wide tap and hold gesture
- that cannot be overriden, hence the gesture might never trigger and default
- context menu will be shown instead.
-*/
-TapAndHoldGesture::TapAndHoldGesture(QWidget *parent)
- : QGesture(parent), iteration(0)
-{
-}
-
-/*! \internal */
-bool TapAndHoldGesture::filterEvent(QEvent *event)
-{
- const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
- switch (event->type()) {
- case QEvent::TouchBegin: {
- if (timer.isActive())
- timer.stop();
- timer.start(TapAndHoldGesture::iterationTimeout, this);
- const QPoint p = ev->touchPoints().at(0).pos().toPoint();
- position = p;
- break;
- }
- case QEvent::TouchUpdate:
- if (ev->touchPoints().size() == 1) {
- const QPoint startPos = ev->touchPoints().at(0).startPos().toPoint();
- const QPoint pos = ev->touchPoints().at(0).pos().toPoint();
- if ((startPos - pos).manhattanLength() > 15)
- reset();
- } else {
- reset();
- }
- break;
- case QEvent::TouchEnd:
- reset();
- break;
-#ifdef TAPANDHOLD_USING_MOUSE
- case QEvent::MouseButtonPress: {
- if (timer.isActive())
- timer.stop();
- timer.start(TapAndHoldGesture::iterationTimeout, this);
- const QPoint p = static_cast<QMouseEvent*>(event)->pos();
- position = startPosition = p;
- break;
- }
- case QEvent::MouseMove: {
- const QPoint startPos = startPosition;
- const QPoint pos = static_cast<QMouseEvent*>(event)->pos();
- if ((startPos - pos).manhattanLength() > 15)
- reset();
- break;
- }
- case QEvent::MouseButtonRelease:
- reset();
- break;
-#endif // TAPANDHOLD_USING_MOUSE
- default:
- break;
- }
- return false;
-}
-
-/*! \internal */
-void TapAndHoldGesture::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() != timer.timerId())
- return;
- if (iteration == TapAndHoldGesture::iterationCount) {
- timer.stop();
- updateState(Qt::GestureFinished);
- } else {
- updateState(Qt::GestureUpdated);
- }
- ++iteration;
-}
-
-/*! \internal */
-void TapAndHoldGesture::reset()
-{
- timer.stop();
- iteration = 0;
- position = startPosition = QPoint();
- updateState(Qt::NoGesture);
-}
-
-/*!
- \property TapAndHoldGesture::pos
-
- \brief The position of the gesture.
-*/
-QPoint TapAndHoldGesture::pos() const
-{
- return position;
-}
diff --git a/examples/gestures/imageviewer/tapandholdgesture.h b/examples/gestures/imageviewer/tapandholdgesture.h
deleted file mode 100644
index 682342e..0000000
--- a/examples/gestures/imageviewer/tapandholdgesture.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 TAPANDHOLDGESTURE_H
-#define TAPANDHOLDGESTURE_H
-
-#include <QtCore/QBasicTimer>
-#include <QtGui/QGesture>
-#include <QtGui/QWidget>
-
-class TapAndHoldGesture : public QGesture
-{
- Q_OBJECT
- Q_PROPERTY(QPoint pos READ pos)
-
-public:
- TapAndHoldGesture(QWidget *parent);
-
- bool filterEvent(QEvent *event);
- void reset();
-
- QPoint pos() const;
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- QBasicTimer timer;
- int iteration;
- QPoint position;
- QPoint startPosition;
- static const int iterationCount;
- static const int iterationTimeout;
-};
-
-#endif // TAPANDHOLDGESTURE_H
diff --git a/examples/graphicsview/graphicsview.pro b/examples/graphicsview/graphicsview.pro
index 0408111..a919c74 100644
--- a/examples/graphicsview/graphicsview.pro
+++ b/examples/graphicsview/graphicsview.pro
@@ -8,6 +8,7 @@ SUBDIRS = \
!symbian: SUBDIRS += \
diagramscene \
dragdroprobot \
+ flowlayout \
anchorlayout
contains(QT_CONFIG, qt3support):SUBDIRS += portedcanvas portedasteroids
diff --git a/examples/multimedia/audio/audio.pro b/examples/multimedia/audio/audio.pro
deleted file mode 100644
index c64bb34..0000000
--- a/examples/multimedia/audio/audio.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = audioinput \
- audiooutput \
- audiodevices
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS audio.pro README
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
-INSTALLS += target sources
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index 4198605..4198605 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h
index 5fe5547..5fe5547 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.h
+++ b/examples/multimedia/audiodevices/audiodevices.h
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.pro b/examples/multimedia/audiodevices/audiodevices.pro
index 173aa8f..232da09 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.pro
+++ b/examples/multimedia/audiodevices/audiodevices.pro
@@ -6,9 +6,9 @@ FORMS += audiodevicesbase.ui
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiodevices.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audiodevices/audiodevicesbase.ui
index 5207338..5207338 100644
--- a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui
+++ b/examples/multimedia/audiodevices/audiodevicesbase.ui
diff --git a/examples/multimedia/audio/audiodevices/main.cpp b/examples/multimedia/audiodevices/main.cpp
index d5ddd4f..d5ddd4f 100644
--- a/examples/multimedia/audio/audiodevices/main.cpp
+++ b/examples/multimedia/audiodevices/main.cpp
diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 05723ae..05723ae 100644
--- a/examples/multimedia/audio/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h
index 14e1bac..14e1bac 100644
--- a/examples/multimedia/audio/audioinput/audioinput.h
+++ b/examples/multimedia/audioinput/audioinput.h
diff --git a/examples/multimedia/audio/audioinput/audioinput.pro b/examples/multimedia/audioinput/audioinput.pro
index 0d6198d..a54d452 100644
--- a/examples/multimedia/audio/audioinput/audioinput.pro
+++ b/examples/multimedia/audioinput/audioinput.pro
@@ -5,9 +5,9 @@ SOURCES = audioinput.cpp \
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audioinput.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audioinput/main.cpp b/examples/multimedia/audioinput/main.cpp
index d7e9c6c..d7e9c6c 100644
--- a/examples/multimedia/audio/audioinput/main.cpp
+++ b/examples/multimedia/audioinput/main.cpp
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index 9e532cd..9e532cd 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h
index 6c07a3a..6c07a3a 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.h
+++ b/examples/multimedia/audiooutput/audiooutput.h
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.pro b/examples/multimedia/audiooutput/audiooutput.pro
index b43763c..26f68fe 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.pro
+++ b/examples/multimedia/audiooutput/audiooutput.pro
@@ -5,9 +5,9 @@ SOURCES = audiooutput.cpp \
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiooutput.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audiooutput/main.cpp b/examples/multimedia/audiooutput/main.cpp
index 79ec99e..79ec99e 100644
--- a/examples/multimedia/audio/audiooutput/main.cpp
+++ b/examples/multimedia/audiooutput/main.cpp
diff --git a/examples/multimedia/multimedia.pro b/examples/multimedia/multimedia.pro
index ac78b15..4a764f2 100644
--- a/examples/multimedia/multimedia.pro
+++ b/examples/multimedia/multimedia.pro
@@ -1,5 +1,15 @@
-TEMPLATE = subdirs
-SUBDIRS = audio
+TEMPLATE = subdirs
+
+!static {
+ SUBDIRS += \
+ audiodevices \
+ audioinput \
+ audiooutput
+}
+
+SUBDIRS += \
+ videographicsitem \
+ videowidget
# install
target.path = $$[QT_INSTALL_EXAMPLES]/multimedia
diff --git a/examples/video/videographicsitem/main.cpp b/examples/multimedia/videographicsitem/main.cpp
index 3bf4c6d..3bf4c6d 100644
--- a/examples/video/videographicsitem/main.cpp
+++ b/examples/multimedia/videographicsitem/main.cpp
diff --git a/examples/video/videographicsitem/videographicsitem.pro b/examples/multimedia/videographicsitem/videographicsitem.pro
index d79c3fb..7c118cc 100644
--- a/examples/video/videographicsitem/videographicsitem.pro
+++ b/examples/multimedia/videographicsitem/videographicsitem.pro
@@ -10,9 +10,9 @@ SOURCES += main.cpp \
videoitem.cpp
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
-sources.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem
INSTALLS += target sources
symbian {
diff --git a/examples/video/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp
index c95e335..c95e335 100644
--- a/examples/video/videographicsitem/videoitem.cpp
+++ b/examples/multimedia/videographicsitem/videoitem.cpp
diff --git a/examples/video/videographicsitem/videoitem.h b/examples/multimedia/videographicsitem/videoitem.h
index 96f578a..96f578a 100644
--- a/examples/video/videographicsitem/videoitem.h
+++ b/examples/multimedia/videographicsitem/videoitem.h
diff --git a/examples/video/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp
index 83644db..83644db 100644
--- a/examples/video/videographicsitem/videoplayer.cpp
+++ b/examples/multimedia/videographicsitem/videoplayer.cpp
diff --git a/examples/video/videographicsitem/videoplayer.h b/examples/multimedia/videographicsitem/videoplayer.h
index 8e73e4c..8e73e4c 100644
--- a/examples/video/videographicsitem/videoplayer.h
+++ b/examples/multimedia/videographicsitem/videoplayer.h
diff --git a/examples/video/videowidget/main.cpp b/examples/multimedia/videowidget/main.cpp
index f5edf73..f5edf73 100644
--- a/examples/video/videowidget/main.cpp
+++ b/examples/multimedia/videowidget/main.cpp
diff --git a/examples/video/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp
index ed24714..ed24714 100644
--- a/examples/video/videowidget/videoplayer.cpp
+++ b/examples/multimedia/videowidget/videoplayer.cpp
diff --git a/examples/video/videowidget/videoplayer.h b/examples/multimedia/videowidget/videoplayer.h
index 6547415..6547415 100644
--- a/examples/video/videowidget/videoplayer.h
+++ b/examples/multimedia/videowidget/videoplayer.h
diff --git a/examples/video/videowidget/videowidget.cpp b/examples/multimedia/videowidget/videowidget.cpp
index 80688e1..80688e1 100644
--- a/examples/video/videowidget/videowidget.cpp
+++ b/examples/multimedia/videowidget/videowidget.cpp
diff --git a/examples/video/videowidget/videowidget.h b/examples/multimedia/videowidget/videowidget.h
index 8c343bf..8c343bf 100644
--- a/examples/video/videowidget/videowidget.h
+++ b/examples/multimedia/videowidget/videowidget.h
diff --git a/examples/video/videowidget/videowidget.pro b/examples/multimedia/videowidget/videowidget.pro
index 4a1d717..3f93745 100644
--- a/examples/video/videowidget/videowidget.pro
+++ b/examples/multimedia/videowidget/videowidget.pro
@@ -13,6 +13,12 @@ SOURCES = \
videowidget.cpp \
videowidgetsurface.cpp
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget
+sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget
+INSTALLS += target sources
+
symbian {
TARGET.UID3 = 0xA000D7C3
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/video/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp
index ec9b8b5..ec9b8b5 100644
--- a/examples/video/videowidget/videowidgetsurface.cpp
+++ b/examples/multimedia/videowidget/videowidgetsurface.cpp
diff --git a/examples/video/videowidget/videowidgetsurface.h b/examples/multimedia/videowidget/videowidgetsurface.h
index 83439d3..83439d3 100644
--- a/examples/video/videowidget/videowidgetsurface.h
+++ b/examples/multimedia/videowidget/videowidgetsurface.h
diff --git a/examples/network/fortuneclient/fortuneclient.pro b/examples/network/fortuneclient/fortuneclient.pro
index d7ad9d5..c9dc39a 100644
--- a/examples/network/fortuneclient/fortuneclient.pro
+++ b/examples/network/fortuneclient/fortuneclient.pro
@@ -11,7 +11,7 @@ INSTALLS += target sources
symbian {
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
- HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h
+ HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
LIBS += -lesock
TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData"
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
diff --git a/examples/network/fortuneserver/fortuneserver.pro b/examples/network/fortuneserver/fortuneserver.pro
index 803c2f2..4dbc2e8 100644
--- a/examples/network/fortuneserver/fortuneserver.pro
+++ b/examples/network/fortuneserver/fortuneserver.pro
@@ -12,7 +12,7 @@ INSTALLS += target sources
symbian {
TARGET.UID3 = 0xA000CF71
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
- HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h
+ HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
LIBS += -lesock
TARGET.CAPABILITY = "All -TCB"
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
diff --git a/examples/network/network-chat/network-chat.pro b/examples/network/network-chat/network-chat.pro
index 99e82ae..16c11e3 100644
--- a/examples/network/network-chat/network-chat.pro
+++ b/examples/network/network-chat/network-chat.pro
@@ -20,7 +20,7 @@ INSTALLS += target sources
symbian {
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
- HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h
+ HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
LIBS += -lesock -lconnmon -lcharconv -linsock
TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData"
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
diff --git a/examples/network/network.pro b/examples/network/network.pro
index 38cdae8..0849271 100644
--- a/examples/network/network.pro
+++ b/examples/network/network.pro
@@ -6,7 +6,7 @@ SUBDIRS = blockingfortuneclient \
downloadmanager \
fortuneclient \
fortuneserver \
- ftp \
+ qftp \
http \
loopback \
threadedfortuneserver \
@@ -16,7 +16,7 @@ SUBDIRS = blockingfortuneclient \
# no QProcess
!vxworks:!qnx:SUBDIRS += network-chat
-symbian: SUBDIRS = ftp
+symbian: SUBDIRS = qftp
contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient
diff --git a/examples/network/ftp/ftp.qrc b/examples/network/qftp/ftp.qrc
index b598ab8..b598ab8 100644
--- a/examples/network/ftp/ftp.qrc
+++ b/examples/network/qftp/ftp.qrc
diff --git a/examples/network/ftp/ftpwindow.cpp b/examples/network/qftp/ftpwindow.cpp
index f3fc52b..f3fc52b 100644
--- a/examples/network/ftp/ftpwindow.cpp
+++ b/examples/network/qftp/ftpwindow.cpp
diff --git a/examples/network/ftp/ftpwindow.h b/examples/network/qftp/ftpwindow.h
index f92c36a..f92c36a 100644
--- a/examples/network/ftp/ftpwindow.h
+++ b/examples/network/qftp/ftpwindow.h
diff --git a/examples/network/ftp/images/cdtoparent.png b/examples/network/qftp/images/cdtoparent.png
index 24b6180..24b6180 100644
--- a/examples/network/ftp/images/cdtoparent.png
+++ b/examples/network/qftp/images/cdtoparent.png
Binary files differ
diff --git a/examples/network/ftp/images/dir.png b/examples/network/qftp/images/dir.png
index 0ce5ae7..0ce5ae7 100644
--- a/examples/network/ftp/images/dir.png
+++ b/examples/network/qftp/images/dir.png
Binary files differ
diff --git a/examples/network/ftp/images/file.png b/examples/network/qftp/images/file.png
index be6c530..be6c530 100644
--- a/examples/network/ftp/images/file.png
+++ b/examples/network/qftp/images/file.png
Binary files differ
diff --git a/examples/network/ftp/main.cpp b/examples/network/qftp/main.cpp
index d44ccd7..d44ccd7 100644
--- a/examples/network/ftp/main.cpp
+++ b/examples/network/qftp/main.cpp
diff --git a/examples/network/ftp/ftp.pro b/examples/network/qftp/qftp.pro
index ce2a97b..b3106c3 100644
--- a/examples/network/ftp/ftp.pro
+++ b/examples/network/qftp/qftp.pro
@@ -5,9 +5,9 @@ RESOURCES += ftp.qrc
QT += network
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/network/ftp
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS ftp.pro images
-sources.path = $$[QT_INSTALL_EXAMPLES]/network/ftp
+target.path = $$[QT_INSTALL_EXAMPLES]/network/qftp
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/network/qftp
INSTALLS += target sources
symbian {
diff --git a/examples/network/ftp/sym_iap_util.h b/examples/network/qftp/sym_iap_util.h
index ebeae0a..ebeae0a 100644
--- a/examples/network/ftp/sym_iap_util.h
+++ b/examples/network/qftp/sym_iap_util.h
diff --git a/examples/opengl/hellogl/glwidget.cpp b/examples/opengl/hellogl/glwidget.cpp
index 282f21f..ffb3b15 100644
--- a/examples/opengl/hellogl/glwidget.cpp
+++ b/examples/opengl/hellogl/glwidget.cpp
@@ -150,10 +150,10 @@ void GLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
- glTranslated(0.0, 0.0, -10.0);
- glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
- glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
- glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
+ glTranslatef(0.0, 0.0, -10.0);
+ glRotatef(xRot / 16.0, 1.0, 0.0, 0.0);
+ glRotatef(yRot / 16.0, 0.0, 1.0, 0.0);
+ glRotatef(zRot / 16.0, 0.0, 0.0, 1.0);
logo->draw();
}
//! [7]
@@ -166,7 +166,11 @@ void GLWidget::resizeGL(int width, int height)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+#ifdef QT_OPENGL_ES_1
+ glOrthof(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0);
+#else
glOrtho(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0);
+#endif
glMatrixMode(GL_MODELVIEW);
}
//! [8]
diff --git a/examples/opengl/hellogl/main.cpp b/examples/opengl/hellogl/main.cpp
index e645dba..f610b3b 100644
--- a/examples/opengl/hellogl/main.cpp
+++ b/examples/opengl/hellogl/main.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <QApplication>
+#include <QDesktopWidget>
#include "window.h"
@@ -47,6 +48,13 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
- window.show();
+ window.resize(window.sizeHint());
+ int desktopArea = QApplication::desktop()->width() *
+ QApplication::desktop()->height();
+ int widgetArea = window.width() * window.height();
+ if (((float)widgetArea / (float)desktopArea) < 0.75f)
+ window.show();
+ else
+ window.showMaximized();
return app.exec();
}
diff --git a/examples/opengl/hellogl/window.cpp b/examples/opengl/hellogl/window.cpp
index 2b06b9c..19a8aac 100644
--- a/examples/opengl/hellogl/window.cpp
+++ b/examples/opengl/hellogl/window.cpp
@@ -88,3 +88,11 @@ QSlider *Window::createSlider()
return slider;
}
//! [2]
+
+void Window::keyPressEvent(QKeyEvent *e)
+{
+ if (e->key() == Qt::Key_Escape)
+ close();
+ else
+ QWidget::keyPressEvent(e);
+}
diff --git a/examples/opengl/hellogl/window.h b/examples/opengl/hellogl/window.h
index 7269a05..4cfd31b 100644
--- a/examples/opengl/hellogl/window.h
+++ b/examples/opengl/hellogl/window.h
@@ -57,6 +57,9 @@ class Window : public QWidget
public:
Window();
+protected:
+ void keyPressEvent(QKeyEvent *event);
+
private:
QSlider *createSlider();
diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro
index 2cb8227..eaac9b8 100644
--- a/examples/opengl/opengl.pro
+++ b/examples/opengl/opengl.pro
@@ -9,6 +9,9 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles1cl)|contains(QT_CONF
!contains(QT_CONFIG, opengles1cl) {
SUBDIRS += textures
}
+ contains(QT_CONFIG, opengles1) {
+ SUBDIRS += hellogl
+ }
} else {
SUBDIRS = 2dpainting \
grabber \
diff --git a/examples/opengl/pbuffers/cube.h b/examples/opengl/pbuffers/cube.h
index c882f1f..f17299f 100644
--- a/examples/opengl/pbuffers/cube.h
+++ b/examples/opengl/pbuffers/cube.h
@@ -48,7 +48,9 @@
#include <QtGui/qvector3d.h>
#include <QtGui/qvector2d.h>
+QT_BEGIN_NAMESPACE
class QPropertyAnimation;
+QT_END_NAMESPACE
class Geometry
{
diff --git a/examples/opengl/pbuffers/glwidget.h b/examples/opengl/pbuffers/glwidget.h
index c019abe..1b46bfd 100644
--- a/examples/opengl/pbuffers/glwidget.h
+++ b/examples/opengl/pbuffers/glwidget.h
@@ -47,7 +47,9 @@
class Geometry;
class Cube;
class Tile;
+QT_BEGIN_NAMESPACE
class QGLPixelBuffer;
+QT_END_NAMESPACE
class GLWidget : public QGLWidget
{
diff --git a/examples/opengl/shared/qtlogo.cpp b/examples/opengl/shared/qtlogo.cpp
index b32b416..bad83d1 100644
--- a/examples/opengl/shared/qtlogo.cpp
+++ b/examples/opengl/shared/qtlogo.cpp
@@ -39,6 +39,12 @@
**
****************************************************************************/
+#include <QGLWidget>
+#include <QMatrix4x4>
+#include <QVector3D>
+
+#include <qmath.h>
+
#include "qtlogo.h"
static const qreal tee_height = 0.311126;
diff --git a/examples/opengl/shared/qtlogo.h b/examples/opengl/shared/qtlogo.h
index 4f5c357..152958b 100644
--- a/examples/opengl/shared/qtlogo.h
+++ b/examples/opengl/shared/qtlogo.h
@@ -43,7 +43,7 @@
#define QTLOGO_H
#include <QObject>
-#include <QtOpenGL>
+#include <QColor>
class Patch;
struct Geometry;
diff --git a/examples/phonon/phonon.pro b/examples/phonon/phonon.pro
index 0ddf767..aa6ac13 100644
--- a/examples/phonon/phonon.pro
+++ b/examples/phonon/phonon.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS = musicplayer \
+SUBDIRS = qmusicplayer \
capabilities
# install
diff --git a/examples/phonon/musicplayer/main.cpp b/examples/phonon/qmusicplayer/main.cpp
index fc7baa3..fc7baa3 100644
--- a/examples/phonon/musicplayer/main.cpp
+++ b/examples/phonon/qmusicplayer/main.cpp
diff --git a/examples/phonon/musicplayer/mainwindow.cpp b/examples/phonon/qmusicplayer/mainwindow.cpp
index 787ae53..787ae53 100644
--- a/examples/phonon/musicplayer/mainwindow.cpp
+++ b/examples/phonon/qmusicplayer/mainwindow.cpp
diff --git a/examples/phonon/musicplayer/mainwindow.h b/examples/phonon/qmusicplayer/mainwindow.h
index 41f8147..41f8147 100644
--- a/examples/phonon/musicplayer/mainwindow.h
+++ b/examples/phonon/qmusicplayer/mainwindow.h
diff --git a/examples/phonon/musicplayer/musicplayer.pro b/examples/phonon/qmusicplayer/qmusicplayer.pro
index a0c953a..25ab7eb 100644
--- a/examples/phonon/musicplayer/musicplayer.pro
+++ b/examples/phonon/qmusicplayer/qmusicplayer.pro
@@ -5,9 +5,9 @@ SOURCES += main.cpp \
mainwindow.cpp
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/phonon/musicplayer
+target.path = $$[QT_INSTALL_EXAMPLES]/phonon/qmusicplayer
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
-sources.path = $$[QT_INSTALL_EXAMPLES]/phonon/musicplayer
+sources.path = $$[QT_INSTALL_EXAMPLES]/phonon/qmusicplayer
INSTALLS += target sources
wince*{
diff --git a/examples/qws/ahigl/ahigl.pro b/examples/qws/ahigl/ahigl.pro
deleted file mode 100644
index 1ee8e6e..0000000
--- a/examples/qws/ahigl/ahigl.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TEMPLATE = lib
-QT += opengl
-CONFIG += plugin
-
-TARGET = qahiglscreen
-
-target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers
-INSTALLS += target
-
-HEADERS = qwindowsurface_ahigl_p.h \
- qscreenahigl_qws.h
-
-SOURCES = qwindowsurface_ahigl.cpp \
- qscreenahigl_qws.cpp \
- qscreenahiglplugin.cpp
-
diff --git a/examples/qws/ahigl/qscreenahigl_qws.cpp b/examples/qws/ahigl/qscreenahigl_qws.cpp
deleted file mode 100644
index 491d70f..0000000
--- a/examples/qws/ahigl/qscreenahigl_qws.cpp
+++ /dev/null
@@ -1,963 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 "qscreenahigl_qws.h"
-#include "qwindowsurface_ahigl_p.h"
-
-#include <QWSServer>
-#include <QMap>
-#include <QTimer>
-#include <QTimeLine>
-
-#include <qwindowsystem_qws.h>
-#include <private/qwindowsurface_qws_p.h>
-#include <private/qfixed_p.h>
-
-#include <GLES/egl.h>
-#include <GLES/gl.h>
-#include <math.h>
-
-const int animationLength = 1500;
-const int frameSpan = 20;
-
-static GLuint createTexture(const QImage &img);
-
-class QAhiGLCursor : public QScreenCursor
-{
-public:
- QAhiGLCursor() : texture(0) {}
- ~QAhiGLCursor();
-
- void set(const QImage &image, int hotx, int hoty);
-
- GLuint texture;
-};
-
-QAhiGLCursor::~QAhiGLCursor()
-{
- if (texture)
- glDeleteTextures(1, &texture);
-}
-
-void QAhiGLCursor::set(const QImage &image, int hotx, int hoty)
-{
- if (texture)
- glDeleteTextures(1, &texture);
-
- if (image.isNull())
- texture = 0;
- else
- texture = createTexture(image.convertToFormat(QImage::Format_ARGB32));
-
- QScreenCursor::set(image, hotx, hoty);
-}
-
-
-/*!
- \class QAhiGLScreenPrivate
- The QAhiGLScreenPrivate class contains state information for class QAhiGLScreen.
-
- An instance of this class points to the owning instance of
- class QAhiGLScreen. This class uses a QTimer to limit the
- update frequency.
- */
-//! [0]
-class QAhiGLScreenPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QAhiGLScreenPrivate(QAhiGLScreen *s);
-
-public slots:
- void windowEvent(QWSWindow *w, QWSServer::WindowEvent e);
- void redrawScreen();
-
-public:
- QAhiGLScreen *screen;
- QAhiGLCursor *cursor;
-
- EGLContext eglContext;
- EGLDisplay eglDisplay;
- EGLSurface eglSurface;
-
- QTimer updateTimer;
- bool doEffects;
-};
-//! [0]
-
-//! [1]
-class ShowAnimation : public QTimeLine
-{
-public:
- ShowAnimation(QAhiGLScreenPrivate *screen);
- qreal valueForTime(int msec);
-};
-//! [1]
-
-//! [2]
-struct WindowInfo
-{
- WindowInfo() : texture(0), animation(0) {}
-
- GLuint texture;
- QPointer<ShowAnimation> animation;
-};
-
-static QMap<QWSWindow*, WindowInfo*> windowMap;
-//! [2]
-
-/*!
- Constructs the animation for the transition effect used
- when the window associated with \a screen is displayed.
- */
-//! [3]
-ShowAnimation::ShowAnimation(QAhiGLScreenPrivate *screen)
- : QTimeLine(animationLength)
-{
- setUpdateInterval(frameSpan);
- connect(this, SIGNAL(valueChanged(qreal)), screen, SLOT(redrawScreen()));
- connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
- start();
-}
-//! [3]
-
-//! [4]
-qreal ShowAnimation::valueForTime(int msec)
-{
- const qreal t = msec / qreal(duration());
- return 3*t*t - 2*t*t*t;
-}
-//! [4]
-
-QAhiGLScreenPrivate::QAhiGLScreenPrivate(QAhiGLScreen *s)
- : screen(s), cursor(0), doEffects(false)
-{
- connect(&updateTimer, SIGNAL(timeout()), this, SLOT(redrawScreen()));
-}
-
-/*!
- This slot handles the \a event when the \l {QWSServer}
- {window server} emits a window event for the specified
- \a window.
-
- The \l {QWSServer::WindowEvent} {window events} handled
- are \c Create, \c Destroy, and \c Show. The \c Create
- event creates a new instance of \l {WindowInfo} and stores
- it in a window map to mark the creation of a new window.
- The \c Destroy event causes the \l {WindoInfo} instance
- to be removed from the map and destroyed.
-
- The \c Show event is the most interesting. If the user
- has started the application with -display ahigl:effects,
- then the \c Show event is handled by creating a small
- \l {ShowAnimation} {animation} for use when the window
- is first shown.
- */
-//! [5]
-void QAhiGLScreenPrivate::windowEvent(QWSWindow *window,
- QWSServer::WindowEvent event)
-{
- switch (event) {
- case QWSServer::Create:
- windowMap[window] = new WindowInfo;
- break;
- case QWSServer::Show:
- if (doEffects)
- windowMap[window]->animation = new ShowAnimation(this);
- break;
- case QWSServer::Destroy:
- delete windowMap[window];
- windowMap.remove(window);
- break;
- default:
- break;
- }
-}
-//! [5]
-
-/*!
- This function assumes the updateTimer is still counting down and stops it
- and then calls redrawScreen() in the public screen driver class QAhiGLScreen.
- */
-//! [6]
-void QAhiGLScreenPrivate::redrawScreen()
-{
- updateTimer.stop();
- screen->redrawScreen();
-}
-//! [6]
-
-/*!
- \class QAhiGLScreen
-
- \brief The QAhiGLScreen class is the screen driver for the ATI handheld device interface.
-
- QAhiGLScreen is implemented with the d-pointer pattern. That is,
- the only data member the class contains is a pointer called d_ptr,
- which means data pointer. It points to an instance of a private
- class called QAhiGLScreenPrivate, where all the screen driver's
- context data members are defined. The d-pointer pattern is used
- so that changes can be made to the screen driver's context data
- members without destroying the binary compatibility of the public
- screen driver class.
-
- The pure virtual functions found in the base class QScreen are
- listed below. All must have implementations in any screen driver
- class derived from QScreen. All are impemented in this example,
- except for setMode(), which has only been given a stub
- implementation to satisfy the compiler.
-
- bool connect(const QString & displaySpec);
- void disconnect();
- bool initDevice();
- void setMode(int width, int height, int depth);
-
- The stub implementation of setMode() is not meant to indicate
- setMode() can be ignored in your own screen driver class. It was
- simply decided not to provide a fully implemented screen driver
- class for the example, which would normally be tailored to your
- device's specific requirements.
-
- The base class QGLScreen has only one pure virtual function,
- hasOpenGL(), which must return true if your screen driver class
- supports OpenGL.
-
- QWSWindowSurface * createSurface(const QString & key) const
- QWSWindowSurface * createSurface(QWidget * widget) const
- void exposeRegion(QRegion region, int windowIndex)
-
- */
-
-/*!
- Constructs a new, ATI handheld device screen driver.
-
- The displayId identifies the QWS server to connect to.
- */
-QAhiGLScreen::QAhiGLScreen(int displayId) : QGLScreen(displayId)
-{
- d_ptr = new QAhiGLScreenPrivate(this);
- d_ptr->eglDisplay = EGL_NO_DISPLAY;
- d_ptr->eglSurface = EGL_NO_SURFACE;
-}
-
-/*!
- Destroys this ATI handheld device screen driver.
- */
-QAhiGLScreen::~QAhiGLScreen()
-{
- delete d_ptr;
-}
-
-/*!
- \reimp
- */
-//! [7]
-bool QAhiGLScreen::connect(const QString &displaySpec)
-{
- // Hardcoded values for this device
- w = 480;
- h = 640;
- dw = w;
- dh = h;
- d = 16;
-
- const int dpi = 120;
- physWidth = qRound(dw * 25.4 / dpi);
- physHeight = qRound(dh * 25.4 / dpi);
-
- if (displaySpec.section(':', 1, 1).contains("effects"))
- d_ptr->doEffects = true;
-
- return true;
-}
-//! [7]
-
-/*!
- \reimp
- */
-//! [8]
-bool QAhiGLScreen::initDevice()
-{
- EGLint version, subversion;
- EGLint attrs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_STENCIL_SIZE, 8, EGL_DEPTH_SIZE, 16,
- EGL_NONE };
- EGLint numConfig;
- EGLConfig eglConfig;
-
- d_ptr->eglDisplay = eglGetDisplay(0);
- if (d_ptr->eglDisplay == EGL_NO_DISPLAY) {
- qCritical("QAhiGLScreen::initDevice(): eglGetDisplay failed: 0x%x",
- eglGetError());
- return false;
- }
-
- if (!eglInitialize(d_ptr->eglDisplay, &version, &subversion)) {
- qCritical("QAhiGLScreen::initDevice(): eglInitialize failed: 0x%x",
- eglGetError());
- return false;
- }
-
- if (!eglChooseConfig(d_ptr->eglDisplay, attrs, &eglConfig, 1, &numConfig)) {
- qCritical("QAhiGLScreen::initDevice(): eglChooseConfig failed: 0x%x",
- eglGetError());
- return false;
- }
-
- static DummyScreen win = { w, h };
- d_ptr->eglSurface = eglCreateWindowSurface(d_ptr->eglDisplay, eglConfig,
- &win, 0);
- if (d_ptr->eglSurface == EGL_NO_SURFACE) {
- qCritical("QAhiGLScreen::initDevice(): eglCreateWindowSurface failed: 0x%x",
- eglGetError());
- return false;
- }
-
- d_ptr->eglContext = eglCreateContext(d_ptr->eglDisplay, eglConfig,
- EGL_NO_CONTEXT, 0);
- if (d_ptr->eglContext == EGL_NO_CONTEXT) {
- qCritical("QAhiGLScreen::initDevice(): eglCreateContext failed: 0x%x",
- eglGetError());
- return false;
- }
-
- if (!eglMakeCurrent(d_ptr->eglDisplay, d_ptr->eglSurface, d_ptr->eglSurface, d_ptr->eglContext)) {
- qCritical("QAhiGLScreen::initDevice(): eglMakeCurrent failed: 0x%x",
- eglGetError());
- return false;
- }
-
- d_ptr->connect(QWSServer::instance(),
- SIGNAL(windowEvent(QWSWindow*, QWSServer::WindowEvent)),
- SLOT(windowEvent(QWSWindow*, QWSServer::WindowEvent)));
-
- d_ptr->cursor = new QAhiGLCursor;
- qt_screencursor = d_ptr->cursor;
-
- return true;
-}
-//! [8]
-
-/*!
- \reimp
- */
-//! [9]
-void QAhiGLScreen::shutdownDevice()
-{
- delete d_ptr->cursor;
- d_ptr->cursor = 0;
- qt_screencursor = 0;
-
- eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE,
- EGL_NO_SURFACE, EGL_NO_CONTEXT);
- eglDestroyContext(d_ptr->eglDisplay, d_ptr->eglContext);
- eglDestroySurface(d_ptr->eglDisplay, d_ptr->eglSurface);
- eglTerminate(d_ptr->eglDisplay);
-}
-//! [9]
-
-/*!
- \reimp
-
- In this case, the reimplimentation does nothing. It is
- required because the function is declared as pure virtual
- in the base class QScreen.
- */
-void QAhiGLScreen::disconnect()
-{
-}
-
-/*
- This internal function rounds up to the next power of
- two. If v is already a power of two, that same value is
- returned.
- */
-inline static uint nextPowerOfTwo(uint v)
-{
- v--;
- v |= v >> 1;
- v |= v >> 2;
- v |= v >> 4;
- v |= v >> 8;
- v |= v >> 16;
- ++v;
- return v;
-}
-
-/*
- This internal function creates a texture from the image img
- and returns its texture identifier.
-
- The term "texture" is a graphics technology term that refers
- to a pixmap constructed from an image by adding extra points
- of contrast to the otherwise plain color image. The texture
- has a, well, texture, that the original image doesn't have.
- */
-static GLuint createTexture(const QImage &img)
-{
- if (img.isNull())
- return 0;
-
- int width = img.width();
- int height = img.height();
- int textureWidth;
- int textureHeight;
- GLuint texture;
-
- glGenTextures(1, &texture);
- textureWidth = nextPowerOfTwo(width);
- textureHeight = nextPowerOfTwo(height);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- switch (img.format()) {
- case QImage::Format_RGB16:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
- textureWidth,
- textureHeight, 0,
- GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height,
- GL_RGB, GL_UNSIGNED_SHORT_5_6_5, img.bits());
- break;
-
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_ARGB32:
- case QImage::Format_RGB32:
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- textureWidth,
- textureHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, 0);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height,
- GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
- break;
-
- default:
- break;
- }
-
- return texture;
-}
-
-/*
- A helper function used by QAhiGLScreen::drawQuad().
- */
-static void drawQuad_helper(GLshort *coords, GLfloat *texCoords)
-{
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_SHORT, 0, coords);
- glEnable(GL_TEXTURE_2D);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glDisable(GL_TEXTURE_2D);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-}
-
-/*
- A helper function used by QAhiGLScreen::drawQuadWavyFlag().
- */
-static void drawQuad_helper(GLshort *coords, GLfloat *texCoords,
- int arraySize, int numArrays)
-{
- glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_SHORT, 0, coords);
-
- for (int i = 0; i < numArrays-1; ++i)
- glDrawArrays(GL_TRIANGLE_STRIP, i*arraySize, arraySize);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisable(GL_TEXTURE_2D);
-}
-
-/*
- A convenience function used by QAhiGLScreen::drawQuad().
- */
-static void setRectCoords(GLshort *coords, QRect rect)
-{
- coords[0] = GLshort(rect.left());
- coords[1] = GLshort(rect.top());
-
- coords[2] = GLshort(rect.right());
- coords[3] = GLshort(rect.top());
-
- coords[4] = GLshort(rect.right());
- coords[5] = GLshort(rect.bottom());
-
- coords[6] = GLshort(rect.left());
- coords[7] = GLshort(rect.bottom());
-}
-
-/*!
- A helper function used by QAhiGLScreen::drawWindow() and
- QAhiGLScreen::redrawScreen().
- */
-void QAhiGLScreen::drawQuad(const QRect &textureGeometry,
- const QRect &subGeometry,
- const QRect &screenGeometry)
-{
- qreal textureWidth = qreal(nextPowerOfTwo(textureGeometry.width()));
- qreal textureHeight = qreal(nextPowerOfTwo(textureGeometry.height()));
-
- GLshort coords[8];
- setRectCoords(coords, screenGeometry);
-
- GLfloat texcoords[8];
- texcoords[0] = (subGeometry.left() - textureGeometry.left()) / textureWidth;
- texcoords[1] = (subGeometry.top() - textureGeometry.top()) / textureHeight;
-
- texcoords[2] = (subGeometry.right() - textureGeometry.left()) / textureWidth;
- texcoords[3] = (subGeometry.top() - textureGeometry.top()) / textureHeight;
-
- texcoords[4] = (subGeometry.right() - textureGeometry.left()) / textureWidth;
- texcoords[5] = (subGeometry.bottom() - textureGeometry.top()) / textureHeight;
-
- texcoords[6] = (subGeometry.left() - textureGeometry.left()) / textureWidth;
- texcoords[7] = (subGeometry.bottom() - textureGeometry.top()) / textureHeight;
-
- drawQuad_helper(coords, texcoords);
-}
-
-/*
- My own sine function.
- */
-static qreal mySin(QFixed radians)
-{
- const QFixed twoPI = QFixed::fromReal(2*M_PI);
-
- const int tableSize = 40;
- static int *table = 0;
-
- if (!table) {
- table = new int[tableSize];
- for (int i = 0; i < tableSize; ++i) {
- table[i] = qRound(sin(M_PI*(i*360.0/40.0)/180.0) * 16776960.0);
- }
- }
-
- QFixed tableLookup = radians*tableSize/twoPI;
- return table[tableLookup.truncate()%tableSize]/16776960.0;
-}
-
-/*
- My own cosine function.
- */
-static qreal myCos(QFixed radians)
-{
- const int twoPI = qRound(2*M_PI);
-
- const int tableSize = 40;
- static int *table = 0;
-
- if (!table) {
- table = new int[tableSize];
- for (int i = 0; i < tableSize; ++i) {
- table[i] = int(cos(M_PI*(i*360.0/40.0)/180.0) * 16776960.0);
- }
- }
-
- QFixed tableLookup = radians*tableSize/twoPI;
- return table[tableLookup.truncate()%tableSize]/16776960.0;
-}
-
-// number of grid cells in wavy flag tesselation in x- and y-direction
-const int subdivisions = 10;
-
-/*
- A helper function used by drawQuadWavyFlag(). It computes
- coordinates for grid cells for a wavy flag tesselation and
- stores them in the array called coords.
- */
-static void setFlagCoords(GLshort *coords,
- QRectF screenGeometry,
- int frameNum,
- qreal progress)
-{
- int coordIndex = 0;
- qreal waveHeight = 30.0*(1.0-progress);
- for (int j = 0; j < subdivisions-1; ++j) {
- for (int i = 0; i < subdivisions; ++i) {
- qreal c;
- c = screenGeometry.left()
- + (i * screenGeometry.width() / (subdivisions - 1))
- + waveHeight * qRound(mySin(QFixed::fromReal(M_PI * 20 * (frameNum + i) / 180.0)))
- + waveHeight * qRound(myCos(QFixed::fromReal(M_PI * 20 * (frameNum + j) / 180.0)));
- coords[coordIndex++] = qRound(c);
- c = screenGeometry.top()
- + (j * screenGeometry.height() / (subdivisions - 1))
- + waveHeight * mySin(QFixed::fromReal(M_PI * 20 * (frameNum + i) / 180.0))
- + waveHeight * myCos(QFixed::fromReal(M_PI * 20 * (frameNum + j) / 180.0));
- coords[coordIndex++] = qRound(c);
- c = screenGeometry.left() + (i * screenGeometry.width() / (subdivisions - 1))
- + waveHeight * mySin(QFixed::fromReal(M_PI * 20 * (frameNum + i) / 180.0))
- + waveHeight * myCos(QFixed::fromReal(M_PI * 20 * (frameNum + (j+1)) / 180.0));
- coords[coordIndex++] = qRound(c);
-
- c = screenGeometry.top()
- + ((j + 1) * screenGeometry.height() / (subdivisions - 1))
- + waveHeight * mySin(QFixed::fromReal(M_PI * 20 * (frameNum + i) / 180.0))
- + waveHeight * myCos(QFixed::fromReal(M_PI * 20 * (frameNum + (j + 1)) / 180.0));
- coords[coordIndex++] = qRound(c);
- }
- }
-}
-
-static void setFlagTexCoords(GLfloat *texcoords,
- const QRectF &subTexGeometry,
- const QRectF &textureGeometry,
- int textureWidth, int textureHeight)
-{
- qreal topLeftX = (subTexGeometry.left() - textureGeometry.left())/textureWidth;
- qreal topLeftY = (textureGeometry.height() - (subTexGeometry.top() - textureGeometry.top()))/textureHeight;
-
- qreal width = (subTexGeometry.right() - textureGeometry.left())/textureWidth - topLeftX;
- qreal height = (textureGeometry.height() - (subTexGeometry.bottom() - textureGeometry.top()))/textureHeight - topLeftY;
-
- int coordIndex = 0;
- qreal spacing = subdivisions - 1;
- for (int j = 0; j < subdivisions-1; ++j) {
- for (int i = 0; i < subdivisions; ++i) {
- texcoords[coordIndex++] = topLeftX + (i*width) / spacing;
- texcoords[coordIndex++] = topLeftY + (j*height) / spacing;
- texcoords[coordIndex++] = topLeftX + (i*width) / spacing;
- texcoords[coordIndex++] = topLeftY + ((j+1)*height) / spacing;
- }
- }
-}
-
-void QAhiGLScreen::drawQuadWavyFlag(const QRect &textureGeometry,
- const QRect &subTexGeometry,
- const QRect &screenGeometry,
- qreal progress)
-{
- const int textureWidth = nextPowerOfTwo(textureGeometry.width());
- const int textureHeight = nextPowerOfTwo(textureGeometry.height());
-
- static int frameNum = 0;
-
- GLshort coords[subdivisions*subdivisions*2*2];
- setFlagCoords(coords, screenGeometry, frameNum++, progress);
-
- GLfloat texcoords[subdivisions*subdivisions*2*2];
- setFlagTexCoords(texcoords, subTexGeometry, textureGeometry,
- textureWidth, textureHeight);
-
- drawQuad_helper(coords, texcoords, subdivisions*2, subdivisions);
-}
-
-void QAhiGLScreen::invalidateTexture(int windowIndex)
-{
- if (windowIndex < 0)
- return;
-
- QList<QWSWindow*> windows = QWSServer::instance()->clientWindows();
- if (windowIndex > windows.size() - 1)
- return;
-
- QWSWindow *win = windows.at(windowIndex);
- if (!win)
- return;
-
- WindowInfo *info = windowMap[win];
- if (info->texture) {
- glDeleteTextures(1, &info->texture);
- info->texture = 0;
- }
-}
-
-void QAhiGLScreen::drawWindow(QWSWindow *win, qreal progress)
-{
- const QRect screenRect = win->allocatedRegion().boundingRect();
- QRect drawRect = screenRect;
-
- glColor4f(1.0, 1.0, 1.0, progress);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- QWSWindowSurface *surface = win->windowSurface();
- if (!surface)
- return;
-
- if (progress >= 1.0) {
- if (surface->key() == QLatin1String("ahigl")) {
- drawRect.setCoords(drawRect.left(), drawRect.bottom(),
- drawRect.right(), drawRect.top());
- }
- drawQuad(win->requestedRegion().boundingRect(), screenRect, drawRect);
- return;
- }
-
- const int dx = qRound((1 - progress) * drawRect.width() / 2);
- const int dy = qRound((1 - progress) * drawRect.height() / 2);
-
- drawRect.adjust(dx, dy, -dx, -dy);
-
- if (surface->key() != QLatin1String("ahigl")) {
- drawRect.setCoords(drawRect.left(), drawRect.bottom(),
- drawRect.right(), drawRect.top());
- }
-
- drawQuadWavyFlag(win->requestedRegion().boundingRect(), screenRect,
- drawRect, progress);
-}
-
-/*!
- The window compositions are constructed here.
- */
-//! [10]
-void QAhiGLScreen::redrawScreen()
-{
- glBindFramebufferOES(GL_FRAMEBUFFER_EXT, 0);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrthof(0, w, h, 0, -999999, 999999);
- glViewport(0, 0, w, h);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- // Fill background color
-
- QColor bgColor = QWSServer::instance()->backgroundBrush().color();
- glClearColor(bgColor.redF(), bgColor.greenF(),
- bgColor.blueF(), bgColor.alphaF());
- glClear(GL_COLOR_BUFFER_BIT);
-//! [10]
-
- // Draw all windows
-
- glDisable(GL_CULL_FACE);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_STENCIL_TEST);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ZERO);
- glDisable(GL_ALPHA_TEST);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
-//! [11]
- QList<QWSWindow*> windows = QWSServer::instance()->clientWindows();
- for (int i = windows.size() - 1; i >= 0; --i) {
- QWSWindow *win = windows.at(i);
- QWSWindowSurface *surface = win->windowSurface();
- if (!surface)
- continue;
-
- WindowInfo *info = windowMap[win];
-
- if (!info->texture) {
- if (surface->key() == QLatin1String("ahigl"))
- info->texture = static_cast<QAhiGLWindowSurface*>(surface)->textureId();
- else
- info->texture = createTexture(surface->image());
- }
- qreal progress;
- if (info->animation)
- progress = info->animation->currentValue();
- else
- progress = 1.0;
-
- glBindTexture(GL_TEXTURE_2D, info->texture);
- drawWindow(win, progress);
- } // for i
-//! [11] //! [12]
-
- // Draw cursor
-
- const QAhiGLCursor *cursor = d_ptr->cursor;
- if (cursor->texture) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glBindTexture(GL_TEXTURE_2D, d_ptr->cursor->texture);
- drawQuad(cursor->boundingRect(), cursor->boundingRect(),
- cursor->boundingRect());
- }
-
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
-
- eglSwapBuffers(d_ptr->eglDisplay, d_ptr->eglSurface);
-}
-//! [12]
-
-/*!
- \reimp
-
- */
-//! [13]
-void QAhiGLScreen::exposeRegion(QRegion r, int windowIndex)
-{
- if ((r & region()).isEmpty())
- return;
-
- invalidateTexture(windowIndex);
-
- if (!d_ptr->updateTimer.isActive())
- d_ptr->updateTimer.start(frameSpan);
-}
-//! [13]
-
-/*!
- \reimp
-
- This overloading of createSurface() is called on the client side to
- create a window surface for a new window. If the \a widget is a
- QGLWidget, or if the widget's width and height are both less than or
- equal to 256, it creates an instance of QAhiGLWindowSurface.
- Otherwise, it calls QScreen::createSurface() to create a non-OpenGL
- window surface. The pointer to the new window surface is returned.
-
- Note that this function first asks whether this application is the
- server, and it only creates an instance of QAhiGLWindowSurface if
- the answer is yes. What this means is we only let the server have
- access to the OpenGL hardware, because of an implementation
- restyriction in the OpenGL libraries we are using. Thus only clients
- that are in the server process get to create OpenGL window surfaces.
- */
-//! [14]
-QWSWindowSurface* QAhiGLScreen::createSurface(QWidget *widget) const
-{
- if (QApplication::type() == QApplication::GuiServer) {
- if (qobject_cast<QGLWidget*>(widget)) {
- return new QAhiGLWindowSurface(widget,
- d_ptr->eglDisplay,
- d_ptr->eglSurface,
- d_ptr->eglContext);
- }
-
- const QRect rect = widget->frameGeometry();
- if (rect.width() <= 256 && rect.height() <= 256) {
- return new QAhiGLWindowSurface(widget,
- d_ptr->eglDisplay,
- d_ptr->eglSurface,
- d_ptr->eglContext);
- }
- }
-
- return QScreen::createSurface(widget);
-}
-//! [14]
-
-/*!
- \reimp
-
- This overloading of createSurface() is called on the server side
- to manage a window surface corresponding to a window surface
- already created on the client side.
-
- If the \a key is "ahigl", create an instance of QAhiGLWindowSurface
- and return it. Otherwise, call QScreen::createSurface() and return
- the window surface it creates.
-
- See QScreen::createSurface().
- */
-//! [15]
-QWSWindowSurface* QAhiGLScreen::createSurface(const QString &key) const
-{
- if (key == QLatin1String("ahigl")) {
- return new QAhiGLWindowSurface(d_ptr->eglDisplay,
- d_ptr->eglSurface,
- d_ptr->eglContext);
- }
-
- return QScreen::createSurface(key);
-}
-//! [15]
-
-/*!
- This function would normally reset the frame buffer resolution
- according to \a width, \a height, and the bit \a depth. It would
- then notify other applications that their frame buffer size had
- changed so they could redraw. The function is a no-op in this
- example, which means the example screen driver can't change its
- frame buffer resolution. There is no significance to that in the
- example. You would normally implement setMode() in an OpenGL
- screen driver. This no-op reimplementation is required here
- because setMode() in QScreen is a pure virtual function.
-
- See QScreen::setMode()
- */
-void QAhiGLScreen::setMode(int width, int height, int depth)
-{
- Q_UNUSED(width);
- Q_UNUSED(height);
- Q_UNUSED(depth);
-}
-
-/*!
- This function would normally be reimplemented to prevent the
- screen driver from updating the screen if \a on is true. It is a
- no-op in this example, which means the screen driver can always
- update the screen.
-
- See QScreen::blank().
- */
-void QAhiGLScreen::blank(bool on)
-{
- Q_UNUSED(on);
-}
-
-/*!
- This function always returns true, since the purpose of
- this screen driver class is to implement an OpenGL ES
- screen driver. In some other class designed to handle both
- OpenGL and non-OpenGL graphics, it might test the system to
- determine whether OpenGL graphics are supported and return
- true or false accordingly.
- */
-bool QAhiGLScreen::hasOpenGL()
-{
- return true;
-}
-
-#include "qscreenahigl_qws.moc"
diff --git a/examples/qws/ahigl/qscreenahigl_qws.h b/examples/qws/ahigl/qscreenahigl_qws.h
deleted file mode 100644
index 2dc3dae..0000000
--- a/examples/qws/ahigl/qscreenahigl_qws.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 QAHIGLSCREEN_H
-#define QAHIGLSCREEN_H
-
-#include <QGLScreen>
-#include <QWSServer>
-
-QT_BEGIN_NAMESPACE
-class QAhiGLScreenPrivate;
-QT_END_NAMESPACE
-
-//! [0]
-class QAhiGLScreen : public QGLScreen
-{
-public:
- QAhiGLScreen(int displayId);
- virtual ~QAhiGLScreen();
-
- bool initDevice();
- bool connect(const QString &displaySpec);
- void disconnect();
- void shutdownDevice();
-
- void setMode(int width, int height, int depth);
- void blank(bool on);
-
- void exposeRegion(QRegion r, int changing);
-
- QWSWindowSurface* createSurface(QWidget *widget) const;
- QWSWindowSurface* createSurface(const QString &key) const;
-
- bool hasOpenGL();
-
-private:
- void invalidateTexture(int windowIndex);
- void redrawScreen();
- void drawWindow(QWSWindow *win, qreal progress);
- void drawQuad(const QRect &textureGeometry,
- const QRect &subGeometry,
- const QRect &screenGeometry);
- void drawQuadWavyFlag(const QRect &textureGeometry,
- const QRect &subTexGeometry,
- const QRect &screenGeometry,
- float progress);
-
- QAhiGLScreenPrivate *d_ptr;
- friend class QAhiGLScreenPrivate;
-};
-//! [0]
-
-#endif // QAHIGLSCREEN_H
diff --git a/examples/qws/ahigl/qscreenahiglplugin.cpp b/examples/qws/ahigl/qscreenahiglplugin.cpp
deleted file mode 100644
index 4fd1241..0000000
--- a/examples/qws/ahigl/qscreenahiglplugin.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 "qscreenahigl_qws.h"
-
-#include <QScreenDriverPlugin>
-#include <QStringList>
-
-//! [0]
-class QAhiGLScreenPlugin : public QScreenDriverPlugin
-{
-public:
- QAhiGLScreenPlugin();
-
- QStringList keys() const;
- QScreen *create(const QString&, int displayId);
-};
-//! [0]
-
-/*!
- \class QAhiGLScreenPlugin
- \brief The QAhiGLScreenPlugin class is the plugin for the ATI handheld device graphics driver.
-
- QAhiGLScreenPlugin inherits QScreenDriverPlugin. See
- \l{How to Create Qt Plugins} for details.
- */
-
-/*!
- This is the default constructor.
- */
-QAhiGLScreenPlugin::QAhiGLScreenPlugin()
- : QScreenDriverPlugin()
-{
-}
-
-/*!
- Returns a string list containing the string "ahigl" which
- is the only screen driver supported by this plugin.
- */
-QStringList QAhiGLScreenPlugin::keys() const
-{
- return (QStringList() << "ahigl");
-}
-
-/*!
- Creates a screen driver of the kind specified by \a driver.
- The \a displayId identifies the Qt for Embedded Linux server to connect to.
- */
-QScreen* QAhiGLScreenPlugin::create(const QString& driver, int displayId)
-{
- if (driver.toLower() != "ahigl")
- return 0;
-
- return new QAhiGLScreen(displayId);
-}
-
-//! [1]
-Q_EXPORT_PLUGIN2(qahiglscreen, QAhiGLScreenPlugin)
-//! [1]
diff --git a/examples/qws/ahigl/qwindowsurface_ahigl.cpp b/examples/qws/ahigl/qwindowsurface_ahigl.cpp
deleted file mode 100644
index 3466a27..0000000
--- a/examples/qws/ahigl/qwindowsurface_ahigl.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 "qwindowsurface_ahigl_p.h"
-#include "qscreenahigl_qws.h"
-
-#include <qwsdisplay_qws.h>
-#include <QtGui/QPaintDevice>
-#include <QtGui/QWidget>
-#include <QtOpenGL/private/qglpaintdevice_qws_p.h>
-#include <QtOpenGL/private/qgl_p.h>
-#include <GLES/gl.h>
-
-/*!
- \class QAhiGLWindowSurfacePrivate
- \internal
-
- \brief The QAhiGLWindowSurfacePrivate class is the private implementation
- class for class QAhiGLWindowSurface.
-
- This class contains only state variables.
- */
-//! [0]
-class QAhiGLWindowSurfacePrivate
-{
-public:
- QAhiGLWindowSurfacePrivate(EGLDisplay eglDisplay,
- EGLSurface eglSurface,
- EGLContext eglContext);
-
- QPaintDevice *device;
-
- int textureWidth;
- int textureHeight;
-
- GLuint texture;
- GLuint frameBufferObject;
- GLuint depthbuf;
-
- EGLDisplay display;
- EGLSurface surface;
- EGLContext context;
-};
-//! [0]
-
-/*!
- The construct just sets statwe variables using the ones
- provided.
- */
-QAhiGLWindowSurfacePrivate::QAhiGLWindowSurfacePrivate(EGLDisplay eglDisplay,
- EGLSurface eglSurface,
- EGLContext eglContext)
- : texture(0), frameBufferObject(0), depthbuf(0), display(eglDisplay),
- surface(eglSurface), context(eglContext)
-{
-}
-
-inline static int nextPowerOfTwo(uint v)
-{
- v--;
- v |= v >> 1;
- v |= v >> 2;
- v |= v >> 4;
- v |= v >> 8;
- v |= v >> 16;
- ++v;
- return v;
-}
-
-/*!
- \class QAhiGLWindowSurface
- \preliminary
- \internal
-
- \brief The QAhiGLWindowSurface class provides the drawing area
- for top-level windows using OpenGL for drawing on an ATI handheld
- device.
-
- In \l{Qt for Embedded Linux}, the default behavior for each client is to
- render widgets into an area of memory. The server then displays
- the contents of that memory on the screen. For ATI handheld
- devices using OpenGL, QAhiGLWindowSurface is the window surface
- class that allocates and manages the memory areas in the clients
- and the server.
-
- When a screen update is required, the server runs through all the
- top-level windows that intersect with the region being updated,
- ensuring that the clients have updated their window surfaces. Then
- the server uses the screen driver to copy the contents of the
- affected window surfaces into its composition and then display the
- composition on the screen.
-
- \tableofcontents
-
- \section1 Pure Virtual Functions
-
- There are two window surface instances for each top-level window.
- One is used by the application when drawing a window, and the
- other is used by the server application to make its copy for
- building a window composition to send to the screen.
-
- The key() function is implemented to uniquely identify this window
- surface class as "ahigl", and the isValid() function is
- implemented to determine whether the associated window is still
- acceptable for representation by this window surface class. It
- must either be a window using an \l {QGLWidget} {OpenGL widget},
- or it must be a window whose frame is no bigger than 256 x 256.
-
- The setGeometry() function is implemented to change the geometry
- of the frame buffer whenever the geometry of the associated
- top-level window changes. The image() function is called by the
- window system when building window compositions to return an image
- of the top-level window.
-
- The paintDevice() function is implemented to return the appropriate
- paint device.
-
- \section1 Virtual Functions
-
- When painting onto the surface, the window system will always call
- the beginPaint() function before any painting operations are
- performed. It ensures that the correct frame buffer will be used
- by the OpenGL library for painting operations. Likewise, the
- endPaint() function is automatically called when the painting is
- done, but it isn't implemented for this example.
-*/
-
-/*!
- This is the client side constructor.
- */
-//! [1]
-QAhiGLWindowSurface::QAhiGLWindowSurface(QWidget *widget,
- EGLDisplay eglDisplay,
- EGLSurface eglSurface,
- EGLContext eglContext)
- : QWSGLWindowSurface(widget)
-{
- d_ptr = new QAhiGLWindowSurfacePrivate(eglDisplay, eglSurface, eglContext);
- d_ptr->device = new QWSGLPaintDevice(widget);
-
- setSurfaceFlags(QWSWindowSurface::Buffered);
-}
-//! [1]
-
-/*!
- This is the server side constructor.
- */
-//! [2]
-QAhiGLWindowSurface::QAhiGLWindowSurface(EGLDisplay eglDisplay,
- EGLSurface eglSurface,
- EGLContext eglContext)
-{
- d_ptr = new QAhiGLWindowSurfacePrivate(eglDisplay, eglSurface, eglContext);
- setSurfaceFlags(QWSWindowSurface::Buffered);
-}
-//! [2]
-
-/*!
- The destructor deletes the OpenGL structures held by the
- private implementation class, and then it deletes the
- private implementation class.
- */
-QAhiGLWindowSurface::~QAhiGLWindowSurface()
-{
- if (d_ptr->texture)
- glDeleteTextures(1, &d_ptr->texture);
- if (d_ptr->depthbuf)
- glDeleteRenderbuffersOES(1, &d_ptr->depthbuf);
- if (d_ptr->frameBufferObject)
- glDeleteFramebuffersOES(1, &d_ptr->frameBufferObject);
-
- delete d_ptr;
-}
-
-/*!
- This function changes the geometry of the frame buffer
- to the geometry in \a rect. It is called whenever the
- geometry of the associated top-level window changes. It
- also rebuilds the window surface's texture and binds
- the OpenGL identifier to the texture for use by the
- OpenGL library.
- */
-//! [3]
-void QAhiGLWindowSurface::setGeometry(const QRect &rect)
-{
- QSize size = rect.size();
-
- const QWidget *w = window();
- if (w && !w->mask().isEmpty()) {
- const QRegion region = w->mask()
- & rect.translated(-w->geometry().topLeft());
- size = region.boundingRect().size();
- }
-
- if (geometry().size() != size) {
-
- // Driver specific limitations:
- // FBO maximimum size of 256x256
- // Depth buffer required
-
- d_ptr->textureWidth = qMin(256, nextPowerOfTwo(size.width()));
- d_ptr->textureHeight = qMin(256, nextPowerOfTwo(size.height()));
-
- glGenTextures(1, &d_ptr->texture);
- glBindTexture(GL_TEXTURE_2D, d_ptr->texture);
-
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- const int bufSize = d_ptr->textureWidth * d_ptr->textureHeight * 2;
- GLshort buf[bufSize];
- memset(buf, 0, sizeof(GLshort) * bufSize);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, d_ptr->textureWidth,
- d_ptr->textureHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, buf);
-
- glGenRenderbuffersOES(1, &d_ptr->depthbuf);
- glBindRenderbufferOES(GL_RENDERBUFFER_EXT, d_ptr->depthbuf);
- glRenderbufferStorageOES(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
- d_ptr->textureWidth, d_ptr->textureHeight);
-
- glGenFramebuffersOES(1, &d_ptr->frameBufferObject);
- glBindFramebufferOES(GL_FRAMEBUFFER_EXT, d_ptr->frameBufferObject);
-
- glFramebufferTexture2DOES(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, d_ptr->texture, 0);
- glFramebufferRenderbufferOES(GL_FRAMEBUFFER_EXT,
- GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, d_ptr->depthbuf);
- glBindFramebufferOES(GL_FRAMEBUFFER_EXT, 0);
- }
-
- QWSGLWindowSurface::setGeometry(rect);
-}
-//! [3]
-
-/*!
- Returns the window surface's texture as a QByteArray.
- */
-QByteArray QAhiGLWindowSurface::permanentState() const
-{
- QByteArray array;
- array.resize(sizeof(GLuint));
-
- char *ptr = array.data();
- reinterpret_cast<GLuint*>(ptr)[0] = textureId();
- return array;
-}
-
-/*!
- Sets the window surface's texture to \a data.
- */
-void QAhiGLWindowSurface::setPermanentState(const QByteArray &data)
-{
- const char *ptr = data.constData();
- d_ptr->texture = reinterpret_cast<const GLuint*>(ptr)[0];
-}
-
-/*!
- Returns the paint device being used for this window surface.
- */
-QPaintDevice *QAhiGLWindowSurface::paintDevice()
-{
- return d_ptr->device;
-}
-
-/*!
- Returns the window surface's texture.
- */
-GLuint QAhiGLWindowSurface::textureId() const
-{
- return d_ptr->texture;
-}
-
-/*!
- The \l {QWSServer} {window system} always calls this function
- before any painting operations begin for this window surface.
- It ensures that the correct frame buffer will be used by the
- OpenGL library for painting operations.
- */
-//! [4]
-void QAhiGLWindowSurface::beginPaint(const QRegion &region)
-{
- QWSGLWindowSurface::beginPaint(region);
-
- if (d_ptr->frameBufferObject)
- glBindFramebufferOES(GL_FRAMEBUFFER_EXT, d_ptr->frameBufferObject);
-}
-//! [4]
-
-/*!
- This function returns true if the window associated with
- this window surface can still rendered using this window
- surface class. Either the window's top-level widget must
- be an \l {QGLWidget} {OpenGL widget}, or the window's
- frame must be no bigger than 256 x 256.
- */
-//! [5]
-bool QAhiGLWindowSurface::isValid() const
-{
- if (!qobject_cast<QGLWidget*>(window())) {
- const QRect r = window()->frameGeometry();
- if (r.width() > 256 || r.height() > 256)
- return false;
- }
- return true;
-}
-//! [5]
diff --git a/examples/qws/ahigl/qwindowsurface_ahigl_p.h b/examples/qws/ahigl/qwindowsurface_ahigl_p.h
deleted file mode 100644
index bcb0509..0000000
--- a/examples/qws/ahigl/qwindowsurface_ahigl_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the examples 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 QWINDOWSURFACE_AHIGL_P_H
-#define QWINDOWSURFACE_AHIGL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QAhiGLWindowSurface class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtOpenGL/private/qglwindowsurface_qws_p.h>
-#include <GLES/gl.h>
-#include <GLES/egl.h>
-
-QT_BEGIN_NAMESPACE
-class QAhiGLWindowSurfacePrivate;
-QT_END_NAMESPACE
-
-//! [0]
-class QAhiGLWindowSurface : public QWSGLWindowSurface
-{
-public:
- QAhiGLWindowSurface(QWidget *widget, EGLDisplay eglDisplay,
- EGLSurface eglSurface, EGLContext eglContext);
- QAhiGLWindowSurface(EGLDisplay eglDisplay, EGLSurface eglSurface,
- EGLContext eglContext);
- ~QAhiGLWindowSurface();
-
- QString key() const { return QLatin1String("ahigl"); }
- void setGeometry(const QRect &rect);
- QPaintDevice *paintDevice();
- void beginPaint(const QRegion &region);
- bool isValid() const;
-
- QByteArray permanentState() const;
- void setPermanentState(const QByteArray &);
-
- QImage image() const { return QImage(); }
-
- GLuint textureId() const;
-
-private:
- QAhiGLWindowSurfacePrivate *d_ptr;
-};
-//! [0]
-
-#endif // QWINDOWSURFACE_AHIGL_P_H
diff --git a/examples/richtext/textobject/svgtextobject.cpp b/examples/richtext/textobject/svgtextobject.cpp
index f5810b6..cf0b0ba 100644
--- a/examples/richtext/textobject/svgtextobject.cpp
+++ b/examples/richtext/textobject/svgtextobject.cpp
@@ -46,7 +46,7 @@
#include "window.h"
//![0]
-QSizeF SvgTextObject::intrinsicSize(QTextDocument *doc, int posInDocument,
+QSizeF SvgTextObject::intrinsicSize(QTextDocument * /*doc*/, int /*posInDocument*/,
const QTextFormat &format)
{
QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData));
@@ -61,7 +61,7 @@ QSizeF SvgTextObject::intrinsicSize(QTextDocument *doc, int posInDocument,
//![1]
void SvgTextObject::drawObject(QPainter *painter, const QRectF &rect,
- QTextDocument *doc, int posInDocument,
+ QTextDocument * /*doc*/, int /*posInDocument*/,
const QTextFormat &format)
{
QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData));
diff --git a/examples/sql/drilldown/main.cpp b/examples/sql/drilldown/main.cpp
index 20f4cbf..f0b506e 100644
--- a/examples/sql/drilldown/main.cpp
+++ b/examples/sql/drilldown/main.cpp
@@ -59,5 +59,8 @@ int main(int argc, char *argv[])
#else
view.showFullScreen();
#endif
+#ifdef QT_KEYPAD_NAVIGATION
+ QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
+#endif
return app.exec();
}
diff --git a/examples/video/video.pro b/examples/video/video.pro
deleted file mode 100644
index f0b63b6..0000000
--- a/examples/video/video.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- videographicsitem \
- videowidget
-