summaryrefslogtreecommitdiffstats
path: root/scroller
diff options
context:
space:
mode:
authorRalf Engels <ralf.engels@nokia.com>2010-05-28 19:35:09 +0200
committerRalf Engels <ralf.engels@nokia.com>2010-05-28 19:35:09 +0200
commit6ac62ecc1fb1ddaa939e5417d864382e944b0fd1 (patch)
tree83c3f6c7bb283f62cd8da801caefc2f0ee144f01 /scroller
parent55041c80118e1748268a977dd4e549223ed96767 (diff)
Revert "Add gestures"HEADmaster
This reverts commit 4d7cc49a79343aec00a9fc6241ae120177bf9d53.
Diffstat (limited to 'scroller')
-rw-r--r--scroller/qflickgesture.cpp208
-rw-r--r--scroller/qflickgesture.h90
-rw-r--r--scroller/qkineticscroller.h3
-rw-r--r--scroller/scroller.pro4
4 files changed, 2 insertions, 303 deletions
diff --git a/scroller/qflickgesture.cpp b/scroller/qflickgesture.cpp
deleted file mode 100644
index 03434a2..0000000
--- a/scroller/qflickgesture.cpp
+++ /dev/null
@@ -1,208 +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 QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qflickgesture.h"
-#include "qgesture.h"
-#include "qevent.h"
-#include "qwidget.h"
-#include "qabstractscrollarea.h"
-#include "qdebug.h"
-
-QT_BEGIN_NAMESPACE
-
-
-class QFlickGesturePrivate
-{
-public:
- QFlickGesturePrivate()
- {
- }
-
- QKineticScroller *scroller()
- {
- if (!target || !target->parent())
- return 0;
-
- QKineticScroller *s = target->parent()->property("kineticScroller").value<QKineticScroller *>();
- return s;
- }
-
- QPointer<QWidget> target;
-
-#if QT_VERSION < 0x040700
- QTime timer;
-#else
- QElapsedTimer timer;
-#endif
-
- friend class QFlickGesture;
-};
-
-
-QFlickGestureRecognizer::QFlickGestureRecognizer()
-{
-}
-
-QGesture *QFlickGestureRecognizer::create(QObject *target)
-{
- if (target && target->isWidgetType()) {
- QWidget *widget = static_cast<QWidget *>(target);
-#if defined(Q_OS_WIN) && !defined(QT_NO_NATIVE_GESTURES)
- // for scroll areas on Windows we want to use native gestures instead
- if (!qobject_cast<QAbstractScrollArea *>(target->parent()))
- widget->setAttribute(Qt::WA_AcceptTouchEvents);
-#else
- widget->setAttribute(Qt::WA_AcceptTouchEvents);
-#endif
- return new QFlickGesture(widget);
- }
- return new QFlickGesture(0);
-}
-
-QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
- QObject *,
- QEvent *event)
-{
- QFlickGesture *q = static_cast<QFlickGesture *>(state);
- QFlickGesturePrivate *d = q->d;
-
- QKineticScroller *scroller = d->scroller();
- if (!scroller)
- return QGestureRecognizer::Ignore;
-
- // eat mouse events if the scroller is active
- if ((scroller->state() == QKineticScroller::StateDragging ||
- scroller->state() == QKineticScroller::StateScrolling) &&
- (event->type() != QEvent::MouseButtonPress &&
- event->type() != QEvent::MouseMove &&
- event->type() != QEvent::MouseButtonDblClick &&
- event->type() != QEvent::MouseButtonRelease) )
- return QGestureRecognizer::Ignore | QGestureRecognizer::ConsumeEventHint;
-
- // ignore all other events except touch
- if (event->type() != QEvent::TouchBegin &&
- event->type() != QEvent::TouchEnd &&
- event->type() != QEvent::TouchUpdate)
- return QGestureRecognizer::Ignore;
-
- qDebug()<<"recognize event: "<<event<<"target:"<<d->target<<"scroller:"<<d->scroller();
-
- const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
- QTouchEvent::TouchPoint tp = ev->touchPoints().first();
-
- qint64 timestamp = d->timer.elapsed();
-
- QKineticScroller::State oldState = scroller->state();
-
- QGestureRecognizer::Result result = QGestureRecognizer::Ignore;
- switch (event->type()) {
- case QEvent::TouchBegin:
- scroller->handleInput(QKineticScroller::InputPress, tp.pos(), timestamp);
- break;
- case QEvent::TouchEnd:
- scroller->handleInput(QKineticScroller::InputRelease, tp.pos(), timestamp);
- break;
- case QEvent::TouchUpdate:
- scroller->handleInput(QKineticScroller::InputMove, tp.pos(), timestamp);
- break;
- default:
- break;
- }
-
- QKineticScroller::State newState = scroller->state();
-
- bool oldTriggered = (oldState == QKineticScroller::StateInactive) ||
- (oldState == QKineticScroller::StatePressed);
-
- bool newTriggered = (newState == QKineticScroller::StateInactive) ||
- (newState == QKineticScroller::StatePressed);
-
- if (event->type() == QEvent::TouchBegin && !newTriggered)
- return QGestureRecognizer::MayBeGesture;
-
- if (event->type() == QEvent::TouchEnd && !oldTriggered)
- return QGestureRecognizer::CancelGesture;
-
- if (!oldTriggered && !newTriggered)
- return QGestureRecognizer::Ignore;
-
- if (oldTriggered && newTriggered)
- return QGestureRecognizer::Ignore | QGestureRecognizer::ConsumeEventHint;
-
- if (!oldTriggered)
- return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
-
- return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
-}
-
-void QFlickGestureRecognizer::reset(QGesture *state)
-{
- QFlickGesture *flick = static_cast<QFlickGesture*>(state);
- flick->d->target = 0;
- flick->d->timer.start();
-
- QGestureRecognizer::reset(state);
-}
-
-
-
-/*!
- \class QFlickGesture
- \since 4.7
- \brief The QFlickGesture class describes a flicking gesture made by the user.
- \ingroup gestures
-
- \sa {Gestures Programming}, QPinchGesture, QSwipeGesture
-*/
-
-/*!
- \internal
-*/
-QFlickGesture::QFlickGesture(QWidget *target, QObject *parent)
- : QGesture(parent)
-{
- d = new QFlickGesturePrivate();
- d->target = target;
- d->timer.start();
- qDebug() << "QFlickGesture::FlickGesture for: " << target;
-}
-
-QT_END_NAMESPACE
diff --git a/scroller/qflickgesture.h b/scroller/qflickgesture.h
deleted file mode 100644
index b6571d0..0000000
--- a/scroller/qflickgesture.h
+++ /dev/null
@@ -1,90 +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 QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QFLICKGESTURE_P_H
-#define QFLICKGESTURE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qgesturerecognizer.h"
-#include "private/qgesture_p.h"
-
-#include "qkineticscroller.h"
-
-QT_BEGIN_NAMESPACE
-
-class QFlickGestureRecognizer : public QGestureRecognizer
-{
-public:
- QFlickGestureRecognizer();
-
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *state);
-};
-
-class QFlickGesturePrivate;
-
-class Q_GUI_EXPORT QFlickGesture : public QGesture
-{
- Q_OBJECT
-
-public:
- QFlickGesture(QWidget *widget, QObject *parent = 0);
-
- friend class QFlickGestureRecognizer;
-
-private:
- QFlickGesturePrivate *d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QFLICKGESTURES_P_H
diff --git a/scroller/qkineticscroller.h b/scroller/qkineticscroller.h
index 56bf733..f7eef8f 100644
--- a/scroller/qkineticscroller.h
+++ b/scroller/qkineticscroller.h
@@ -53,7 +53,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-class QFlickGestureRecognizer;
class QKineticScrollerPrivate;
class QKineticScroller
@@ -155,8 +154,6 @@ protected:
private:
Q_DISABLE_COPY(QKineticScroller)
Q_DECLARE_PRIVATE(QKineticScroller)
-
- friend class QFlickGestureRecognizer;
};
QT_END_NAMESPACE
diff --git a/scroller/scroller.pro b/scroller/scroller.pro
index 28b794b..97a3ca7 100644
--- a/scroller/scroller.pro
+++ b/scroller/scroller.pro
@@ -9,8 +9,8 @@ DEPENDPATH += .
INCLUDEPATH += .
# Input
-HEADERS += qkineticscroller.h qkineticscroller_p.h qflickgesture.h
-SOURCES += qkineticscroller.cpp qflickgesture.cpp
+HEADERS += qkineticscroller.h qkineticscroller_p.h
+SOURCES += qkineticscroller.cpp
macx:SOURCES += qkineticscroller_mac.mm
maemo5:SOURCES += qkineticscroller_maemo5.cpp