Debian Codegraph @

src/imports/Test/plugin/uctestextras.h

raw
1 /*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #ifndef UCTESTEXTRAS_H
18 #define UCTESTEXTRAS_H
19
20 #include <QtCore/QObject>
21
22 class QQuickItem;
23 class QTouchDevice;
24 class UCTestExtras : public QObject
25 {
26 Q_OBJECT
27 Q_PROPERTY(bool touchPresent READ touchDevicePresent NOTIFY touchDevicePresentChanged)
28 public:
29 explicit UCTestExtras(QObject *parent = 0);
30
31 Q_SIGNALS:
32 void touchDevicePresentChanged();
33
34 public Q_SLOTS:
35 static QString openGLflavor();
36 static QString cpuArchitecture();
37 static bool touchDevicePresent();
38 static void registerTouchDevice();
39 static void touchPress(int touchId, QQuickItem *item, const QPoint &point);
40 static void touchRelease(int touchId, QQuickItem *item, const QPoint &point);
41 static void touchClick(int touchId, QQuickItem *item, const QPoint &point);
42 static void touchLongPress(int touchId, QQuickItem *item, const QPoint &point);
43 static void touchDoubleClick(int touchId, QQuickItem *item, const QPoint &point);
44 static void touchMove(int touchId, QQuickItem *item, const QPoint &point);
45 static void touchDrag(int touchId, QQuickItem *item, const QPoint &from, const QPoint &delta, int steps = 5);
46
47 static void mouseDrag(
48 QQuickItem *item,
49 const QPoint &from,
50 const QPoint &delta,
51 Qt::MouseButton button,
52 Qt::KeyboardModifiers stateKey = Qt::NoModifier,
53 int steps = -1,
54 int delay = -1);
55
56 static void removeTimeConstraintsFromSwipeArea(QQuickItem *item);
57
58 public: // yet for cpp use
59 static void touchDragWithPoints(int touchId, QQuickItem *item, QList<QPoint> points, int delay = -1);
60 static void mouseDragWithPoints(
61 QQuickItem *item,
62 QList<QPoint> points,
63 Qt::MouseButton button,
64 Qt::KeyboardModifiers stateKey = Qt::NoModifier,
65 int delay = -1);
66
67 private:
68 static UCTestExtras *m_testExtras;
69
70 friend class UCMouseTouchAdaptor;
71 };
72
73 #endif // UCTESTEXTRAS_H