summaryrefslogtreecommitdiffstats
path: root/animals
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2010-08-13 12:58:10 +0200
committerFrederik Gladhorn <frederik.gladhorn@nokia.com>2010-08-13 12:58:10 +0200
commited30aaba19d4b3067a7c73cc96060aadd4bfe44d (patch)
tree3791c8e1ac0ea64b982e764f0f3233586c4b80d2 /animals
parent543433c03e0cc5a5fd5daaf0d85cf7b428669974 (diff)
Remove cpp skeleton, remove old main qml file.
Diffstat (limited to 'animals')
-rw-r--r--animals/animals.pro31
-rw-r--r--animals/animals.qml71
-rwxr-xr-xanimals/main.cpp52
-rwxr-xr-xanimals/mainwindow.cpp31
-rwxr-xr-xanimals/mainwindow.h19
-rw-r--r--animals/pangesturerecognizer.cpp108
-rw-r--r--animals/pangesturerecognizer.h58
-rw-r--r--animals/pinchgesturerecognizer.cpp109
-rw-r--r--animals/pinchgesturerecognizer.h58
-rw-r--r--animals/swipegesturerecognizer.cpp97
-rw-r--r--animals/swipegesturerecognizer.h58
-rw-r--r--animals/tapandholdgesturerecognizer.cpp159
-rw-r--r--animals/tapandholdgesturerecognizer.h87
-rw-r--r--animals/tapgesturerecognizer.cpp112
-rw-r--r--animals/tapgesturerecognizer.h58
15 files changed, 0 insertions, 1108 deletions
diff --git a/animals/animals.pro b/animals/animals.pro
deleted file mode 100644
index e2dd407..0000000
--- a/animals/animals.pro
+++ /dev/null
@@ -1,31 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Tue Jul 20 15:52:04 2010
-######################################################################
-
-QT += core gui declarative
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-HEADERS += mainwindow.h \
- pangesturerecognizer.h \
- tapgesturerecognizer.h \
- tapandholdgesturerecognizer.h \
- swipegesturerecognizer.h \
- pinchgesturerecognizer.h
-SOURCES += main.cpp mainwindow.cpp \
- pangesturerecognizer.cpp \
- pinchgesturerecognizer.cpp \
- tapgesturerecognizer.cpp \
- tapandholdgesturerecognizer.cpp \
- swipegesturerecognizer.cpp
-
-OTHER_FILES += \
- animals.qml \
- Animal.qml \
- AnimalLayout.qml \
- memory.qml \
- memory.js
diff --git a/animals/animals.qml b/animals/animals.qml
deleted file mode 100644
index 6968bc1..0000000
--- a/animals/animals.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-import Qt 4.7
-import Qt.labs.gestures 1.0
-
-Rectangle {
- width: 520
- height: 500
-
- Flickable {
- contentWidth: parent.width;
- contentHeight: parent.height * 2;
-
- id: flickable
- width: parent.width
- height: parent.height
-
- Text {
- id: bottomleft;
- text: "(0," + parent.height + ")";
- anchors.bottom: parent.bottom;
- anchors.left: parent.left;
- z: 2;
- }
- Text {
- id: bottomright;
- text: "(" + parent.width + "," + parent.height + ")";
- anchors.bottom: parent.bottom;
- anchors.right: parent.right;
- z: 2;
- }
- Text {
- id: topright;
- text: "(" + parent.width + ",0)";
- anchors.top: parent.top;
- anchors.right: parent.right;
- z: 2;
- }
-
- Rectangle {
- id: contentRect
- anchors.fill: parent
-
- gradient: Gradient {
- GradientStop {
- position: 0.00;
- color: "#0FFF1B";
- }
- GradientStop {
- position: 1.00;
- color: "#0070ff";
- }
- }
-
- Grid {
- Repeater {
- //random: true
- model: [ "Andy_ant.png", "ArtFavor_Cartoon_Sheep.png", "johnny_automatic_chicken.png", "johnny_automatic_cow.png",
- "liftarn_Ddraig.png", "liftarn_Owl_on_book.png", "johnny_automatic_turkey.png", "lemmling_Cartoon_cow.png",
- "johnny_automatic_startled_bears.png", "PeterM_Angry_black_panther.png", "PeterM_Bee.png", "lakeside_witch_over_harvest_moon.png",
- "PeterM_Sad_cat.png", "PeterM_Housefly.png", "ArtFavor_Sheep_(Ewe).png", "PeterM_Penguin_with_a_shirt.png",
- "johnny_automatic_cow_1.png", "rejon_Ant_Icon.png", "liftarn_Taun_taun.png", "johnny_automatic_hare_and_tabor.png",
- "TheresaKnott_frog.png", "johnny_automatic_horse_silhouette.png", "obi_Dragon_s_head.png"
- ]
-
- Animal {
- image: "images/" + modelData
- }
- }
- }
- }
- }
-}
diff --git a/animals/main.cpp b/animals/main.cpp
deleted file mode 100755
index 888cfd3..0000000
--- a/animals/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <QtGui/QApplication>
-#include "mainwindow.h"
-
-
-#include <QGesture>
-#include <QGestureRecognizer>
-
-#include <QDeclarativeEngine>
-#include "qdeclarative.h"
-
-#if defined(Q_OS_LINUX)
-#include "pangesturerecognizer.h"
-#include "pinchgesturerecognizer.h"
-#include "tapgesturerecognizer.h"
-#include "tapandholdgesturerecognizer.h"
-#include "swipegesturerecognizer.h"
-
-#endif
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow w;
- w.show();
-
-
-#if defined(Q_OS_LINUX)
- // Qt Gestures
-
- QGestureRecognizer::unregisterRecognizer(Qt::TapGesture);
- TapGestureRecognizer::registerRecognizer();
-
- QGestureRecognizer::unregisterRecognizer(Qt::PinchGesture);
- PinchGestureRecognizer::registerRecognizer();
- SwipeGestureRecognizer::registerRecognizer();
-
- QGestureRecognizer::unregisterRecognizer(Qt::TapAndHoldGesture);
- TapAndHoldGestureRecognizer::registerRecognizer();
- QGestureRecognizer::unregisterRecognizer(Qt::PanGesture);
- PanGestureRecognizer::registerRecognizer();
-
-#endif
- app.setApplicationName("Animals");
- app.setOrganizationName("Nokia");
- app.setOrganizationDomain("nokia.com");
-
-#ifndef QT_NO_GESTURES
- qmlRegisterType<QGesture>("Qt.labs.gestures",1,0, "Gesture");
-#endif
-
- return app.exec();
-}
diff --git a/animals/mainwindow.cpp b/animals/mainwindow.cpp
deleted file mode 100755
index 47ebc78..0000000
--- a/animals/mainwindow.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "mainwindow.h"
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeView>
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- view = new QDeclarativeView(this);
- setCentralWidget(view);
-
- view->setSource(QUrl::fromLocalFile("animals.qml"));
- //view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
-
- view->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
- view->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
- view->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
- view->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
- view->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent);
- view->setAttribute(Qt::WA_AcceptTouchEvents);
-
-
-}
-
-MainWindow::~MainWindow()
-{
- delete view;
-}
-
diff --git a/animals/mainwindow.h b/animals/mainwindow.h
deleted file mode 100755
index d86cc19..0000000
--- a/animals/mainwindow.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QtGui/QMainWindow>
-
-class QDeclarativeView;
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow(QWidget *parent = 0);
- ~MainWindow();
-
- QDeclarativeView* view;
-};
-
-#endif // MAINWINDOW_H
diff --git a/animals/pangesturerecognizer.cpp b/animals/pangesturerecognizer.cpp
deleted file mode 100644
index 2c936bf..0000000
--- a/animals/pangesturerecognizer.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "pangesturerecognizer.h"
-
-void PanGestureRecognizer::registerRecognizer()
-{
- QGestureRecognizer::registerRecognizer(new PanGestureRecognizer);
-}
-
-PanGestureRecognizer::PanGestureRecognizer()
-{
- qDebug() << "creating PanGestureRecognizer (Qt)";
-}
-
-QGesture *PanGestureRecognizer::create(QObject *)
-{
- return new QPanGesture;
-}
-
-QGestureRecognizer::Result PanGestureRecognizer::recognize(QGesture *state, QObject *,
- QEvent *event)
-{
- QPanGesture *q = static_cast<QPanGesture *>(state);
- QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(event);
- switch(event->type()) {
- case QEvent::GraphicsSceneMousePress:
- if (ev->buttons() == Qt::LeftButton && !(ev->modifiers() & Qt::ControlModifier)) {
- state->setProperty("startPos", ev->screenPos());
- state->setHotSpot(ev->screenPos());
- state->setHandled(false);
- ev->accept();
- return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
- } else if (state->state() == Qt::GestureUpdated) {
- return QGestureRecognizer::CancelGesture;
- } else
- return QGestureRecognizer::Ignore;
- case QEvent::GraphicsSceneMouseMove:
- if (!state->property("startPos").toPoint().isNull()) {
- QPoint delta = ev->screenPos() - state->property("startPos").toPoint();
- q->setLastOffset(q->offset());
- q->setOffset(delta);
-
- if (delta.manhattanLength() < 50) {
- return QGestureRecognizer::MayBeGesture;
- }
-
- //qDebug() << "PanGestureRecognizer::recognize trigger";
-
- return QGestureRecognizer::TriggerGesture;
- }
- return QGestureRecognizer::Ignore;
- case QEvent::GraphicsSceneMouseRelease:
- if (!state->property("startPos").toPoint().isNull()) {
- state->setProperty("startPos", QPoint());
- return QGestureRecognizer::FinishGesture;
- }
- return QGestureRecognizer::Ignore;
- default:
- break;
- }
- return QGestureRecognizer::Ignore;
-}
-
-void PanGestureRecognizer::reset(QGesture *state)
-{
- QPanGesture *q = static_cast<QPanGesture *>(state);
- q->setLastOffset(QPointF());
- q->setOffset(QPointF());
- q->setAcceleration(0);
-}
diff --git a/animals/pangesturerecognizer.h b/animals/pangesturerecognizer.h
deleted file mode 100644
index 6a593ca..0000000
--- a/animals/pangesturerecognizer.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef PANGESTURERECOGNIZER_H
-#define PANGESTURERECOGNIZER_H
-
-#include <QtGui>
-
-class PanGestureRecognizer : public QGestureRecognizer
-{
-public:
- static void registerRecognizer();
-
-private:
- PanGestureRecognizer();
- QGesture *create(QObject *);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *, QEvent *event);
- void reset(QGesture *state);
-};
-
-#endif
diff --git a/animals/pinchgesturerecognizer.cpp b/animals/pinchgesturerecognizer.cpp
deleted file mode 100644
index a3af555..0000000
--- a/animals/pinchgesturerecognizer.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "pinchgesturerecognizer.h"
-
-void PinchGestureRecognizer::registerRecognizer()
-{
- QGestureRecognizer::registerRecognizer(new PinchGestureRecognizer);
-}
-
-PinchGestureRecognizer::PinchGestureRecognizer()
-{
-}
-
-QGesture *PinchGestureRecognizer::create(QObject *)
-{
- return new QPinchGesture;
-}
-
-QGestureRecognizer::Result PinchGestureRecognizer::recognize(QGesture *state, QObject *,
- QEvent *event)
-{
- QPinchGesture *q = static_cast<QPinchGesture *>(state);
- QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(event);
- switch(event->type()) {
- case QEvent::GraphicsSceneMousePress:
- if (ev->buttons() == Qt::LeftButton && (ev->modifiers() & Qt::ControlModifier)) {
- state->setProperty("startPos", ev->screenPos());
- state->setHotSpot(ev->screenPos());
- q->setCenterPoint(ev->screenPos());
- state->setHandled(false);
- ev->accept();
- return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
- } else if (state->state() == Qt::GestureUpdated) {
- return QGestureRecognizer::CancelGesture;
- } else
- return QGestureRecognizer::Ignore;
- case QEvent::GraphicsSceneMouseMove:
- if (!state->property("startPos").toPoint().isNull()) {
- QPoint delta = ev->screenPos() - state->property("startPos").toPoint();
- int x = delta.x();
- int y = -delta.y();
- qreal dist = sqrt(pow(x,2)+pow(y,2))/100.0f;
- if(!( (x>0 && abs(x) > abs(y)) || (y>0 && abs(y) > abs(x)))) {
- dist = 1.0f-dist;
- dist = dist > 0 ? dist : 0.01f;
- }
- else
- dist+=1.0f;
-
- q->setTotalScaleFactor(dist);
- return QGestureRecognizer::TriggerGesture;
- }
- return QGestureRecognizer::Ignore;
- case QEvent::GraphicsSceneMouseRelease:
- if (!state->property("startPos").toPoint().isNull()) {
- state->setProperty("startPos", QPoint());
- return QGestureRecognizer::FinishGesture;
- }
- return QGestureRecognizer::Ignore;
- default:
- break;
- }
- return QGestureRecognizer::Ignore;
-}
-
-void PinchGestureRecognizer::reset(QGesture *state)
-{
- QPinchGesture *q = static_cast<QPinchGesture *>(state);
- //q->setLastOffset(QPointF());
- q->setTotalScaleFactor(1);
-}
diff --git a/animals/pinchgesturerecognizer.h b/animals/pinchgesturerecognizer.h
deleted file mode 100644
index a0a28d6..0000000
--- a/animals/pinchgesturerecognizer.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef PINCHGESTURERECOGNIZER_H
-#define PINCHGESTURERECOGNIZER_H
-
-#include <QtGui>
-
-class PinchGestureRecognizer : public QGestureRecognizer
-{
-public:
- static void registerRecognizer();
-
-private:
- PinchGestureRecognizer();
- QGesture *create(QObject *);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *, QEvent *event);
- void reset(QGesture *state);
-};
-
-#endif
diff --git a/animals/swipegesturerecognizer.cpp b/animals/swipegesturerecognizer.cpp
deleted file mode 100644
index 300cd6f..0000000
--- a/animals/swipegesturerecognizer.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "swipegesturerecognizer.h"
-
-void SwipeGestureRecognizer::registerRecognizer()
-{
- QGestureRecognizer::registerRecognizer(new SwipeGestureRecognizer);
-}
-
-SwipeGestureRecognizer::SwipeGestureRecognizer()
-{
-}
-
-QGesture *SwipeGestureRecognizer::create(QObject *)
-{
- return new QSwipeGesture;
-}
-
-QGestureRecognizer::Result SwipeGestureRecognizer::recognize(QGesture *state, QObject *,
- QEvent *event)
-{
- QSwipeGesture *q = static_cast<QSwipeGesture *>(state);
- QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(event);
- switch(event->type()) {
- case QEvent::GraphicsSceneMousePress:
- if (ev->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier | Qt::ControlModifier))
- return QGestureRecognizer::Ignore;
- if (ev->buttons() == Qt::LeftButton) {
- state->setProperty("startPos", ev->screenPos());
- state->setHotSpot(ev->screenPos());
- state->setHandled(false);
- ev->accept();
- return QGestureRecognizer::MayBeGesture;
- }
- return QGestureRecognizer::Ignore;
- case QEvent::GraphicsSceneMouseMove:
- if (!state->property("startPos").toPoint().isNull()) {
- QPoint startPos = state->property("startPos").toPoint();
- QPoint delta = ev->screenPos() - startPos;
- if (delta.manhattanLength() > 100) {
- q->setSwipeAngle(QLineF(startPos, ev->screenPos()).angle());
- return QGestureRecognizer::FinishGesture;
- }
- }
- return QGestureRecognizer::Ignore;
- case QEvent::GraphicsSceneMouseRelease:
- return QGestureRecognizer::Ignore;
- default:
- break;
- }
- return QGestureRecognizer::Ignore;
-}
-
-void SwipeGestureRecognizer::reset(QGesture *state)
-{
- QSwipeGesture *q = static_cast<QSwipeGesture *>(state);
- q->setSwipeAngle(0);
- q->setProperty("startPos", QVariant());
-}
diff --git a/animals/swipegesturerecognizer.h b/animals/swipegesturerecognizer.h
deleted file mode 100644
index 4133a0d..0000000
--- a/animals/swipegesturerecognizer.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef SWIPEGESTURERECOGNIZER_H
-#define SWIPEGESTURERECOGNIZER_H
-
-#include <QtGui>
-
-class SwipeGestureRecognizer : public QGestureRecognizer
-{
-public:
- static void registerRecognizer();
-
-private:
- SwipeGestureRecognizer();
- QGesture *create(QObject *);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *, QEvent *event);
- void reset(QGesture *state);
-};
-
-#endif
diff --git a/animals/tapandholdgesturerecognizer.cpp b/animals/tapandholdgesturerecognizer.cpp
deleted file mode 100644
index 2ff1ef9..0000000
--- a/animals/tapandholdgesturerecognizer.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "tapandholdgesturerecognizer.h"
-
-Qt::GestureType TapAndHoldFeedbackGesture::Type;
-
-TapAndHoldFeedbackGesture::TapAndHoldFeedbackGesture()
- : m_completionStatus(0)
-{
-}
-
-int TapAndHoldFeedbackGesture::completionStatus() const
-{
- return m_completionStatus;
-}
-
-void TapAndHoldFeedbackGesture::setCompletionStatus(int value)
-{
- m_completionStatus = value;
-}
-
-QPointF TapAndHoldFeedbackGesture::position() const
-{
- return m_position;
-}
-
-void TapAndHoldFeedbackGesture::setPosition(const QPointF &value)
-{
- m_position = value;
-}
-
-void TapAndHoldGestureRecognizer::registerRecognizer()
-{
- QGestureRecognizer::registerRecognizer(new TapAndHoldGestureRecognizer(false));
- TapAndHoldFeedbackGesture::Type = QGestureRecognizer::registerRecognizer(new TapAndHoldGestureRecognizer(true));
-}
-
-TapAndHoldGestureRecognizer::TapAndHoldGestureRecognizer(bool feedback)
- : m_feedback(feedback)
-{
-}
-
-QGesture *TapAndHoldGestureRecognizer::create(QObject *)
-{
- if (m_feedback)
- return new TapAndHoldFeedbackGesture;
- return new QTapAndHoldGesture;
-}
-
-QGestureRecognizer::Result TapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *watched,
- QEvent *event)
-{
- QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(event);
- switch(event->type()) {
- case QEvent::GraphicsSceneMousePress:
- if (m_feedback)
- state->setProperty("completionStatus", 0);
- state->setProperty("position", ev->screenPos());
- Q_ASSERT(state->property("timerid").toInt() == 0);
- state->setProperty("timerid", state->startTimer(100));
- state->setHotSpot(ev->screenPos());
- event->accept();
- return m_feedback ?
- QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint :
- QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
- case QEvent::GraphicsSceneMouseMove:
- if (int timerid = state->property("timerid").toInt()) {
- QPoint delta = ev->screenPos() - state->property("position").toPointF().toPoint();
- enum { TapRadius = 40 };
- if (delta.manhattanLength() > TapRadius) {
- state->killTimer(timerid);
-#if 1
- reset(state);
-#endif
- return QGestureRecognizer::CancelGesture;
- }
- }
- return m_feedback ?
- QGestureRecognizer::Ignore :
- QGestureRecognizer::MayBeGesture;
- case QEvent::GraphicsSceneMouseRelease:
- if (int timerid = state->property("timerid").toInt()) {
- state->killTimer(timerid);
-#if 1
- reset(state);
-#endif
- return QGestureRecognizer::CancelGesture;
- }
- return QGestureRecognizer::Ignore;
- case QEvent::Timer: {
- Q_ASSERT(state == watched);
- Q_ASSERT(state->property("timerid").toInt() != 0);
- int iteration = state->property("iteration").toInt();
- if (m_feedback)
- state->setProperty("completionStatus", iteration+1);
- if (iteration++ == 9) {
- state->killTimer(state->property("timerid").toInt());
- return QGestureRecognizer::FinishGesture;
- }
- state->setProperty("iteration", iteration);
- return m_feedback ?
- QGestureRecognizer::TriggerGesture|QGestureRecognizer::ConsumeEventHint :
- QGestureRecognizer::Ignore|QGestureRecognizer::ConsumeEventHint;
- }
- default:
- break;
- }
- return QGestureRecognizer::Ignore;
-}
-
-void TapAndHoldGestureRecognizer::reset(QGesture *q)
-{
- q->setProperty("completionStatus", 0);
- q->setProperty("position", QPointF());
- if (int timerid = q->property("timerid").toInt())
- q->killTimer(timerid);
- q->setProperty("timerid", 0);
- q->setProperty("iteration", 0);
-}
-
-
diff --git a/animals/tapandholdgesturerecognizer.h b/animals/tapandholdgesturerecognizer.h
deleted file mode 100644
index f5e99f3..0000000
--- a/animals/tapandholdgesturerecognizer.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef TAPANDHOLDGESTURE_H
-#define TAPANDHOLDGESTURE_H
-
-#include <QtGui>
-
-class TapAndHoldFeedbackGesture : public QGesture
-{
- Q_OBJECT
- Q_PROPERTY(int completionStatus READ completionStatus WRITE setCompletionStatus)
- Q_PROPERTY(QPointF position READ position WRITE setPosition)
-
-public:
- static Qt::GestureType Type;
-
- TapAndHoldFeedbackGesture();
-
- int completionStatus() const;
- void setCompletionStatus(int value);
-
- QPointF position() const;
- void setPosition(const QPointF &value);
-
-private:
- int m_completionStatus;
- QPointF m_position;
- friend class TapAndHoldGestureRecognizer;
-};
-
-class TapAndHoldGestureRecognizer : public QGestureRecognizer
-{
-public:
- static void registerRecognizer();
-
-private:
- TapAndHoldGestureRecognizer(bool feedback);
-
- QGesture *create(QObject *);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *q);
-
- bool m_feedback;
-
- const static int Timeout = 2000;
-};
-
-#endif
-
diff --git a/animals/tapgesturerecognizer.cpp b/animals/tapgesturerecognizer.cpp
deleted file mode 100644
index f31115b..0000000
--- a/animals/tapgesturerecognizer.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "tapgesturerecognizer.h"
-
-void TapGestureRecognizer::registerRecognizer()
-{
- QGestureRecognizer::registerRecognizer(new TapGestureRecognizer);
-}
-
-TapGestureRecognizer::TapGestureRecognizer()
-{
- qDebug() << "creating TapGestureRecognizer (Qt)";
-}
-
-QGesture *TapGestureRecognizer::create(QObject *)
-{
- return new QTapGesture;
-}
-
-QGestureRecognizer::Result TapGestureRecognizer::recognize(QGesture *state, QObject *watched,
- QEvent *event)
-{
- QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(event);
- switch(event->type()) {
- case QEvent::GraphicsSceneMousePress:
- if (!(ev->modifiers() & Qt::ControlModifier)) {
- state->setProperty("position", ev->screenPos());
- state->setHotSpot(ev->screenPos());
- state->setHandled(false);
- //event->accept();
- qDebug() << "TapGestureRecognizer::recognize: trigger gesture" << watched;
-
-
- return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
- } else
- return QGestureRecognizer::Ignore;
-
- case QEvent::GraphicsSceneMouseMove:
- return QGestureRecognizer::Ignore;
-
- case QEvent::GraphicsSceneMouseRelease:
- qDebug() << "Mouse release: " << state->state();
- if (state->state() != Qt::GestureStarted) {
- return QGestureRecognizer::CancelGesture;
- } else if (state->state() != Qt::GestureCanceled) {
- return QGestureRecognizer::FinishGesture;
- }
- return QGestureRecognizer::Ignore;
-
- case QEvent::Gesture: {
- QGestureEvent *ge = static_cast<QGestureEvent *>(event);
- QGesture *tap = ge->gesture(Qt::TapGesture);
- QGesture *pan = ge->gesture(Qt::PanGesture);
- //qDebug() << "TapGestureRecognizer::recognize got a gesture" << tap << (tap ? tap->state() : 0)
- // << ", " << pan << (pan ? pan->state() : 0);
- if (ge->gesture(Qt::PanGesture)) {
- //return QGestureRecognizer::CancelGesture;
- return QGestureRecognizer::Ignore;
- }
- if (ge->gesture(Qt::TapAndHoldGesture))
- return QGestureRecognizer::CancelGesture;
- }
-
- return QGestureRecognizer::Ignore;
- default:
- break;
- }
- return QGestureRecognizer::Ignore;
-}
-
-void TapGestureRecognizer::reset(QGesture *q)
-{
- q->setProperty("position", QPointF());
-}
diff --git a/animals/tapgesturerecognizer.h b/animals/tapgesturerecognizer.h
deleted file mode 100644
index 165e236..0000000
--- a/animals/tapgesturerecognizer.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef TAPGESTURERECOGNIZER_H
-#define TAPGESTURERECOGNIZER_H
-
-#include <QtGui>
-
-class TapGestureRecognizer : public QGestureRecognizer
-{
-public:
- static void registerRecognizer();
-
-private:
- TapGestureRecognizer();
- QGesture *create(QObject *);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *q);
-};
-
-#endif