summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-05-27 23:25:07 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-05-27 23:25:07 (GMT)
commitfb2e33b21557412ae7bde009662ca89870407f5f (patch)
tree61e7765a4e644d12a0addc21a0bf63e13e992cb9 /examples
parentd53e4499f864719446abdb7fdeff433dbb3f7d98 (diff)
parentfcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6 (diff)
downloadQt-fb2e33b21557412ae7bde009662ca89870407f5f.zip
Qt-fb2e33b21557412ae7bde009662ca89870407f5f.tar.gz
Qt-fb2e33b21557412ae7bde009662ca89870407f5f.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts: mkspecs/features/qt.prf src/corelib/animation/qanimationgroup.cpp src/corelib/animation/qparallelanimationgroup.cpp src/corelib/animation/qpauseanimation.cpp src/corelib/animation/qpropertyanimation.cpp src/corelib/animation/qsequentialanimationgroup.cpp src/corelib/kernel/kernel.pri src/corelib/kernel/qvariant_p.h src/corelib/tools/qeasingcurve.cpp src/gui/graphicsview/qgraphicsitem.cpp src/opengl/opengl.pro src/opengl/qgl_x11egl.cpp tests/auto/auto.pro
Diffstat (limited to 'examples')
-rw-r--r--examples/animation/README38
-rw-r--r--examples/animation/animatedtiles/animatedtiles.pro10
-rw-r--r--examples/animation/animatedtiles/main.cpp13
-rw-r--r--examples/animation/animation.pro2
-rw-r--r--examples/animation/appchooser/appchooser.pro5
-rw-r--r--examples/animation/appchooser/main.cpp3
-rw-r--r--examples/animation/easing/animation.h6
-rw-r--r--examples/animation/easing/easing.pro24
-rw-r--r--examples/animation/easing/easing.qrc (renamed from examples/animation/easing/resources.qrc)0
-rw-r--r--examples/animation/easing/main.cpp1
-rw-r--r--examples/animation/example/example.pro12
-rw-r--r--examples/animation/example/main.cpp53
-rw-r--r--examples/animation/example/mainwindow.cpp252
-rw-r--r--examples/animation/example/mainwindow.h75
-rw-r--r--examples/animation/moveblocks/main.cpp12
-rw-r--r--examples/animation/moveblocks/moveblocks.pro5
-rw-r--r--examples/animation/padnavigator-ng/backside.ui208
-rw-r--r--examples/animation/padnavigator-ng/images/artsfftscope.pngbin1294 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/blue_angle_swirl.jpgbin11826 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/kontact_contacts.pngbin4382 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/kontact_journal.pngbin3261 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/kontact_mail.pngbin3202 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/kontact_notes.pngbin3893 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/kopeteavailable.pngbin2380 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/metacontact_online.pngbin2545 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/images/minitools.pngbin2087 -> 0 bytes
-rw-r--r--examples/animation/padnavigator-ng/main.cpp54
-rw-r--r--examples/animation/padnavigator-ng/padnavigator.pro24
-rw-r--r--examples/animation/padnavigator-ng/padnavigator.qrc14
-rw-r--r--examples/animation/padnavigator-ng/panel.cpp246
-rw-r--r--examples/animation/padnavigator-ng/panel.h89
-rw-r--r--examples/animation/padnavigator-ng/roundrectitem.cpp136
-rw-r--r--examples/animation/padnavigator-ng/roundrectitem.h77
-rw-r--r--examples/animation/padnavigator-ng/splashitem.cpp85
-rw-r--r--examples/animation/padnavigator-ng/splashitem.h61
-rw-r--r--examples/animation/research/memberfunctions/main.cpp89
-rw-r--r--examples/animation/research/memberfunctions/memberfunctions.pro16
-rw-r--r--examples/animation/research/memberfunctions/qvalueanimation.cpp101
-rw-r--r--examples/animation/research/memberfunctions/qvalueanimation.h119
-rw-r--r--examples/animation/research/memberfunctions/qvalueanimation_p.h77
-rw-r--r--examples/animation/research/photobrowser/main.cpp82
-rw-r--r--examples/animation/research/photobrowser/menu.cpp155
-rw-r--r--examples/animation/research/photobrowser/menu.h80
-rw-r--r--examples/animation/research/photobrowser/photobrowser.pro17
-rw-r--r--examples/animation/research/photobrowser/river.cpp591
-rw-r--r--examples/animation/research/photobrowser/river.h111
-rw-r--r--examples/animation/research/photobrowser/riveritem.cpp125
-rw-r--r--examples/animation/research/photobrowser/riveritem.h66
-rw-r--r--examples/animation/research/piemenu/main.cpp56
-rw-r--r--examples/animation/research/piemenu/piemenu.pro8
-rw-r--r--examples/animation/research/piemenu/qgraphicspiemenu.cpp250
-rw-r--r--examples/animation/research/piemenu/qgraphicspiemenu.h104
-rw-r--r--examples/animation/research/piemenu/qgraphicspiemenu_p.h78
-rw-r--r--examples/animation/research/piemenu/qgraphicspiemenusection_p.h88
-rw-r--r--examples/animation/research/piemenu/scene.cpp73
-rw-r--r--examples/animation/research/piemenu/scene.h60
-rw-r--r--examples/animation/research/propertytransform/main.cpp88
-rw-r--r--examples/animation/research/propertytransform/propertytransform.pro14
-rw-r--r--examples/animation/research/propertytransform/qpropertytransform.h119
-rw-r--r--examples/animation/research/sound/main.cpp104
-rw-r--r--examples/animation/research/sound/media/sax.mp3bin417844 -> 0 bytes
-rw-r--r--examples/animation/research/sound/sound.pro14
-rw-r--r--examples/animation/research/sound/sound.qrc5
-rw-r--r--examples/animation/states/main.cpp8
-rw-r--r--examples/animation/stickman/animation.h2
-rw-r--r--examples/animation/stickman/editor/animationdialog.h2
-rw-r--r--examples/animation/stickman/lifecycle.cpp57
-rw-r--r--examples/animation/stickman/lifecycle.h4
-rw-r--r--examples/animation/stickman/node.cpp4
-rw-r--r--examples/animation/stickman/stickman.cpp6
-rw-r--r--examples/animation/stickman/stickman.h2
-rw-r--r--examples/animation/stickman/stickman.pro27
-rw-r--r--examples/animation/sub-attaq/animationmanager.cpp6
-rw-r--r--examples/animation/sub-attaq/animationmanager.h2
-rw-r--r--examples/animation/sub-attaq/boat.cpp10
-rw-r--r--examples/animation/sub-attaq/boat.h8
-rw-r--r--examples/animation/sub-attaq/boat_p.h19
-rw-r--r--examples/animation/sub-attaq/bomb.cpp8
-rw-r--r--examples/animation/sub-attaq/bomb.h9
-rw-r--r--examples/animation/sub-attaq/custompropertyanimation.cpp7
-rw-r--r--examples/animation/sub-attaq/custompropertyanimation.h8
-rw-r--r--examples/animation/sub-attaq/graphicsscene.cpp11
-rw-r--r--examples/animation/sub-attaq/graphicsscene.h9
-rw-r--r--examples/animation/sub-attaq/mainwindow.cpp6
-rw-r--r--examples/animation/sub-attaq/mainwindow.h3
-rw-r--r--examples/animation/sub-attaq/qanimationstate.cpp52
-rw-r--r--examples/animation/sub-attaq/qanimationstate.h4
-rw-r--r--examples/animation/sub-attaq/states.cpp7
-rw-r--r--examples/animation/sub-attaq/states.h11
-rw-r--r--examples/animation/sub-attaq/sub-attaq.pro15
-rw-r--r--examples/animation/sub-attaq/subattaq.qrc1
-rw-r--r--examples/animation/sub-attaq/submarine.cpp8
-rw-r--r--examples/animation/sub-attaq/submarine.h5
-rw-r--r--examples/animation/sub-attaq/submarine_p.h17
-rw-r--r--examples/animation/sub-attaq/torpedo.cpp6
-rw-r--r--examples/animation/sub-attaq/torpedo.h9
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/itemviews/puzzle/puzzle.pro5
-rw-r--r--examples/network/googlesuggest/googlesuggest.pro4
-rw-r--r--examples/opengl/framebufferobject/glwidget.cpp28
-rw-r--r--examples/opengl/framebufferobject/glwidget.h3
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.pro2
-rw-r--r--examples/qtconcurrent/qtconcurrent.pro5
-rw-r--r--examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro3
-rw-r--r--examples/statemachine/citizenquartz/citizenquartz.pro20
-rw-r--r--examples/statemachine/citizenquartz/citizenquartz.qrc6
-rw-r--r--examples/statemachine/citizenquartz/clock.cpp390
-rw-r--r--examples/statemachine/citizenquartz/clock.h62
-rw-r--r--examples/statemachine/citizenquartz/clockbutton.cpp39
-rw-r--r--examples/statemachine/citizenquartz/clockbutton.h25
-rw-r--r--examples/statemachine/citizenquartz/clockdisplay.cpp139
-rw-r--r--examples/statemachine/citizenquartz/clockdisplay.h89
-rw-r--r--examples/statemachine/citizenquartz/images/alarm.pngbin434 -> 0 bytes
-rw-r--r--examples/statemachine/citizenquartz/main.cpp23
-rw-r--r--examples/statemachine/citizenquartz/propertyaddstate.cpp46
-rw-r--r--examples/statemachine/citizenquartz/propertyaddstate.h33
-rw-r--r--examples/statemachine/citizenquartz/sound/alarm.wavbin3238264 -> 0 bytes
-rw-r--r--examples/statemachine/citizenquartz/timeperiod.h84
-rw-r--r--examples/statemachine/eventtransitions/eventtransitions.pro12
-rw-r--r--examples/statemachine/factorial/factorial.pro11
-rw-r--r--examples/statemachine/pingpong/pingpong.pro13
-rw-r--r--examples/statemachine/tankgame/gameitem.cpp41
-rw-r--r--examples/statemachine/tankgame/gameitem.h43
-rw-r--r--examples/statemachine/tankgame/gameovertransition.cpp45
-rw-r--r--examples/statemachine/tankgame/gameovertransition.h41
-rw-r--r--examples/statemachine/tankgame/main.cpp41
-rw-r--r--examples/statemachine/tankgame/mainwindow.cpp83
-rw-r--r--examples/statemachine/tankgame/mainwindow.h48
-rw-r--r--examples/statemachine/tankgame/plugin.h45
-rw-r--r--examples/statemachine/tankgame/rocketitem.cpp43
-rw-r--r--examples/statemachine/tankgame/rocketitem.h44
-rw-r--r--examples/statemachine/tankgame/tankgame.pro30
-rw-r--r--examples/statemachine/tankgame/tankitem.cpp73
-rw-r--r--examples/statemachine/tankgame/tankitem.h47
-rw-r--r--examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp41
-rw-r--r--examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h43
-rw-r--r--examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp57
-rw-r--r--examples/statemachine/tankgameplugins/seek_ai/seek_ai.h61
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp51
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai/spin_ai.h45
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp49
-rw-r--r--examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h45
-rw-r--r--examples/statemachine/trafficlight/trafficlight.pro7
-rw-r--r--examples/statemachine/twowaybutton/twowaybutton.pro12
-rw-r--r--examples/widgets/movie/movie.pro8
145 files changed, 1194 insertions, 5441 deletions
diff --git a/examples/animation/README b/examples/animation/README
new file mode 100644
index 0000000..6a892f8
--- /dev/null
+++ b/examples/animation/README
@@ -0,0 +1,38 @@
+The animation framework aims to provide an easy way for creating animated and
+smooth GUI's. By animating Qt properties, the framework provides great freedom
+for animating widgets and other QObjects. The framework can also be used with
+the Graphics View framework.
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/animation/animatedtiles/animatedtiles.pro b/examples/animation/animatedtiles/animatedtiles.pro
index 9e9062c..1840b17 100644
--- a/examples/animation/animatedtiles/animatedtiles.pro
+++ b/examples/animation/animatedtiles/animatedtiles.pro
@@ -1,2 +1,8 @@
-SOURCES += main.cpp
-RESOURCES += animatedtiles.qrc
+SOURCES = main.cpp
+RESOURCES = animatedtiles.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation/animatedtiles
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS animatedtiles.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation/animatedtiles
+INSTALLS += target sources
diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp
index a97eaf3..4b1d99d 100644
--- a/examples/animation/animatedtiles/main.cpp
+++ b/examples/animation/animatedtiles/main.cpp
@@ -40,18 +40,7 @@
****************************************************************************/
#include <QtGui>
-#ifdef QT_EXPERIMENTAL_SOLUTION
-# include "qgraphicswidget.h"
-# include "qstate.h"
-# include "qstatemachine.h"
-# include "qabstracttransition.h"
-# include "qgraphicswidget.h"
-# include "qparallelanimationgroup.h"
-# include "qpropertyanimation.h"
-# include "qsignaltransition.h"
-#else
#include <QtCore/qstate.h>
-#endif
class Pixmap : public QObject, public QGraphicsPixmapItem
{
@@ -143,6 +132,8 @@ protected:
int main(int argc, char **argv)
{
+ Q_INIT_RESOURCE(animatedtiles);
+
QApplication app(argc, argv);
QPixmap kineticPix(":/images/kinetic.png");
diff --git a/examples/animation/animation.pro b/examples/animation/animation.pro
index 0a57d3d..9a2874b 100644
--- a/examples/animation/animation.pro
+++ b/examples/animation/animation.pro
@@ -4,9 +4,7 @@ SUBDIRS += \
animatedtiles \
appchooser \
easing \
- example \
moveblocks \
- padnavigator-ng \
states \
stickman \
sub-attaq
diff --git a/examples/animation/appchooser/appchooser.pro b/examples/animation/appchooser/appchooser.pro
index 8cda19a..847b60a 100644
--- a/examples/animation/appchooser/appchooser.pro
+++ b/examples/animation/appchooser/appchooser.pro
@@ -1,6 +1,5 @@
-# Input
-SOURCES += main.cpp
-RESOURCES += appchooser.qrc
+SOURCES = main.cpp
+RESOURCES = appchooser.qrc
# install
target.path = $$[QT_INSTALL_EXAMPLES]/animation/appchooser
diff --git a/examples/animation/appchooser/main.cpp b/examples/animation/appchooser/main.cpp
index 1c63aba..44457f7 100644
--- a/examples/animation/appchooser/main.cpp
+++ b/examples/animation/appchooser/main.cpp
@@ -41,9 +41,6 @@
#include <QtCore>
#include <QtGui>
-#ifdef QT_EXPERIMENTAL_SOLUTION
-#include "qtgraphicswidget.h"
-#endif
class Pixmap : public QGraphicsWidget
diff --git a/examples/animation/easing/animation.h b/examples/animation/easing/animation.h
index c9472e1..d4d699d 100644
--- a/examples/animation/easing/animation.h
+++ b/examples/animation/easing/animation.h
@@ -44,11 +44,7 @@
#include <QtGui>
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qpropertyanimation.h"
-#else
-# include <QtCore/qpropertyanimation.h>
-#endif
+#include <QtCore/qpropertyanimation.h>
class Animation : public QPropertyAnimation {
public:
diff --git a/examples/animation/easing/easing.pro b/examples/animation/easing/easing.pro
index fa5b22d..8e8a35f 100644
--- a/examples/animation/easing/easing.pro
+++ b/examples/animation/easing/easing.pro
@@ -1,16 +1,14 @@
-######################################################################
-# Automatically generated by qmake (2.01a) to 2. okt 23:22:11 2008
-######################################################################
+HEADERS = window.h \
+ animation.h
+SOURCES = main.cpp \
+ window.cpp
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
+FORMS = form.ui
-# Input
-HEADERS += window.h animation.h
-SOURCES += main.cpp window.cpp
+RESOURCES = easing.qrc
-FORMS += form.ui
-
-RESOURCES = resources.qrc
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation/easing
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS easing.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation/easing
+INSTALLS += target sources
diff --git a/examples/animation/easing/resources.qrc b/examples/animation/easing/easing.qrc
index 7e112d3..7e112d3 100644
--- a/examples/animation/easing/resources.qrc
+++ b/examples/animation/easing/easing.qrc
diff --git a/examples/animation/easing/main.cpp b/examples/animation/easing/main.cpp
index 487fa86..bd10df2 100644
--- a/examples/animation/easing/main.cpp
+++ b/examples/animation/easing/main.cpp
@@ -44,6 +44,7 @@
int main(int argc, char **argv)
{
+ Q_INIT_RESOURCE(easing);
QApplication app(argc, argv);
Window w;
w.resize(400, 400);
diff --git a/examples/animation/example/example.pro b/examples/animation/example/example.pro
deleted file mode 100644
index bc79b82..0000000
--- a/examples/animation/example/example.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Thu Sep 25 14:03:47 2008
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-HEADERS += mainwindow.h
-SOURCES += main.cpp mainwindow.cpp
diff --git a/examples/animation/example/main.cpp b/examples/animation/example/main.cpp
deleted file mode 100644
index 1180b4f..0000000
--- a/examples/animation/example/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- //Q_INIT_RESOURCE(example);
- QApplication app(argc, argv);
- MainWindow w;
- w.show();
- return app.exec();
-}
-
diff --git a/examples/animation/example/mainwindow.cpp b/examples/animation/example/mainwindow.cpp
deleted file mode 100644
index 4aff384..0000000
--- a/examples/animation/example/mainwindow.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow() : QMainWindow(0)
-{
- // Text edit and button
- listWidget = new QListWidget;
- new QListWidgetItem("Rachel", listWidget);
- new QListWidgetItem("Andreas", listWidget);
- new QListWidgetItem("David", listWidget);
- new QListWidgetItem("Olivier", listWidget);
- new QListWidgetItem("Andy", listWidget);
- new QListWidgetItem("Martial", listWidget);
- new QListWidgetItem("Kazou", listWidget);
- new QListWidgetItem("Fred", listWidget);
- new QListWidgetItem("Ingrid", listWidget);
- QGraphicsProxyWidget *listProxy = new QGraphicsProxyWidget;
- listProxy->setWidget(listWidget);
-
- labelWidget = new QLabel;
- QGraphicsProxyWidget *labelProxy = new QGraphicsProxyWidget;
- labelProxy->setWidget(labelWidget);
- labelWidget->setAttribute(Qt::WA_NoSystemBackground);
-
- label2Widget = new QLabel;
- label2Widget->setAlignment(Qt::AlignCenter);
- QGraphicsProxyWidget *label2Proxy = new QGraphicsProxyWidget;
- label2Proxy->setWidget(label2Widget);
- label2Widget->setAttribute(Qt::WA_NoSystemBackground);
-
- editWidget = new QLineEdit;
- QGraphicsProxyWidget *editProxy = new QGraphicsProxyWidget;
- editProxy->setWidget(editWidget);
- editWidget->setAttribute(Qt::WA_NoSystemBackground);
-
- // Parent widget
- QGraphicsWidget *widget = new QGraphicsWidget;
- // Parent widget
- QGraphicsWidget *widget2 = new QGraphicsWidget;
-
- QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(Qt::Vertical, widget);
- vLayout->addItem(listProxy);
- vLayout->addItem(widget2);
- widget->setLayout(vLayout);
-
- QPushButton *button = new QPushButton;
- QGraphicsProxyWidget *buttonProxy = new QGraphicsProxyWidget;
- buttonProxy->setWidget(button);
-
- QPushButton *button2 = new QPushButton;
- QGraphicsProxyWidget *buttonProxy2 = new QGraphicsProxyWidget;
- buttonProxy2->setWidget(button2);
-
- QPushButton *button3 = new QPushButton;
- QGraphicsProxyWidget *buttonProxy3 = new QGraphicsProxyWidget;
- buttonProxy3->setWidget(button3);
-
- QPushButton *button4 = new QPushButton;
- QGraphicsProxyWidget *buttonProxy4 = new QGraphicsProxyWidget;
- buttonProxy4->setWidget(button4);
-
- QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout(Qt::Horizontal, widget2);
- hLayout->addItem(buttonProxy);
- hLayout->addItem(buttonProxy2);
- hLayout->addItem(buttonProxy3);
- widget2->setLayout(hLayout);
-
- scene = new QGraphicsScene(0, 0, 700, 600);
- scene->setBackgroundBrush(scene->palette().window());
- scene->addItem(widget);
- scene->addItem(editProxy);
- scene->addItem(label2Proxy);
- scene->addItem(labelProxy);
- scene->addItem(buttonProxy4);
-
- machine = new QStateMachine();
-
- group = new QState(machine->rootState());
- state1 = new QState(group);
- state2 = new QState(group);
- state3 = new QState(group);
- group->setInitialState(state1);
-
- machine->setInitialState(group);
-
- // State 1
- state1->assignProperty(button, "text", "Edit");
- state1->assignProperty(button2, "text", "Add");
- state1->assignProperty(button3, "text", "Remove");
- state1->assignProperty(button4, "text", "Accept");
- state1->addTransition(button2, SIGNAL(clicked()), state3);
- state1->assignProperty(listProxy, "geometry", QRectF(0, 0, 700, 560));
- state1->assignProperty(widget, "geometry", QRectF(0, 0, 700, 600));
- state1->assignProperty(editProxy, "opacity", double(0));
- state1->assignProperty(labelProxy, "opacity", double(0));
- state1->assignProperty(label2Proxy, "opacity", double(0));
- state1->assignProperty(buttonProxy4, "opacity", double(0));
- state1->assignProperty(labelWidget, "text", "Name : ");
- state1->assignProperty(label2Widget, "text", "Edit a contact");
- state1->assignProperty(label2Proxy, "geometry", QRectF(375, -50, 300, 30));
- state1->assignProperty(labelProxy, "geometry", QRectF(350, 300, 100, 30));
- state1->assignProperty(editProxy, "geometry", QRectF(750, 300, 250, 30));
- state1->assignProperty(buttonProxy4, "geometry", QRectF(500, 350, 80, 25));
-
- // State 2
- state2->assignProperty(button, "text", "Close Editing");
- state2->assignProperty(listProxy, "geometry", QRectF(0, 0, 350, 560));
- state2->addTransition(button2, SIGNAL(clicked()), state3);
- state2->addTransition(button4, SIGNAL(clicked()), state1);
-
- state2->assignProperty(editProxy, "opacity", double(1));
- state2->assignProperty(labelProxy, "opacity", double(1));
- state2->assignProperty(label2Proxy, "opacity", double(1));
- state2->assignProperty(buttonProxy4, "opacity", double(1));
-
- state2->assignProperty(label2Proxy, "geometry", QRectF(375, 250, 300, 30));
- state2->assignProperty(editProxy, "geometry", QRectF(440, 300, 260, 30));
-
- // State 3
- state3->assignProperty(button4, "text", "Create New");
- state3->assignProperty(listProxy, "geometry", QRectF(0, 0, 350, 560));
- state3->addTransition(button4, SIGNAL(clicked()), state1);
- state3->addTransition(button, SIGNAL(clicked()), state1);
- state3->assignProperty(editProxy, "opacity", double(1));
- state3->assignProperty(labelProxy, "opacity", double(1));
- state3->assignProperty(label2Proxy, "opacity", double(1));
- state3->assignProperty(buttonProxy4, "opacity", double(1));
-
- state3->assignProperty(label2Proxy, "geometry", QRectF(375, 250, 300, 30));
- state3->assignProperty(editProxy, "geometry", QRectF(440, 300, 260, 30));
-
- {
- QAnimationGroup *animationGroup = new QParallelAnimationGroup;
- QVariantAnimation *anim = new QPropertyAnimation(labelProxy, "opacity");
- animationGroup->addAnimation(anim);
- anim = new QPropertyAnimation(label2Proxy, "geometry");
- animationGroup->addAnimation(anim);
- anim = new QPropertyAnimation(editProxy, "geometry");
- animationGroup->addAnimation(anim);
- anim = new QPropertyAnimation(listProxy, "geometry");
- animationGroup->addAnimation(anim);
-
- QAbstractTransition *trans = state1->addTransition(button, SIGNAL(clicked()), state2);
- trans->addAnimation(animationGroup);
- }
-
- {
- QVariantAnimation *anim;
- QAnimationGroup *animationGroup = new QParallelAnimationGroup;
- anim = new QPropertyAnimation(label2Proxy, "geometry");
- animationGroup->addAnimation(anim);
- anim = new QPropertyAnimation(editProxy, "geometry");
- animationGroup->addAnimation(anim);
- anim = new QPropertyAnimation(listProxy, "geometry");
- animationGroup->addAnimation(anim);
- QAbstractTransition *trans = state2->addTransition(button, SIGNAL(clicked()), state1);
- trans->addAnimation(animationGroup);
- }
-
- currentState = state1;
-
- view = new QGraphicsView(scene);
-
- setCentralWidget(view);
-
- QObject::connect(state3, SIGNAL(entered()), this, SLOT(onEnterState3()));
- QObject::connect(state2, SIGNAL(entered()), this, SLOT(onEnterState2()));
- QObject::connect(state1, SIGNAL(entered()), this, SLOT(onEnterState1()));
-
- connect(listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemClicked(QListWidgetItem*)));
- connect(button3, SIGNAL(clicked()), this, SLOT(onRemoveClicked()));
-
- machine->start();
-}
-
-void MainWindow::onEnterState2()
-{
- currentState = state2;
- if (listWidget->currentItem())
- editWidget->setText(listWidget->currentItem()->text());
-}
-
-void MainWindow::onEnterState1()
-{
- if (currentState == state2 && listWidget->currentItem())
- listWidget->currentItem()->setText(editWidget->text());
- if (currentState == state3 && !editWidget->text().isNull()) {
- new QListWidgetItem(editWidget->text(), listWidget);
- editWidget->clear();
- }
- currentState = state1;
-}
-
-void MainWindow::onEnterState3()
-{
- currentState = state3;
-}
-
-void MainWindow::onItemClicked(QListWidgetItem*)
-{
- if (currentState == state2)
- {
- editWidget->setText(listWidget->currentItem()->text());
- editWidget->clear();
- }
-}
-
-void MainWindow::onRemoveClicked()
-{
- QListWidgetItem *listItem = listWidget->takeItem(listWidget->currentRow());
- delete listItem;
-}
diff --git a/examples/animation/example/mainwindow.h b/examples/animation/example/mainwindow.h
deleted file mode 100644
index 163eb89..0000000
--- a/examples/animation/example/mainwindow.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef __MAINWINDOW__H__
-#define __MAINWINDOW__H__
-
-#include <QtGui>
-
-class MainWindow : public QMainWindow
-{
-Q_OBJECT
-public:
- MainWindow();
-
-private slots :
- void onEnterState3();
- void onEnterState2();
- void onEnterState1();
- void onItemClicked(QListWidgetItem*);
- void onRemoveClicked();
-private:
- QListWidget *listWidget;
- QLabel *labelWidget;
- QLabel *label2Widget;
- QLineEdit *editWidget;
- QGraphicsScene *scene;
- QGraphicsView *view;
- QState *state1;
- QState *state2;
- QState *state3;
- QState *currentState;
- QState *group;
- QStateMachine *machine;
-};
-
-#endif //__MAINWINDOW__H__
-
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
index 0ce07fc..d315112 100644
--- a/examples/animation/moveblocks/main.cpp
+++ b/examples/animation/moveblocks/main.cpp
@@ -41,16 +41,6 @@
#include <QtCore>
#include <QtGui>
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qstatemachine.h"
-#include "qstate.h"
-#include "qabstracttransition.h"
-#include "qpropertyanimation.h"
-#include "qsequentialanimationgroup.h"
-#include "qparallelanimationgroup.h"
-#include "qgraphicswidget.h"
-#endif
-#include <time.h>
class StateSwitchEvent: public QEvent
{
@@ -297,7 +287,7 @@ int main(int argc, char **argv)
window.resize(300, 300);
window.show();
- qsrand(time(0));
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
return app.exec();
}
diff --git a/examples/animation/moveblocks/moveblocks.pro b/examples/animation/moveblocks/moveblocks.pro
index 7a82ca5..b8e88b2 100644
--- a/examples/animation/moveblocks/moveblocks.pro
+++ b/examples/animation/moveblocks/moveblocks.pro
@@ -1,8 +1,7 @@
-# Input
-SOURCES += main.cpp
+SOURCES = main.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/animation/moveblocks
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS states.pro
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS moveblocks.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/animation/moveblocks
INSTALLS += target sources
diff --git a/examples/animation/padnavigator-ng/backside.ui b/examples/animation/padnavigator-ng/backside.ui
deleted file mode 100644
index afa488c..0000000
--- a/examples/animation/padnavigator-ng/backside.ui
+++ /dev/null
@@ -1,208 +0,0 @@
-<ui version="4.0" >
- <class>BackSide</class>
- <widget class="QWidget" name="BackSide" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>378</width>
- <height>385</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>BackSide</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2" >
- <item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
- <string>Settings</string>
- </property>
- <property name="flat" >
- <bool>true</bool>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Title:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="hostName" >
- <property name="text" >
- <string>Pad Navigator Example</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Modified:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Extent</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <widget class="QSlider" name="horizontalSlider" >
- <property name="value" >
- <number>42</number>
- </property>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="spinBox" >
- <property name="value" >
- <number>42</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="1" >
- <widget class="QDateTimeEdit" name="dateTimeEdit" />
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2" >
- <property name="title" >
- <string>Other input</string>
- </property>
- <property name="flat" >
- <bool>true</bool>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2" >
- <item>
- <widget class="QTreeWidget" name="treeWidget" >
- <column>
- <property name="text" >
- <string>Widgets On Graphics View</string>
- </property>
- </column>
- <item>
- <property name="text" >
- <string>QGraphicsProxyWidget</string>
- </property>
- <item>
- <property name="text" >
- <string>QGraphicsWidget</string>
- </property>
- <item>
- <property name="text" >
- <string>QObject</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>QGraphicsItem</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>QGraphicsLayoutItem</string>
- </property>
- </item>
- </item>
- </item>
- <item>
- <property name="text" >
- <string>QGraphicsGridLayout</string>
- </property>
- <item>
- <property name="text" >
- <string>QGraphicsLayout</string>
- </property>
- <item>
- <property name="text" >
- <string>QGraphicsLayoutItem</string>
- </property>
- </item>
- </item>
- </item>
- <item>
- <property name="text" >
- <string>QGraphicsLinearLayout</string>
- </property>
- <item>
- <property name="text" >
- <string>QGraphicsLayout</string>
- </property>
- <item>
- <property name="text" >
- <string>QGraphicsLayoutItem</string>
- </property>
- </item>
- </item>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>groupBox</tabstop>
- <tabstop>hostName</tabstop>
- <tabstop>dateTimeEdit</tabstop>
- <tabstop>horizontalSlider</tabstop>
- <tabstop>spinBox</tabstop>
- <tabstop>groupBox_2</tabstop>
- <tabstop>treeWidget</tabstop>
- </tabstops>
- <resources/>
- <connections>
- <connection>
- <sender>horizontalSlider</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinBox</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>184</x>
- <y>125</y>
- </hint>
- <hint type="destinationlabel" >
- <x>275</x>
- <y>127</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinBox</sender>
- <signal>valueChanged(int)</signal>
- <receiver>horizontalSlider</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>272</x>
- <y>114</y>
- </hint>
- <hint type="destinationlabel" >
- <x>190</x>
- <y>126</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/animation/padnavigator-ng/images/artsfftscope.png b/examples/animation/padnavigator-ng/images/artsfftscope.png
deleted file mode 100644
index b4b8775..0000000
--- a/examples/animation/padnavigator-ng/images/artsfftscope.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/blue_angle_swirl.jpg b/examples/animation/padnavigator-ng/images/blue_angle_swirl.jpg
deleted file mode 100644
index 5bf0deb..0000000
--- a/examples/animation/padnavigator-ng/images/blue_angle_swirl.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_contacts.png b/examples/animation/padnavigator-ng/images/kontact_contacts.png
deleted file mode 100644
index 6fb4cc8..0000000
--- a/examples/animation/padnavigator-ng/images/kontact_contacts.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_journal.png b/examples/animation/padnavigator-ng/images/kontact_journal.png
deleted file mode 100644
index b1fedb6..0000000
--- a/examples/animation/padnavigator-ng/images/kontact_journal.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_mail.png b/examples/animation/padnavigator-ng/images/kontact_mail.png
deleted file mode 100644
index 672f8fa..0000000
--- a/examples/animation/padnavigator-ng/images/kontact_mail.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_notes.png b/examples/animation/padnavigator-ng/images/kontact_notes.png
deleted file mode 100644
index 229bf73..0000000
--- a/examples/animation/padnavigator-ng/images/kontact_notes.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kopeteavailable.png b/examples/animation/padnavigator-ng/images/kopeteavailable.png
deleted file mode 100644
index 2eaf41a..0000000
--- a/examples/animation/padnavigator-ng/images/kopeteavailable.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/metacontact_online.png b/examples/animation/padnavigator-ng/images/metacontact_online.png
deleted file mode 100644
index 6a398dd..0000000
--- a/examples/animation/padnavigator-ng/images/metacontact_online.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/minitools.png b/examples/animation/padnavigator-ng/images/minitools.png
deleted file mode 100644
index 0248c9d..0000000
--- a/examples/animation/padnavigator-ng/images/minitools.png
+++ /dev/null
Binary files differ
diff --git a/examples/animation/padnavigator-ng/main.cpp b/examples/animation/padnavigator-ng/main.cpp
deleted file mode 100644
index f8b167f..0000000
--- a/examples/animation/padnavigator-ng/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include "panel.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Q_INIT_RESOURCE(padnavigator);
-
- Panel panel(3, 3);
- panel.show();
-
- return app.exec();
-}
diff --git a/examples/animation/padnavigator-ng/padnavigator.pro b/examples/animation/padnavigator-ng/padnavigator.pro
deleted file mode 100644
index 0d094c6..0000000
--- a/examples/animation/padnavigator-ng/padnavigator.pro
+++ /dev/null
@@ -1,24 +0,0 @@
-HEADERS += \
- panel.h \
- roundrectitem.h \
- splashitem.h
-
-SOURCES += \
- panel.cpp \
- roundrectitem.cpp \
- splashitem.cpp \
- main.cpp
-
-RESOURCES += \
- padnavigator.qrc
-
-FORMS += \
- backside.ui
-
-contains(QT_CONFIG, opengl):QT += opengl
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/padnavigator
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS padnavigator.pro images
-sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/padnavigator
-INSTALLS += target sources
diff --git a/examples/animation/padnavigator-ng/padnavigator.qrc b/examples/animation/padnavigator-ng/padnavigator.qrc
deleted file mode 100644
index 30ee8e1..0000000
--- a/examples/animation/padnavigator-ng/padnavigator.qrc
+++ /dev/null
@@ -1,14 +0,0 @@
-<RCC>
- <qresource>
- <file>images/blue_angle_swirl.jpg</file>
- <file>images/artsfftscope.png</file>
- <file>images/kontact_contacts.png</file>
- <file>images/kontact_journal.png</file>
- <file>images/kontact_mail.png</file>
- <file>images/kontact_notes.png</file>
- <file>images/kopeteavailable.png</file>
- <file>images/metacontact_online.png</file>
- <file>images/minitools.png</file>
- <file>images/blue_angle_swirl.jpg</file>
- </qresource>
-</RCC>
diff --git a/examples/animation/padnavigator-ng/panel.cpp b/examples/animation/padnavigator-ng/panel.cpp
deleted file mode 100644
index e61be0e..0000000
--- a/examples/animation/padnavigator-ng/panel.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "panel.h"
-#include "roundrectitem.h"
-#include "splashitem.h"
-#include "ui_backside.h"
-
-#ifndef QT_NO_OPENGL
-#include <QtOpenGL/QtOpenGL>
-#else
-#endif
-#include <QtGui/QtGui>
-
-Panel::Panel(int width, int height)
- : selectedIndex(0),
- grid(width*height),
- width(width),
- height(height),
- flipped(false),
- flippingGroup(0),
- rotationXanim(0),
- rotationYanim(0)
-{
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setCacheMode(CacheBackground);
- setViewportUpdateMode(FullViewportUpdate);
- setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
- setBackgroundBrush(QPixmap(":/images/blue_angle_swirl.jpg"));
-#ifndef QT_NO_OPENGL
- setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
-#endif
-
- QRectF bounds((-width / 2.0) * 150, (-height / 2.0) * 150, width * 150, height * 150);
-
- setScene(new QGraphicsScene(bounds, this));
-
- baseItem = new RoundRectItem(bounds, QColor(226, 255, 92, 64));
- scene()->addItem(baseItem);
-
- QWidget *embed = new QWidget;
- ui = new Ui_BackSide;
- ui->setupUi(embed);
- ui->hostName->setFocus();
-
- backItem = new RoundRectItem(bounds, embed->palette().window(), embed);
- backItem->setYRotation(180);
- backItem->setParentItem(baseItem);
-
- selectionItem = new RoundRectItem(QRectF(-60, -60, 120, 120), Qt::gray);
- selectionItem->setParentItem(baseItem);
- selectionItem->setZValue(-1);
- selectionItem->setPos(posForLocation(0));
-
- int currentIndex = 0;
- for (int y = 0; y < height; ++y) {
- for (int x = 0; x < width; ++x) {
- RoundRectItem *item = new RoundRectItem(QRectF(-54, -54, 108, 108),
- QColor(214, 240, 110, 128));
- item->setPos(posForLocation(currentIndex));
-
- item->setParentItem(baseItem);
- item->setFlag(QGraphicsItem::ItemIsFocusable);
- grid[currentIndex++] = item;
-
- switch (qrand() % 9) {
- case 0: item->setPixmap(QPixmap(":/images/kontact_contacts.png")); break;
- case 1: item->setPixmap(QPixmap(":/images/kontact_journal.png")); break;
- case 2: item->setPixmap(QPixmap(":/images/kontact_notes.png")); break;
- case 3: item->setPixmap(QPixmap(":/images/kopeteavailable.png")); break;
- case 4: item->setPixmap(QPixmap(":/images/metacontact_online.png")); break;
- case 5: item->setPixmap(QPixmap(":/images/minitools.png")); break;
- case 6: item->setPixmap(QPixmap(":/images/kontact_journal.png")); break;
- case 7: item->setPixmap(QPixmap(":/images/kontact_contacts.png")); break;
- case 8: item->setPixmap(QPixmap(":/images/kopeteavailable.png")); break;
- default:
- break;
- }
-
- connect(item, SIGNAL(activated()), this, SLOT(flip()));
- }
- }
-
- grid.first()->setFocus();
-
- connect(backItem, SIGNAL(activated()),
- this, SLOT(flip()));
-
- splash = new SplashItem;
- splash->setZValue(5);
- splash->setPos(-splash->rect().width() / 2, scene()->sceneRect().top());
- scene()->addItem(splash);
-
- splash->grabKeyboard();
-
- //initialize the position
- baseItem->setYRotation(selectionItem->x()/6.);
- baseItem->setXRotation(selectionItem->y()/6.);
-
- setWindowTitle(tr("Pad Navigator Example"));
-}
-
-Panel::~Panel()
-{
-}
-
-void Panel::keyPressEvent(QKeyEvent *event)
-{
- if (splash->isVisible() || event->key() == Qt::Key_Return || flipped) {
- QGraphicsView::keyPressEvent(event);
- return;
- }
-
- selectedIndex = (selectedIndex + grid.count() + (event->key() == Qt::Key_Right) - (event->key() == Qt::Key_Left)
- + width * ((event->key() == Qt::Key_Down) - (event->key() == Qt::Key_Up))) % grid.count();
- grid[selectedIndex]->setFocus();
-
- const QPointF pos = posForLocation(selectedIndex);
-
- const double angleY = pos.x() / 6.,
- angleX = pos.y() / 6.;
-
- QAnimationGroup *group = new QParallelAnimationGroup();
-
- QVariantAnimation *anim = new QPropertyAnimation(baseItem, "xRotation");
- anim->setEndValue(angleX);
- anim->setDuration(150);
- anim->setEasingCurve(QEasingCurve::OutInSine);
- group->addAnimation(anim);
-
- anim = new QPropertyAnimation(baseItem, "yRotation");
- anim->setEndValue(angleY);
- anim->setDuration(150);
- anim->setEasingCurve(QEasingCurve::OutInSine);
- group->addAnimation(anim);
-
- anim = new QPropertyAnimation(selectionItem, "pos");
- anim->setEndValue(pos);
- anim->setDuration(150);
- anim->setEasingCurve(QEasingCurve::Linear);
- group->addAnimation(anim);
-
- group->start(QAbstractAnimation::DeleteWhenStopped);
-}
-
-void Panel::resizeEvent(QResizeEvent *event)
-{
- QGraphicsView::resizeEvent(event);
- fitInView(scene()->sceneRect(), Qt::KeepAspectRatio);
-}
-
-void Panel::flip()
-{
- grid[selectedIndex]->setFocus();
-
- if (flippingGroup == 0) {
- flippingGroup = new QParallelAnimationGroup(this);
-
- const qreal zoomOut = qreal(.75);
-
- //slight scaling down while flipping
- QVariantAnimation *anim = new QPropertyAnimation(baseItem, "yScale");
- anim->setKeyValueAt(qreal(.5), zoomOut);
- anim->setEndValue(1);
- anim->setEasingCurve(QEasingCurve::OutInSine);
- anim->setDuration(500);
- flippingGroup->addAnimation(anim);
-
- anim = new QPropertyAnimation(baseItem, "xScale");
- anim->setKeyValueAt(qreal(.5), zoomOut);
- anim->setEndValue(1);
- anim->setEasingCurve(QEasingCurve::OutInSine);
- anim->setDuration(500);
- flippingGroup->addAnimation(anim);
-
- rotationXanim = new QPropertyAnimation(baseItem, "xRotation");
- rotationXanim->setEndValue(0);
- rotationXanim->setDuration(500);
- flippingGroup->addAnimation(rotationXanim);
-
- rotationYanim = new QPropertyAnimation(baseItem, "yRotation");
- rotationYanim->setEndValue(180);
- rotationYanim->setDuration(500);
- flippingGroup->addAnimation(rotationYanim);
- }
-
- if (flippingGroup->currentTime() != 0 && flippingGroup->direction() == QAbstractAnimation::Forward) {
- flippingGroup->setDirection(QAbstractAnimation::Backward);
- } else {
- flippingGroup->setDirection(QAbstractAnimation::Forward);
- if (flippingGroup->currentTime() == 0) {
- //we always make sure when it is at the beginning
- rotationXanim->setStartValue(baseItem->xRotation());
- rotationYanim->setStartValue(baseItem->yRotation());
- }
- }
- flippingGroup->start();
- flipped = !flipped;
-}
-
-QPointF Panel::posForLocation(int index) const
-{
- const int x = index % width,
- y = index / width;
- return QPointF(x * 150, y * 150)
- - QPointF((width - 1) * 75, (height - 1) * 75);
-}
diff --git a/examples/animation/padnavigator-ng/panel.h b/examples/animation/padnavigator-ng/panel.h
deleted file mode 100644
index 35d0db5..0000000
--- a/examples/animation/padnavigator-ng/panel.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/qgraphicsview.h>
-#ifdef QT_EXPERIMENTAL_SOLUTION
-#include "qtgraphicswidget.h"
-#else
-#include <QtGui/qgraphicswidget.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-class Ui_BackSide;
-QT_END_NAMESPACE;
-
-class RoundRectItem;
-class QAnimationGroup;
-class QPropertyAnimation;
-
-class Panel : public QGraphicsView
-{
- Q_OBJECT
-public:
- Panel(int width, int height);
- ~Panel();
-
-protected:
- void keyPressEvent(QKeyEvent *event);
- void resizeEvent(QResizeEvent *event);
-
-private Q_SLOTS:
- void flip();
-
-private:
- QPointF posForLocation(int index) const;
-
- QGraphicsWidget *selectionItem;
- QGraphicsWidget *baseItem;
- RoundRectItem *backItem;
- QGraphicsWidget *splash;
- int selectedIndex;
-
- QVector<QGraphicsItem*> grid;
-
- int width;
- int height;
- bool flipped;
- Ui_BackSide *ui;
-
- QAnimationGroup *flippingGroup;
- QPropertyAnimation *rotationXanim, *rotationYanim;
-};
diff --git a/examples/animation/padnavigator-ng/roundrectitem.cpp b/examples/animation/padnavigator-ng/roundrectitem.cpp
deleted file mode 100644
index 7e7d423..0000000
--- a/examples/animation/padnavigator-ng/roundrectitem.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "roundrectitem.h"
-
-#include <QtGui/QtGui>
-
-RoundRectItem::RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget)
- : QGraphicsWidget(),
- brush(brush),
- proxyWidget(0),
- m_rect(rect)
-{
- if (embeddedWidget) {
- proxyWidget = new QGraphicsProxyWidget(this);
- proxyWidget->setFocusPolicy(Qt::StrongFocus);
- proxyWidget->setWidget(embeddedWidget);
- }
-}
-
-void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
- const bool widgetHidden = parentItem() == 0 || qAbs(static_cast<QGraphicsWidget*>(parentItem())->yRotation()) < 90;
-
- if (proxyWidget) {
- if (widgetHidden) {
- proxyWidget->hide();
- } else {
- if (!proxyWidget->isVisible()) {
- proxyWidget->setGeometry(boundingRect().adjusted(25, 25, -25, -25));
- proxyWidget->show();
- proxyWidget->setFocus();
- }
- painter->setBrush(brush);
- painter->setPen(QPen(Qt::black, 1));
- painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
- painter->drawRoundRect(m_rect);
- }
- } else if (widgetHidden) {
- painter->setPen(Qt::NoPen);
- painter->setBrush(QColor(0, 0, 0, 64));
- painter->drawRoundRect(m_rect.translated(2, 2));
-
- QLinearGradient gradient(m_rect.topLeft(), m_rect.bottomRight());
- const QColor col = brush.color();
- gradient.setColorAt(0, col);
- gradient.setColorAt(1, col.dark(200));
- painter->setBrush(gradient);
- painter->setPen(QPen(Qt::black, 1));
- painter->drawRoundRect(m_rect);
- if (!pix.isNull()) {
- painter->scale(qreal(1.95), qreal(1.95));
- painter->drawPixmap(-pix.width() / 2, -pix.height() / 2, pix);
- }
- }
-
-}
-
-QRectF RoundRectItem::boundingRect() const
-{
- qreal penW = qreal(.5);
- qreal shadowW = 2;
- return m_rect.adjusted(-penW, -penW, penW + shadowW, penW + shadowW);
-}
-
-void RoundRectItem::setPixmap(const QPixmap &pixmap)
-{
- pix = pixmap;
- if (scene() && isVisible())
- update();
-}
-
-void RoundRectItem::keyPressEvent(QKeyEvent *event)
-{
- if (event->isAutoRepeat() || event->key() != Qt::Key_Return) {
- QGraphicsWidget::keyPressEvent(event);
- return;
- }
-
- if (!proxyWidget) {
- setXScale(qreal(.9));
- setYScale(qreal(.9));
- }
- emit activated();
-}
-
-void RoundRectItem::keyReleaseEvent(QKeyEvent *event)
-{
- if (event->isAutoRepeat() || event->key() != Qt::Key_Return) {
- QGraphicsWidget::keyReleaseEvent(event);
- return;
- }
-
- if (!proxyWidget) {
- setXScale(1);
- setYScale(1);
- }
-}
diff --git a/examples/animation/padnavigator-ng/roundrectitem.h b/examples/animation/padnavigator-ng/roundrectitem.h
deleted file mode 100644
index fb142c6..0000000
--- a/examples/animation/padnavigator-ng/roundrectitem.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qobject.h>
-#include <QtGui/qbrush.h>
-#ifdef QT_EXPERIMENTAL_SOLUTION
-#include "qtgraphicswidget.h"
-#else
-#include <QtGui/qgraphicswidget.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-class QGraphicsProxyWidget;
-QT_END_NAMESPACE;
-
-class RoundRectItem : public QGraphicsWidget
-{
- Q_OBJECT
-public:
- RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget = 0);
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
- QRectF boundingRect() const;
-
- void setPixmap(const QPixmap &pixmap);
-
-Q_SIGNALS:
- void activated();
-
-protected:
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
-
-private:
- QRectF m_rect;
- QBrush brush;
- QPixmap pix;
- QGraphicsProxyWidget *proxyWidget;
-};
diff --git a/examples/animation/padnavigator-ng/splashitem.cpp b/examples/animation/padnavigator-ng/splashitem.cpp
deleted file mode 100644
index 1264987..0000000
--- a/examples/animation/padnavigator-ng/splashitem.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "splashitem.h"
-
-#include <QtGui/QtGui>
-
-SplashItem::SplashItem(QGraphicsItem *parent)
- : QGraphicsWidget(parent)
-{
-
- text = tr("Welcome to the Pad Navigator Example. You can use the"
- " keyboard arrows to navigate the icons, and press enter"
- " to activate an item. Please press any key to continue.");
- resize(400, 175);
-}
-
-void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
- painter->setPen(QPen(Qt::black, 2));
- painter->setBrush(QColor(245, 245, 255, 220));
- painter->setClipRect(rect());
- painter->drawRoundRect(3, -100 + 3, 400 - 6, 250 - 6);
-
- QRectF textRect = rect().adjusted(10, 10, -10, -10);
- int flags = Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap;
-
- QFont font;
- font.setPixelSize(18);
- painter->setPen(Qt::black);
- painter->setFont(font);
- painter->drawText(textRect, flags, text);
-}
-
-void SplashItem::keyPressEvent(QKeyEvent * /* event */)
-{
- QVariantAnimation *anim = new QPropertyAnimation(this, "pos");
- anim->setEndValue(QPointF(x(), scene()->sceneRect().top() - rect().height()));
- anim->setDuration(350);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-
- anim = new QPropertyAnimation(this, "opacity");
- anim->setEndValue(0);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-
- connect(anim, SIGNAL(finished()), SLOT(close()));
-}
diff --git a/examples/animation/padnavigator-ng/splashitem.h b/examples/animation/padnavigator-ng/splashitem.h
deleted file mode 100644
index 05ff040..0000000
--- a/examples/animation/padnavigator-ng/splashitem.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qobject.h>
-#ifdef QT_EXPERIMENTAL_SOLUTION
-#include "qtgraphicswidget.h"
-#else
-#include <QtGui/qgraphicswidget.h>
-#endif
-
-class SplashItem : public QGraphicsWidget
-{
- Q_OBJECT
-public:
- SplashItem(QGraphicsItem *parent = 0);
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
-
-protected:
- void keyPressEvent(QKeyEvent *event);
-
-private:
- QString text;
-};
diff --git a/examples/animation/research/memberfunctions/main.cpp b/examples/animation/research/memberfunctions/main.cpp
deleted file mode 100644
index 2663f9c..0000000
--- a/examples/animation/research/memberfunctions/main.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include "qvalueanimation.h"
-
-AbstractProperty *qGraphicsItemProperty(QGraphicsItem *item, const char *property)
-{
- if (qstrcmp(property, "pos") == 0) {
- return new MemberFunctionProperty<QGraphicsItem, QPointF>(item, &QGraphicsItem::pos, &QGraphicsItem::setPos);
- }
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QGraphicsScene scene;
- QGraphicsView view(&scene);
-
- QGraphicsItem *item = new QGraphicsRectItem(QRectF(0,0, 200, 100));
- scene.addItem(item);
-
- QValueAnimation *posAnim = new QValueAnimation;
- posAnim->setStartValue(QPointF(0,0));
- posAnim->setEndValue(QPointF(400, 0));
- posAnim->setDuration(1000);
- // Alternative 1
- //posAnim->setMemberFunction(item, &QGraphicsItem::pos, &QGraphicsItem::setPos);
-
- // Alternative 2
- //posAnim->setProperty(qMemberFunctionProperty(item, &QGraphicsItem::pos, &QGraphicsItem::setPos));
-
- // Alternative 3
- posAnim->setProperty(qGraphicsItemProperty(item, "pos"));
-
- // Alternative 4, (by implementing the qGraphicsItemProperty QGraphicsItem::property())
- //posAnim->setProperty(item->property("pos"));
-
- // can also do this, which abstracts away the whole property thing.
- // i.e. this interface can also be used for QObject-properties:
- //posAnim->setAnimationProperty(animationProperty);
-
- posAnim->start();
-
- view.resize(800,600);
- view.show();
- return app.exec();
-}
-
diff --git a/examples/animation/research/memberfunctions/memberfunctions.pro b/examples/animation/research/memberfunctions/memberfunctions.pro
deleted file mode 100644
index 6b67895..0000000
--- a/examples/animation/research/memberfunctions/memberfunctions.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) fr 26. sep 13:21:57 2008
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp \
- qvalueanimation.cpp
-HEADERS += qvalueanimation.h
-
-CONFIG += console
-
diff --git a/examples/animation/research/memberfunctions/qvalueanimation.cpp b/examples/animation/research/memberfunctions/qvalueanimation.cpp
deleted file mode 100644
index de0b8ff..0000000
--- a/examples/animation/research/memberfunctions/qvalueanimation.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvalueanimation.h"
-#include "qvalueanimation_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-void QValueAnimationPrivate::initDefaultStartValue()
-{
- Q_Q(QValueAnimation);
- if (animProp && !q->startValue().isValid()
- && (currentTime == 0
- || (currentTime == duration && currentLoop == (loopCount - 1)))) {
- setDefaultStartValue(animProp->read());
- }
-}
-
-
-QValueAnimation::QValueAnimation(QObject *parent) : QVariantAnimation(*new QValueAnimationPrivate, parent)
-{
-}
-
-QValueAnimation::~QValueAnimation()
-{
-}
-
-void QValueAnimation::setProperty(AbstractProperty *animProp)
-{
- Q_D(QValueAnimation);
- d->animProp = animProp;
-}
-
-/*!
- \reimp
- */
-void QValueAnimation::updateCurrentValue(const QVariant &value)
-{
- Q_D(QValueAnimation);
- if (state() == QAbstractAnimation::Stopped)
- return;
-
- d->animProp->write(value);
-}
-
-
-/*!
- \reimp
-*/
-void QValueAnimation::updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
-{
- Q_D(QValueAnimation);
- // Initialize start value
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running)
- d->initDefaultStartValue();
-}
-
-
-
-#include "moc_qvalueanimation.cpp"
-
-QT_END_NAMESPACE
diff --git a/examples/animation/research/memberfunctions/qvalueanimation.h b/examples/animation/research/memberfunctions/qvalueanimation.h
deleted file mode 100644
index 55c4993..0000000
--- a/examples/animation/research/memberfunctions/qvalueanimation.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVALUEANIMATION_H
-#define QVALUEANIMATION_H
-
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qvariantanimation.h"
-#else
-# include <QtCore/qvariantanimation.h>
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsItem;
-class QValueAnimationPrivate;
-
-QT_MODULE(Gui)
-
-struct AbstractProperty {
- virtual void write(const QVariant &value) = 0;
- virtual QVariant read() const = 0;
-};
-
-# define CALL_MEMBER_FN(object,ptrToMember) ((object)->*(ptrToMember))
-template <typename Target, typename T>
-class MemberFunctionProperty : public AbstractProperty {
-public:
- typedef void (Target::*RefWrite)(const T &);
- typedef T (Target::*ValRead)(void) const;
-
- MemberFunctionProperty(Target *target, ValRead readFunc, RefWrite writeFunc)
- : m_target(target), m_readFn(readFunc), m_writeFn(writeFunc) {}
-
- virtual void write(const QVariant &value) {
- CALL_MEMBER_FN(m_target, m_writeFn)(qVariantValue<T>(value));
- }
-
- virtual QVariant read() const {
- if (m_readFn)
- return qVariantFromValue<T>(CALL_MEMBER_FN(m_target, m_readFn)());
- return QVariant();
- }
-
-private:
- Target *m_target;
- ValRead m_readFn;
- RefWrite m_writeFn;
-};
-
-
-class QValueAnimation : public QVariantAnimation
-{
- Q_OBJECT
-
-public:
- QValueAnimation(QObject *parent = 0);
- ~QValueAnimation();
-
- template <typename Target, typename T>
- void setMemberFunction(Target *target,
- T (Target::*readFunc)(void) const, // ### useValRead typedef
- void (Target::*writeFunc)(const T &) // ### use RefWrite typedef
- ) {
- // ### ownership of MemberFunctionProperty
- AbstractProperty *animProp = new MemberFunctionProperty<Target, T>(target, readFunc, writeFunc);
- setProperty(animProp);
- }
-
- void updateCurrentValue(const QVariant &value);
- void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
- void setProperty(AbstractProperty *animProp);
-
-private:
- Q_DISABLE_COPY(QValueAnimation);
- Q_DECLARE_PRIVATE(QValueAnimation);
-};
-
-#endif // QVALUEANIMATION_H
diff --git a/examples/animation/research/memberfunctions/qvalueanimation_p.h b/examples/animation/research/memberfunctions/qvalueanimation_p.h
deleted file mode 100644
index 55c8ce1..0000000
--- a/examples/animation/research/memberfunctions/qvalueanimation_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVALUEANIMATION_P_H
-#define QVALUEANIMATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of QIODevice. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qvariantanimation_p.h> //###
-
-QT_BEGIN_NAMESPACE
-
-class QValueAnimationPrivate : public QVariantAnimationPrivate
-{
- Q_DECLARE_PUBLIC(QValueAnimation)
-public:
- QValueAnimationPrivate() : QVariantAnimationPrivate(), animProp(0)
- {
- }
-
- void initDefaultStartValue();
-
- AbstractProperty *animProp;
-
- //###TODO
-};
-
-QT_END_NAMESPACE
-
-#endif //QVALUEANIMATION_P_H
diff --git a/examples/animation/research/photobrowser/main.cpp b/examples/animation/research/photobrowser/main.cpp
deleted file mode 100644
index d5ab2a3..0000000
--- a/examples/animation/research/photobrowser/main.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "river.h"
-#include "menu.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- if (app.arguments().size() == 1) {
- qWarning("you have to specifiy a path to look for the photos");
- return 0;
- }
-
-
- QGraphicsScene scene;
- scene.setSceneRect(QRectF(QPointF(), River::fixedSize()));
-
- QGraphicsView view(&scene);
- view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
- const int fw = view.frameWidth() * 2;
- view.setFixedSize(River::fixedSize() + QSize(fw,fw));
-
- River river(app.arguments()[1]);
- scene.addItem(&river);
-
- Menu menu(&river);
- menu.addAction(QLatin1String("River Mode"), &river, SLOT(setRiverMode()));
- menu.addAction(QLatin1String("Grid Mode"), &river, SLOT(setGridMode()));
- menu.addAction(QLatin1String("Cover Flow"), &river, SLOT(setCoverMode()));
- menu.addAction(QLatin1String("Hide Menu"), &menu, SLOT(hide()));
- menu.addAction(QLatin1String("Exit"), &app, SLOT(quit()));
- menu.setZValue(2);
- menu.setFocus();
-
- river.menu = &menu;
- view.show();
-
- return app.exec();
-}
diff --git a/examples/animation/research/photobrowser/menu.cpp b/examples/animation/research/photobrowser/menu.cpp
deleted file mode 100644
index 97493ba..0000000
--- a/examples/animation/research/photobrowser/menu.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "menu.h"
-
-Menu::Menu(QGraphicsItem *parent) : QGraphicsWidget(parent), m_selected(0)
-{
- setFlag(QGraphicsItem::ItemIsFocusable);
- m_selection = new QGraphicsRectItem(this);
- QLinearGradient linearGrad(QPointF(0, 0), QPointF(0,50));
- linearGrad.setColorAt(0, QColor(255,255,255,128));
- linearGrad.setColorAt(1, QColor(255,255,255,16));
- m_selection->setBrush(linearGrad);
- m_selection->setPen(QPen(Qt::transparent));
-}
-
-Menu::~Menu()
-{
-}
-
-
-MenuAction *Menu::addAction(const QString &text, QObject *receiver, const char* slot)
-{
- MenuAction *action = new MenuAction(text, this);
- if (!m_actions.isEmpty()) {
- MenuAction *last = m_actions.last();
- action->setPos(last->pos() + last->boundingRect().bottomLeft());
- }
- m_actions.append(action);
- if (m_selection->boundingRect().width() < action->boundingRect().width())
- m_selection->setRect(action->boundingRect());
-
- QObject::connect(action, SIGNAL(triggered()), receiver, slot);
- return action;
-}
-
-QRectF Menu::boundingRect() const
-{
- QRectF res;
- foreach (MenuAction *a, m_actions)
- res |= a->boundingRect();
- return res;
-}
-
-void Menu::keyPressEvent (QKeyEvent * event)
-{
- switch (event->key()) {
- case Qt::Key_Escape:
- hide();
- break;
- case Qt::Key_Up:
- m_selected -= 2;
- case Qt::Key_Down:
- if (!m_actions.isEmpty()) {
- m_selected = (m_selected + 1 + m_actions.count()) % m_actions.count();
- QItemAnimation *anim = new QItemAnimation(m_selection, QItemAnimation::Position);
- anim->setEndValue(m_actions.at(m_selected)->pos());
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- }
- break;
- case Qt::Key_Enter:
- case Qt::Key_Return:
- if (!m_actions.isEmpty()) {
- QItemAnimation *anim = new QItemAnimation(m_selection, QItemAnimation::RotationX);
- anim->setEndValue(m_selection->xRotation() < 180 ? qreal(360) : qreal(0));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- m_actions.at(m_selected)->trigger();
- hide();
- }
- break;
- default:
- QGraphicsItem::keyPressEvent(event);
- }
-}
-
-void Menu::show()
-{
- QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::Opacity);
- anim->setEndValue(qreal(1.));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorX);
- anim->setEndValue(qreal(1));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorY);
- anim->setEndValue(qreal(1));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- setFocus();
-}
-
-void Menu::hide()
-{
- QItemAnimation *anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorX);
- anim->setEndValue(qreal(.1));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorY);
- anim->setEndValue(qreal(.1));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(this, QItemAnimation::Opacity);
- anim->setEndValue(qreal(0));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- parentItem()->setFocus();
-}
-
-
-MenuAction::MenuAction(const QString &text, Menu * parent)
- : QGraphicsTextItem(text,parent)
-{
- QFont f = font();
- f.setPointSize(18);
- setFont(f);
- setDefaultTextColor(Qt::white);
-}
-
-void MenuAction::trigger()
-{
- emit triggered();
-}
diff --git a/examples/animation/research/photobrowser/menu.h b/examples/animation/research/photobrowser/menu.h
deleted file mode 100644
index 3bdfe45..0000000
--- a/examples/animation/research/photobrowser/menu.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef __MENU__H__
-#define __MENU__H__
-
-#include <QtGui>
-
-class MenuAction;
-
-class Menu : public QGraphicsWidget
-{
- Q_OBJECT
-public:
- Menu(QGraphicsItem *parent);
- ~Menu();
-
- MenuAction *addAction(const QString&, QObject *receiver = 0, const char* slot = 0 );
-
- QRectF boundingRect() const;
- void keyPressEvent ( QKeyEvent * event );
-public slots:
- void show();
- void hide();
-private:
- QList<MenuAction*> m_actions;
- QGraphicsRectItem *m_selection;
- int m_selected;
-};
-
-class MenuAction : public QGraphicsTextItem
-{
- Q_OBJECT
-public:
- MenuAction(const QString &text, Menu * parent);
- void trigger();
-signals:
- void triggered();
-};
-
-
-#endif //__RIVERITEM__H__
diff --git a/examples/animation/research/photobrowser/photobrowser.pro b/examples/animation/research/photobrowser/photobrowser.pro
deleted file mode 100644
index 21f03d6..0000000
--- a/examples/animation/research/photobrowser/photobrowser.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) ven. 22. août 13:09:33 2008
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp \
- river.cpp \
- riveritem.cpp \
- menu.cpp
-HEADERS += river.h \
- riveritem.h \
- menu.h
diff --git a/examples/animation/research/photobrowser/river.cpp b/examples/animation/research/photobrowser/river.cpp
deleted file mode 100644
index 6760066..0000000
--- a/examples/animation/research/photobrowser/river.cpp
+++ /dev/null
@@ -1,591 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "river.h"
-#include "riveritem.h"
-
-#include "qvariantanimation.h"
-
-#include <QtCore/QDebug>
-#include <QtGui/QKeyEvent>
-#include <QtGui/QGraphicsScene>
-#include <QtGui/QPainter>
-
-
-#define GRID_ROW_COUNT 3
-#define GRID_COLUMN_COUNT 2
-#define GRID_DIMENSIONS (GRID_ROW_COUNT * GRID_COLUMN_COUNT)
-#define ITEM_COUNT 12
-
-#define RIVER_MAGNIFY(ITEM) (qreal(0.50) + (ITEM)->zValue()*2 )
-#define GRID_MAGNIFY qreal(1.5)
-#define GRID_CURRENT_MAGNIFY 2
-
-River::River(const QString &path) :
-m_images(QDir(path).entryInfoList(QStringList() << QLatin1String("*.jpg") << QLatin1String("*.png"))),
-m_currentImage(0), m_mode(RiverMode), m_selectedItem(-1) , m_topLeftIndex(-1)
-{
- setFocusPolicy(Qt::StrongFocus);
- setGeometry(QRectF( QPointF(), fixedSize()));
-
-
- for (int i = 0; i < ITEM_COUNT; ++i) {
- RiverItem * item = new RiverItem(this);
-
- //here we also randomize the x position (not when looping)
- const int x = qrand() % fixedSize().width();
- item->setPos(x, -1);
-
- m_items.insert(m_currentImage, item);
- addUnusedRiverItem(item);
- }
-
-}
-
-QPointF River::gridItemPosition(int row, int col) const
-{
- if (col < 0) {
- col += GRID_COLUMN_COUNT;
- row --;
- }
- return QPointF(rect().width()*(col*2 + 1)/(GRID_COLUMN_COUNT*2),
- rect().height()*(row*2 + 1)/(GRID_ROW_COUNT*2));
-}
-
-QPixmap River::pixmap(int index) const
-{
- if (index < 0 || index >= m_images.size())
- return QPixmap();
-
- if (m_pixmaps.size() <= index) {
- m_pixmaps.resize(index+1);
- }
-
- if (m_pixmaps.at(index).isNull()) {
- m_pixmaps[index] = QPixmap(m_images.at(index).absoluteFilePath());
- }
-
- return m_pixmaps.at(index);
-}
-
-void River::addUnusedRiverItem(RiverItem * item)
-{
- if (m_images.isEmpty())
- return;
-
- QRectF realItemRect = item->mapToParent(item->boundingRect()).boundingRect();
-
- int y = item->pos().y();
- int x = item->pos().x();
- if (x >= fixedSize().width() || x < -realItemRect.width() || y < 0) {
- //we set the new pixmap
-
- m_items.remove(m_items.key(item));
-
- while (m_items.contains(m_currentImage))
- m_currentImage = (m_currentImage + 1 ) % m_images.size();
-
- item->setPixmap(pixmap(m_currentImage));
-
- m_items.insert(m_currentImage, item);
- //this manages looping as well
- m_currentImage = (m_currentImage + 1 ) % m_images.size();
-
- item->setZValue(qreal(qrand()%100)/200.0);
-
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(RIVER_MAGNIFY(item));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(RIVER_MAGNIFY(item));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-
- realItemRect = item->mapToParent(item->boundingRect()).boundingRect();
-
- y = -realItemRect.y() + qrand() % (fixedSize().height() - int(realItemRect.height()));
- if (x >= fixedSize().width()) {
- x = -realItemRect.width()/2;
- }
- }
-
- item->setPos(x, y);
-
- const QPointF target(QPointF(fixedSize().width() + realItemRect.width()/2, y));
-
- const int distance = target.x() - x;
-
- const int duration = (40 - 50*item->zValue() ) * distance;
- QItemAnimation *a = new QItemAnimation(item, QItemAnimation::Position, scene());
- a->setEndValue(target);
- a->setDuration(duration);
- a->start(QAbstractAnimation::DeleteWhenStopped);
- connect(a, SIGNAL(finished()), SLOT(animationFinished()));
-}
-
-void River::animationFinished()
-{
- QItemAnimation *anim = qobject_cast<QItemAnimation*>(sender());
- if (!anim || anim->propertyName() != QItemAnimation::Position)
- return;
-
- /*RiverItem *item = static_cast<RiverItem*>(anim->graphicsItem());
- if (m_mode != RiverMode) {*/
- /*int key = m_items.key(item);
- if (key < m_topLeftIndex || key >= m_topLeftIndex + GRID_DIMENSIONS) {
- delete item;
- m_items.remove(key);
- }*/
- //return;
-
- //}
-
- addUnusedRiverItem(static_cast<RiverItem*>(anim->targetItem()));
-}
-
-void River::switchPaused()
-{
- const bool paused = m_pausedAnimations.isEmpty();
- if (paused)
- m_pausedAnimations = scene()->findChildren<QItemAnimation*>();
-
- foreach(QItemAnimation *anim, m_pausedAnimations) {
- if (paused)
- anim->pause();
- else
- anim->resume();
- }
-
- if (!paused)
- m_pausedAnimations.clear();
-}
-
-void River::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
-{
- painter->fillRect(option->rect, Qt::black);
-}
-
-void River::setMode(Mode m)
-{
- if (m_mode == m)
- return;
-
- Mode oldMode = m_mode;
- m_mode = m;
- switch(m)
- {
- case RiverMode:
- m_mode = oldMode; //some animation may be stopt, and we don't want that animationFinished we were in that mode yet
- foreach (RiverItem *item, m_items) {
- const int x = qrand() % fixedSize().width();
- const int y = qrand() % fixedSize().width();
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(RIVER_MAGNIFY(item));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(RIVER_MAGNIFY(item));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(item, QItemAnimation::Position, scene());
- anim->setEndValue(QPointF(x, y));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
- }
- m_mode = m;
- break;
-
- case GridMode:
-
- if (oldMode == GridFullScreenMode) {
- currentItem()->setFullScreen(false, GRID_CURRENT_MAGNIFY);
- } else {
- m_topLeftIndex = -GRID_DIMENSIONS;
- foreach (RiverItem *item, m_items) {
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(GRID_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(GRID_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- }
- adjustGrid(m_currentImage - GRID_DIMENSIONS + 1);
- setCurrentItem(m_topLeftIndex);
- }
- break;
- case GridFullScreenMode:
- //let's put the current item fullscreen
- currentItem()->setFullScreen(true, GRID_CURRENT_MAGNIFY);
- break;
- case CoverMode:
- m_gridItem = m_items.values();
- setCurrentItem(m_gridItem.count()/2);
- default:
- break;
- }
-}
-
-River::Mode River::mode() const
-{
- return m_mode;
-}
-
-QSize River::fixedSize()
-{
- return QSize(352, 416);
-}
-
-//the name of this method is not that good...
-void River::makeCenterAvailable(qreal size)
-{
- QRectF center(QPointF(), QSizeF(size, size));
- center.moveCenter(rect().center());
-
- const QList<QGraphicsItem*> list = scene()->items(center);
-
- foreach(QGraphicsItem *item, m_items) {
-
- if (!list.contains(item))
- continue;
-
- QPointF pos = item->pos();
-
- if (pos.y() < rect().center().y()) {
- //item is above center
- pos.ry() = center.top() - item->boundingRect().height() - 1;
- } else {
- //item is below the center
- pos.ry() = center.bottom() + 1;
- }
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::Position, scene());
- anim->setEndValue(pos);
- anim->setDuration(150);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- }
-}
-
-
-//this is there just to test small interaction
-void River::keyPressEvent ( QKeyEvent * keyEvent )
-{
- switch(keyEvent->key())
- {
- case Qt::Key_O:
- {
- QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::Opacity, scene());
- anim->setDuration(2000);
- anim->setEndValue(qreal(.5));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- }
- break;
- case Qt::Key_N:
- //that's a test
- makeCenterAvailable(60);
- break;
- case Qt::Key_P:
- switchPaused();
- break;
- case Qt::Key_V:
- setMode(GridMode);
- break;
- case Qt::Key_R:
- setMode(RiverMode);
- break;
- case Qt::Key_C:
- setMode(CoverMode);
- break;
- case Qt::Key_Return:
- case Qt::Key_Enter:
- if (m_mode == RiverMode) {
- setMode(GridMode);
- } else if (m_mode == GridMode) {
- setMode(GridFullScreenMode);
- } else if (m_mode == GridFullScreenMode) {
- setMode(GridMode);
- }
- break;
- case Qt::Key_Escape:
- if (m_mode == GridFullScreenMode) {
- setMode(GridMode);
- } else if (m_mode == GridMode || m_mode == CoverMode) {
- setMode(RiverMode);
- } else if (m_mode == RiverMode) {
- menu->show();
- }
- break;
- case Qt::Key_Right:
- if (m_mode == GridMode) {
- navigateBy(+1);
- } else if (m_mode == CoverMode) {
- setCurrentItem(m_selectedItem + 1);
- }
- break;
- case Qt::Key_Left:
- if (m_mode == GridMode) {
- navigateBy(-1);
- } else if (m_mode == CoverMode) {
- setCurrentItem(m_selectedItem - 1);
- }
- break;
- case Qt::Key_Down:
- if (m_mode == GridMode) {
- navigateBy(GRID_COLUMN_COUNT);
- }
- break;
- case Qt::Key_Up:
- if (m_mode == GridMode) {
- navigateBy(-GRID_COLUMN_COUNT);
- }
- break;
-// case Qt::Key_PageUp:
- case Qt::Key_M:
- menu->show();
- break;
- case Qt::Key_Space:
- if (m_mode == GridMode) {
- RiverItem *item = currentItem();
- if(!item)
- break;
-
- //stupid sequence.
- QPointF pos = item->pos();
- QAnimationGroup *group = new QSequentialAnimationGroup();
- //item->animator()->beginSequence();
-
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::Position, scene());
- anim->setEndValue(pos);
- group->addAnimation(anim);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(qreal(1.));
- anim->setDuration(500);
- group->addAnimation(anim);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(qreal(1.));
- anim->setDuration(500);
- group->addAnimation(anim);
- anim = new QItemAnimation(item, QItemAnimation::RotationX, scene());
- anim->setEndValue(qreal(0));
- group->addAnimation(anim);
- group->start(QAbstractAnimation::DeleteWhenStopped);
- }
- default:
- break;
- }
-
- QGraphicsItem::keyPressEvent(keyEvent);
-}
-
-
-void River::setGridMode()
-{
- setMode(GridMode);
-}
-
-void River::setRiverMode()
-{
- setMode(RiverMode);
-}
-
-void River::setCoverMode()
-{
- setMode(CoverMode);
-}
-
-
-void River::adjustGrid(int newTopLeft)
-{
- for (int i = newTopLeft ; i < newTopLeft + GRID_DIMENSIONS; i++) {
- if (!m_items.contains(i)) {
- RiverItem *item = createItem(i);
- int row = (i - m_topLeftIndex) / GRID_COLUMN_COUNT;
- int col = (i - m_topLeftIndex) % GRID_COLUMN_COUNT;
- item->setPos(gridItemPosition(row, col));
- item->setXScale(0);
- item->setYScale(0);
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(GRID_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(GRID_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- }
- }
- newTopLeft = newTopLeft - newTopLeft % GRID_COLUMN_COUNT;
-
- QHash<int, RiverItem *>::iterator it = m_items.begin();
- while (it != m_items.constEnd()) {
- const int imageIdx = it.key();
- RiverItem *item = *it;
- QSizeF itemSize = item->boundingRect().size();
- if ((imageIdx >= newTopLeft && imageIdx < newTopLeft + GRID_DIMENSIONS)
- || boundingRect().adjusted(-itemSize.width()/2, -itemSize.height()/2, itemSize.width()/2, itemSize.height()/2)
- .contains(item->pos())) {
- int row = (imageIdx-newTopLeft) / GRID_COLUMN_COUNT;
- int col = (imageIdx-newTopLeft) % GRID_COLUMN_COUNT;
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::Position, scene());
- anim->setEndValue(gridItemPosition(row, col));
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- ++it;
- } else {
- ++it; /* ### ideally we should remove the items, but this cause the photobrowser to crash
- because the QItemAnimations are not notified the item is deleted
- delete item;
- it = m_items.erase(it);
- */
- }
- }
-
- m_topLeftIndex = newTopLeft;
-}
-
-
-RiverItem *River::createItem(int imageIndex)
-{
- Q_ASSERT(!m_items.contains(imageIndex));
- RiverItem * item = new RiverItem(this);
- item->setPixmap(pixmap(imageIndex));
- m_items.insert(imageIndex,item);
- return item;
-}
-
-void River::setCurrentItem(int newCurrentItem)
-{
- if (m_mode == CoverMode)
- {
- m_selectedItem = newCurrentItem;
- for (int i = 0; i < m_gridItem.count(); i++) {
- QVariantAnimation *anim;
- RiverItem *item = m_gridItem.at(i);
-
- qreal rotation = 0;
- qreal width = boundingRect().width() / 2;
- qreal x = width;
- qreal scale = 3;
- qreal z = 1;
- qreal y = boundingRect().height()/2;
-
- if (i < newCurrentItem - 4) {
- item->setVisible(false);
- item->setPos(QPointF(0, y));
- continue;
- } else if(i > newCurrentItem + 4) {
- item->setVisible(false);
- item->setPos(QPointF(boundingRect().width(), y));
- continue;
- } else if (i < newCurrentItem) {
- x = (i - newCurrentItem + 4) * width/7;
- rotation = -75;
- scale = 2;
- z = 1.+qreal(i-newCurrentItem)/10.;
- } else if (i > newCurrentItem) {
- x = width + (i - newCurrentItem + 3) * width/7;
- rotation = 75;
- scale = 2;
- z = 1.-qreal(i-newCurrentItem)/8.;
- }
-
- item->setVisible(true);
- item->setZValue(z);
-
- anim = new QItemAnimation(item, QItemAnimation::RotationY, scene());
- anim->setEndValue(rotation);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(scale);
- anim->start(QVariantAnimation::DeleteWhenStopped);
-
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(scale);
- anim->start(QVariantAnimation::DeleteWhenStopped);
-
- anim = new QItemAnimation(item, QItemAnimation::Position, scene());
- anim->setEndValue(QPointF(x,y));
- anim->start(QVariantAnimation::DeleteWhenStopped);
- }
- return;
- }
-
-
- //deselect the current item
- if (m_selectedItem >= 0 && m_items.contains(m_selectedItem)) {
- RiverItem *item = m_items.value(m_selectedItem);
- item->setZValue(qreal(qrand()%100)/200.0);
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(GRID_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(GRID_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- }
-
- if (newCurrentItem < 0) {
- m_selectedItem = newCurrentItem;
- return;
- }
-
- //ensure visible;
- if (newCurrentItem < m_topLeftIndex) {
- adjustGrid(newCurrentItem);
- } else if (newCurrentItem >= m_topLeftIndex + GRID_DIMENSIONS) {
- adjustGrid(newCurrentItem - GRID_DIMENSIONS + GRID_COLUMN_COUNT);
- }
-
- //select the new one
- m_selectedItem = newCurrentItem;
- RiverItem *item = currentItem();
- Q_ASSERT(item);
- item->setZValue(1);
-
- QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
- anim->setEndValue(GRID_CURRENT_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
- anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
- anim->setEndValue(GRID_CURRENT_MAGNIFY);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-}
-
-void River::navigateBy(int offset)
-{
- int newSelection = m_selectedItem + offset;
- const int imageCount = m_images.size();
- while (newSelection < 0)
- newSelection += imageCount;
- newSelection %= imageCount;
- setCurrentItem(newSelection);
-}
diff --git a/examples/animation/research/photobrowser/river.h b/examples/animation/research/photobrowser/river.h
deleted file mode 100644
index d6bfc76..0000000
--- a/examples/animation/research/photobrowser/river.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef __RIVER__H__
-#define __RIVER__H__
-
-#include <QtCore/QDirIterator>
-#include <QtGui/QGraphicsWidget>
-
-#include "menu.h"
-
-class RiverItem;
-
-class River : public QGraphicsWidget
-{
- Q_OBJECT
-public:
- enum Mode
- {
- RiverMode,
- GridMode,
- GridFullScreenMode,
- CoverMode
- };
-
- River(const QString &path);
- void addUnusedRiverItem(RiverItem * item);
-
- static QSize fixedSize();
-
- void switchPaused();
-
- void setMode(Mode m);
- Mode mode() const;
-
- Menu *menu;
-
-protected:
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
- void keyPressEvent ( QKeyEvent * keyEvent );
- void makeCenterAvailable(qreal size);
- QPointF gridItemPosition(int row, int col) const;
- QPixmap pixmap(int index) const;
-
-protected slots:
- void animationFinished();
-public slots:
- void setRiverMode();
- void setGridMode();
- void setCoverMode();
-
-private:
- const QFileInfoList m_images;
- int m_currentImage;
- mutable QVector<QPixmap> m_pixmaps;
- QHash<int, RiverItem*> m_items;
- QList<RiverItem*> m_gridItem;
- QList<QItemAnimation*> m_pausedAnimations;
- Mode m_mode;
-
- void adjustGrid(int topRight);
- RiverItem *currentItem() { return m_items.value(m_selectedItem); }
- RiverItem *createItem(int imageIndex);
- void setCurrentItem(int currentItem);
- void navigateBy(int offset);
-
- int m_selectedItem;
- int m_topLeftIndex;
-
-};
-
-
-#endif //__RIVERITEM__H__
diff --git a/examples/animation/research/photobrowser/riveritem.cpp b/examples/animation/research/photobrowser/riveritem.cpp
deleted file mode 100644
index 9692d30..0000000
--- a/examples/animation/research/photobrowser/riveritem.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "riveritem.h"
-#include "river.h"
-
-RiverItem::RiverItem(QGraphicsItem *parent) : QGraphicsPixmapItem(parent), m_fullscreen(false)
-{
- setCacheMode(DeviceCoordinateCache);
-}
-
-RiverItem::~RiverItem()
-{
-}
-
-void RiverItem::setPixmap(const QPixmap &pix)
-{
- const QSize oldSize = pixmap().size();
- const QSize newSize = pix.size();
- QGraphicsPixmapItem::setPixmap(pix);
-
- if (newSize != oldSize) {
- setOffset(-newSize.width()/2, -newSize.height()/2);
- const qreal scaleFactor = qreal(River::fixedSize().height())/(qreal(pix.height()*7));
- setTransform(QTransform().scale(scaleFactor, scaleFactor));
- prepareGeometryChange();
- }
-}
-
-
-void RiverItem::setFullScreen(bool b, qreal originScaleFactor)
-{
- if (m_fullscreen == b)
- return;
-
- m_fullscreen = b;
-
- QPointF newPos;
- qreal rotationZ;
- qreal scaleX, scaleY;
-
- if (b) {
- const QSizeF basePixmapSize = transform().map(boundingRect()).boundingRect().size();
-
- newPos = parentItem()->boundingRect().center();
- rotationZ = 90;
- scaleY = qreal(River::fixedSize().width()) / basePixmapSize.height() * yScale();
- scaleX = qreal(River::fixedSize().height()) / basePixmapSize.width() * xScale();
-
- if (m_nonFSPos.isNull()) {
- m_nonFSPos = pos(); //let's save our current (non fullscreen) position
- }
-
- } else {
- Q_ASSERT(!m_nonFSPos.isNull());
- rotationZ = 0;
- scaleX = originScaleFactor;
- scaleY = originScaleFactor;
- newPos = m_nonFSPos;
- }
-
- QAnimationGroup *group = new QParallelAnimationGroup(scene());
- QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::Position);
- anim->setEndValue(newPos);
- group->addAnimation(anim);
- anim = new QItemAnimation(this, QItemAnimation::RotationZ);
- anim->setEndValue(rotationZ);
- group->addAnimation(anim);
- anim = new QItemAnimation(this, QItemAnimation::ScaleFactorX);
- anim->setEndValue(scaleX);
- group->addAnimation(anim);
- anim = new QItemAnimation(this, QItemAnimation::ScaleFactorY);
- anim->setEndValue(scaleY);
- group->addAnimation(anim);
- group->start(QAbstractAnimation::DeleteWhenStopped);
-}
-
-void RiverItem::mousePressEvent(QGraphicsSceneMouseEvent*)
-{
- //just let it rotate on itself
- QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::RotationY);
- anim->setEndValue(yRotation() < 180 ? 360 : 0);
- anim->setDuration(500);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-}
-
-
diff --git a/examples/animation/research/photobrowser/riveritem.h b/examples/animation/research/photobrowser/riveritem.h
deleted file mode 100644
index 2023c44..0000000
--- a/examples/animation/research/photobrowser/riveritem.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef __RIVERITEM__H__
-#define __RIVERITEM__H__
-
-#include <QtGui/QGraphicsPixmapItem>
-
-class RiverItemAnimator;
-
-class RiverItem : public QGraphicsPixmapItem
-{
-public:
- RiverItem(QGraphicsItem *parent);
- ~RiverItem();
-
- void setPixmap(const QPixmap &);
- void setFullScreen(bool b, qreal originScaleFactor);
-
-protected:
- void mousePressEvent(QGraphicsSceneMouseEvent*);
-
-private:
- QPointF m_nonFSPos; //to save the position when not in fullscreen
- bool m_fullscreen;
-};
-
-#endif //__RIVERITEM__H__
diff --git a/examples/animation/research/piemenu/main.cpp b/examples/animation/research/piemenu/main.cpp
deleted file mode 100644
index 8076da8..0000000
--- a/examples/animation/research/piemenu/main.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include "scene.h"
-#include "qgraphicspiemenu.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- Scene scene;
-
- QGraphicsView view(&scene);
- view.show();
-
- return app.exec();
-}
diff --git a/examples/animation/research/piemenu/piemenu.pro b/examples/animation/research/piemenu/piemenu.pro
deleted file mode 100644
index 4d7a067..0000000
--- a/examples/animation/research/piemenu/piemenu.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-SOURCES += \
- main.cpp \
- qgraphicspiemenu.cpp \
- scene.cpp
-HEADERS += \
- qgraphicspiemenu.h \
- qgraphicspiemenu_p.h \
- scene.h
diff --git a/examples/animation/research/piemenu/qgraphicspiemenu.cpp b/examples/animation/research/piemenu/qgraphicspiemenu.cpp
deleted file mode 100644
index a199119..0000000
--- a/examples/animation/research/piemenu/qgraphicspiemenu.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicspiemenu.h"
-#include "qgraphicspiemenu_p.h"
-
-#include <QtGui/qaction.h>
-
-QGraphicsPieMenu::QGraphicsPieMenu(QGraphicsItem *parent)
- : QGraphicsWidget(parent), d_ptr(new QGraphicsPieMenuPrivate)
-{
- d_ptr->q_ptr = this;
- d_ptr->machine = new QStateMachine();
- d_ptr->popupState = new QState(d_ptr->machine->rootState());
- d_ptr->machine->setInitialState(d_ptr->popupState);
- d_ptr->menuAction = new QAction(this);
-}
-
-QGraphicsPieMenu::QGraphicsPieMenu(const QString &title, QGraphicsItem *parent)
- : QGraphicsWidget(parent), d_ptr(new QGraphicsPieMenuPrivate)
-{
- d_ptr->q_ptr = this;
- d_ptr->machine = new QStateMachine();
- d_ptr->popupState = new QState(d_ptr->machine->rootState());
- d_ptr->machine->setInitialState(d_ptr->popupState);
- d_ptr->menuAction = new QAction(this);
- setTitle(title);
-}
-
-QGraphicsPieMenu::QGraphicsPieMenu(const QIcon &icon, const QString &title, QGraphicsItem *parent)
- : QGraphicsWidget(parent), d_ptr(new QGraphicsPieMenuPrivate)
-{
- d_ptr->q_ptr = this;
- d_ptr->machine = new QStateMachine();
- d_ptr->popupState = new QState(d_ptr->machine->rootState());
- d_ptr->machine->setInitialState(d_ptr->popupState);
- d_ptr->menuAction = new QAction(this);
- setIcon(icon);
- setTitle(title);
-}
-
-QGraphicsPieMenu::~QGraphicsPieMenu()
-{
- delete d_ptr;
-}
-
-QAction *QGraphicsPieMenu::addAction(const QString &text)
-{
- QAction *action = new QAction(text, this);
- addAction(action);
- return action;
-}
-
-QAction *QGraphicsPieMenu::addAction(const QIcon &icon, const QString &text)
-{
- QAction *action = new QAction(icon, text, this);
- addAction(action);
- return action;
-}
-
-QAction *QGraphicsPieMenu::addAction(const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut)
-{
- QAction *action = new QAction(text, this);
- action->setShortcut(shortcut);
- connect(action, SIGNAL(triggered(bool)), receiver, member);
- addAction(action);
- return action;
-}
-
-QAction *QGraphicsPieMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut)
-{
- QAction *action = new QAction(icon, text, this);
- action->setShortcut(shortcut);
- connect(action, SIGNAL(triggered(bool)), receiver, member);
- addAction(action);
- return action;
-}
-
-QAction *QGraphicsPieMenu::addMenu(QGraphicsPieMenu *menu)
-{
- QAction *action = menu->menuAction();
- addAction(action);
- return action;
-}
-
-QGraphicsPieMenu *QGraphicsPieMenu::addMenu(const QString &title)
-{
- QGraphicsPieMenu *menu = new QGraphicsPieMenu(title, this);
- addMenu(menu);
- return menu;
-}
-
-QGraphicsPieMenu *QGraphicsPieMenu::addMenu(const QIcon &icon, const QString &title)
-{
- QGraphicsPieMenu *menu = new QGraphicsPieMenu(icon, title, this);
- addMenu(menu);
- return menu;
-}
-
-QAction *QGraphicsPieMenu::addSeparator()
-{
- QAction *action = new QAction(this);
- action->setSeparator(true);
- addAction(action);
- return action;
-}
-
-QAction *QGraphicsPieMenu::insertMenu(QAction *before, QGraphicsPieMenu *menu)
-{
- QAction *action = menu->menuAction();
- insertAction(before, action);
- return action;
-}
-
-QAction *QGraphicsPieMenu::insertSeparator(QAction *before)
-{
- QAction *action = new QAction(this);
- action->setSeparator(true);
- insertAction(before, action);
- return action;
-}
-
-QAction *QGraphicsPieMenu::menuAction() const
-{
- return d_func()->menuAction;
-}
-
-bool QGraphicsPieMenu::isEmpty() const
-{
- // ### d->actions
- QList<QAction *> actionList = actions();
- bool ret = true;
- for (int i = 0; ret && i < actionList.size(); ++i) {
- const QAction *action = actionList.at(i);
- if (!action->isSeparator() && action->isVisible()) {
- ret = false;
- break;
- }
- }
- return ret;
-}
-
-void QGraphicsPieMenu::clear()
-{
- // ### d->actions
- QList<QAction *> actionList = actions();
- for(int i = 0; i < actionList.size(); i++) {
- QAction *action = actionList.at(i);
- removeAction(action);
- if (action->parent() == this && action->associatedGraphicsWidgets().isEmpty())
- delete action;
- }
-}
-
-void QGraphicsPieMenu::popup(const QPointF &pos)
-{
- Q_UNUSED(pos);
- Q_D(QGraphicsPieMenu);
- d->machine->start();
-}
-
-QAction *QGraphicsPieMenu::exec()
-{
- return exec(pos());
-}
-
-QAction *QGraphicsPieMenu::exec(const QPointF &pos)
-{
- Q_UNUSED(pos);
- return 0;
-}
-
-QAction *QGraphicsPieMenu::exec(QList<QAction *> actions, const QPointF &pos)
-{
- QGraphicsPieMenu menu;
- for (QList<QAction *>::ConstIterator it = actions.constBegin(); it != actions.constEnd(); ++it)
- menu.addAction(*it);
- return menu.exec(pos);
-}
-
-QString QGraphicsPieMenu::title() const
-{
- Q_D(const QGraphicsPieMenu);
- return d->title;
-}
-
-void QGraphicsPieMenu::setTitle(const QString &title)
-{
- Q_D(QGraphicsPieMenu);
- d->title = title;
- updateGeometry();
-}
-
-QIcon QGraphicsPieMenu::icon() const
-{
- Q_D(const QGraphicsPieMenu);
- return d->icon;
-}
-
-void QGraphicsPieMenu::setIcon(const QIcon &icon)
-{
- Q_D(QGraphicsPieMenu);
- d->icon = icon;
- updateGeometry();
-}
-
-QSizeF QGraphicsPieMenu::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(which);
- Q_UNUSED(constraint);
- return QSizeF(1, 1);
-}
diff --git a/examples/animation/research/piemenu/qgraphicspiemenu.h b/examples/animation/research/piemenu/qgraphicspiemenu.h
deleted file mode 100644
index d784f93..0000000
--- a/examples/animation/research/piemenu/qgraphicspiemenu.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSPIEMENU_H
-#define QGRAPHICSPIEMENU_H
-
-#include <QtGui/qgraphicswidget.h>
-
-class QGraphicsPieMenuPrivate;
-class QGraphicsPieMenu : public QGraphicsWidget
-{
- Q_OBJECT
-public:
- QGraphicsPieMenu(QGraphicsItem *parent = 0);
- QGraphicsPieMenu(const QString &title, QGraphicsItem *parent = 0);
- QGraphicsPieMenu(const QIcon &icon, const QString &title, QGraphicsItem *parent = 0);
- ~QGraphicsPieMenu();
-
-#ifdef Q_NO_USING_KEYWORD
- inline void addAction(QAction *action) { QGraphicsWidget::addAction(action); }
-#else
- using QGraphicsWidget::addAction;
-#endif
- QAction *addAction(const QString &text);
- QAction *addAction(const QIcon &icon, const QString &text);
- QAction *addAction(const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut = 0);
- QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut = 0);
- QAction *addMenu(QGraphicsPieMenu *menu);
- QGraphicsPieMenu *addMenu(const QString &title);
- QGraphicsPieMenu *addMenu(const QIcon &icon, const QString &title);
- QAction *addSeparator();
- QAction *insertMenu(QAction *before, QGraphicsPieMenu *menu);
- QAction *insertSeparator(QAction *before);
-
- QAction *menuAction() const;
-
- bool isEmpty() const;
- void clear();
-
- void popup(const QPointF &pos);
- QAction *exec();
- QAction *exec(const QPointF &pos);
- static QAction *exec(QList<QAction *> actions, const QPointF &pos);
-
- QString title() const;
- void setTitle(const QString &title);
-
- QIcon icon() const;
- void setIcon(const QIcon &icon);
-
-Q_SIGNALS:
- void aboutToShow();
- void aboutToHide();
- void triggered(QAction *action);
- void hovered(QAction *action);
-
-protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-
-private:
- Q_DISABLE_COPY(QGraphicsPieMenu)
- Q_DECLARE_PRIVATE(QGraphicsPieMenu)
- QGraphicsPieMenuPrivate *d_ptr;
-};
-
-#endif
diff --git a/examples/animation/research/piemenu/qgraphicspiemenu_p.h b/examples/animation/research/piemenu/qgraphicspiemenu_p.h
deleted file mode 100644
index 458b8f1..0000000
--- a/examples/animation/research/piemenu/qgraphicspiemenu_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSPIEMENU_P_H
-#define QGRAPHICSPIEMENU_P_H
-
-#include "qgraphicspiemenu.h"
-#include "qgraphicspiemenusection_p.h"
-
-#include <QtGui/qicon.h>
-#include <QtCore/qstate.h>
-#include <QtCore/qtransition.h>
-#include <QtCore/qstatemachine.h>
-
-class QAction;
-class QEventLoop;
-class QGraphicsPieMenuSection;
-
-class QGraphicsPieMenuPrivate
-{
- Q_DECLARE_PUBLIC(QGraphicsPieMenu);
-public:
- void init(const QIcon &icon = QIcon(), const QString &title = QString());
-
- QIcon icon;
- QString title;
- QStateMachine *machine;
- QState *popupState;
- //QTransition *transition;
- QList<QGraphicsPieMenuSection *> sections;
-
- QEventLoop *eventLoop;
-
- QAction *menuAction;
- QGraphicsPieMenu *q_ptr;
-
- void updatePopupState();
-};
-
-#endif
diff --git a/examples/animation/research/piemenu/qgraphicspiemenusection_p.h b/examples/animation/research/piemenu/qgraphicspiemenusection_p.h
deleted file mode 100644
index 2d71a06..0000000
--- a/examples/animation/research/piemenu/qgraphicspiemenusection_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSPIEMENUSECTION_H
-#define QGRAPHICSPIEMENUSECTION_H
-
-#include <QtGui/qgraphicswidget.h>
-#include <QtGui/qpainter.h>
-
-class QGraphicsPieMenuSection : public QGraphicsWidget
-{
- Q_OBJECT
- Q_PROPERTY(qreal rotation READ rotation WRITE setRotation)
-public:
- QGraphicsPieMenuSection(QGraphicsItem *parent = 0)
- : QGraphicsWidget(parent), rot(0)
- { }
-
- qreal rotation() const
- {
- return rot;
- }
- void setRotation(qreal rotation)
- {
- rot = rotation;
- setTransform(QTransform().rotate(rot));
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
- {
- Q_UNUSED(option);
- Q_UNUSED(widget);
- painter->setPen(QPen(Qt::black, 1));
- painter->setBrush(QBrush(Qt::gray));
- painter->drawPie(QRectF(-100, -100, 200, 200), 0, -30 * 16);
- }
-
-protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &size = QSizeF()) const
- {
- Q_UNUSED(which);
- Q_UNUSED(size);
- return QSizeF(100, 30);
- }
-
-private:
- qreal rot;
-};
-
-#endif
diff --git a/examples/animation/research/piemenu/scene.cpp b/examples/animation/research/piemenu/scene.cpp
deleted file mode 100644
index 6309975..0000000
--- a/examples/animation/research/piemenu/scene.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicspiemenu.h"
-#include "scene.h"
-
-#include <QtGui/qaction.h>
-#include <QtGui/qgraphicssceneevent.h>
-
-Scene::Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent)
- : QGraphicsScene(x, y, width, height, parent)
-{
-}
-
-Scene::Scene(const QRectF &sceneRect, QObject *parent)
- : QGraphicsScene(sceneRect, parent)
-{
-}
-
-Scene::Scene(QObject *parent)
- : QGraphicsScene(parent)
-{
-}
-
-Scene::~Scene()
-{
-}
-
-void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- QGraphicsPieMenu *menu = new QGraphicsPieMenu;
- for (int i = 0; i < 5; ++i)
- menu->addAction(new QAction(QString("Item %1").arg(i), menu));
- menu->popup(event->scenePos());
-}
diff --git a/examples/animation/research/piemenu/scene.h b/examples/animation/research/piemenu/scene.h
deleted file mode 100644
index bbfe6d3..0000000
--- a/examples/animation/research/piemenu/scene.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SCENE_H
-#define SCENE_H
-
-#include <QtGui/qgraphicsscene.h>
-
-class Scene : public QGraphicsScene
-{
- Q_OBJECT
-public:
- Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent = 0);
- Scene(const QRectF &sceneRect, QObject *parent = 0);
- Scene(QObject *parent = 0);
- ~Scene();
-
-protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
-};
-
-#endif
diff --git a/examples/animation/research/propertytransform/main.cpp b/examples/animation/research/propertytransform/main.cpp
deleted file mode 100644
index 99cd769..0000000
--- a/examples/animation/research/propertytransform/main.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "qpropertytransform.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QGraphicsScene scene;
- QGraphicsView view(&scene);
-
- QGraphicsItem *item = new QGraphicsRectItem(QRectF(0,0, 200, 100));
- scene.addItem(item);
- QPropertyTransform transform;
- transform.setTargetItem(item);
-
- QAnimationGroup *group = new QAnimationGroup(QAnimationGroup::Parallel, &scene);
- QPropertyAnimation *scaleAnim = new QPropertyAnimation(&transform, "scaleX");
- scaleAnim->setStartValue(1.0);
- scaleAnim->setTargetValue(2.0);
- scaleAnim->setDuration(10000);
- group->add(scaleAnim);
-
- QPropertyAnimation *scaleAnim2 = new QPropertyAnimation(&transform, "scaleY");
- scaleAnim2->setStartValue(.0);
- scaleAnim2->setTargetValue(2.0);
- scaleAnim2->setDuration(10000);
- QEasingCurve curve(QEasingCurve::InElastic);
- curve.setPeriod(2);
- curve.setAmplitude(2);
-
- //scaleAnim2->setEasingCurve(curve);
- //scaleAnim2->setEasingCurve(QEasingCurve(QEasingCurve::OutElastic , 2, 2 ));
- group->add(scaleAnim2);
-
- QPropertyAnimation *rotAnim = new QPropertyAnimation(&transform, "rotation");
- rotAnim->setStartValue(0);
- rotAnim->setTargetValue(90);
- rotAnim->setDuration(10000);
- group->add(rotAnim);
-
- group->start();
-
- view.resize(800,600);
- view.show();
- return app.exec();
-}
diff --git a/examples/animation/research/propertytransform/propertytransform.pro b/examples/animation/research/propertytransform/propertytransform.pro
deleted file mode 100644
index 94c36b8..0000000
--- a/examples/animation/research/propertytransform/propertytransform.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) fr 26. sep 13:21:57 2008
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp
-HEADERS += qpropertytransform.h
-CONFIG += console
-
diff --git a/examples/animation/research/propertytransform/qpropertytransform.h b/examples/animation/research/propertytransform/qpropertytransform.h
deleted file mode 100644
index e27987f..0000000
--- a/examples/animation/research/propertytransform/qpropertytransform.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QObject>
-#include <QtCore/QPoint>
-#include <QtGui/QGraphicsItem>
-#include <QtGui/QTransform>
-#include <QtCore/QDebug>
-
-/**
- * Experimental.
- * Pros:
- * 1. Does not add ugly/confusing API to QGraphicsItem.
- *
- * Cons:
- * 1. apply() /m_item->setTransform() is called too many times. (FIXED NOW?)
- *
- *
- */
-class QPropertyTransform : public QObject {
- Q_OBJECT
-public:
- Q_PROPERTY(QPointF center READ center WRITE setCenter);
- Q_PROPERTY(qreal rotation READ rotation WRITE setRotation);
- Q_PROPERTY(qreal scaleX READ scaleX WRITE setScaleX);
- Q_PROPERTY(qreal scaleY READ scaleY WRITE setScaleY);
-public:
- QPropertyTransform() : m_item(0), m_rotationZ(0), m_scaleX(1.), m_scaleY(1.) {}
-
- void setTargetItem(QGraphicsItem *item) {
- m_item = item;
- }
-
- void setCenter(const QPointF &center) {
- m_center = center;
- apply();
- }
-
- QPointF center() const { return m_center; }
-
- void setRotation(qreal rotation) {
- m_rotationZ = rotation;
- apply();
- }
-
- qreal rotation() const { return m_rotationZ; }
-
- void setScaleX(qreal scale) {
- m_scaleX = scale;
- apply();
- }
-
- qreal scaleX() const { return m_scaleX; }
-
- void setScaleY(qreal scale) {
- m_scaleY = scale;
- apply();
- }
-
- qreal scaleY() const { return m_scaleY; }
-
-private:
- QTransform transform() const {
- return QTransform().translate(m_center.x(), m_center.y())
- .rotate(m_rotationZ)
- .scale(m_scaleX, m_scaleY)
- .translate(-m_center.x(), -m_center.y());
- }
-
- void apply() {
- if (m_item)
- m_item->setTransform(transform());
- }
-
- QGraphicsItem *m_item;
- QPointF m_center;
- qreal m_rotationZ;
- qreal m_scaleX;
- qreal m_scaleY;
-};
-
diff --git a/examples/animation/research/sound/main.cpp b/examples/animation/research/sound/main.cpp
deleted file mode 100644
index ffbc44c..0000000
--- a/examples/animation/research/sound/main.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** 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.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//The purpose of this example is to show that it is possible to have your own
-// animation with undefined duration
-
-#include <QtGui/QtGui>
-#include <phonon>
-
-class SoundAnimation : public QAbstractAnimation
-{
-public:
- SoundAnimation(const QString &file)
- {
- //in an idea case we should also control the errors
- Phonon::createPath(&m_media, &m_audio);
- m_media.setCurrentSource(file);
- connect(&m_media, SIGNAL(finished()), SLOT(stop()));
- }
-
- int duration() const
- {
- return -1;
- }
-
- void updateCurrentTime(int msecs)
- {
- //nothing to do here...
- qDebug() << "updateCurrentTime" << msecs;
- }
-
- void updateState(State state)
- {
- switch(state)
- {
- case Running:
- m_media.play();
- break;
- case Stopped:
- m_media.stop();
- break;
- case Paused:
- m_media.pause();
- break;
- }
- }
-
-
-private:
- Phonon::MediaObject m_media;
- Phonon::AudioOutput m_audio;
-
-};
-
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- Q_INIT_RESOURCE(sound);
-
- SoundAnimation anim(QLatin1String(":/media/sax.mp3"));
- app.connect(&anim, SIGNAL(finished()), SLOT(quit()));
- anim.start();
-
- return app.exec();
-}
diff --git a/examples/animation/research/sound/media/sax.mp3 b/examples/animation/research/sound/media/sax.mp3
deleted file mode 100644
index 0a078b1..0000000
--- a/examples/animation/research/sound/media/sax.mp3
+++ /dev/null
Binary files differ
diff --git a/examples/animation/research/sound/sound.pro b/examples/animation/research/sound/sound.pro
deleted file mode 100644
index 0ad3050..0000000
--- a/examples/animation/research/sound/sound.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) mer. 21. janv. 13:53:26 2009
-######################################################################
-
-TEMPLATE = app
-QT += phonon
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-RESOURCES = sound.qrc
-
-# Input
-SOURCES += main.cpp
diff --git a/examples/animation/research/sound/sound.qrc b/examples/animation/research/sound/sound.qrc
deleted file mode 100644
index 8919142..0000000
--- a/examples/animation/research/sound/sound.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
-<file>media/sax.mp3</file>
-</qresource>
-</RCC>
diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp
index 06b0667..17a7a8e 100644
--- a/examples/animation/states/main.cpp
+++ b/examples/animation/states/main.cpp
@@ -40,14 +40,6 @@
****************************************************************************/
#include <QtGui>
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qstate.h"
-# include "qstatemachine.h"
-# include "qtransition.h"
-# include "qparallelanimationgroup.h"
-# include "qsequentialanimationgroup.h"
-# include "qpropertyanimation.h"
-#endif
class Pixmap : public QGraphicsWidget
{
diff --git a/examples/animation/stickman/animation.h b/examples/animation/stickman/animation.h
index e6c375e..b0b39c9 100644
--- a/examples/animation/stickman/animation.h
+++ b/examples/animation/stickman/animation.h
@@ -47,7 +47,9 @@
#include <QString>
class Frame;
+QT_BEGIN_NAMESPACE
class QIODevice;
+QT_END_NAMESPACE
class Animation
{
public:
diff --git a/examples/animation/stickman/editor/animationdialog.h b/examples/animation/stickman/editor/animationdialog.h
index 764cdaf..6025088 100644
--- a/examples/animation/stickman/editor/animationdialog.h
+++ b/examples/animation/stickman/editor/animationdialog.h
@@ -45,8 +45,10 @@
#include <QDialog>
#include <QMessageBox>
+QT_BEGIN_NAMESPACE
class QSpinBox;
class QLineEdit;
+QT_END_NAMESPACE
class StickMan;
class Animation;
class AnimationDialog: public QDialog
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index 423d7ad..eb4ed11 100644
--- a/examples/animation/stickman/lifecycle.cpp
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -47,15 +47,6 @@
#include <QtCore>
#include <QtGui>
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qstatemachine.h"
-#include "qstate.h"
-#include "qeventtransition.h"
-#include "qsignaltransition.h"
-#include "qsignalevent.h"
-#include "qpropertyanimation.h"
-#include "qparallelanimationgroup.h"
-#endif
class KeyPressTransition: public QSignalTransition
{
@@ -82,6 +73,7 @@ private:
Qt::Key m_key;
};
+//! [4]
class LightningStrikesTransition: public QEventTransition
{
public:
@@ -97,6 +89,7 @@ public:
return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
}
};
+//! [4]
LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
: m_stickMan(stickMan), m_keyReceiver(keyReceiver)
@@ -110,7 +103,10 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
}
// Set up intial state graph
+//! [3]
m_machine = new QStateMachine();
+ m_machine->addDefaultAnimation(m_animationGroup);
+//! [3]
m_alive = new QState(m_machine->rootState());
m_alive->setObjectName("alive");
@@ -122,11 +118,13 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
lightningBlink->assignProperty(m_stickMan, "fillColor", Qt::white);
lightningBlink->assignProperty(m_stickMan, "isDead", true);
+//! [5]
QTimer *timer = new QTimer(lightningBlink);
timer->setSingleShot(true);
timer->setInterval(100);
QObject::connect(lightningBlink, SIGNAL(entered()), timer, SLOT(start()));
QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop()));
+//! [5]
m_dead = new QState(m_machine->rootState());
m_dead->assignProperty(m_stickMan->scene(), "backgroundBrush", Qt::black);
@@ -142,8 +140,9 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
// Lightning strikes at random
m_alive->addTransition(new LightningStrikesTransition(lightningBlink));
- //m_alive->addTransition(new KeyPressTransition(m_keyReceiver, Qt::Key_L, lightningBlink));
- connectByAnimation(lightningBlink, m_dead, new QSignalTransition(timer, SIGNAL(timeout())));
+//! [0]
+ lightningBlink->addTransition(timer, SIGNAL(timeout()), m_dead);
+//! [0]
m_machine->setInitialState(m_alive);
}
@@ -159,22 +158,10 @@ void LifeCycle::start()
m_machine->start();
}
-void LifeCycle::connectByAnimation(QState *s1, QAbstractState *s2,
- QAbstractTransition *transition)
-{
- if (transition == 0) {
- transition = s1->addTransition(s2);
- } else {
- transition->setTargetState(s2);
- s1->addTransition(transition);
- }
- transition->addAnimation(m_animationGroup);
-}
-
void LifeCycle::addActivity(const QString &fileName, Qt::Key key)
{
QState *state = makeState(m_alive, fileName);
- connectByAnimation(m_alive, state, new KeyPressTransition(m_keyReceiver, key));
+ m_alive->addTransition(new KeyPressTransition(m_keyReceiver, key, state));
}
QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName)
@@ -191,26 +178,28 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa
const int frameCount = animation.totalFrames();
QState *previousState = 0;
for (int i=0; i<frameCount; ++i) {
- QState *frameState = new QState(topLevel);
- frameState->setObjectName(QString::fromLatin1("frame %0").arg(i));
-
animation.setCurrentFrame(i);
+
+//! [1]
+ QState *frameState = new QState(topLevel);
const int nodeCount = animation.nodeCount();
for (int j=0; j<nodeCount; ++j)
frameState->assignProperty(m_stickMan->node(j), "position", animation.nodePos(j));
+//! [1]
- if (previousState == 0) {
+ frameState->setObjectName(QString::fromLatin1("frame %0").arg(i));
+ if (previousState == 0)
topLevel->setInitialState(frameState);
- } else {
- connectByAnimation(previousState, frameState,
- new QSignalTransition(previousState, SIGNAL(polished())));
- }
+ else
+//! [2]
+ previousState->addTransition(previousState, SIGNAL(polished()), frameState);
+//! [2]
+
previousState = frameState;
}
// Loop
- connectByAnimation(previousState, topLevel->initialState(),
- new QSignalTransition(previousState, SIGNAL(polished())));
+ previousState->addTransition(previousState, SIGNAL(polished()), topLevel->initialState());
return topLevel;
diff --git a/examples/animation/stickman/lifecycle.h b/examples/animation/stickman/lifecycle.h
index e520402..2be4762 100644
--- a/examples/animation/stickman/lifecycle.h
+++ b/examples/animation/stickman/lifecycle.h
@@ -45,11 +45,13 @@
#include <Qt>
class StickMan;
+QT_BEGIN_NAMESPACE
class QStateMachine;
class QAnimationGroup;
class QState;
class QAbstractState;
class QAbstractTransition;
+QT_END_NAMESPACE
class GraphicsView;
class LifeCycle
{
@@ -63,8 +65,6 @@ public:
void start();
private:
- void connectByAnimation(QState *s1, QAbstractState *s2,
- QAbstractTransition *transition = 0);
QState *makeState(QState *parentState, const QString &animationFileName);
StickMan *m_stickMan;
diff --git a/examples/animation/stickman/node.cpp b/examples/animation/stickman/node.cpp
index ed18108..9c485d9 100644
--- a/examples/animation/stickman/node.cpp
+++ b/examples/animation/stickman/node.cpp
@@ -75,7 +75,7 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
return QGraphicsItem::itemChange(change, value);
}
-void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
+void Node::mousePressEvent(QGraphicsSceneMouseEvent *)
{
m_dragging = true;
}
@@ -86,7 +86,7 @@ void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
setPos(mapToParent(event->pos()));
}
-void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
{
m_dragging = false;
}
diff --git a/examples/animation/stickman/stickman.cpp b/examples/animation/stickman/stickman.cpp
index 5eb392f..a3b200c 100644
--- a/examples/animation/stickman/stickman.cpp
+++ b/examples/animation/stickman/stickman.cpp
@@ -48,6 +48,10 @@
#define _USE_MATH_DEFINES
#include <math.h>
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
static const int NodeCount = 16;
static const qreal Coords[NodeCount * 2] = {
0.0, -150.0, // head, #0
@@ -178,7 +182,7 @@ Node *StickMan::node(int idx) const
return 0;
}
-void StickMan::timerEvent(QTimerEvent *e)
+void StickMan::timerEvent(QTimerEvent *)
{
update();
}
diff --git a/examples/animation/stickman/stickman.h b/examples/animation/stickman/stickman.h
index 46863a3..6395272 100644
--- a/examples/animation/stickman/stickman.h
+++ b/examples/animation/stickman/stickman.h
@@ -47,7 +47,9 @@
const int LimbCount = 16;
class Node;
+QT_BEGIN_NAMESPACE
class QTimer;
+QT_END_NAMESPACE
class StickMan: public QObject, public QGraphicsItem
{
Q_OBJECT
diff --git a/examples/animation/stickman/stickman.pro b/examples/animation/stickman/stickman.pro
index bfee5b0..1dbbce9 100644
--- a/examples/animation/stickman/stickman.pro
+++ b/examples/animation/stickman/stickman.pro
@@ -1,14 +1,21 @@
-######################################################################
-# Automatically generated by qmake (2.01a) ti 3. feb 19:50:14 2009
-######################################################################
+HEADERS += stickman.h \
+ animation.h \
+ node.h \
+ lifecycle.h \
+ graphicsview.h
+SOURCES += main.cpp \
+ stickman.cpp \
+ animation.cpp \
+ node.cpp \
+ lifecycle.cpp \
+ graphicsview.cpp
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
+INCLUDEPATH += $$PWD
include(editor/editor.pri)
-# Input
-HEADERS += stickman.h animation.h node.h lifecycle.h graphicsview.h
-SOURCES += main.cpp stickman.cpp animation.cpp node.cpp lifecycle.cpp graphicsview.cpp
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation/stickman
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS stickman.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation/stickman
+INSTALLS += target sources
diff --git a/examples/animation/sub-attaq/animationmanager.cpp b/examples/animation/sub-attaq/animationmanager.cpp
index 5b9282a..477d3bd 100644
--- a/examples/animation/sub-attaq/animationmanager.cpp
+++ b/examples/animation/sub-attaq/animationmanager.cpp
@@ -43,11 +43,7 @@
#include "animationmanager.h"
//Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qabstractanimation.h"
-#else
-# include <QtCore/QAbstractAnimation>
-#endif
+#include <QtCore/QAbstractAnimation>
#include <QtCore/QDebug>
// the universe's only animation manager
diff --git a/examples/animation/sub-attaq/animationmanager.h b/examples/animation/sub-attaq/animationmanager.h
index 69ec3d7..a563c96 100644
--- a/examples/animation/sub-attaq/animationmanager.h
+++ b/examples/animation/sub-attaq/animationmanager.h
@@ -44,7 +44,9 @@
#include <QtCore/QObject>
+QT_BEGIN_NAMESPACE
class QAbstractAnimation;
+QT_END_NAMESPACE
class AnimationManager : public QObject
{
diff --git a/examples/animation/sub-attaq/boat.cpp b/examples/animation/sub-attaq/boat.cpp
index 143cf94..63d12bb 100644
--- a/examples/animation/sub-attaq/boat.cpp
+++ b/examples/animation/sub-attaq/boat.cpp
@@ -50,22 +50,12 @@
#include "qanimationstate.h"
//Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qpropertyanimation.h"
-# include "qstatemachine.h"
-# include "qhistorystate.h"
-# include "qfinalstate.h"
-# include "qstate.h"
-# include "qpauseanimation.h"
-#include "qsequentialanimationgroup.h"
-#else
#include <QtCore/QPropertyAnimation>
#include <QtCore/QStateMachine>
#include <QtCore/QHistoryState>
#include <QtCore/QFinalState>
#include <QtCore/QState>
#include <QtCore/QSequentialAnimationGroup>
-#endif
static QAbstractAnimation *setupDestroyAnimation(Boat *boat)
{
diff --git a/examples/animation/sub-attaq/boat.h b/examples/animation/sub-attaq/boat.h
index b28cf20..08a9fa2 100644
--- a/examples/animation/sub-attaq/boat.h
+++ b/examples/animation/sub-attaq/boat.h
@@ -46,17 +46,15 @@
#include <QtCore/QObject>
#include <QtGui/QKeyEvent>
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qtgraphicswidget.h"
-#else
-# include <QtGui/QGraphicsWidget>
-#endif
+#include <QtGui/QGraphicsWidget>
class PixmapItem;
class Bomb;
+QT_BEGIN_NAMESPACE
class QVariantAnimation;
class QAbstractAnimation;
class QStateMachine;
+QT_END_NAMESPACE
class Boat : public QGraphicsWidget
{
diff --git a/examples/animation/sub-attaq/boat_p.h b/examples/animation/sub-attaq/boat_p.h
index 6f03e48..a8a24a6 100644
--- a/examples/animation/sub-attaq/boat_p.h
+++ b/examples/animation/sub-attaq/boat_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -42,16 +42,23 @@
#ifndef BOAT_P_H
#define BOAT_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
//Own
#include "bomb.h"
#include "graphicsscene.h"
// Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qkeyeventtransition.h"
-#else
-# include <QtGui/QKeyEventTransition>
-#endif
+#include <QtGui/QKeyEventTransition>
static const int MAX_BOMB = 5;
diff --git a/examples/animation/sub-attaq/bomb.cpp b/examples/animation/sub-attaq/bomb.cpp
index 04310aa..f1f5324 100644
--- a/examples/animation/sub-attaq/bomb.cpp
+++ b/examples/animation/sub-attaq/bomb.cpp
@@ -47,18 +47,10 @@
#include "qanimationstate.h"
//Qt
-
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qpropertyanimation.h"
-#include "qsequentialanimationgroup.h"
-#include "qstatemachine.h"
-#include "qfinalstate.h"
-#else
#include <QtCore/QSequentialAnimationGroup>
#include <QtCore/QPropertyAnimation>
#include <QtCore/QStateMachine>
#include <QtCore/QFinalState>
-#endif
Bomb::Bomb(QGraphicsItem * parent, Qt::WindowFlags wFlags)
: QGraphicsWidget(parent,wFlags), launchAnimation(0)
diff --git a/examples/animation/sub-attaq/bomb.h b/examples/animation/sub-attaq/bomb.h
index 9191e6e..226d056 100644
--- a/examples/animation/sub-attaq/bomb.h
+++ b/examples/animation/sub-attaq/bomb.h
@@ -43,13 +43,8 @@
#define __BOMB__H__
//Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qanimationgroup.h"
-# include "qgraphicswidget.h"
-#else
-# include <QtGui/QGraphicsWidget>
-# include <QtCore/QAnimationGroup>
-#endif
+#include <QtGui/QGraphicsWidget>
+#include <QtCore/QAnimationGroup>
class PixmapItem;
diff --git a/examples/animation/sub-attaq/custompropertyanimation.cpp b/examples/animation/sub-attaq/custompropertyanimation.cpp
index f7ab269..8226cca 100644
--- a/examples/animation/sub-attaq/custompropertyanimation.cpp
+++ b/examples/animation/sub-attaq/custompropertyanimation.cpp
@@ -44,9 +44,6 @@
// Qt
#include <QtCore/qdebug.h>
-QT_BEGIN_NAMESPACE
-
-
CustomPropertyAnimation::CustomPropertyAnimation(QObject *parent) :
QVariantAnimation(parent), animProp(0)
{
@@ -108,8 +105,4 @@ void CustomPropertyAnimation::updateState(QAbstractAnimation::State oldState, QA
QVariantAnimation::updateState(oldState, newState);
}
-
-
#include "moc_custompropertyanimation.cpp"
-
-QT_END_NAMESPACE
diff --git a/examples/animation/sub-attaq/custompropertyanimation.h b/examples/animation/sub-attaq/custompropertyanimation.h
index 48a50c9..8654aeb 100644
--- a/examples/animation/sub-attaq/custompropertyanimation.h
+++ b/examples/animation/sub-attaq/custompropertyanimation.h
@@ -42,13 +42,11 @@
#ifndef CUSTOMPROPERTYANIMATION_H
#define CUSTOMPROPERTYANIMATION_H
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qvariantanimation.h"
-#else
-# include <QtCore/qvariantanimation.h>
-#endif
+#include <QtCore/qvariantanimation.h>
+QT_BEGIN_NAMESPACE
class QGraphicsItem;
+QT_END_NAMESPACE
struct AbstractProperty
{
diff --git a/examples/animation/sub-attaq/graphicsscene.cpp b/examples/animation/sub-attaq/graphicsscene.cpp
index 2a6f83c..e773dae 100644
--- a/examples/animation/sub-attaq/graphicsscene.cpp
+++ b/examples/animation/sub-attaq/graphicsscene.cpp
@@ -53,21 +53,12 @@
#include "progressitem.h"
//Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qpropertyanimation.h"
-#include "qsequentialanimationgroup.h"
-#include "qparallelanimationgroup.h"
-#include "qstatemachine.h"
-#include "qfinalstate.h"
-#include "qpauseanimation.h"
-#else
#include <QtCore/QPropertyAnimation>
#include <QtCore/QSequentialAnimationGroup>
#include <QtCore/QParallelAnimationGroup>
#include <QtCore/QStateMachine>
#include <QtCore/QFinalState>
#include <QtCore/QPauseAnimation>
-#endif
#include <QtGui/QAction>
#include <QtCore/QDir>
#include <QtGui/QApplication>
@@ -129,7 +120,7 @@ GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode)
//parse the xml that contain all data of the game
QXmlStreamReader reader;
- QFile file(QDir::currentPath() + "/data.xml");
+ QFile file(":data.xml");
file.open(QIODevice::ReadOnly);
reader.setDevice(&file);
LevelDescription currentLevel;
diff --git a/examples/animation/sub-attaq/graphicsscene.h b/examples/animation/sub-attaq/graphicsscene.h
index 0840564..8b0ea96 100644
--- a/examples/animation/sub-attaq/graphicsscene.h
+++ b/examples/animation/sub-attaq/graphicsscene.h
@@ -45,12 +45,7 @@
//Qt
#include <QtGui/QGraphicsScene>
#include <QtCore/QSet>
-
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qstate.h"
-#else
-# include <QtCore/QState>
-#endif
+#include <QtCore/QState>
class Boat;
@@ -59,7 +54,9 @@ class Torpedo;
class Bomb;
class PixmapItem;
class ProgressItem;
+QT_BEGIN_NAMESPACE
class QAction;
+QT_END_NAMESPACE
class GraphicsScene : public QGraphicsScene
{
diff --git a/examples/animation/sub-attaq/mainwindow.cpp b/examples/animation/sub-attaq/mainwindow.cpp
index a166241..9cf9eb5 100644
--- a/examples/animation/sub-attaq/mainwindow.cpp
+++ b/examples/animation/sub-attaq/mainwindow.cpp
@@ -43,11 +43,11 @@
#include "mainwindow.h"
#include "graphicsscene.h"
+//Qt
+#include <QtGui/QtGui>
#ifndef QT_NO_OPENGL
- #include <QtOpenGL/QtOpenGL>
+#include <QtOpenGL/QtOpenGL>
#endif
-//Qt
-#include <QtGui/QGraphicsView>
MainWindow::MainWindow() : QMainWindow(0)
{
diff --git a/examples/animation/sub-attaq/mainwindow.h b/examples/animation/sub-attaq/mainwindow.h
index 72d1324..87f194a 100644
--- a/examples/animation/sub-attaq/mainwindow.h
+++ b/examples/animation/sub-attaq/mainwindow.h
@@ -44,9 +44,10 @@
//Qt
#include <QtGui/QMainWindow>
-
class GraphicsScene;
+QT_BEGIN_NAMESPACE
class QGraphicsView;
+QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
diff --git a/examples/animation/sub-attaq/qanimationstate.cpp b/examples/animation/sub-attaq/qanimationstate.cpp
index 0f30ac2..d4d109c 100644
--- a/examples/animation/sub-attaq/qanimationstate.cpp
+++ b/examples/animation/sub-attaq/qanimationstate.cpp
@@ -41,14 +41,7 @@
#include "qanimationstate.h"
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qstate.h"
-# include "qstate_p.h"
-#else
-# include <QtCore/qstate.h>
-# include <private/qstate_p.h>
-#endif
-
+#include <QtCore/qstate.h>
QT_BEGIN_NAMESPACE
@@ -81,25 +74,11 @@ machine.start();
#ifndef QT_NO_ANIMATION
-class QAnimationStatePrivate : public QStatePrivate
-{
- Q_DECLARE_PUBLIC(QAnimationState)
-public:
- QAnimationStatePrivate()
- : animation(0)
- {
-
- }
- ~QAnimationStatePrivate() {}
-
- QAbstractAnimation *animation;
-};
-
/*!
Constructs a new state with the given \a parent state.
*/
QAnimationState::QAnimationState(QState *parent)
- : QState(*new QAnimationStatePrivate, parent)
+ : QState(parent), m_animation(0)
{
}
@@ -117,20 +96,18 @@ QAnimationState::~QAnimationState()
*/
void QAnimationState::setAnimation(QAbstractAnimation *animation)
{
- Q_D(QAnimationState);
-
- if (animation == d->animation)
+ if (animation == m_animation)
return;
//Disconnect from the previous animation if exist
- if(d->animation)
- disconnect(d->animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
+ if(m_animation)
+ disconnect(m_animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
- d->animation = animation;
+ m_animation = animation;
- if (d->animation) {
+ if (m_animation) {
//connect the new animation
- connect(d->animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
+ connect(m_animation, SIGNAL(finished()), this, SIGNAL(animationFinished()));
}
}
@@ -139,8 +116,7 @@ void QAnimationState::setAnimation(QAbstractAnimation *animation)
*/
QAbstractAnimation* QAnimationState::animation() const
{
- Q_D(const QAnimationState);
- return d->animation;
+ return m_animation;
}
/*!
@@ -148,9 +124,8 @@ QAbstractAnimation* QAnimationState::animation() const
*/
void QAnimationState::onEntry(QEvent *)
{
- Q_D(QAnimationState);
- if (d->animation)
- d->animation->start();
+ if (m_animation)
+ m_animation->start();
}
/*!
@@ -158,9 +133,8 @@ void QAnimationState::onEntry(QEvent *)
*/
void QAnimationState::onExit(QEvent *)
{
- Q_D(QAnimationState);
- if (d->animation)
- d->animation->stop();
+ if (m_animation)
+ m_animation->stop();
}
/*!
diff --git a/examples/animation/sub-attaq/qanimationstate.h b/examples/animation/sub-attaq/qanimationstate.h
index 88c0a6d..e5322ad 100644
--- a/examples/animation/sub-attaq/qanimationstate.h
+++ b/examples/animation/sub-attaq/qanimationstate.h
@@ -58,7 +58,7 @@ QT_MODULE(Gui)
#ifndef QT_NO_ANIMATION
-class QAnimationStatePrivate;
+class QAbstractAnimation;
class QAnimationState : public QState
{
@@ -80,7 +80,7 @@ protected:
private:
Q_DISABLE_COPY(QAnimationState)
- Q_DECLARE_PRIVATE(QAnimationState)
+ QAbstractAnimation *m_animation;
};
#endif
diff --git a/examples/animation/sub-attaq/states.cpp b/examples/animation/sub-attaq/states.cpp
index 7650b0f..adc8bd0 100644
--- a/examples/animation/sub-attaq/states.cpp
+++ b/examples/animation/sub-attaq/states.cpp
@@ -51,17 +51,10 @@
//Qt
#include <QtGui/QMessageBox>
#include <QtGui/QGraphicsView>
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qstatemachine.h"
-#include "qkeyeventtransition.h"
-#include "qsignalevent.h"
-#include "qfinalstate.h"
-#else
#include <QtCore/QStateMachine>
#include <QtGui/QKeyEventTransition>
#include <QtCore/QSignalEvent>
#include <QtCore/QFinalState>
-#endif
PlayState::PlayState(GraphicsScene *scene, QState *parent)
: QState(parent),
diff --git a/examples/animation/sub-attaq/states.h b/examples/animation/sub-attaq/states.h
index a1cb5ff..71375e0 100644
--- a/examples/animation/sub-attaq/states.h
+++ b/examples/animation/sub-attaq/states.h
@@ -43,23 +43,18 @@
#define STATES_H
//Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qstate.h"
-#include "qsignaltransition.h"
-#include "qpropertyanimation.h"
-#include "qkeyeventtransition.h"
-#else
#include <QtCore/QState>
#include <QtCore/QSignalTransition>
#include <QtCore/QPropertyAnimation>
-# include <QtGui/QKeyEventTransition>
-#endif
+#include <QtGui/QKeyEventTransition>
#include <QtCore/QSet>
class GraphicsScene;
class Boat;
class SubMarine;
+QT_BEGIN_NAMESPACE
class QStateMachine;
+QT_END_NAMESPACE
class PlayState : public QState
{
diff --git a/examples/animation/sub-attaq/sub-attaq.pro b/examples/animation/sub-attaq/sub-attaq.pro
index 961a9b5..d13a099 100644
--- a/examples/animation/sub-attaq/sub-attaq.pro
+++ b/examples/animation/sub-attaq/sub-attaq.pro
@@ -1,14 +1,5 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Thu Oct 9 10:53:30 2008
-# #####################################################################
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-QT += xml
contains(QT_CONFIG, opengl):QT += opengl
-# Input
HEADERS += boat.h \
bomb.h \
mainwindow.h \
@@ -37,3 +28,9 @@ SOURCES += boat.cpp \
qanimationstate.cpp \
progressitem.cpp
RESOURCES += subattaq.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation/sub-attaq
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS sub-attaq.pro pics
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation/sub-attaq
+INSTALLS += target sources
diff --git a/examples/animation/sub-attaq/subattaq.qrc b/examples/animation/sub-attaq/subattaq.qrc
index c76f8ef..80a3af1 100644
--- a/examples/animation/sub-attaq/subattaq.qrc
+++ b/examples/animation/sub-attaq/subattaq.qrc
@@ -34,5 +34,6 @@
<file alias="big/explosion/submarine/step2" >pics/big/explosion/submarine/step2.png</file>
<file alias="big/explosion/submarine/step3" >pics/big/explosion/submarine/step3.png</file>
<file alias="big/explosion/submarine/step4" >pics/big/explosion/submarine/step4.png</file>
+ <file>data.xml</file>
</qresource>
</RCC>
diff --git a/examples/animation/sub-attaq/submarine.cpp b/examples/animation/sub-attaq/submarine.cpp
index 0f03efc..d8cf1da 100644
--- a/examples/animation/sub-attaq/submarine.cpp
+++ b/examples/animation/sub-attaq/submarine.cpp
@@ -49,18 +49,10 @@
#include "custompropertyanimation.h"
#include "qanimationstate.h"
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qpropertyanimation.h"
-# include "qstatemachine.h"
-# include "qfinalstate.h"
-# include "qsequentialanimationgroup.h"
-# include "qpauseanimation.h"
-#else
#include <QtCore/QPropertyAnimation>
#include <QtCore/QStateMachine>
#include <QtCore/QFinalState>
#include <QtCore/QSequentialAnimationGroup>
-#endif
static QAbstractAnimation *setupDestroyAnimation(SubMarine *sub)
{
diff --git a/examples/animation/sub-attaq/submarine.h b/examples/animation/sub-attaq/submarine.h
index 7ee587d..4001603 100644
--- a/examples/animation/sub-attaq/submarine.h
+++ b/examples/animation/sub-attaq/submarine.h
@@ -43,13 +43,8 @@
#define __SUBMARINE__H__
//Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qvariantanimation.h"
-#include "qgraphicswidget.h"
-#else
#include <QtCore/QVariantAnimation>
#include <QtGui/QGraphicsWidget>
-#endif
class PixmapItem;
diff --git a/examples/animation/sub-attaq/submarine_p.h b/examples/animation/sub-attaq/submarine_p.h
index c76d991..8c31eb7 100644
--- a/examples/animation/sub-attaq/submarine_p.h
+++ b/examples/animation/sub-attaq/submarine_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -42,17 +42,24 @@
#ifndef SUBMARINE_P_H
#define SUBMARINE_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
//Own
#include "animationmanager.h"
#include "submarine.h"
#include "qanimationstate.h"
//Qt
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qpropertyanimation.h"
-#else
#include <QtCore/QPropertyAnimation>
-#endif
#include <QtGui/QGraphicsScene>
//This state is describing when the boat is moving right
diff --git a/examples/animation/sub-attaq/torpedo.cpp b/examples/animation/sub-attaq/torpedo.cpp
index 88f1112..02a54fc 100644
--- a/examples/animation/sub-attaq/torpedo.cpp
+++ b/examples/animation/sub-attaq/torpedo.cpp
@@ -47,15 +47,9 @@
#include "animationmanager.h"
#include "qanimationstate.h"
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-#include "qpropertyanimation.h"
-#include "qstatemachine.h"
-#include "qfinalstate.h"
-#else
#include <QtCore/QPropertyAnimation>
#include <QtCore/QStateMachine>
#include <QtCore/QFinalState>
-#endif
Torpedo::Torpedo(QGraphicsItem * parent, Qt::WindowFlags wFlags)
: QGraphicsWidget(parent,wFlags), currentSpeed(0), launchAnimation(0)
diff --git a/examples/animation/sub-attaq/torpedo.h b/examples/animation/sub-attaq/torpedo.h
index 2e44e41..4a0f457 100644
--- a/examples/animation/sub-attaq/torpedo.h
+++ b/examples/animation/sub-attaq/torpedo.h
@@ -45,13 +45,8 @@
//Qt
#include <QtCore/QObject>
-#if defined(QT_EXPERIMENTAL_SOLUTION)
-# include "qvariantanimation.h"
-# include "qgraphicswidget.h"
-#else
-# include <QtCore/QVariantAnimation>
-# include <QtGui/QGraphicsWidget>
-#endif
+#include <QtCore/QVariantAnimation>
+#include <QtGui/QGraphicsWidget>
class PixmapItem;
diff --git a/examples/examples.pro b/examples/examples.pro
index 4677a23..8a20845 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,5 +1,6 @@
TEMPLATE = subdirs
SUBDIRS = \
+ animation \
desktop \
dialogs \
draganddrop \
@@ -26,7 +27,6 @@ SUBDIRS = \
contains(QT_CONFIG, phonon):!static: SUBDIRS += phonon
contains(QT_CONFIG, webkit): SUBDIRS += webkit
-contains(QT_CONFIG, animation): SUBDIRS += animation
embedded:SUBDIRS += qws
!wince*: {
!contains(QT_EDITION, Console):contains(QT_BUILD_PARTS, tools):SUBDIRS += designer
diff --git a/examples/itemviews/puzzle/puzzle.pro b/examples/itemviews/puzzle/puzzle.pro
index deed112..4f5aaad 100644
--- a/examples/itemviews/puzzle/puzzle.pro
+++ b/examples/itemviews/puzzle/puzzle.pro
@@ -12,3 +12,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/itemviews/puzzle
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.jpg
sources.path = $$[QT_INSTALL_EXAMPLES]/itemviews/puzzle
INSTALLS += target sources
+
+wince* {
+ DEPLOYMENT_PLUGIN += qjpeg qgif qtiff
+}
+
diff --git a/examples/network/googlesuggest/googlesuggest.pro b/examples/network/googlesuggest/googlesuggest.pro
index afd600f..33b79de 100644
--- a/examples/network/googlesuggest/googlesuggest.pro
+++ b/examples/network/googlesuggest/googlesuggest.pro
@@ -3,7 +3,7 @@ SOURCES = main.cpp searchbox.cpp googlesuggest.cpp
HEADERS = searchbox.h googlesuggest.h
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlesuggest
+target.path = $$[QT_INSTALL_EXAMPLES]/network/googlesuggest
sources.files = $$SOURCES $$HEADERS *.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlesuggest
+sources.path = $$[QT_INSTALL_EXAMPLES]/network/googlesuggest
INSTALLS += target sources
diff --git a/examples/opengl/framebufferobject/glwidget.cpp b/examples/opengl/framebufferobject/glwidget.cpp
index d3591d6..3cb3929 100644
--- a/examples/opengl/framebufferobject/glwidget.cpp
+++ b/examples/opengl/framebufferobject/glwidget.cpp
@@ -53,7 +53,18 @@ GLWidget::GLWidget(QWidget *parent)
{
setWindowTitle(tr("OpenGL framebuffer objects"));
makeCurrent();
- fbo = new QGLFramebufferObject(1024, 1024);
+
+ if (QGLFramebufferObject::hasOpenGLFramebufferBlit()) {
+ QGLFramebufferObjectFormat format;
+ format.setSamples(4);
+
+ render_fbo = new QGLFramebufferObject(512, 512, format);
+ texture_fbo = new QGLFramebufferObject(512, 512);
+ } else {
+ render_fbo = new QGLFramebufferObject(1024, 1024);
+ texture_fbo = render_fbo;
+ }
+
rot_x = rot_y = rot_z = 0.0f;
scale = 0.1f;
anim = new QTimeLine(750, this);
@@ -113,7 +124,9 @@ GLWidget::~GLWidget()
{
delete[] wave;
glDeleteLists(tile_list, 1);
- delete fbo;
+ delete texture_fbo;
+ if (render_fbo != texture_fbo)
+ delete render_fbo;
}
void GLWidget::paintEvent(QPaintEvent *)
@@ -129,10 +142,16 @@ void GLWidget::draw()
saveGLState();
// render the 'bubbles.svg' file into our framebuffer object
- QPainter fbo_painter(fbo);
+ QPainter fbo_painter(render_fbo);
svg_renderer->render(&fbo_painter);
fbo_painter.end();
+ if (render_fbo != texture_fbo) {
+ QRect rect(0, 0, render_fbo->width(), render_fbo->height());
+ QGLFramebufferObject::blitFramebuffer(texture_fbo, rect,
+ render_fbo, rect);
+ }
+
// draw into the GL widget
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
@@ -145,8 +164,9 @@ void GLWidget::draw()
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glBindTexture(GL_TEXTURE_2D, fbo->texture());
+ glBindTexture(GL_TEXTURE_2D, texture_fbo->texture());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glEnable(GL_TEXTURE_2D);
glEnable(GL_MULTISAMPLE);
glEnable(GL_CULL_FACE);
diff --git a/examples/opengl/framebufferobject/glwidget.h b/examples/opengl/framebufferobject/glwidget.h
index b64cfa8..d97ef78 100644
--- a/examples/opengl/framebufferobject/glwidget.h
+++ b/examples/opengl/framebufferobject/glwidget.h
@@ -77,6 +77,7 @@ private:
QImage logo;
QTimeLine *anim;
QSvgRenderer *svg_renderer;
- QGLFramebufferObject *fbo;
+ QGLFramebufferObject *render_fbo;
+ QGLFramebufferObject *texture_fbo;
};
diff --git a/examples/qtconcurrent/imagescaling/imagescaling.pro b/examples/qtconcurrent/imagescaling/imagescaling.pro
index fbf864a..0a25efb 100644
--- a/examples/qtconcurrent/imagescaling/imagescaling.pro
+++ b/examples/qtconcurrent/imagescaling/imagescaling.pro
@@ -11,3 +11,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtconcurrent/imagescaling
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/qtconcurrent/imagescaling
INSTALLS += target sources
+
+wince*: DEPLOYMENT_PLUGIN += qgif qjpeg qtiff
diff --git a/examples/qtconcurrent/qtconcurrent.pro b/examples/qtconcurrent/qtconcurrent.pro
index 53008f0..5d73533 100644
--- a/examples/qtconcurrent/qtconcurrent.pro
+++ b/examples/qtconcurrent/qtconcurrent.pro
@@ -1,10 +1,13 @@
TEMPLATE = subdirs
SUBDIRS = imagescaling \
map \
- progressdialog \
runfunction \
wordcount
+!wince* {
+ SUBDIRS += progressdialog
+}
+
# install
target.path = $$[QT_INSTALL_EXAMPLES]/qtconcurrent
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qtconcurrent.pro README
diff --git a/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro
index 1881fce..c216a30 100644
--- a/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro
+++ b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro
@@ -8,3 +8,6 @@ target.path = $$[QT_INSTALL_EXAMPLES]/sql/sqlwidgetmapper
sources.files = $$SOURCES $$HEADERS *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/sql/sqlwidgetmapper
INSTALLS += target sources
+
+wince*: DEPLOYMENT_PLUGIN += qsqlite
+
diff --git a/examples/statemachine/citizenquartz/citizenquartz.pro b/examples/statemachine/citizenquartz/citizenquartz.pro
deleted file mode 100644
index 58039a0..0000000
--- a/examples/statemachine/citizenquartz/citizenquartz.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += main.cpp \
- clock.cpp \
- clockbutton.cpp \
- clockdisplay.cpp \
- propertyaddstate.cpp \
-
-HEADERS += clock.h \
- clockbutton.h \
- clockdisplay.h \
- propertyaddstate.h \
- timeperiod.h \
-
-RESOURCES += citizenquartz.qrc
-CONFIG += console
diff --git a/examples/statemachine/citizenquartz/citizenquartz.qrc b/examples/statemachine/citizenquartz/citizenquartz.qrc
deleted file mode 100644
index fc09ef9..0000000
--- a/examples/statemachine/citizenquartz/citizenquartz.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>sound/alarm.wav</file>
- <file>images/alarm.png</file>
-</qresource>
-</RCC> \ No newline at end of file
diff --git a/examples/statemachine/citizenquartz/clock.cpp b/examples/statemachine/citizenquartz/clock.cpp
deleted file mode 100644
index 1b2b21e..0000000
--- a/examples/statemachine/citizenquartz/clock.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-#include "clock.h"
-#include "clockbutton.h"
-#include "clockdisplay.h"
-#include "propertyaddstate.h"
-#include "timeperiod.h"
-
-#include <QStateMachine>
-#include <QState>
-#include <QHistoryState>
-
-#include <QPainter>
-#include <QTimer>
-#include <QSound>
-
-Clock::Clock(QGraphicsItem *parent)
- : QGraphicsItem(parent),
- m_stateMachine(0),
- m_clockDisplay(0),
- m_buttonA(0),
- m_buttonB(0),
- m_buttonC(0),
- m_buttonD(0),
- m_alarmState(0),
- m_timeState(0),
- m_updateState(0),
- m_regularState(0),
- m_displaysHistoryState(0),
- m_alarmSound(new QSound(":/sound/alarm.wav", this))
-{
-}
-
-void Clock::initializeUi()
-{
- QPainterPath path = shape();
- QPointF pap;
- qreal aap;
-
- m_buttonA = new ClockButton("Button A", this);
- pap = path.pointAtPercent(0.05);
- aap = path.angleAtPercent(0.05);
- m_buttonA->translate(pap.x(), pap.y());
- m_buttonA->rotate(-aap);
- connect(m_buttonA, SIGNAL(pressed()), this, SIGNAL(anyButtonPressed()));
-
- m_buttonB = new ClockButton("Button B", this);
- pap = path.pointAtPercent(0.77);
- aap = path.angleAtPercent(0.77);
- m_buttonB->translate(pap.x(), pap.y());
- m_buttonB->rotate(-aap);
- connect(m_buttonB, SIGNAL(pressed()), this, SIGNAL(anyButtonPressed()));
-
- m_buttonC = new ClockButton("Button C", this);
- pap = path.pointAtPercent(0.67);
- aap = path.angleAtPercent(0.67);
- m_buttonC->translate(pap.x(), pap.y());
- m_buttonC->rotate(-aap);
- connect(m_buttonC, SIGNAL(pressed()), this, SIGNAL(anyButtonPressed()));
-
- m_buttonD = new ClockButton("Button D", this);
- pap = path.pointAtPercent(0.57);
- aap = path.angleAtPercent(0.57);
- m_buttonD->translate(pap.x(), pap.y());
- m_buttonD->rotate(-aap);
- connect(m_buttonD, SIGNAL(pressed()), this, SIGNAL(anyButtonPressed()));
-
- QGraphicsSimpleTextItem *label = new QGraphicsSimpleTextItem(this);
- label->setText("CITIZEN");
- label->setPos(0.0 - label->boundingRect().width() / 2.0, -100.0);
-
- m_clockDisplay = new ClockDisplay(this);
- m_clockDisplay->setCurrentTime(QDateTime::currentDateTime());
-
- QTimer *timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(updateTime()));
- timer->setInterval(1);
- timer->start();
- m_time.start();
-}
-
-void Clock::initializeStateMachine()
-{
- m_stateMachine = new QStateMachine;
-
- QState *displays = new QState(m_stateMachine->rootState());
- displays->setObjectName("displays");
- initializeDisplaysState(displays);
-
- QState *alarmsBeepState = new QState(m_stateMachine->rootState());
- alarmsBeepState->setObjectName("alarmsBeep");
- alarmsBeepState->invokeMethodOnEntry(this, "playSound");
- alarmsBeepState->invokeMethodOnExit(this, "stopSound");
-
- QTimer *alarmTimeOut = new QTimer(alarmsBeepState);
- alarmTimeOut->setInterval(30000);
- alarmsBeepState->invokeMethodOnEntry(alarmTimeOut, "start");
- alarmsBeepState->invokeMethodOnExit(alarmTimeOut, "stop");
-
- displays->addTransition(m_clockDisplay, SIGNAL(alarmTriggered()), alarmsBeepState);
- alarmsBeepState->addTransition(this, SIGNAL(anyButtonPressed()), m_displaysHistoryState);
- alarmsBeepState->addTransition(alarmTimeOut, SIGNAL(timeout()), m_displaysHistoryState);
-
- m_stateMachine->setInitialState(displays);
- m_stateMachine->start();
-}
-
-void Clock::initializeUpdateState(QState *updateState)
-{
- QState *sec = new QState(updateState);
- sec->setObjectName("sec");
- sec->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditSecondMode);
- updateState->setInitialState(sec);
-
- PropertyAddState *secIncrease = new PropertyAddState(updateState);
- secIncrease->setObjectName("sec ++");
- secIncrease->addToProperty(m_clockDisplay, "currentTime", TimePeriod().setSeconds(1));
- sec->addTransition(m_buttonD, SIGNAL(pressed()), secIncrease);
- secIncrease->addTransition(sec);
-
- QState *oneMin = new QState(updateState);
- oneMin->setObjectName("1 min");
- oneMin->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditMinuteMode);
- sec->addTransition(m_buttonC, SIGNAL(pressed()), oneMin);
-
- PropertyAddState *oneMinIncrease = new PropertyAddState(updateState);
- oneMinIncrease->setObjectName("1 min ++");
- oneMinIncrease->addToProperty(m_clockDisplay, "currentTime", TimePeriod().setMinutes(1));
- oneMin->addTransition(m_buttonD, SIGNAL(pressed()), oneMinIncrease);
- oneMinIncrease->addTransition(oneMin);
-
- QState *tenMin = new QState(updateState);
- tenMin->setObjectName("10 min");
- tenMin->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditMinuteMode);
- oneMin->addTransition(m_buttonC, SIGNAL(pressed()), tenMin);
-
- PropertyAddState *tenMinIncrease = new PropertyAddState(updateState);
- tenMinIncrease->setObjectName("10 min ++");
- tenMinIncrease->addToProperty(m_clockDisplay, "currentTime", TimePeriod().setMinutes(10));
- tenMin->addTransition(m_buttonD, SIGNAL(pressed()), tenMinIncrease);
- tenMinIncrease->addTransition(tenMin);
-
- QState *hr = new QState(updateState);
- hr->setObjectName("hr");
- hr->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditHourMode);
- tenMin->addTransition(m_buttonC, SIGNAL(pressed()), hr);
-
- PropertyAddState *hrIncrease = new PropertyAddState(updateState);
- hrIncrease->setObjectName("hr ++");
- hrIncrease->addToProperty(m_clockDisplay, "currentTime", TimePeriod().setHours(1));
- hr->addTransition(m_buttonD, SIGNAL(pressed()), hrIncrease);
- hrIncrease->addTransition(hr);
-
- QState *mon = new QState(updateState);
- mon->setObjectName("mon");
- mon->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditMonthMode);
- hr->addTransition(m_buttonC, SIGNAL(pressed()), mon);
-
- PropertyAddState *monIncrease = new PropertyAddState(updateState);
- monIncrease->setObjectName("mon ++");
- monIncrease->addToProperty(m_clockDisplay, "currentTime", TimePeriod().setMonths(1));
- mon->addTransition(m_buttonD, SIGNAL(pressed()), monIncrease);
- monIncrease->addTransition(mon);
-
- QState *day = new QState(updateState);
- day->setObjectName("day");
- day->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditDayMode);
- mon->addTransition(m_buttonC, SIGNAL(pressed()), day);
-
- PropertyAddState *dayIncrease = new PropertyAddState(updateState);
- dayIncrease->setObjectName("day ++");
- dayIncrease->addToProperty(m_clockDisplay, "currentTime", TimePeriod().setDays(1));
- day->addTransition(m_buttonD, SIGNAL(pressed()), dayIncrease);
- dayIncrease->addTransition(day);
-
- QState *year = new QState(updateState);
- year->setObjectName("year");
- year->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditYearMode);
- day->addTransition(m_buttonC, SIGNAL(pressed()), year);
-
- PropertyAddState *yearIncrease = new PropertyAddState(updateState);
- yearIncrease->setObjectName("year ++");
- yearIncrease->addToProperty(m_clockDisplay, "currentTime", TimePeriod().setYears(1));
- year->addTransition(m_buttonD, SIGNAL(pressed()), yearIncrease);
- yearIncrease->addTransition(year);
- year->addTransition(m_buttonC, SIGNAL(pressed()), m_timeState);
-}
-
-void Clock::initializeRegularState(QState *regular)
-{
- m_timeState = new QState(regular);
- m_timeState->setObjectName("time");
- m_timeState->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::CurrentTimeMode);
-
- QState *date = new QState(regular);
- date->setObjectName("date");
- date->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::CurrentDateMode);
-
- QState *dateTimerState = new QState(date);
- dateTimerState->setObjectName("dateTimerState");
-
- // Date state exits after 2 m
- QTimer *dateTimer = new QTimer(dateTimerState);
- dateTimer->setSingleShot(true);
- dateTimer->setInterval(2*60000);
- dateTimerState->invokeMethodOnEntry(dateTimer, "start");
- dateTimerState->invokeMethodOnExit(dateTimer, "stop");
-
- date->setInitialState(dateTimerState);
-
- m_updateState = new QState(regular);
- m_updateState->setObjectName("update");
-
- // Update state exits after 2 m
- QTimer *updateTimer = new QTimer(m_updateState);
- updateTimer->setSingleShot(true);
- updateTimer->setInterval(2 * 60000);
- m_updateState->invokeMethodOnEntry(updateTimer, "start");
- m_updateState->invokeMethodOnExit(updateTimer, "stop");
-
- initializeUpdateState(m_updateState);
-
- m_timeState->addTransition(m_buttonD, SIGNAL(pressed()), date);
- date->addTransition(m_buttonD, SIGNAL(pressed()), m_timeState);
- date->addTransition(dateTimer, SIGNAL(timeout()), m_timeState);
-
- m_updateState->addTransition(updateTimer, SIGNAL(timeout()), m_timeState);
- m_updateState->addTransition(m_buttonB, SIGNAL(pressed()), m_timeState);
-
- regular->setInitialState(m_timeState);
-}
-
-void Clock::initializeAlarmUpdateState(QState *update)
-{
- QState *hr = new QState(update);
- hr->setObjectName("hr");
- hr->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditAlarmHourMode);
-
- PropertyAddState *hrInc = new PropertyAddState(update);
- hrInc->setObjectName("hr ++");
- hrInc->addToProperty(m_clockDisplay, "alarm", TimePeriod().setHours(1));
- hr->addTransition(m_buttonD, SIGNAL(pressed()), hrInc);
- hrInc->addTransition(hr);
-
- QState *tenMin = new QState(update);
- tenMin->setObjectName("10 min");
- tenMin->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditAlarmTenMinuteMode);
- hr->addTransition(m_buttonC, SIGNAL(pressed()), tenMin);
-
- PropertyAddState *tenMinInc = new PropertyAddState(update);
- tenMinInc->setObjectName("10 min ++");
- tenMinInc->addToProperty(m_clockDisplay, "alarm", TimePeriod().setMinutes(10));
- tenMin->addTransition(m_buttonD, SIGNAL(pressed()), tenMinInc);
- tenMinInc->addTransition(tenMin);
-
- QState *oneMin = new QState(update);
- oneMin->setObjectName("1 min");
- oneMin->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::EditAlarmMinuteMode);
- tenMin->addTransition(m_buttonC, SIGNAL(pressed()), oneMin);
-
- PropertyAddState *oneMinInc = new PropertyAddState(update);
- oneMinInc->setObjectName("1 min ++");
- oneMinInc->addToProperty(m_clockDisplay, "alarm", TimePeriod().setMinutes(1));
- oneMin->addTransition(m_buttonD, SIGNAL(pressed()), oneMinInc);
- oneMinInc->addTransition(oneMin);
-
- oneMin->addTransition(m_buttonC, SIGNAL(pressed()), m_alarmState);
- m_alarmState->addTransition(m_buttonC, SIGNAL(pressed()), hr);
-}
-
-void Clock::initializeOutState(QState *out)
-{
- m_alarmState = new QState(out);
- m_alarmState->setObjectName("alarmState");
- m_alarmState->setPropertyOnEntry(m_clockDisplay, "displayMode", ClockDisplay::AlarmMode);
- initializeAlarmState(m_alarmState);
- out->setInitialState(m_alarmState);
-
- QState *alarmUpdate = new QState(out);
- alarmUpdate->setObjectName("alarmUpdate");
- initializeAlarmUpdateState(alarmUpdate);
-
- alarmUpdate->addTransition(m_buttonB, SIGNAL(pressed()), m_alarmState);
- m_alarmState->addTransition(m_buttonA, SIGNAL(pressed()), m_regularState);
-}
-
-void Clock::initializeDisplaysState(QState *displays)
-{
- m_regularState = new QState(displays);
- m_regularState->setObjectName("regular");
- initializeRegularState(m_regularState);
- displays->setInitialState(m_regularState);
-
- QState *out = new QState(displays);
- out->setObjectName("out");
-
- QTimer *outTimer = new QTimer(out);
- outTimer->setSingleShot(true);
- outTimer->setInterval(2 * 60000);
- out->invokeMethodOnEntry(outTimer, "start");
- out->invokeMethodOnExit(outTimer, "stop");
-
- initializeOutState(out);
-
- QState *wait = new QState(displays);
- wait->setObjectName("wait");
-
- QTimer *waitTimer = new QTimer(wait);
- waitTimer->setSingleShot(true);
- waitTimer->setInterval(2000);
- wait->invokeMethodOnEntry(waitTimer, "start");
- wait->invokeMethodOnExit(waitTimer, "stop");
-
- m_displaysHistoryState = displays->addHistoryState(QState::DeepHistory);
-
- m_timeState->addTransition(m_buttonC, SIGNAL(pressed()), wait);
- wait->addTransition(waitTimer, SIGNAL(timeout()), m_updateState);
- wait->addTransition(m_buttonC, SIGNAL(released()), m_timeState);
- m_timeState->addTransition(m_buttonA, SIGNAL(pressed()), m_alarmState);
- out->addTransition(outTimer, SIGNAL(timeout()), m_regularState);
-}
-
-void Clock::initializeAlarmState(QState *alarmState)
-{
- QState *offState = new QState(alarmState);
- offState->setObjectName("alarmOff");
- offState->setPropertyOnEntry(m_clockDisplay, "alarmEnabled", false);
-
- QState *onState = new QState(alarmState);
- onState->setObjectName("alarmOn");
- onState->setPropertyOnEntry(m_clockDisplay, "alarmEnabled", true);
-
- QHistoryState *history = alarmState->addHistoryState();
- history->setObjectName("alarmHistory");
- history->setDefaultState(offState);
-
- offState->addTransition(m_buttonD, SIGNAL(pressed()), onState);
- onState->addTransition(m_buttonD, SIGNAL(pressed()), offState);
-
- QState *intermediate = new QState(alarmState);
- intermediate->addTransition(history);
-
- alarmState->setInitialState(intermediate);
-}
-
-QRectF Clock::boundingRect() const
-{
- return shape().boundingRect();
-}
-
-QPainterPath Clock::shape() const
-{
- QPainterPath path;
- path.addRoundedRect(QRectF(-140.0, -100.0, 280.0, 200.0), 50.0, 50.0, Qt::RelativeSize);
-
- return path;
-}
-
-void Clock::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
- painter->setPen(Qt::black);
- painter->setBrush(Qt::NoBrush);
-
- // Clock face
- painter->drawPath(shape());
-}
-
-void Clock::updateTime()
-{
- int elapsed = m_time.elapsed();
- if (elapsed > 0) {
- m_time.restart();
- QDateTime currentTime = m_clockDisplay->currentTime();
- m_clockDisplay->setCurrentTime(currentTime.addMSecs(elapsed));
-
- update();
- }
-}
-
-void Clock::playSound()
-{
- qDebug("playing sound");
- m_alarmSound->stop();
- m_alarmSound->play();
-}
-
-void Clock::stopSound()
-{
- qDebug("stopping sound");
- m_alarmSound->stop();
-}
-
diff --git a/examples/statemachine/citizenquartz/clock.h b/examples/statemachine/citizenquartz/clock.h
deleted file mode 100644
index afd6433..0000000
--- a/examples/statemachine/citizenquartz/clock.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef CLOCK_H
-#define CLOCK_H
-
-#include <QGraphicsItem>
-#include <QTime>
-
-class ClockButton ;
-class ClockDisplay ;
-class QStateMachine ;
-class QState ;
-class QTimerState ;
-class QSound ;
-class QHistoryState ;
-
-class Clock: public QObject, public QGraphicsItem
-{
- Q_OBJECT
-public:
- Clock(QGraphicsItem *parent = 0);
-
- void initializeUi();
- void initializeStateMachine();
-
- virtual QRectF boundingRect() const;
- virtual QPainterPath shape() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
-
-signals:
- void anyButtonPressed();
-
-public slots:
- void updateTime();
- void playSound();
- void stopSound();
-
-private:
- void initializeDisplaysState(QState *displays);
- void initializeAlarmState(QState *alarmState);
- void initializeRegularState(QState *regular);
- void initializeUpdateState(QState *update);
- void initializeOutState(QState *out);
- void initializeAlarmUpdateState(QState *update);
-
- QStateMachine *m_stateMachine;
- ClockDisplay *m_clockDisplay;
- ClockButton *m_buttonA;
- ClockButton *m_buttonB;
- ClockButton *m_buttonC;
- ClockButton *m_buttonD;
-
- QState *m_alarmState;
- QState *m_timeState;
- QState *m_updateState;
- QState *m_regularState;
-
- QHistoryState *m_displaysHistoryState;
-
- QSound *m_alarmSound;
- QTime m_time;
-};
-
-#endif // CLOCK_H
diff --git a/examples/statemachine/citizenquartz/clockbutton.cpp b/examples/statemachine/citizenquartz/clockbutton.cpp
deleted file mode 100644
index 7b86891..0000000
--- a/examples/statemachine/citizenquartz/clockbutton.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "clockbutton.h"
-
-#include <QPainter>
-
-ClockButton::ClockButton(const QString &name, QGraphicsItem *parent) : QGraphicsItem(parent)
-{
- setObjectName(name);
- setToolTip(name);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-QRectF ClockButton::boundingRect() const
-{
- return QRectF(-10.0, -10.0, 20.0, 20.0);
-}
-
-QPainterPath ClockButton::shape() const
-{
- QPainterPath path;
- path.addRoundedRect(boundingRect(), 15.0, 15.0, Qt::RelativeSize);
-
- return path;
-}
-
-void ClockButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
- painter->setBrush(Qt::black);
- painter->drawPath(shape());
-}
-
-void ClockButton::mousePressEvent(QGraphicsSceneMouseEvent *)
-{
- emit pressed();
-}
-
-void ClockButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- emit released();
-} \ No newline at end of file
diff --git a/examples/statemachine/citizenquartz/clockbutton.h b/examples/statemachine/citizenquartz/clockbutton.h
deleted file mode 100644
index 02a7ccd..0000000
--- a/examples/statemachine/citizenquartz/clockbutton.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef CLOCKBUTTON_H
-#define CLOCKBUTTON_H
-
-#include <QGraphicsItem>
-
-class ClockButton: public QObject, public QGraphicsItem
-{
- Q_OBJECT
-public:
- ClockButton(const QString &name, QGraphicsItem *parent = 0);
-
- virtual QRectF boundingRect() const;
- virtual QPainterPath shape() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
-
-protected:
- virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-
-signals:
- void pressed();
- void released();
-};
-
-#endif //CLOCKBUTTON_H
diff --git a/examples/statemachine/citizenquartz/clockdisplay.cpp b/examples/statemachine/citizenquartz/clockdisplay.cpp
deleted file mode 100644
index db026f5..0000000
--- a/examples/statemachine/citizenquartz/clockdisplay.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-#include "clockdisplay.h"
-
-#include <QPainter>
-#include <QTimer>
-
-ClockDisplay::ClockDisplay(QGraphicsItem *parent)
- : QGraphicsItem(parent),
- m_displayMode(CurrentTimeMode),
- m_currentTime(QDate(1970, 1, 1), QTime(0, 0)),
- m_alarm(0, 0),
- m_alarmEnabled(false),
- m_blink(false)
-
-{
- m_text = new QGraphicsTextItem(this);
-
- QTimer *timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(toggleBlinkFlag()));
- timer->start(500);
-
- QFont font = m_text->font();
- font.setPointSizeF(20.0);
- m_text->setFont(font);
-
- m_text->translate(-100.0, -20.0);
-
- QPixmap pm(":/images/alarm.png");
- m_alarmSymbol = new QGraphicsPixmapItem(pm, this);
- m_alarmSymbol->translate(-100.0, -60.0);
- m_alarmSymbol->setOffset(5.0, 5.0);
- m_alarmSymbol->scale(0.5, 0.5);
-}
-
-ClockDisplay::~ClockDisplay()
-{
-}
-
-void ClockDisplay::toggleBlinkFlag()
-{
- m_blink = !m_blink;
- update();
-}
-
-void ClockDisplay::updateText()
-{
- switch (m_displayMode) {
- case EditSecondMode:
- if (m_blink) {
- m_text->setHtml(m_currentTime.toString("hh:mm:'<font color=\"transparent\">'ss'</font>'"));
- break;
- }
- // fall throoough
- case EditMinuteMode:
- if (m_blink) {
- m_text->setHtml(m_currentTime.toString("hh:'<font color=\"transparent\">'mm'</font>':ss"));
- break;
- }
-
- // fall throoough
- case EditHourMode:
- if (m_blink) {
- m_text->setHtml(m_currentTime.toString("'<font color=\"transparent\">'hh'</font>':mm:ss"));
- break;
- }
-
- // fall throoough
- case CurrentTimeMode:
- m_text->setHtml(m_currentTime.toString("hh:mm:ss"));
- break;
-
- case EditMonthMode:
- if (m_blink) {
- m_text->setHtml(m_currentTime.toString("yyyy.'<font color=\"transparent\">'MM'</font>'.dd"));
- break;
- }
-
- // fall throoough
- case EditDayMode:
- if (m_blink) {
- m_text->setHtml(m_currentTime.toString("yyyy.MM.'<font color=\"transparent\">'dd'</font>'"));
- break;
- }
-
- // fall throoough
- case EditYearMode:
- if (m_blink) {
- m_text->setHtml(m_currentTime.toString("'<font color=\"transparent\">'yyyy'</font>'.MM.dd"));
- break;
- }
-
- // fall throoough
- case CurrentDateMode:
- m_text->setHtml(m_currentTime.toString("yyyy.MM.dd"));
- break;
-
- case EditAlarmHourMode:
- if (m_blink) {
- m_text->setHtml(m_alarm.toString("'<font color=\"transparent\">'hh'</font>':mm"));
- break;
- }
-
- // fall throooough
- case EditAlarmTenMinuteMode:
- case EditAlarmMinuteMode:
- if (m_blink) {
- m_text->setHtml(m_alarm.toString("hh:'<font color=\"transparent\">'mm'</font>'"));
- break;
- }
-
- // fall throoough
- case AlarmMode:
- m_text->setHtml(m_alarm.toString("hh:mm"));
- break;
-
- default:
- m_text->setHtml("Not implemented");
- };
-}
-
-QRectF ClockDisplay::boundingRect() const
-{
- return QRectF(-100.0, -60.0, 200.0, 120.0);
-}
-
-void ClockDisplay::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
- m_alarmSymbol->setVisible(m_alarmEnabled);
-
- updateText();
-
- // Screen
- painter->drawRoundedRect(boundingRect(), 15.0, 15.0, Qt::RelativeSize);
-
- // Button grid
- painter->drawLine(QPointF(-100.0, -20.0), QPointF(100.0, -20.0));
- painter->drawLine(QPointF(-50.0, -60.0), QPointF(-50.0, -20.0));
- painter->drawLine(QPointF(0.0, -60.0), QPointF(0.0, -20.0));
- painter->drawLine(QPointF(50.0, -60.0), QPointF(50.0, -20.0));
-}
diff --git a/examples/statemachine/citizenquartz/clockdisplay.h b/examples/statemachine/citizenquartz/clockdisplay.h
deleted file mode 100644
index ec86509..0000000
--- a/examples/statemachine/citizenquartz/clockdisplay.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef CLOCKDISPLAY_H
-#define CLOCKDISPLAY_H
-
-#include <QObject>
-#include <QGraphicsItem>
-#include <QDateTime>
-
-class ClockDisplay: public QObject, public QGraphicsItem
-{
- Q_OBJECT
- Q_ENUMS(DisplayMode)
- Q_PROPERTY(DisplayMode displayMode READ displayMode WRITE setDisplayMode)
- Q_PROPERTY(QDateTime currentTime READ currentTime WRITE setCurrentTime)
- Q_PROPERTY(QTime alarm READ alarm WRITE setAlarm)
- Q_PROPERTY(bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled)
-public:
- enum DisplayMode {
- CurrentTimeMode,
- EditSecondMode,
- EditMinuteMode,
- EditHourMode,
-
- CurrentDateMode,
- EditMonthMode,
- EditDayMode,
- EditYearMode,
-
- AlarmMode,
- EditAlarmHourMode,
- EditAlarmTenMinuteMode,
- EditAlarmMinuteMode,
-
- ChimeMode,
- StopWatchMode,
- ModeCount
- };
-
- ClockDisplay(QGraphicsItem *parent = 0);
- virtual ~ClockDisplay();
-
- void setDisplayMode(DisplayMode displayMode) { m_displayMode = displayMode; update(); }
- DisplayMode displayMode() const { return m_displayMode; }
-
- QDateTime currentTime() const { return m_currentTime; }
- void setCurrentTime(const QDateTime &time)
- {
- if (m_alarmEnabled && !alarmMatches(m_currentTime) && alarmMatches(time))
- emit alarmTriggered();
- m_currentTime = time;
- update();
- }
-
- QTime alarm() const { return m_alarm; }
- void setAlarm(const QTime &time) { m_alarm = time; update(); }
-
- bool alarmEnabled() const { return m_alarmEnabled; }
- void setAlarmEnabled(bool enabled) { m_alarmEnabled = enabled; update(); }
-
- virtual QRectF boundingRect() const;
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
-
-signals:
- void alarmTriggered();
-
-private slots:
- void toggleBlinkFlag();
-
-private:
- void updateText();
-
- bool alarmMatches(const QDateTime &dt)
- {
- return (dt.time().hour() == m_alarm.hour() && dt.time().minute() == m_alarm.minute());
- }
-
- DisplayMode m_displayMode;
-
- QDateTime m_currentTime;
- QTime m_alarm;
-
- QGraphicsTextItem *m_text;
- QGraphicsPixmapItem *m_alarmSymbol;
-
- uint m_alarmEnabled : 1;
- uint m_blink : 1;
- uint m_reserved : 30;
-};
-
-#endif
diff --git a/examples/statemachine/citizenquartz/images/alarm.png b/examples/statemachine/citizenquartz/images/alarm.png
deleted file mode 100644
index a19778d..0000000
--- a/examples/statemachine/citizenquartz/images/alarm.png
+++ /dev/null
Binary files differ
diff --git a/examples/statemachine/citizenquartz/main.cpp b/examples/statemachine/citizenquartz/main.cpp
deleted file mode 100644
index 2c6b14c..0000000
--- a/examples/statemachine/citizenquartz/main.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <QApplication>
-#include <QGraphicsScene>
-#include <QGraphicsView>
-
-#include "clock.h"
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QGraphicsScene scene;
-
- Clock *clock = new Clock;
- clock->initializeUi();
- clock->initializeStateMachine();
- scene.addItem(clock);
-
- QGraphicsView view(&scene);
- view.setRenderHint(QPainter::Antialiasing);
- view.show();
-
- return app.exec();
-}
diff --git a/examples/statemachine/citizenquartz/propertyaddstate.cpp b/examples/statemachine/citizenquartz/propertyaddstate.cpp
deleted file mode 100644
index dd23948..0000000
--- a/examples/statemachine/citizenquartz/propertyaddstate.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "PropertyAddState.h"
-#include "timeperiod.h"
-
-#include <QDateTime>
-#include <QDebug>
-
-PropertyAddState::PropertyAddState(QState *parent)
- : QState(parent)
-{
-}
-
-void PropertyAddState::addToProperty(QObject *object, const char *propertyName,
- const QVariant &valueToAdd)
-{
- m_propertyAdditions.append(PropertyAdder(object, propertyName, valueToAdd));
-}
-
-QVariant PropertyAddState::addProperties(const QVariant &current, const QVariant &toAdd) const
-{
- QVariant result;
- switch (current.type()) {
- case QVariant::DateTime:
- result = current.toDateTime() + qvariant_cast<TimePeriod>(toAdd);
- break;
- case QVariant::Time:
- result = current.toTime() + qvariant_cast<TimePeriod>(toAdd);
- break;
- default:
- qWarning("PropertyAddState::addProperties: QVariant type '%s' not supported",
- current.typeName());
- };
-
- return result;
-}
-
-void PropertyAddState::onEntry()
-{
- foreach (PropertyAdder propertyAdder, m_propertyAdditions) {
- QObject *object = propertyAdder.object;
- QByteArray propertyName = propertyAdder.propertyName;
- QVariant toAdd = propertyAdder.valueToAdd;
- QVariant current = object->property(propertyName);
-
- object->setProperty(propertyName, addProperties(current, toAdd));
- }
-}
diff --git a/examples/statemachine/citizenquartz/propertyaddstate.h b/examples/statemachine/citizenquartz/propertyaddstate.h
deleted file mode 100644
index 4d28055..0000000
--- a/examples/statemachine/citizenquartz/propertyaddstate.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef PropertyAddState_H
-#define PropertyAddState_H
-
-#include <qstate.h>
-
-#include <QVariant>
-#include <QList>
-
-class PropertyAddState: public QState
-{
-public:
- PropertyAddState(QState *parent = 0);
-
- void addToProperty(QObject *object, const char *propertyName, const QVariant &valueToAdd);
- virtual void onEntry();
-
-private:
- QVariant addProperties(const QVariant &current, const QVariant &toAdd) const;
-
- struct PropertyAdder {
- PropertyAdder(QObject *_object, const char *_propertyName, const QVariant &_valueToAdd)
- : object(_object), propertyName(_propertyName), valueToAdd(_valueToAdd)
- {
- }
-
- QObject *object;
- QByteArray propertyName;
- QVariant valueToAdd;
- };
- QList<PropertyAdder> m_propertyAdditions;
-};
-
-#endif // PropertyAddState_H
diff --git a/examples/statemachine/citizenquartz/sound/alarm.wav b/examples/statemachine/citizenquartz/sound/alarm.wav
deleted file mode 100644
index 1d9486f..0000000
--- a/examples/statemachine/citizenquartz/sound/alarm.wav
+++ /dev/null
Binary files differ
diff --git a/examples/statemachine/citizenquartz/timeperiod.h b/examples/statemachine/citizenquartz/timeperiod.h
deleted file mode 100644
index c5a3a16..0000000
--- a/examples/statemachine/citizenquartz/timeperiod.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef TIMEPERIOD_H
-#define TIMEPERIOD_H
-
-#include <QDateTime>
-#include <QTime>
-#include <QDebug>
-
-class TimePeriod
-{
-public:
- TimePeriod() : m_seconds(0), m_minutes(0), m_hours(0), m_days(0), m_months(0), m_years(0)
- {
- }
-
- TimePeriod &setSeconds(int seconds) { m_seconds = seconds; return *this; }
- int seconds() const { return m_seconds; }
-
- TimePeriod &setMinutes(int minutes) { m_minutes = minutes; return *this; }
- int minutes() const { return m_minutes; }
-
- TimePeriod &setHours(int hours) { m_hours = hours; return *this; }
- int hours() const { return m_hours; }
-
- TimePeriod &setDays(int days) { m_days = days; return *this; }
- int days() const { return m_days; }
-
- TimePeriod &setMonths(int months) { m_months = months; return *this; }
- int months() const { return m_months; }
-
- TimePeriod &setYears(int years) { m_years = years; return *this; }
- int years() const { return m_years; }
-
- operator QVariant() const
- {
- QVariant v;
- qVariantSetValue<TimePeriod>(v, *this);
- return v;
- }
-
-private:
- int m_seconds;
- int m_minutes;
- int m_hours;
- int m_days;
- int m_months;
- int m_years;
-};
-
-inline void operator+=(QDateTime &dateTime, const TimePeriod &timePeriod)
-{
- dateTime = dateTime.addSecs(timePeriod.seconds());
- dateTime = dateTime.addSecs(timePeriod.minutes() * 60);
- dateTime = dateTime.addSecs(timePeriod.hours() * 3600);
- dateTime = dateTime.addDays(timePeriod.days());
- dateTime = dateTime.addMonths(timePeriod.months());
- dateTime = dateTime.addYears(timePeriod.years());
-}
-
-inline QDateTime operator+(const QDateTime &dateTime, const TimePeriod &timePeriod)
-{
- QDateTime result(dateTime);
- result += timePeriod;
-
- return result;
-}
-
-inline void operator+=(QTime &time, const TimePeriod &timePeriod)
-{
- time = time.addSecs(timePeriod.seconds());
- time = time.addSecs(timePeriod.minutes() * 60);
- time = time.addSecs(timePeriod.hours() * 3600);
-}
-
-inline QTime operator+(const QTime &time, const TimePeriod &timePeriod)
-{
- QTime result(time);
- result += timePeriod;
-
- return result;
-}
-
-Q_DECLARE_METATYPE(TimePeriod)
-
-#endif \\ TIMEPERIOD_H
diff --git a/examples/statemachine/eventtransitions/eventtransitions.pro b/examples/statemachine/eventtransitions/eventtransitions.pro
index 6a976cb..7e92cf2 100644
--- a/examples/statemachine/eventtransitions/eventtransitions.pro
+++ b/examples/statemachine/eventtransitions/eventtransitions.pro
@@ -1,7 +1,7 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
+SOURCES = main.cpp
-# Input
-SOURCES += main.cpp
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/eventtransitions
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS eventtransitions.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/eventtransitions
+INSTALLS += target sources
diff --git a/examples/statemachine/factorial/factorial.pro b/examples/statemachine/factorial/factorial.pro
index ac79117..14a6833 100644
--- a/examples/statemachine/factorial/factorial.pro
+++ b/examples/statemachine/factorial/factorial.pro
@@ -1,10 +1,11 @@
-TEMPLATE = app
-TARGET =
QT = core
win32: CONFIG += console
mac:CONFIG -= app_bundle
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
SOURCES += main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/factorial
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS factorial.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/factorial
+INSTALLS += target sources
diff --git a/examples/statemachine/pingpong/pingpong.pro b/examples/statemachine/pingpong/pingpong.pro
index bff9cb8..42eab6c 100644
--- a/examples/statemachine/pingpong/pingpong.pro
+++ b/examples/statemachine/pingpong/pingpong.pro
@@ -1,10 +1,11 @@
QT = core
-TEMPLATE = app
-TARGET =
win32: CONFIG += console
mac:CONFIG -= app_bundle
-DEPENDPATH += .
-INCLUDEPATH += .
-# Input
-SOURCES += main.cpp
+SOURCES = main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/pingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS pingpong.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/pingpong
+INSTALLS += target sources
diff --git a/examples/statemachine/tankgame/gameitem.cpp b/examples/statemachine/tankgame/gameitem.cpp
index 1a2af71..ad8b37c 100644
--- a/examples/statemachine/tankgame/gameitem.cpp
+++ b/examples/statemachine/tankgame/gameitem.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "gameitem.h"
#include <QGraphicsScene>
diff --git a/examples/statemachine/tankgame/gameitem.h b/examples/statemachine/tankgame/gameitem.h
index 43b8785..90b0a6c 100644
--- a/examples/statemachine/tankgame/gameitem.h
+++ b/examples/statemachine/tankgame/gameitem.h
@@ -1,9 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef GAMEITEM_H
#define GAMEITEM_H
#include <QGraphicsItem>
+QT_BEGIN_NAMESPACE
class QLineF;
+QT_END_NAMESPACE
class GameItem: public QObject, public QGraphicsItem
{
Q_OBJECT
diff --git a/examples/statemachine/tankgame/gameovertransition.cpp b/examples/statemachine/tankgame/gameovertransition.cpp
index cec786e..360e902 100644
--- a/examples/statemachine/tankgame/gameovertransition.cpp
+++ b/examples/statemachine/tankgame/gameovertransition.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "gameovertransition.h"
#include "tankitem.h"
@@ -8,7 +49,7 @@ GameOverTransition::GameOverTransition(QAbstractState *targetState)
: QSignalTransition(new QSignalMapper(), SIGNAL(mapped(QObject*)))
{
setTargetState(targetState);
-
+
QSignalMapper *mapper = qobject_cast<QSignalMapper *>(senderObject());
mapper->setParent(this);
}
@@ -36,4 +77,4 @@ bool GameOverTransition::eventTest(QEvent *e)
} else {
return false;
}
-} \ No newline at end of file
+}
diff --git a/examples/statemachine/tankgame/gameovertransition.h b/examples/statemachine/tankgame/gameovertransition.h
index 9a86b83..5e99a75 100644
--- a/examples/statemachine/tankgame/gameovertransition.h
+++ b/examples/statemachine/tankgame/gameovertransition.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef GAMEOVERTRANSITION_H
#define GAMEOVERTRANSITION_H
diff --git a/examples/statemachine/tankgame/main.cpp b/examples/statemachine/tankgame/main.cpp
index 26fc1bb..185ad68 100644
--- a/examples/statemachine/tankgame/main.cpp
+++ b/examples/statemachine/tankgame/main.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include <QApplication>
#include "mainwindow.h"
diff --git a/examples/statemachine/tankgame/mainwindow.cpp b/examples/statemachine/tankgame/mainwindow.cpp
index fcc0325..46e0db3 100644
--- a/examples/statemachine/tankgame/mainwindow.cpp
+++ b/examples/statemachine/tankgame/mainwindow.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "mainwindow.h"
#include "tankitem.h"
#include "rocketitem.h"
@@ -97,7 +138,7 @@ void MainWindow::init()
addWall(QRectF(centerOfMap - QPointF(-50.0, -60.0), centerOfMap - QPointF(50.0, -50.0)));
addWall(QRectF(centerOfMap + QPointF(-50.0, -50.0), centerOfMap + QPointF(-40.0, 50.0)));
addWall(QRectF(centerOfMap - QPointF(-50.0, -50.0), centerOfMap - QPointF(-40.0, 50.0)));
-
+
addWall(QRectF(sceneRect.topLeft() + QPointF(sceneRect.width() / 2.0 - 5.0, -10.0),
sceneRect.topLeft() + QPointF(sceneRect.width() / 2.0 + 5.0, 100.0)));
addWall(QRectF(sceneRect.bottomLeft() + QPointF(sceneRect.width() / 2.0 - 5.0, 10.0),
@@ -108,18 +149,18 @@ void MainWindow::init()
sceneRect.topRight() + QPointF(-100.0, sceneRect.height() / 2.0 + 5.0)));
- QAction *addTankAction = menuBar()->addAction("&Add tank");
- QAction *runGameAction = menuBar()->addAction("&Run game");
+ QAction *addTankAction = menuBar()->addAction("&Add tank");
+ QAction *runGameAction = menuBar()->addAction("&Run game");
runGameAction->setObjectName("runGameAction");
- QAction *stopGameAction = menuBar()->addAction("&Stop game");
+ QAction *stopGameAction = menuBar()->addAction("&Stop game");
menuBar()->addSeparator();
QAction *quitAction = menuBar()->addAction("&Quit");
-
+
connect(addTankAction, SIGNAL(triggered()), this, SLOT(addTank()));
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
-
- m_machine = new QStateMachine(this);
- QState *stoppedState = new QState(m_machine->rootState());
+
+ m_machine = new QStateMachine(this);
+ QState *stoppedState = new QState(m_machine->rootState());
stoppedState->setObjectName("stoppedState");
stoppedState->assignProperty(runGameAction, "enabled", true);
stoppedState->assignProperty(stopGameAction, "enabled", false);
@@ -127,19 +168,19 @@ void MainWindow::init()
m_machine->setInitialState(stoppedState);
//! [5]
- QState *spawnsAvailable = new QState(stoppedState);
+ QState *spawnsAvailable = new QState(stoppedState);
spawnsAvailable->assignProperty(addTankAction, "enabled", true);
- QState *noSpawnsAvailable = new QState(stoppedState);
+ QState *noSpawnsAvailable = new QState(stoppedState);
noSpawnsAvailable->assignProperty(addTankAction, "enabled", false);
-//! [5]
+//! [5]
spawnsAvailable->setObjectName("spawnsAvailable");
noSpawnsAvailable->setObjectName("noSpawnsAvailable");
spawnsAvailable->addTransition(this, SIGNAL(mapFull()), noSpawnsAvailable);
//! [3]
- QHistoryState *hs = new QHistoryState(stoppedState);
+ QHistoryState *hs = new QHistoryState(stoppedState);
hs->setDefaultState(spawnsAvailable);
//! [3]
hs->setObjectName("hs");
@@ -158,7 +199,7 @@ void MainWindow::init()
gameOverState->setObjectName("gameOverState");
gameOverState->assignProperty(stopGameAction, "enabled", false);
connect(gameOverState, SIGNAL(entered()), this, SLOT(gameOver()));
-
+
stoppedState->addTransition(runGameAction, SIGNAL(triggered()), m_runningState);
m_runningState->addTransition(stopGameAction, SIGNAL(triggered()), stoppedState);
@@ -168,12 +209,12 @@ void MainWindow::init()
QTimer *timer = new QTimer(this);
timer->setInterval(100);
connect(timer, SIGNAL(timeout()), this, SLOT(runStep()));
- connect(m_runningState, SIGNAL(entered()), timer, SLOT(start()));
+ connect(m_runningState, SIGNAL(entered()), timer, SLOT(start()));
connect(m_runningState, SIGNAL(exited()), timer, SLOT(stop()));
m_machine->start();
m_time.start();
-}
+}
void MainWindow::runStep()
{
@@ -201,12 +242,12 @@ void MainWindow::gameOver()
TankItem *lastTankStanding = 0;
foreach (QGraphicsItem *item, items) {
if (GameItem *gameItem = qgraphicsitem_cast<GameItem *>(item)) {
- if (lastTankStanding = qobject_cast<TankItem *>(gameItem))
+ if ((lastTankStanding = qobject_cast<TankItem *>(gameItem)) != 0)
break;
}
}
- QMessageBox::information(this, "Game over!",
+ QMessageBox::information(this, "Game over!",
QString::fromLatin1("The tank played by '%1' has won!").arg(lastTankStanding->objectName()));
}
@@ -216,7 +257,7 @@ void MainWindow::addRocket()
if (tankItem != 0) {
RocketItem *rocketItem = new RocketItem;
- QPointF s = tankItem->mapToScene(QPointF(tankItem->boundingRect().right() + 10.0,
+ QPointF s = tankItem->mapToScene(QPointF(tankItem->boundingRect().right() + 10.0,
tankItem->boundingRect().center().y()));
rocketItem->setPos(s);
rocketItem->setDirection(tankItem->direction());
@@ -264,10 +305,10 @@ void MainWindow::addTank()
bool ok;
//! [1]
- QString selectedName = QInputDialog::getItem(this, "Select a tank type", "Tank types",
+ QString selectedName = QInputDialog::getItem(this, "Select a tank type", "Tank types",
itemNames, 0, false, &ok);
//! [1]
-
+
if (ok && !selectedName.isEmpty()) {
int idx = itemNames.indexOf(selectedName);
if (Plugin *plugin = idx >= 0 ? items.at(idx) : 0) {
@@ -280,7 +321,7 @@ void MainWindow::addTank()
emit mapFull();
m_gameOverTransition->addTankItem(tankItem);
-
+
QState *region = new QState(m_runningState);
region->setObjectName(QString::fromLatin1("region%1").arg(m_spawns.size()));
//! [2]
diff --git a/examples/statemachine/tankgame/mainwindow.h b/examples/statemachine/tankgame/mainwindow.h
index 40e1595..4ae8f7a 100644
--- a/examples/statemachine/tankgame/mainwindow.h
+++ b/examples/statemachine/tankgame/mainwindow.h
@@ -1,14 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTime>
+QT_BEGIN_NAMESPACE
class QGraphicsScene;
class QStateMachine;
class QState;
+QT_END_NAMESPACE
class GameOverTransition;
class TankItem;
+
class MainWindow: public QMainWindow
{
Q_OBJECT
@@ -34,14 +78,14 @@ private:
void addWall(const QRectF &wall);
QGraphicsScene *m_scene;
-
+
QStateMachine *m_machine;
QState *m_runningState;
GameOverTransition *m_gameOverTransition;
QList<TankItem *> m_spawns;
QTime m_time;
-
+
bool m_started : 1;
};
diff --git a/examples/statemachine/tankgame/plugin.h b/examples/statemachine/tankgame/plugin.h
index 2b48d43..ddd10b7 100644
--- a/examples/statemachine/tankgame/plugin.h
+++ b/examples/statemachine/tankgame/plugin.h
@@ -1,9 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef PLUGIN_H
#define PLUGIN_H
#include <QtPlugin>
+QT_BEGIN_NAMESPACE
class QState;
+QT_END_NAMESPACE
class Plugin
{
public:
@@ -12,6 +55,8 @@ public:
virtual QState *create(QState *parentState, QObject *tank) = 0;
};
+QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(Plugin, "TankPlugin")
+QT_END_NAMESPACE
#endif
diff --git a/examples/statemachine/tankgame/rocketitem.cpp b/examples/statemachine/tankgame/rocketitem.cpp
index c324980..3ace8e8 100644
--- a/examples/statemachine/tankgame/rocketitem.cpp
+++ b/examples/statemachine/tankgame/rocketitem.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "rocketitem.h"
#include "tankitem.h"
@@ -53,7 +94,7 @@ void RocketItem::idle(qreal elapsed)
if (tankItem != 0)
tankItem->hitByRocket();
}
-
+
scene()->removeItem(this);
delete this;
}
diff --git a/examples/statemachine/tankgame/rocketitem.h b/examples/statemachine/tankgame/rocketitem.h
index 189a1dd..31146a6 100644
--- a/examples/statemachine/tankgame/rocketitem.h
+++ b/examples/statemachine/tankgame/rocketitem.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef ROCKETITEM_H
#define ROCKETITEM_H
@@ -12,7 +53,7 @@ public:
virtual void idle(qreal elapsed);
qreal speed() const { return 100.0; }
void setDirection(qreal direction) { m_direction = direction; }
-
+
protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
@@ -22,5 +63,4 @@ private:
qreal m_distance;
};
-
#endif
diff --git a/examples/statemachine/tankgame/tankgame.pro b/examples/statemachine/tankgame/tankgame.pro
index 46cfe2e..59415be 100644
--- a/examples/statemachine/tankgame/tankgame.pro
+++ b/examples/statemachine/tankgame/tankgame.pro
@@ -1,13 +1,19 @@
-######################################################################
-# Automatically generated by qmake (2.01a) on 22. apr 14:11:33 2009
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += C:/dev/kinetic/examples/statemachine/tankgame/. .
-
-# Input
-HEADERS += mainwindow.h plugin.h tankitem.h rocketitem.h gameitem.h gameovertransition.h
-SOURCES += main.cpp mainwindow.cpp tankitem.cpp rocketitem.cpp gameitem.cpp gameovertransition.cpp
+HEADERS += mainwindow.h \
+ plugin.h \
+ tankitem.h \
+ rocketitem.h \
+ gameitem.h \
+ gameovertransition.h
+SOURCES += main.cpp \
+ mainwindow.cpp \
+ tankitem.cpp \
+ rocketitem.cpp \
+ gameitem.cpp \
+ gameovertransition.cpp
CONFIG += console
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS tankgame.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/tankgame
+INSTALLS += target sources
diff --git a/examples/statemachine/tankgame/tankitem.cpp b/examples/statemachine/tankgame/tankitem.cpp
index c322d21..393d65f 100644
--- a/examples/statemachine/tankgame/tankitem.cpp
+++ b/examples/statemachine/tankgame/tankitem.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "tankitem.h"
#include <QPainter>
@@ -35,15 +76,15 @@ public:
m_reverse = m_distance < 0.0;
}
- bool apply(qreal timeDelta)
+ bool apply(qreal timeDelta)
{
qreal dist = timeDelta * item()->speed() * (m_reverse ? -1.0 : 1.0);
- bool done = false;
- if (qAbs(m_distance) < qAbs(dist)) {
+ bool done = false;
+ if (qAbs(m_distance) < qAbs(dist)) {
done = true;
dist = m_distance;
- }
+ }
m_distance -= dist;
qreal a = item()->direction() * M_PI / 180.0;
@@ -69,14 +110,14 @@ public:
m_reverse = m_distance < 0.0;
}
- bool apply(qreal timeDelta)
+ bool apply(qreal timeDelta)
{
qreal dist = timeDelta * item()->angularSpeed() * (m_reverse ? -1.0 : 1.0);
- bool done = false;
+ bool done = false;
if (qAbs(m_distance) < qAbs(dist)) {
done = true;
dist = m_distance;
- }
+ }
m_distance -= dist;
item()->setDirection(item()->direction() + dist);
@@ -88,7 +129,7 @@ private:
bool m_reverse;
};
-TankItem::TankItem(QObject *parent)
+TankItem::TankItem(QObject *parent)
: GameItem(parent), m_currentAction(0), m_currentDirection(0.0), m_enabled(true)
{
connect(this, SIGNAL(cannonFired()), this, SIGNAL(actionCompleted()));
@@ -106,7 +147,7 @@ void TankItem::idle(qreal elapsed)
QGraphicsItem *item = 0;
qreal distance = distanceToObstacle(&item);
if (TankItem *tankItem = qgraphicsitem_cast<TankItem *>(item))
- emit tankSpotted(tankItem->direction(), distance);
+ emit tankSpotted(tankItem->direction(), distance);
}
}
}
@@ -119,7 +160,7 @@ void TankItem::hitByRocket()
void TankItem::setAction(Action *newAction)
{
- if (m_currentAction != 0)
+ if (m_currentAction != 0)
delete m_currentAction;
m_currentAction = newAction;
@@ -184,9 +225,9 @@ void TankItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge
QRectF cannonBase = brect.adjusted(10.0, 6.0, -12.0, -6.0);
painter->drawEllipse(cannonBase);
- painter->drawRect(QRectF(QPointF(cannonBase.center().x(), cannonBase.center().y() - 2.0),
+ painter->drawRect(QRectF(QPointF(cannonBase.center().x(), cannonBase.center().y() - 2.0),
QPointF(brect.right(), cannonBase.center().y() + 2.0)));
-
+
// left track
painter->setBrush(QBrush(Qt::black, Qt::VerPattern));
QRectF leftTrackRect = QRectF(brect.topLeft(), QPointF(brect.right() - 2.0, brect.top() + 4.0));
@@ -223,7 +264,7 @@ qreal TankItem::direction() const
void TankItem::setDirection(qreal newDirection)
{
- int fullRotations = int(newDirection) / 360;
+ int fullRotations = int(newDirection) / 360;
newDirection -= fullRotations * 360.0;
qreal diff = newDirection - m_currentDirection;
@@ -245,8 +286,8 @@ qreal TankItem::distanceToObstacle(QGraphicsItem **obstacle) const
QPointF nextPosition = tryMove(requestedPosition, 0, &collidedItem);
if (collidedItem != 0) {
if (obstacle != 0)
- *obstacle = collidedItem;
-
+ *obstacle = collidedItem;
+
QPointF d = nextPosition - pos();
return sqrt(pow(d.x(), 2) + pow(d.y(), 2));
} else {
@@ -259,5 +300,3 @@ qreal TankItem::distanceToObstacle() const
return distanceToObstacle(0);
}
-
-
diff --git a/examples/statemachine/tankgame/tankitem.h b/examples/statemachine/tankgame/tankitem.h
index 9475397..942fca8 100644
--- a/examples/statemachine/tankgame/tankitem.h
+++ b/examples/statemachine/tankgame/tankitem.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef TANKITEM_H
#define TANKITEM_H
@@ -12,9 +53,9 @@ class TankItem: public GameItem
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
Q_PROPERTY(qreal direction READ direction WRITE turnTo)
Q_PROPERTY(qreal distanceToObstacle READ distanceToObstacle)
-public:
+public:
TankItem(QObject *parent = 0);
-
+
void setColor(const QColor &color) { m_color = color; }
QColor color() const { return m_color; }
@@ -53,7 +94,7 @@ public slots:
//! [0]
protected:
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value);
private:
diff --git a/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp
index c196247..d360de9 100644
--- a/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp
+++ b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "random_ai_plugin.h"
#include <QState>
diff --git a/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h
index f5e3b6f..9faeeac 100644
--- a/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h
+++ b/examples/statemachine/tankgameplugins/random_ai/random_ai_plugin.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef RANDOM_AI_PLUGIN_H
#define RANDOM_AI_PLUGIN_H
@@ -19,7 +60,7 @@ signals:
void moveForwardsSelected();
void moveBackwardsSelected();
void turnSelected();
-
+
protected:
void onEntry(QEvent *)
{
diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp
index 2fb05d4..6aae015 100644
--- a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp
+++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "seek_ai.h"
QState *SeekAi::create(QState *parentState, QObject *tank)
@@ -12,10 +53,10 @@ QState *SeekAi::create(QState *parentState, QObject *tank)
QState *lookForNearestWall = new SearchState(tank, seek);
lookForNearestWall->setObjectName("lookForNearestWall");
seek->setInitialState(lookForNearestWall);
-
+
QState *driveToFirstObstacle = new QState(seek);
driveToFirstObstacle->setObjectName("driveToFirstObstacle");
- lookForNearestWall->addTransition(lookForNearestWall, SIGNAL(nearestObstacleStraightAhead()),
+ lookForNearestWall->addTransition(lookForNearestWall, SIGNAL(nearestObstacleStraightAhead()),
driveToFirstObstacle);
QState *drive = new QState(driveToFirstObstacle);
@@ -23,25 +64,25 @@ QState *SeekAi::create(QState *parentState, QObject *tank)
driveToFirstObstacle->setInitialState(drive);
connect(drive, SIGNAL(entered()), tank, SLOT(moveForwards()));
connect(drive, SIGNAL(exited()), tank, SLOT(stop()));
-
+
// Go in loop
QState *finishedDriving = new QState(driveToFirstObstacle);
finishedDriving->setObjectName("finishedDriving");
drive->addTransition(tank, SIGNAL(actionCompleted()), finishedDriving);
finishedDriving->addTransition(drive);
-
+
QState *turnTo = new QState(seek);
turnTo->setObjectName("turnTo");
driveToFirstObstacle->addTransition(new CollisionTransition(tank, turnTo));
-
+
turnTo->addTransition(tank, SIGNAL(actionCompleted()), driveToFirstObstacle);
ChaseState *chase = new ChaseState(tank, topLevel);
- chase->setObjectName("chase");
- seek->addTransition(new TankSpottedTransition(tank, chase));
+ chase->setObjectName("chase");
+ seek->addTransition(new TankSpottedTransition(tank, chase));
chase->addTransition(chase, SIGNAL(finished()), driveToFirstObstacle);
chase->addTransition(new TankSpottedTransition(tank, chase));
-
+
return topLevel;
}
diff --git a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
index 9d4aabc..e44ad07 100644
--- a/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
+++ b/examples/statemachine/tankgameplugins/seek_ai/seek_ai.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef SEEK_AI_H
#define SEEK_AI_H
@@ -15,18 +56,18 @@ class SearchState: public QState
{
Q_OBJECT
public:
- SearchState(QObject *tank, QState *parentState = 0)
- : QState(parentState),
- m_tank(tank),
- m_distanceToTurn(360.0),
+ SearchState(QObject *tank, QState *parentState = 0)
+ : QState(parentState),
+ m_tank(tank),
+ m_distanceToTurn(360.0),
m_nearestDistance(-1.0),
- m_directionOfNearestObstacle(0.0)
+ m_directionOfNearestObstacle(0.0)
{
}
public slots:
void turnAlittle()
- {
+ {
qreal dist = m_tank->property("distanceToObstacle").toDouble();
if (m_nearestDistance < 0.0 || dist < m_nearestDistance) {
@@ -72,7 +113,7 @@ private:
class CollisionTransition: public QSignalTransition
{
public:
- CollisionTransition(QObject *tank, QState *turnTo)
+ CollisionTransition(QObject *tank, QState *turnTo)
: QSignalTransition(tank, SIGNAL(collision(QLineF))),
m_tank(tank),
m_turnTo(turnTo)
@@ -99,7 +140,7 @@ protected:
if (qrand() % 2 == 0)
newDirection = angleOfWall;
else
- newDirection = angleOfWall - 180.0;
+ newDirection = angleOfWall - 180.0;
m_turnTo->assignProperty(m_tank, "direction", newDirection);
}
@@ -115,7 +156,7 @@ class ChaseState: public QState
class GoToLocationState: public QState
{
public:
- GoToLocationState(QObject *tank, QState *parentState = 0)
+ GoToLocationState(QObject *tank, QState *parentState = 0)
: QState(parentState), m_tank(tank), m_distance(0.0)
{
}
@@ -123,7 +164,7 @@ class ChaseState: public QState
void setDistance(qreal distance) { m_distance = distance; }
protected:
- void onEntry()
+ void onEntry()
{
QMetaObject::invokeMethod(m_tank, "moveForwards", Q_ARG(qreal, m_distance));
}
diff --git a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp
index de95f41..581a6b2 100644
--- a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp
+++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "spin_ai.h"
#include <QtPlugin>
@@ -5,24 +46,24 @@
QState *SpinAi::create(QState *parentState, QObject *tank)
{
QState *topLevel = new QState(parentState);
- QState *spinState = new SpinState(tank, topLevel);
+ QState *spinState = new SpinState(tank, topLevel);
topLevel->setInitialState(spinState);
// When tank is spotted, fire two times and go back to spin state
QState *fireState = new QState(topLevel);
QState *fireOnce = new QState(fireState);
- fireState->setInitialState(fireOnce);
+ fireState->setInitialState(fireOnce);
connect(fireOnce, SIGNAL(entered()), tank, SLOT(fireCannon()));
QState *fireTwice = new QState(fireState);
connect(fireTwice, SIGNAL(entered()), tank, SLOT(fireCannon()));
-
+
fireOnce->addTransition(tank, SIGNAL(actionCompleted()), fireTwice);
fireTwice->addTransition(tank, SIGNAL(actionCompleted()), spinState);
-
+
spinState->addTransition(tank, SIGNAL(tankSpotted(qreal,qreal)), fireState);
-
+
return topLevel;
}
diff --git a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h
index d8d3d73..652e8b8 100644
--- a/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h
+++ b/examples/statemachine/tankgameplugins/spin_ai/spin_ai.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef SPIN_AI_H
#define SPIN_AI_H
@@ -16,7 +57,7 @@ public:
}
public slots:
- void spin()
+ void spin()
{
m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0);
}
@@ -25,7 +66,7 @@ protected:
void onEntry(QEvent *)
{
connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin()));
- spin();
+ spin();
}
void onExit(QEvent *)
diff --git a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp
index 5499ba3..19137b2 100644
--- a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp
+++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "spin_ai_with_error.h"
#include <QtPlugin>
@@ -5,7 +46,7 @@
QState *SpinAiWithError::create(QState *parentState, QObject *tank)
{
QState *topLevel = new QState(parentState);
- QState *spinState = new SpinState(tank, topLevel);
+ QState *spinState = new SpinState(tank, topLevel);
topLevel->setInitialState(spinState);
// When tank is spotted, fire two times and go back to spin state
@@ -17,12 +58,12 @@ QState *SpinAiWithError::create(QState *parentState, QObject *tank)
QState *fireTwice = new QState(fireState);
connect(fireTwice, SIGNAL(entered()), tank, SLOT(fireCannon()));
-
+
fireOnce->addTransition(tank, SIGNAL(actionCompleted()), fireTwice);
fireTwice->addTransition(tank, SIGNAL(actionCompleted()), spinState);
-
+
spinState->addTransition(tank, SIGNAL(tankSpotted(qreal,qreal)), fireState);
-
+
return topLevel;
}
diff --git a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h
index 456ba01..e040bf2 100644
--- a/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h
+++ b/examples/statemachine/tankgameplugins/spin_ai_with_error/spin_ai_with_error.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef SPIN_AI_WITH_ERROR_H
#define SPIN_AI_WITH_ERROR_H
@@ -16,7 +57,7 @@ public:
}
public slots:
- void spin()
+ void spin()
{
m_tank->setProperty("direction", m_tank->property("direction").toDouble() + 90.0);
}
@@ -25,7 +66,7 @@ protected:
void onEntry(QEvent *)
{
connect(m_tank, SIGNAL(actionCompleted()), this, SLOT(spin()));
- spin();
+ spin();
}
void onExit(QEvent *)
diff --git a/examples/statemachine/trafficlight/trafficlight.pro b/examples/statemachine/trafficlight/trafficlight.pro
index 730bd75..684575a 100644
--- a/examples/statemachine/trafficlight/trafficlight.pro
+++ b/examples/statemachine/trafficlight/trafficlight.pro
@@ -1,9 +1,4 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-SOURCES += main.cpp
+SOURCES = main.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/trafficlight
diff --git a/examples/statemachine/twowaybutton/twowaybutton.pro b/examples/statemachine/twowaybutton/twowaybutton.pro
index 6a976cb..f6cbc57 100644
--- a/examples/statemachine/twowaybutton/twowaybutton.pro
+++ b/examples/statemachine/twowaybutton/twowaybutton.pro
@@ -1,7 +1,7 @@
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
+SOURCES = main.cpp
-# Input
-SOURCES += main.cpp
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/twowaybutton
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS twowaybutton.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/twowaybutton
+INSTALLS += target sources
diff --git a/examples/widgets/movie/movie.pro b/examples/widgets/movie/movie.pro
index 1c7cbae..6aa5780 100644
--- a/examples/widgets/movie/movie.pro
+++ b/examples/widgets/movie/movie.pro
@@ -7,3 +7,11 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/movie
sources.files = $$SOURCES $$HEADERS $$RESOURCES movie.pro animation.mng
sources.path = $$[QT_INSTALL_EXAMPLES]/widgets/movie
INSTALLS += target sources
+
+wince*: {
+ addFiles.sources += *.mng
+ addFiles.path = .
+ DEPLOYMENT += addFiles
+ DEPLOYMENT_PLUGIN += qmng
+}
+