summaryrefslogtreecommitdiffstats
path: root/examples/sensors/shakeit
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-09-29 17:53:56 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2022-10-04 08:11:45 +0300
commit7a94c109e6805b35150522b6714f04e63d751888 (patch)
tree4ce31ad1feb0de16bda4c591ad18c165db833b1d /examples/sensors/shakeit
parentd5d24fd5fe095337063891204e4fee4c6914b165 (diff)
Remove disabled sensor gesture code
Support for sensor gestures in their then-current form was removed in Qt 6 (QTBUG-95747). This commit removes the disabled code. This is to avoid distraction when keeping the repository up-to-date with rest of Qt. The gestures may be reintroduced in some shape or form in the future (QTBUG-97066). For those reference purposes the old code can be found in the git history. Fixes: QTBUG-107065 Change-Id: If2c50171f84d483dde55600422d138d550124bdc Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'examples/sensors/shakeit')
-rw-r--r--examples/sensors/shakeit/CMakeLists.txt53
-rw-r--r--examples/sensors/shakeit/audio/loopy2a_mono.wavbin67772 -> 0 bytes
-rw-r--r--examples/sensors/shakeit/audio/phone.wavbin22094 -> 0 bytes
-rw-r--r--examples/sensors/shakeit/content/triangle.pngbin7251 -> 0 bytes
-rw-r--r--examples/sensors/shakeit/content/triangle2.pngbin5633 -> 0 bytes
-rw-r--r--examples/sensors/shakeit/content/triangle3.pngbin5101 -> 0 bytes
-rw-r--r--examples/sensors/shakeit/doc/images/shakeit.pngbin29380 -> 0 bytes
-rw-r--r--examples/sensors/shakeit/doc/src/shakeit.qdoc40
-rw-r--r--examples/sensors/shakeit/main.cpp5
-rw-r--r--examples/sensors/shakeit/shakeit.pro17
-rw-r--r--examples/sensors/shakeit/shakeit.qml328
-rw-r--r--examples/sensors/shakeit/shakeit.qrc10
12 files changed, 0 insertions, 453 deletions
diff --git a/examples/sensors/shakeit/CMakeLists.txt b/examples/sensors/shakeit/CMakeLists.txt
deleted file mode 100644
index 4a0e222c..00000000
--- a/examples/sensors/shakeit/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(shakeit LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/shakeit")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick)
-
-qt_add_executable(shakeit
- main.cpp
-)
-
-set_target_properties(shakeit PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(shakeit PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Quick
-)
-
-# Resources:
-set(shakeit_resource_files
- "audio/loopy2a_mono.wav"
- "audio/phone.wav"
- "content/triangle.png"
- "content/triangle2.png"
- "content/triangle3.png"
- "shakeit.qml"
-)
-
-qt6_add_resources(shakeit "shakeit"
- PREFIX
- "/"
- FILES
- ${shakeit_resource_files}
-)
-
-install(TARGETS shakeit
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/sensors/shakeit/audio/loopy2a_mono.wav b/examples/sensors/shakeit/audio/loopy2a_mono.wav
deleted file mode 100644
index 7d76cb65..00000000
--- a/examples/sensors/shakeit/audio/loopy2a_mono.wav
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/shakeit/audio/phone.wav b/examples/sensors/shakeit/audio/phone.wav
deleted file mode 100644
index 884e9ac2..00000000
--- a/examples/sensors/shakeit/audio/phone.wav
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/shakeit/content/triangle.png b/examples/sensors/shakeit/content/triangle.png
deleted file mode 100644
index f366537e..00000000
--- a/examples/sensors/shakeit/content/triangle.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/shakeit/content/triangle2.png b/examples/sensors/shakeit/content/triangle2.png
deleted file mode 100644
index 9318d5a3..00000000
--- a/examples/sensors/shakeit/content/triangle2.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/shakeit/content/triangle3.png b/examples/sensors/shakeit/content/triangle3.png
deleted file mode 100644
index 4cc5ccda..00000000
--- a/examples/sensors/shakeit/content/triangle3.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/shakeit/doc/images/shakeit.png b/examples/sensors/shakeit/doc/images/shakeit.png
deleted file mode 100644
index 5ca1b58c..00000000
--- a/examples/sensors/shakeit/doc/images/shakeit.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/shakeit/doc/src/shakeit.qdoc b/examples/sensors/shakeit/doc/src/shakeit.qdoc
deleted file mode 100644
index 2dfb33bb..00000000
--- a/examples/sensors/shakeit/doc/src/shakeit.qdoc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example shakeit
- \title Qt Sensors - ShakeIt QML Example
- \ingroup qtsensors-examples
- \image shakeit.png
-
- \section2 ShakeIt in QML
- \brief The sensor gesture example demonstrates the steps for creating a QML application
- that uses sensor gestures and the included shake sensor.
-
- Writing a QML application that uses the Shake QML sensorgestures type requires the following steps:
-
- Import the Sensors Declarative module.
-
- \snippet shakeit/shakeit.qml 0
-
- Add a SensorGesture QML type.
-
- \snippet shakeit/shakeit.qml 1
-
- In the SensorGesture type, specify which gesture to be used.
- Note that this can be a comma separated list. Here we are only interested in one
- gesture recognizer.
-
- \snippet shakeit/shakeit.qml 2
-
- Use the 'enabled' property to start the sensor gesture.
-
- \snippet shakeit/shakeit.qml 3
-
- Use the onDetected signal to do stuff.
-
- \snippet shakeit/shakeit.qml 4
-
- There are additional gestures to shake which are supported:
- whip, twistRight, hover, cover, turnover and pickup.
-*/
diff --git a/examples/sensors/shakeit/main.cpp b/examples/sensors/shakeit/main.cpp
deleted file mode 100644
index d550f8bc..00000000
--- a/examples/sensors/shakeit/main.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "../stub.h"
-SENSORS_EXAMPLE_MAIN(shakeit)
diff --git a/examples/sensors/shakeit/shakeit.pro b/examples/sensors/shakeit/shakeit.pro
deleted file mode 100644
index 327c669b..00000000
--- a/examples/sensors/shakeit/shakeit.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET = shakeit
-QT += quick sensors
-qtConfig(static):QTPLUGIN += qtsensorgestures_plugin qtsensorgestures_shakeplugin
-
-SOURCES = main.cpp
-
-RESOURCES += \
- shakeit.qrc
-
-OTHER_FILES = \
- $$files(*.qml) \
- audio \
- content
-
-target.path = $$[QT_INSTALL_EXAMPLES]/sensors/shakeit
-INSTALLS += target
diff --git a/examples/sensors/shakeit/shakeit.qml b/examples/sensors/shakeit/shakeit.qml
deleted file mode 100644
index 683e3b16..00000000
--- a/examples/sensors/shakeit/shakeit.qml
+++ /dev/null
@@ -1,328 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-//! [0]
-import QtSensors
-//! [0]
-
-Rectangle {
- id: window
- anchors.fill: parent
-
- state: "default"
-
- Text {
- id: label
- text: qsTr("Shake to rotate triangles")
- y: parent.height / 4
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Image {
- id: triangle1
- smooth: true
- source: "content/triangle.png"
- x: parent.width / 2 - (triangle1.width / 2)
- y: parent.height / 2 - (triangle1.height);
- Behavior on x { SmoothedAnimation { velocity: 200 } }
- Behavior on y { SmoothedAnimation { velocity: 200 } }
- transform: Rotation {
- id: myRot
- }
- }
- Image {
- id: triangle2
- smooth: true
- source: "content/triangle2.png"
- x: parent.width / 2 - (triangle1.width + triangle2.width / 2)
- y: parent.height / 2 + (triangle2.height / 2);
- Behavior on x { SmoothedAnimation { velocity: 200 } }
- Behavior on y { SmoothedAnimation { velocity: 200 } }
- }
- Image {
- id: triangle3
- smooth: true
- source: "content/triangle3.png"
- x: parent.width / 2 + (triangle1.width / 2)
- y: parent.height / 2 + (triangle3.height / 2);
- Behavior on x { SmoothedAnimation { velocity: 200 } }
- Behavior on y { SmoothedAnimation { velocity: 200 } }
- }
-
- states: [
- State {
- name: "rotated"
- PropertyChanges { target: triangle1; rotation: 180 }
- PropertyChanges { target: triangle2; rotation: 90 }
- PropertyChanges { target: triangle3; rotation: 270 }
- },
- State {
- name: "default"
- PropertyChanges { target: triangle1; rotation: 0;
- x: parent.width / 2 - (triangle1.width / 2)
- y: parent.height / 2 - (triangle1.height)
- scale: 1;
-
- }
- PropertyChanges { target: triangle2; rotation: 0;
- x: parent.width / 2 - (triangle1.width + triangle2.width / 2)
- y: parent.height / 2 + (triangle2.height / 2);
- scale: 1;
- }
- PropertyChanges { target: triangle3; rotation: 0;
- x: parent.width / 2 + (triangle1.width / 2)
- y: parent.height / 2 + (triangle3.height / 2);
- scale: 1;
- }
- },
- State {
- name: "whipped"
- PropertyChanges { target: triangle1; rotation: 0; x:0; }
- PropertyChanges { target: triangle2; rotation: 0; x:0;
- y: triangle1.x + triangle1.height; }
- PropertyChanges { target: triangle3; rotation: 0; x:0;
- y: triangle2.y + triangle2.height; }
- },
- State {
- name: "twistedR"
- PropertyChanges { target: triangle1; rotation: 270;
- x:window.width - triangle1.width;
- }
- PropertyChanges { target: triangle2; rotation: 180;
- x:window.width - triangle2.width;
- }
- PropertyChanges { target: triangle3; rotation: 90;
- x:window.width - triangle3.width;
- y:triangle2.y + triangle2.height;
- }
- },
- State {
- name: "twistedL"
- PropertyChanges { target: triangle1; rotation: 270;
- x:0;
- }
- PropertyChanges { target: triangle2; rotation: 180;
- x:0;
- }
- PropertyChanges { target: triangle3; rotation: 90;
- x:0;
- y:triangle2.y + triangle2.height;
- }
- },
- State {
- name: "covered"
- PropertyChanges { target: triangle1; rotation: 0;
- x: window.width / 3 - triangle1.width / 2;
- y: window.height - triangle1.height;
- }
- PropertyChanges { target: triangle2; rotation: 0;
- x: window.width / 2 - triangle2.width / 2; // middle
- y: window.height - triangle2.height;
- }
- PropertyChanges { target: triangle3; rotation: 0;
- x: (window.width / 3 + window.width / 3) - triangle3.width / 2;
- y: window.height - triangle3.height;
- }
- },
- State {
- name: "hovered"
- PropertyChanges { target: triangle1; rotation: 90;
- x: window.width / 3 - triangle1.width / 2;
- y: triangle1.height;
- }
- PropertyChanges { target: triangle2; rotation: 270;
- x: window.width / 2 - triangle2.width / 2; // middle
- y: triangle2.height;
- }
- PropertyChanges { target: triangle3; rotation: 195;
- x: (window.width / 3 + window.width / 3) - triangle3.width / 2;
- y: triangle3.height
- }
- },
- State {
- name :"slammed"
- PropertyChanges { target: triangle1; rotation: 0;
- x: 0;
- y: 0 + 30
- }
- PropertyChanges { target: triangle2; rotation: 0;
- x: window.width - triangle2.width;
- y: 0 + 30
- ;}
- PropertyChanges { target: triangle3; rotation: 0;
- x: window.width / 2 - triangle3.width / 2;
- y:window.height - triangle3.height;
- }
- },
- State {
- name: "doubletapped"
- PropertyChanges { target: triangle1; rotation: 114;
- transformOrigin: Item.BottomLeft
- }
- PropertyChanges { target: triangle2; rotation: 120;
- transformOrigin: Item.BottomLeft
- }
- },
- State {
- name: "turnedover"
- PropertyChanges { target: triangle1; rotation: 180;
- }
- PropertyChanges { target: triangle2; rotation: 180;
- }
- PropertyChanges { target: triangle3; rotation: 180;
- }
- },
- State {
- name: "pickedup"
- PropertyChanges { target: triangle1; scale: 1.5;
- }
- PropertyChanges { target: triangle2; scale: 1.5;
- }
- PropertyChanges { target: triangle3; scale: 1.5;
- }
- }
- ]
-
-
- transitions: [
- Transition {
-
- ParallelAnimation {
- NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce;
- duration: 2000; }
- RotationAnimation { id: t1Rotation; target: triangle1; duration: 1000;
- direction: RotationAnimation.Clockwise }
- RotationAnimation { id: t2Rotation; target: triangle2; duration: 2000;
- direction: RotationAnimation.Counterclockwise }
- RotationAnimation { id: t3Rotation; target: triangle3; duration: 2000;
- direction: RotationAnimation.Clockwise }
- }
-
- }, Transition {
- to: "slammed"
- SequentialAnimation {
- NumberAnimation { properties: "x"; easing.type: Easing.OutBounce;duration: 500; }
-
- }
- }, Transition {
- to: "doubletapped"
- SequentialAnimation {
- PropertyAction { target: triangle1; property: "transformOrigin" }
- PropertyAction { target: triangle2; property: "transformOrigin" }
- NumberAnimation { target: triangle1; properties: "rotation";
- easing.type: Easing.OutBounce;duration: 500; }
- NumberAnimation { target: triangle2; properties: "rotation";
- easing.type: Easing.OutBounce;duration: 1500; }
- }
- }, Transition {
- from: "doubletapped"
- SequentialAnimation {
- NumberAnimation { properties: "rotation";
- easing.type: Easing.OutBounce;duration: 1500; }
- PropertyAction { target: triangle1; property: "transformOrigin" }
- PropertyAction { target: triangle2; property: "transformOrigin" }
- }
- }, Transition {
- to: "turnedover"
- SequentialAnimation {
- NumberAnimation { properties: "rotation";
- easing.type: Easing.OutBounce;duration: 750; }
- PropertyAction { target: triangle1; property: "transformOrigin" }
- PropertyAction { target: triangle2; property: "transformOrigin" }
- }
- }, Transition {
- from: "turnedover"
- SequentialAnimation {
- NumberAnimation { properties: "rotation";
- easing.type: Easing.OutBounce;duration: 750; }
- PropertyAction { target: triangle1; property: "transformOrigin" }
- PropertyAction { target: triangle2; property: "transformOrigin" }
- }
- }, Transition {
- to: "pickedup"
- SequentialAnimation {
- NumberAnimation { properties: "scale";
- easing.type: Easing.OutBounce;duration: 750; }
- }
- }, Transition {
- from: "pickedup"
- SequentialAnimation {
- NumberAnimation { properties: "scale";
- easing.type: Easing.OutBounce;duration: 750; }
- }
- }
- ]
-
-//! [1]
- SensorGesture {
-//! [1]
- id: sensorGesture
-//! [3]
- enabled: true
-//! [3]
-//! [2]
- gestures : ["QtSensors.shake", "QtSensors.whip", "QtSensors.twist", "QtSensors.cover",
- "QtSensors.hover", "QtSensors.turnover", "QtSensors.pickup", "QtSensors.slam",
- "QtSensors.doubletap"]
-//! [2]
-//! [4]
- onDetected:{
- console.debug(gesture)
-
- label.text = gesture
-
- if (gesture == "shake") {
- window.state == "rotated" ? window.state = "default" : window.state = "rotated"
- timer.start()
- }
- if (gesture == "whip") {
- window.state == "whipped" ? window.state = "default" : window.state = "whipped"
- timer.start()
- }
- if (gesture == "twistRight") {
- window.state == "twistedR" ? window.state = "default" : window.state = "twistedR"
- timer.start()
- }
- if (gesture == "twistLeft") {
- window.state == "twistedL" ? window.state = "default" : window.state = "twistedL"
- timer.start()
- }
- if (gesture == "cover") {
- window.state == "covered" ? window.state = "default" : window.state = "covered"
- timer.start()
- }
- if (gesture == "hover") {
- window.state == "hovered" ? window.state = "default" : window.state = "hovered"
- timer.start()
- }
- if (gesture == "turnover") {
- window.state == "turnedover" ? window.state = "default" : window.state = "hovered"
- timer.start()
- }
- if (gesture == "pickup") {
- window.state == "pickedup" ? window.state = "default" : window.state = "pickedup"
- timer.start()
- }
- if (gesture == "slam") {
- window.state == "slammed" ? window.state = "default" : window.state = "slammed"
- timer.start()
- }
- if (gesture == "doubletap") {
- window.state == "doubletapped" ? window.state = "default" : window.state = "doubletapped"
- timer.start()
- }
- }
-//! [4]
- }
- Timer {
- id: timer
- running: false
- repeat: false
- interval: 3000
- onTriggered: {
- console.log("timer triggered")
- window.state = "default"
- label.text = "Try another gesture"
- }
- }
-}
diff --git a/examples/sensors/shakeit/shakeit.qrc b/examples/sensors/shakeit/shakeit.qrc
deleted file mode 100644
index 1a2c75d8..00000000
--- a/examples/sensors/shakeit/shakeit.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>shakeit.qml</file>
- <file>audio/loopy2a_mono.wav</file>
- <file>audio/phone.wav</file>
- <file>content/triangle.png</file>
- <file>content/triangle2.png</file>
- <file>content/triangle3.png</file>
- </qresource>
-</RCC>