diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-01-31 16:52:36 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-03 00:39:18 +0100 |
commit | 01dc7e2ea476e0e6dcdce2e72979bbc858f4057d (patch) | |
tree | d8796f7695bbf8ad42abf47cd84c1b5e000ef795 /src/imports/gestures | |
parent | 5e07b57b818326da47a46d384415041fa4cea0ba (diff) |
Remove QtQuick1 elements from qtdeclarative
QtQuick1 is now contained in a separate repository.
Task-number: QTBUG-23737
Change-Id: I09eae67af5693a22b896b916f816f73ccc3a89b1
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/imports/gestures')
-rw-r--r-- | src/imports/gestures/gestures.pro | 16 | ||||
-rw-r--r-- | src/imports/gestures/plugin.cpp | 73 | ||||
-rw-r--r-- | src/imports/gestures/qdeclarativegesturearea.cpp | 283 | ||||
-rw-r--r-- | src/imports/gestures/qdeclarativegesturearea_p.h | 103 | ||||
-rw-r--r-- | src/imports/gestures/qmldir | 1 |
5 files changed, 0 insertions, 476 deletions
diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro deleted file mode 100644 index 36244a1d71..0000000000 --- a/src/imports/gestures/gestures.pro +++ /dev/null @@ -1,16 +0,0 @@ -TARGET = qmlgesturesplugin -TARGETPATH = Qt/labs/gestures -include(../qimportbase.pri) - -QT += core-private gui-private declarative-private qtquick1 qtquick1-private widgets-private v8-private - -SOURCES += qdeclarativegesturearea.cpp plugin.cpp -HEADERS += qdeclarativegesturearea_p.h - -DESTDIR = $$QT.declarative.imports/$$TARGETPATH -target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH - -qmldir.files += $$PWD/qmldir -qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH - -INSTALLS += target qmldir diff --git a/src/imports/gestures/plugin.cpp b/src/imports/gestures/plugin.cpp deleted file mode 100644 index 83ac3d66dc..0000000000 --- a/src/imports/gestures/plugin.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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. -** -** 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtDeclarative/qdeclarativeextensionplugin.h> -#include <QtDeclarative/qdeclarative.h> - -#include "qdeclarativegesturearea_p.h" - -QT_BEGIN_NAMESPACE - -class GestureAreaQmlPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - virtual void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.gestures")); -#ifndef QT_NO_GESTURES - qmlRegisterCustomType<QDeclarativeGestureArea>(uri,1,0, "GestureArea", new QDeclarativeGestureAreaParser); - - qmlRegisterUncreatableType<QGesture>(uri, 1, 0, "Gesture", QLatin1String("Do not create objects of this type.")); - qmlRegisterUncreatableType<QPanGesture>(uri, 1, 0, "PanGesture", QLatin1String("Do not create objects of this type.")); - qmlRegisterUncreatableType<QTapGesture>(uri, 1, 0, "TapGesture", QLatin1String("Do not create objects of this type.")); - qmlRegisterUncreatableType<QTapAndHoldGesture>(uri, 1, 0, "TapAndHoldGesture", QLatin1String("Do not create objects of this type.")); - qmlRegisterUncreatableType<QPinchGesture>(uri, 1, 0, "PinchGesture", QLatin1String("Do not create objects of this type.")); - qmlRegisterUncreatableType<QSwipeGesture>(uri, 1, 0, "SwipeGesture", QLatin1String("Do not create objects of this type.")); -#endif - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" - -Q_EXPORT_PLUGIN2(qmlgesturesplugin, QT_PREPEND_NAMESPACE(GestureAreaQmlPlugin)); diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp deleted file mode 100644 index 8a23ef1e77..0000000000 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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. -** -** 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativegesturearea_p.h" - -#include <qdeclarativeexpression.h> -#include <qdeclarativecontext.h> -#include <qdeclarativeinfo.h> - -#include <private/qdeclarativeproperty_p.h> -#include <private/qdeclarativescript_p.h> -#include <QtQuick1/private/qdeclarativeitem_p.h> - -#include <QtCore/qdebug.h> -#include <QtCore/qstringlist.h> - -#include <QtGui/qevent.h> - -#include <private/qobject_p.h> - -#ifndef QT_NO_GESTURES - -QT_BEGIN_NAMESPACE - -class QDeclarativeGestureAreaPrivate : public QDeclarativeItemPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeGestureArea) -public: - QDeclarativeGestureAreaPrivate() : componentcomplete(false), gesture(0) {} - - typedef QMap<Qt::GestureType,QDeclarativeExpression*> Bindings; - Bindings bindings; - - bool componentcomplete; - - QByteArray data; - - QGesture *gesture; - - bool gestureEvent(QGestureEvent *event); -}; - -/*! - \qmlclass GestureArea QDeclarativeGestureArea - \ingroup qml-basic-interaction-elements - - \brief The GestureArea item enables simple gesture handling. - \inherits Item - - A GestureArea is like a MouseArea, but it has signals for gesture events. - - \warning Elements in the Qt.labs module are not guaranteed to remain compatible - in future versions. - - \warning GestureArea is an experimental element whose development has - been discontinued. PinchArea is available in QtQuick 1.1 and handles - two finger gesture input. - - \note This element is only functional on devices with touch input. - - \qml - import Qt.labs.gestures 1.0 - - GestureArea { - anchors.fill: parent - // onPan: ... gesture.acceleration ... - // onPinch: ... gesture.rotationAngle ... - // onSwipe: ... - // onTapAndHold: ... - // onTap: ... - // onGesture: ... - } - \endqml - - Each signal has a \e gesture parameter that has the - properties of the gesture. - - \table - \header \o Signal \o Type \o Property \o Description - \row \o onTap \o point \o position \o the position of the tap - \row \o onTapAndHold \o point \o position \o the position of the tap - \row \o onPan \o real \o acceleration \o the acceleration of the pan - \row \o onPan \o point \o delta \o the offset from the previous input position to the current input - \row \o onPan \o point \o offset \o the total offset from the first input position to the current input position - \row \o onPan \o point \o lastOffset \o the previous value of offset - \row \o onPinch \o point \o centerPoint \o the midpoint between the two input points - \row \o onPinch \o point \o lastCenterPoint \o the previous value of centerPoint - \row \o onPinch \o point \o startCenterPoint \o the first value of centerPoint - \row \o onPinch \o real \o rotationAngle \o the angle covered by the gesture motion - \row \o onPinch \o real \o lastRotationAngle \o the previous value of rotationAngle - \row \o onPinch \o real \o totalRotationAngle \o the complete angle covered by the gesture - \row \o onPinch \o real \o scaleFactor \o the change in distance between the two input points - \row \o onPinch \o real \o lastScaleFactor \o the previous value of scaleFactor - \row \o onPinch \o real \o totalScaleFactor \o the complete scale factor of the gesture - \row \o onSwipe \o real \o swipeAngle \o the angle of the swipe - \endtable - - Custom gestures, handled by onGesture, will have custom properties. - - GestureArea is an invisible item: it is never painted. - - \sa MouseArea -*/ - -/*! - \internal - \class QDeclarativeGestureArea - \brief The QDeclarativeGestureArea class provides simple gesture handling. - -*/ -QDeclarativeGestureArea::QDeclarativeGestureArea(QDeclarativeItem *parent) : - QDeclarativeItem(*(new QDeclarativeGestureAreaPrivate), parent) -{ - setAcceptedMouseButtons(Qt::LeftButton); - setAcceptTouchEvents(true); -} - -QDeclarativeGestureArea::~QDeclarativeGestureArea() -{ -} - -QByteArray -QDeclarativeGestureAreaParser::compile(const QList<QDeclarativeCustomParserProperty> &props) -{ - QByteArray rv; - QDataStream ds(&rv, QIODevice::WriteOnly); - - for(int ii = 0; ii < props.count(); ++ii) - { - QString propName = props.at(ii).name(); - Qt::GestureType type; - - if (propName == QLatin1String("onTap")) { - type = Qt::TapGesture; - } else if (propName == QLatin1String("onTapAndHold")) { - type = Qt::TapAndHoldGesture; - } else if (propName == QLatin1String("onPan")) { - type = Qt::PanGesture; - } else if (propName == QLatin1String("onPinch")) { - type = Qt::PinchGesture; - } else if (propName == QLatin1String("onSwipe")) { - type = Qt::SwipeGesture; - } else if (propName == QLatin1String("onGesture")) { - type = Qt::CustomGesture; - } else { - error(props.at(ii), QDeclarativeGestureArea::tr("Cannot assign to non-existent property \"%1\"").arg(propName)); - return QByteArray(); - } - - QList<QVariant> values = props.at(ii).assignedValues(); - - for (int i = 0; i < values.count(); ++i) { - const QVariant &value = values.at(i); - - if (value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) { - error(props.at(ii), QDeclarativeGestureArea::tr("GestureArea: nested objects not allowed")); - return QByteArray(); - } else if (value.userType() == qMetaTypeId<QDeclarativeCustomParserProperty>()) { - error(props.at(ii), QDeclarativeGestureArea::tr("GestureArea: syntax error")); - return QByteArray(); - } else { - QDeclarativeScript::Variant v = qvariant_cast<QDeclarativeScript::Variant>(value); - if (v.isScript()) { - ds << propName; - ds << int(type); - ds << v.asScript(); - } else { - error(props.at(ii), QDeclarativeGestureArea::tr("GestureArea: script expected")); - return QByteArray(); - } - } - } - } - - return rv; -} - -void QDeclarativeGestureAreaParser::setCustomData(QObject *object, - const QByteArray &data) -{ - QDeclarativeGestureArea *ga = static_cast<QDeclarativeGestureArea*>(object); - ga->d_func()->data = data; -} - - -void QDeclarativeGestureArea::connectSignals() -{ - Q_D(QDeclarativeGestureArea); - if (!d->componentcomplete) - return; - - QDataStream ds(d->data); - while (!ds.atEnd()) { - QString propName; - ds >> propName; - int gesturetype; - ds >> gesturetype; - QString script; - ds >> script; - QDeclarativeExpression *exp = new QDeclarativeExpression(qmlContext(this), this, script); - d->bindings.insert(Qt::GestureType(gesturetype),exp); - grabGesture(Qt::GestureType(gesturetype)); - } -} - -void QDeclarativeGestureArea::componentComplete() -{ - QDeclarativeItem::componentComplete(); - Q_D(QDeclarativeGestureArea); - d->componentcomplete=true; - connectSignals(); -} - -QGesture *QDeclarativeGestureArea::gesture() const -{ - Q_D(const QDeclarativeGestureArea); - return d->gesture; -} - -bool QDeclarativeGestureArea::sceneEvent(QEvent *event) -{ - Q_D(QDeclarativeGestureArea); - if (event->type() == QEvent::Gesture) - return d->gestureEvent(static_cast<QGestureEvent*>(event)); - return QDeclarativeItem::sceneEvent(event); -} - -bool QDeclarativeGestureAreaPrivate::gestureEvent(QGestureEvent *event) -{ - bool accept = true; - for (Bindings::Iterator it = bindings.begin(); it != bindings.end(); ++it) { - if ((gesture = event->gesture(it.key()))) { - QDeclarativeExpression *expr = it.value(); - expr->evaluate(); - if (expr->hasError()) - qmlInfo(q_func()) << expr->error(); - event->setAccepted(true); // XXX only if value returns true? - } - } - return accept; -} - -QT_END_NAMESPACE - -#endif // QT_NO_GESTURES diff --git a/src/imports/gestures/qdeclarativegesturearea_p.h b/src/imports/gestures/qdeclarativegesturearea_p.h deleted file mode 100644 index 969997d702..0000000000 --- a/src/imports/gestures/qdeclarativegesturearea_p.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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. -** -** 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEGESTUREAREA_H -#define QDECLARATIVEGESTUREAREA_H - -#include <qdeclarativeitem.h> -#include <qdeclarativescriptstring.h> -#include <private/qdeclarativecustomparser_p.h> - -#include <QtCore/qobject.h> -#include <QtCore/qstring.h> -#include <QtWidgets/qgesture.h> - -#ifndef QT_NO_GESTURES - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - -class QDeclarativeBoundSignal; -class QDeclarativeContext; -class QDeclarativeGestureAreaPrivate; -class QDeclarativeGestureArea : public QDeclarativeItem -{ - Q_OBJECT - - Q_PROPERTY(QGesture *gesture READ gesture) - -public: - QDeclarativeGestureArea(QDeclarativeItem *parent=0); - ~QDeclarativeGestureArea(); - - QGesture *gesture() const; - -protected: - bool sceneEvent(QEvent *event); - -private: - void connectSignals(); - void componentComplete(); - friend class QDeclarativeGestureAreaParser; - - Q_DISABLE_COPY(QDeclarativeGestureArea) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGestureArea) -}; - -class QDeclarativeGestureAreaParser : public QDeclarativeCustomParser -{ -public: - virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &); - virtual void setCustomData(QObject *, const QByteArray &); -}; - - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeGestureArea) - -QT_END_HEADER - -#endif // QT_NO_GESTURES - -#endif diff --git a/src/imports/gestures/qmldir b/src/imports/gestures/qmldir deleted file mode 100644 index 2a31920a40..0000000000 --- a/src/imports/gestures/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin qmlgesturesplugin |