├── qtfeedback.pro ├── src ├── imports │ ├── feedback │ │ ├── plugin.json │ │ ├── qmldir │ │ ├── feedback.pro │ │ ├── qdeclarativefileeffect_p.h │ │ ├── plugin.cpp │ │ ├── qdeclarativefeedbackactuator_p.h │ │ ├── qdeclarativethemeeffect_p.h │ │ ├── qdeclarativefileeffect.cpp │ │ ├── qdeclarativefeedbackeffect_p.h │ │ ├── qdeclarativehapticseffect_p.h │ │ ├── qdeclarativethemeeffect.cpp │ │ ├── plugins.qmltypes │ │ └── qdeclarativefeedbackactuator.cpp │ └── imports.pro ├── plugins │ ├── plugins.pro │ └── feedback │ │ ├── mmk │ │ ├── mmk.json │ │ ├── mmk.pro │ │ └── qfeedback.h │ │ ├── meegotouch │ │ ├── meegotouch.json │ │ ├── meegotouch.pro │ │ ├── qfeedback.h │ │ └── qfeedback.cpp │ │ ├── immersion │ │ ├── immersion.json │ │ ├── immersion.pro │ │ └── qfeedback.h │ │ └── feedback.pro ├── src.pro └── feedback │ ├── feedback.pro │ ├── qfeedbackglobal.h │ ├── qfeedbackplugin_p.h │ ├── qfeedbackactuator.h │ ├── qfeedbackeffect_p.h │ ├── qfeedbackpluginsearch.h │ ├── qfeedbackplugininterfaces.h │ └── qfeedbackeffect.h ├── .tag ├── tests ├── tests.pro └── auto │ ├── auto.pri │ ├── qfeedbackmmk │ ├── test.wav │ └── qfeedbackmmk.pro │ ├── cmake │ ├── cmake.pro │ ├── CMakeLists.txt │ └── test_modules │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── qfeedbackplugin │ ├── qfeedbackplugin.pro │ ├── unittest │ │ ├── unittest.pro │ │ └── tst_qfeedbackplugin.cpp │ ├── testplugin │ │ ├── testplugin.pro │ │ ├── qfeedbacktestplugin.h │ │ └── qfeedbacktestplugin.cpp │ ├── testplugin2 │ │ ├── testplugin2.pro │ │ ├── qfeedbacktestplugin.cpp │ │ └── qfeedbacktestplugin.h │ └── testplugin3 │ │ ├── testplugin3.pro │ │ ├── qfeedbacktestplugin.cpp │ │ └── qfeedbacktestplugin.h │ ├── qfeedbackhapticseffect │ └── qfeedbackhapticseffect.pro │ ├── qfeedbackactuator │ ├── qfeedbackactuator.pro │ └── tst_qfeedbackactuator.cpp │ ├── auto.pro │ └── qdeclarativefeedback │ ├── qdeclarativefeedback.pro │ └── data │ ├── actuator.qml │ ├── themeeffect.qml │ ├── themeeffect2.qml │ ├── fileeffect.qml │ ├── themeeffect3.qml │ └── hapticseffect.qml ├── .qmake.conf ├── doc ├── src │ ├── images │ │ ├── periodic-effect.png │ │ ├── non-periodic-effect.png │ │ └── hapticsquare-example.png │ ├── snippets │ │ ├── qtfeedbackdocsample │ │ │ ├── qtfeedbackdocsample.pro │ │ │ └── qtfeedbackdocsample.cpp │ │ └── declarative │ │ │ └── declarative-feedback.qml │ ├── plugins │ │ └── qml-feedback.qdoc │ ├── legal │ │ ├── editions.qdoc │ │ ├── gpl.qdoc │ │ ├── trademarks.qdoc │ │ └── opensourceedition.qdoc │ └── examples │ │ └── hapticsplayer.qdoc ├── qt-defines.qdocconf ├── qt5-dita.qdocconf ├── compat.qdocconf ├── macros.qdocconf ├── style │ └── style.css ├── qtfeedback.qdocconf └── qt-cpp-ignore.qdocconf ├── examples ├── examples.pri ├── examples.pro ├── hapticsplayer │ ├── hapticsplayer.pro │ ├── main.cpp │ └── hapticsplayer.h └── hapticsquare │ ├── hapticsquare.pro │ ├── main.cpp │ ├── hapticbutton.h │ ├── hapticbutton.cpp │ ├── hapticsquare.h │ └── hapticsquare.cpp ├── sync.profile └── LGPL_EXCEPTION.txt /qtfeedback.pro: -------------------------------------------------------------------------------- 1 | load(qt_parts) 2 | -------------------------------------------------------------------------------- /src/imports/feedback/plugin.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.tag: -------------------------------------------------------------------------------- 1 | a14bd0bb1373cde86e09e3619fb9dc70f34c71f2 2 | -------------------------------------------------------------------------------- /tests/tests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += auto 3 | -------------------------------------------------------------------------------- /.qmake.conf: -------------------------------------------------------------------------------- 1 | load(qt_build_config) 2 | 3 | MODULE_VERSION = 0.0.0 4 | -------------------------------------------------------------------------------- /src/imports/imports.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += feedback 3 | -------------------------------------------------------------------------------- /src/plugins/plugins.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += feedback 3 | -------------------------------------------------------------------------------- /src/plugins/feedback/mmk/mmk.json: -------------------------------------------------------------------------------- 1 | { "Interfaces": [ "QFeedbackFileInterface" ] } 2 | -------------------------------------------------------------------------------- /src/src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | CONFIG += ordered 3 | SUBDIRS = feedback plugins imports 4 | -------------------------------------------------------------------------------- /src/plugins/feedback/meegotouch/meegotouch.json: -------------------------------------------------------------------------------- 1 | { "Interfaces": [ "QFeedbackThemeInterface" ] } 2 | -------------------------------------------------------------------------------- /tests/auto/auto.pri: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | CONFIG += console testcase 3 | 4 | qtAddLibrary(QtTest) 5 | -------------------------------------------------------------------------------- /src/imports/feedback/qmldir: -------------------------------------------------------------------------------- 1 | module QtFeedback 2 | plugin declarative_feedback 3 | typeinfo plugins.qmltypes 4 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackmmk/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtfeedback/master/tests/auto/qfeedbackmmk/test.wav -------------------------------------------------------------------------------- /doc/src/images/periodic-effect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtfeedback/master/doc/src/images/periodic-effect.png -------------------------------------------------------------------------------- /tests/auto/cmake/cmake.pro: -------------------------------------------------------------------------------- 1 | 2 | # Cause make to do nothing. 3 | TEMPLATE = subdirs 4 | 5 | CONFIG += ctest_testcase 6 | -------------------------------------------------------------------------------- /doc/src/images/non-periodic-effect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtfeedback/master/doc/src/images/non-periodic-effect.png -------------------------------------------------------------------------------- /src/plugins/feedback/immersion/immersion.json: -------------------------------------------------------------------------------- 1 | { "Interfaces": [ "QFeedbackHapticsInterface", "QFeedbackFileInterface" ] } 2 | -------------------------------------------------------------------------------- /doc/src/images/hapticsquare-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt/qtfeedback/master/doc/src/images/hapticsquare-example.png -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/qfeedbackplugin.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += testplugin \ 3 | # unittest \ 4 | testplugin2 \ 5 | testplugin3 6 | -------------------------------------------------------------------------------- /examples/examples.pri: -------------------------------------------------------------------------------- 1 | !plugin { 2 | target.path=$$QT_MOBILITY_EXAMPLES 3 | } else { 4 | target.path = $${QT_MOBILITY_PLUGINS}/$${PLUGIN_TYPE} 5 | } 6 | 7 | INSTALLS += target 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/plugins/feedback/mmk/mmk.pro: -------------------------------------------------------------------------------- 1 | TARGET = qtfeedback_mmk 2 | QT = core feedback multimedia 3 | 4 | PLUGIN_TYPE = feedback 5 | load(qt_plugin) 6 | 7 | HEADERS += qfeedback.h 8 | SOURCES += qfeedback.cpp 9 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackhapticseffect/qfeedbackhapticseffect.pro: -------------------------------------------------------------------------------- 1 | include(../auto.pri) 2 | 3 | QT += feedback 4 | 5 | SOURCES += tst_qfeedbackhapticseffect.cpp 6 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 7 | -------------------------------------------------------------------------------- /examples/examples.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | # Feedback API examples 4 | contains(mobility_modules, feedback) { 5 | SUBDIRS += hapticsplayer hapticsquare # this not a good UI for mobile screens at the moment 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackactuator/qfeedbackactuator.pro: -------------------------------------------------------------------------------- 1 | include(../auto.pri) 2 | 3 | QT += feedback 4 | 5 | SOURCES += tst_qfeedbackactuator.cpp 6 | 7 | linux-g++-maemo:DEFINES += HAVE_ACTUATORS 8 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 9 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/unittest/unittest.pro: -------------------------------------------------------------------------------- 1 | include(../../auto.pri) 2 | 3 | QT += feedback 4 | 5 | SOURCES += tst_qfeedbackplugin.cpp 6 | 7 | linux-g++-maemo:DEFINES += HAVE_ACTUATORS 8 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 9 | -------------------------------------------------------------------------------- /src/plugins/feedback/immersion/immersion.pro: -------------------------------------------------------------------------------- 1 | TARGET = qtfeedback_immersion 2 | QT = core feedback 3 | 4 | PLUGIN_TYPE = feedback 5 | load(qt_plugin) 6 | 7 | HEADERS += qfeedback.h 8 | SOURCES += qfeedback.cpp 9 | 10 | LIBS += -limmvibe 11 | -------------------------------------------------------------------------------- /src/plugins/feedback/meegotouch/meegotouch.pro: -------------------------------------------------------------------------------- 1 | TARGET = qtfeedback_meegotouch 2 | QT = core feedback 3 | 4 | PLUGIN_TYPE = feedback 5 | load(qt_plugin) 6 | 7 | HEADERS += qfeedback.h 8 | SOURCES += qfeedback.cpp 9 | 10 | LIBS += -lmeegotouchcore 11 | -------------------------------------------------------------------------------- /tests/auto/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | project(qmake_cmake_files) 5 | 6 | enable_testing() 7 | 8 | find_package(Qt5Core REQUIRED) 9 | 10 | include("${_Qt5CTestMacros}") 11 | 12 | expect_pass(test_modules) 13 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin/testplugin.pro: -------------------------------------------------------------------------------- 1 | TARGET = qtfeedback_testplugin 2 | QT = core feedback 3 | 4 | PLUGIN_TYPE = feedback 5 | load(qt_plugin) 6 | 7 | HEADERS += qfeedbacktestplugin.h 8 | SOURCES += qfeedbacktestplugin.cpp 9 | 10 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 11 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin2/testplugin2.pro: -------------------------------------------------------------------------------- 1 | TARGET = qtfeedback_testplugin2 2 | QT = core feedback 3 | 4 | PLUGIN_TYPE = feedback 5 | load(qt_plugin) 6 | 7 | CONFIG += testplugin 8 | 9 | HEADERS += qfeedbacktestplugin.h 10 | SOURCES += qfeedbacktestplugin.cpp 11 | 12 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 13 | -------------------------------------------------------------------------------- /tests/auto/auto.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | SUBDIRS += \ 3 | qfeedbackactuator \ 4 | qfeedbackhapticseffect \ 5 | qfeedbackplugin \ 6 | qfeedbackmmk \ 7 | qdeclarativefeedback \ 8 | cmake 9 | 10 | !qtHaveModule(qml): SUBDIRS -= \ 11 | qdeclarativefeedback \ 12 | 13 | !qtHaveModule(multimedia): SUBDIRS -= \ 14 | qfeedbackmmk \ 15 | 16 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin3/testplugin3.pro: -------------------------------------------------------------------------------- 1 | TARGET = qtfeedback_testplugin3 2 | QT = core feedback 3 | 4 | PLUGIN_TYPE = feedback 5 | load(qt_plugin) 6 | 7 | INCLUDEPATH += $$QT.feedback.includes 8 | 9 | CONFIG += testplugin 10 | 11 | HEADERS += qfeedbacktestplugin.h 12 | SOURCES += qfeedbacktestplugin.cpp 13 | 14 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 15 | -------------------------------------------------------------------------------- /tests/auto/qdeclarativefeedback/qdeclarativefeedback.pro: -------------------------------------------------------------------------------- 1 | include(../auto.pri) 2 | 3 | QT += qml feedback network 4 | 5 | SOURCES += tst_qdeclarativefeedback.cpp 6 | 7 | DEFINES += SRCDIR=\\\"$$PWD\\\" 8 | 9 | OTHER_FILES += \ 10 | data/hapticseffect.qml \ 11 | data/fileeffect.qml \ 12 | data/actuator.qml \ 13 | data/themeeffect.qml \ 14 | data/themeeffect2.qml \ 15 | data/themeeffect3.qml 16 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 17 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackmmk/qfeedbackmmk.pro: -------------------------------------------------------------------------------- 1 | include(../auto.pri) 2 | 3 | QT += feedback 4 | 5 | SOURCES += tst_qfeedbackmmk.cpp 6 | 7 | maemo* { 8 | DEFINES += QT_QFEEDBACKMMK_USEAPPLICATIONPATH 9 | } else { 10 | DEFINES += SRCDIR=\\\"$$PWD/\\\" 11 | } 12 | 13 | linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test # QTBUG-25448 14 | win32: CONFIG += insignificant_test # QTBUG-25448 15 | DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 16 | -------------------------------------------------------------------------------- /src/plugins/feedback/feedback.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | contains(immersion_enabled, yes) { 4 | message("Building with Immersion TouchSense support") 5 | SUBDIRS += immersion 6 | } 7 | 8 | contains(meegotouchfeedback_enabled, yes) { 9 | message("Building with meegotouch theme haptics support") 10 | SUBDIRS += meegotouch 11 | } 12 | 13 | qtHaveModule(multimedia):!contains(multimedia_disabled, yes) { 14 | message("Building with multimedia support") 15 | SUBDIRS += mmk 16 | } 17 | -------------------------------------------------------------------------------- /tests/auto/cmake/test_modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | project(test_modules) 5 | 6 | find_package(Qt5Core REQUIRED) 7 | 8 | find_package(Qt5Feedback REQUIRED) 9 | 10 | include_directories( 11 | ${Qt5Feedback_INCLUDE_DIRS} 12 | ) 13 | 14 | add_definitions( 15 | ${Qt5Feedback_DEFINITIONS} 16 | ) 17 | 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") 19 | 20 | add_executable(mainapp main.cpp) 21 | target_link_libraries(mainapp 22 | ${Qt5Feedback_LIBRARIES} 23 | ) 24 | -------------------------------------------------------------------------------- /examples/hapticsplayer/hapticsplayer.pro: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/src/feedback 2 | 3 | # 4 | # mobility.prf should do this (since it's platform and release/debug dependent, 5 | # it can't just be -lQtFeedback (might QtFeedback1, QtFeedbackd, QtFeedback1d etc) 6 | # 7 | # if it isn't doing it, mobility.prf is probably not in the right place 8 | # 9 | # LIBS += -lQtFeedback 10 | 11 | HEADERS += hapticsplayer.h 12 | SOURCES += hapticsplayer.cpp main.cpp 13 | FORMS += hapticsplayer.ui 14 | 15 | CONFIG = feedback 16 | 17 | include(../examples.pri) 18 | -------------------------------------------------------------------------------- /doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # Simple example of how to use the feedback API 4 | # 5 | ###################################################################### 6 | 7 | TEMPLATE = lib 8 | TARGET = qtfeedbackdocsample 9 | include(../../../../features/basic_examples_setup.pri) 10 | INCLUDEPATH += ../../../../src/global \ 11 | ../../../../src/feedback 12 | 13 | CONFIG += mobility 14 | MOBILITY = feedback 15 | 16 | SOURCES += qtfeedbackdocsample.cpp 17 | -------------------------------------------------------------------------------- /examples/hapticsquare/hapticsquare.pro: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/src/feedback 2 | 3 | # 4 | # mobility.prf should do this (since it's platform and release/debug dependent, 5 | # it can't just be -lQtFeedback (might QtFeedback1, QtFeedbackd, QtFeedback1d etc) 6 | # 7 | # if it isn't doing it, mobility.prf is probably not in the right place 8 | # 9 | # LIBS += -lQtFeedback 10 | 11 | HEADERS += hapticsquare.h \ 12 | hapticbutton.h 13 | SOURCES += hapticsquare.cpp main.cpp \ 14 | hapticbutton.cpp 15 | 16 | CONFIG = feedback 17 | 18 | include(../examples.pri) 19 | -------------------------------------------------------------------------------- /src/imports/feedback/feedback.pro: -------------------------------------------------------------------------------- 1 | QT = core qml feedback 2 | 3 | HEADERS += qdeclarativehapticseffect_p.h \ 4 | qdeclarativefileeffect_p.h \ 5 | qdeclarativethemeeffect_p.h \ 6 | qdeclarativefeedbackactuator_p.h \ 7 | qdeclarativefeedbackeffect_p.h 8 | 9 | SOURCES += qdeclarativehapticseffect.cpp \ 10 | qdeclarativefileeffect.cpp \ 11 | plugin.cpp \ 12 | qdeclarativethemeeffect.cpp \ 13 | qdeclarativefeedbackactuator.cpp \ 14 | qdeclarativefeedbackeffect.cpp 15 | 16 | load(qml_plugin) 17 | -------------------------------------------------------------------------------- /src/feedback/feedback.pro: -------------------------------------------------------------------------------- 1 | TARGET = QtFeedback 2 | QT = core 3 | 4 | QMAKE_DOCS = $$PWD/../../doc/qtfeedback.qdocconf 5 | 6 | MODULE_PLUGIN_TYPES = \ 7 | feedback 8 | 9 | load(qt_module) 10 | 11 | PUBLIC_HEADERS += qfeedbackglobal.h \ 12 | qfeedbackactuator.h \ 13 | qfeedbackeffect.h \ 14 | qfeedbackplugininterfaces.h \ 15 | qfeedbackpluginsearch.h 16 | 17 | PRIVATE_HEADERS += qfeedbackeffect_p.h \ 18 | qfeedbackplugin_p.h 19 | 20 | HEADERS = $$PUBLIC_HEADERS $$PRIVATE_HEADERS 21 | 22 | SOURCES += qfeedbackactuator.cpp \ 23 | qfeedbackeffect.cpp \ 24 | qfeedbackplugin.cpp 25 | -------------------------------------------------------------------------------- /sync.profile: -------------------------------------------------------------------------------- 1 | %modules = ( # path to module name map 2 | "QtFeedback" => "$basedir/src/feedback", 3 | ); 4 | %moduleheaders = ( # restrict the module headers to those found in relative path 5 | ); 6 | # Module dependencies. 7 | # Every module that is required to build this module should have one entry. 8 | # Each of the module version specifiers can take one of the following values: 9 | # - A specific Git revision. 10 | # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) 11 | # 12 | %dependencies = ( 13 | "qtbase" => "", 14 | "qtxmlpatterns" => "", 15 | "qtdeclarative" => "", 16 | "qtmultimedia" => "", 17 | ); 18 | -------------------------------------------------------------------------------- /doc/qt-defines.qdocconf: -------------------------------------------------------------------------------- 1 | defines = Q_QDOC \ 2 | QT_.*_SUPPORT \ 3 | QT_.*_LIB \ 4 | QT_COMPAT \ 5 | QT_KEYPAD_NAVIGATION \ 6 | QT_NO_EGL \ 7 | QT3_SUPPORT \ 8 | Q_WS_.* \ 9 | Q_OS_.* \ 10 | Q_BYTE_ORDER \ 11 | QT_DEPRECATED \ 12 | Q_NO_USING_KEYWORD \ 13 | __cplusplus \ 14 | Q_COMPILER_INITIALIZER_LISTS 15 | 16 | versionsym = QT_VERSION_STR 17 | 18 | codeindent = 1 19 | -------------------------------------------------------------------------------- /doc/qt5-dita.qdocconf: -------------------------------------------------------------------------------- 1 | # Name of the project. 2 | project = projectname 3 | 4 | include(macros.qdocconf) 5 | include(compat.qdocconf) 6 | include(qt-cpp-ignore.qdocconf) 7 | include(qt-defines.qdocconf) 8 | 9 | # Directories in which to search for files to document and images. 10 | # By default set to the root directory of the project for sources 11 | # and headers and qdoc will therefore generate output for each file. 12 | # Images should be placed in /dic/images and examples in 13 | # /examples. 14 | # Paths are relative to the location of this file. 15 | exampledirs += . 16 | headerdirs += .. 17 | sourcedirs += .. 18 | imagedirs += images 19 | 20 | 21 | #Do not change the variables after this line unless you know what you are doing. 22 | 23 | outputdir = ditaxml 24 | outputformats = DITAXML 25 | 26 | sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" 27 | headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" 28 | -------------------------------------------------------------------------------- /LGPL_EXCEPTION.txt: -------------------------------------------------------------------------------- 1 | The Qt Company Qt LGPL Exception version 1.1 2 | 3 | As an additional permission to the GNU Lesser General Public License version 4 | 2.1, the object code form of a "work that uses the Library" may incorporate 5 | material from a header file that is part of the Library. You may distribute 6 | such object code under terms of your choice, provided that: 7 | (i) the header files of the Library have not been modified; and 8 | (ii) the incorporated material is limited to numerical parameters, data 9 | structure layouts, accessors, macros, inline functions and 10 | templates; and 11 | (iii) you comply with the terms of Section 6 of the GNU Lesser General 12 | Public License version 2.1. 13 | 14 | Moreover, you may apply this exception to a modified version of the Library, 15 | provided that such modification does not involve copying material from the 16 | Library into the modified Library's header files unless such material is 17 | limited to (i) numerical parameters; (ii) data structure layouts; 18 | (iii) accessors; and (iv) small macros, templates and inline functions of 19 | five lines or less in length. 20 | 21 | Furthermore, you are not required to apply this additional permission to a 22 | modified version of the Library. 23 | -------------------------------------------------------------------------------- /doc/compat.qdocconf: -------------------------------------------------------------------------------- 1 | alias.i = e 2 | alias.include = input 3 | 4 | macro.0 = "\\\\0" 5 | macro.b = "\\\\b" 6 | macro.n = "\\\\n" 7 | macro.r = "\\\\r" 8 | macro.i = "\\li" 9 | macro.i11 = "\\li{1,1}" 10 | macro.i12 = "\\li{1,2}" 11 | macro.i13 = "\\li{1,3}" 12 | macro.i14 = "\\li{1,4}" 13 | macro.i15 = "\\li{1,5}" 14 | macro.i16 = "\\li{1,6}" 15 | macro.i17 = "\\li{1,7}" 16 | macro.i18 = "\\li{1,8}" 17 | macro.i19 = "\\li{1,9}" 18 | macro.i21 = "\\li{2,1}" 19 | macro.i31 = "\\li{3,1}" 20 | macro.i41 = "\\li{4,1}" 21 | macro.i51 = "\\li{5,1}" 22 | macro.i61 = "\\li{6,1}" 23 | macro.i71 = "\\li{7,1}" 24 | macro.i81 = "\\li{8,1}" 25 | macro.i91 = "\\li{9,1}" 26 | macro.img = "\\image" 27 | macro.endquote = "\\endquotation" 28 | macro.relatesto = "\\relates" 29 | 30 | spurious = "Missing comma in .*" \ 31 | "Missing pattern .*" 32 | -------------------------------------------------------------------------------- /tests/auto/qdeclarativefeedback/data/actuator.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | import QtFeedback 5.0 30 | 31 | Actuator { 32 | enabled: false 33 | } 34 | -------------------------------------------------------------------------------- /tests/auto/qdeclarativefeedback/data/themeeffect.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | import QtFeedback 5.0 30 | 31 | ThemeEffect { 32 | effect: ThemeEffect.Press; 33 | } 34 | -------------------------------------------------------------------------------- /tests/auto/qdeclarativefeedback/data/themeeffect2.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | import QtFeedback 5.0 30 | 31 | // Test string enum 32 | ThemeEffect {effect: "Press"} 33 | -------------------------------------------------------------------------------- /tests/auto/qdeclarativefeedback/data/fileeffect.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | import QtFeedback 5.0 30 | 31 | FileEffect { 32 | loaded: false 33 | source: "qrc:nonexistingfile.haptic" 34 | } 35 | -------------------------------------------------------------------------------- /tests/auto/qdeclarativefeedback/data/themeeffect3.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | import QtQuick 2.0 30 | import QtFeedback 5.0 31 | 32 | // Test default method 33 | Item { 34 | Component.onCompleted: ThemeEffect {effect: "Press"} 35 | } 36 | -------------------------------------------------------------------------------- /tests/auto/qdeclarativefeedback/data/hapticseffect.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | import QtFeedback 5.0 30 | 31 | HapticsEffect { 32 | id: rumbleEffect 33 | attackIntensity: 0.0 34 | attackTime: 250 35 | intensity: 1.0 36 | duration: 100 37 | fadeTime: 250 38 | fadeIntensity: 0.0 39 | actuator: Actuator {} 40 | } 41 | -------------------------------------------------------------------------------- /tests/auto/cmake/test_modules/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly 4 | ** Copyright (C) 2016 The Qt Company Ltd. 5 | ** Contact: https://www.qt.io/licensing/ 6 | ** 7 | ** This file is part of the QtFeedback module of the Qt Toolkit. 8 | ** 9 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 10 | ** Commercial License Usage 11 | ** Licensees holding valid commercial Qt licenses may use this file in 12 | ** accordance with the commercial license agreement provided with the 13 | ** Software or, alternatively, in accordance with the terms contained in 14 | ** a written agreement between you and The Qt Company. For licensing terms 15 | ** and conditions see https://www.qt.io/terms-conditions. For further 16 | ** information use the contact form at https://www.qt.io/contact-us. 17 | ** 18 | ** GNU General Public License Usage 19 | ** Alternatively, this file may be used under the terms of the GNU 20 | ** General Public License version 3 as published by the Free Software 21 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 22 | ** included in the packaging of this file. Please review the following 23 | ** information to ensure the GNU General Public License requirements will 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25 | ** 26 | ** $QT_END_LICENSE$ 27 | ** 28 | ****************************************************************************/ 29 | 30 | #include 31 | 32 | int main(int argc, char **argv) 33 | { 34 | QFeedbackHapticsEffect feedbackHapticsEffect; 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /doc/macros.qdocconf: -------------------------------------------------------------------------------- 1 | macro.aacute.HTML = "á" 2 | macro.Aring.HTML = "Å" 3 | macro.aring.HTML = "å" 4 | macro.Auml.HTML = "Ä" 5 | macro.author = "\\b{Author:}" 6 | macro.br.HTML = "
" 7 | macro.BR.HTML = "
" 8 | macro.copyright.HTML = "©" 9 | macro.eacute.HTML = "é" 10 | macro.gui = "\\b" 11 | macro.hr.HTML = "
" 12 | macro.iacute.HTML = "í" 13 | macro.key = "\\b" 14 | macro.menu = "\\b" 15 | macro.note = "\\b{Note:}" 16 | macro.oslash.HTML = "ø" 17 | macro.ouml.HTML = "ö" 18 | macro.QA = "Qt Assistant" 19 | macro.QC = "Creator" 20 | macro.QD = "Qt Designer" 21 | macro.QL = "Qt Linguist" 22 | macro.QMLD = "Qt Quick Designer" 23 | macro.QQV = "Qt QML Viewer" 24 | macro.QSDK = "Qt SDK" 25 | #macro.qtcversion = $QTC_VERSION 26 | macro.qtcversion = "0.0" 27 | macro.param = "\\e" 28 | macro.raisedaster.HTML = "*" 29 | macro.rarrow.HTML = "→" 30 | macro.reg.HTML = "®" 31 | macro.return = "Returns" 32 | macro.starslash = "\\c{*/}" 33 | macro.begincomment = "\\c{/*}" 34 | macro.endcomment = "\\c{*/}" 35 | macro.uuml.HTML = "ü" 36 | macro.mdash.HTML = "—" 37 | macro.pi.HTML = "Π" 38 | 39 | macro.beginfloatleft.HTML = "
" 40 | macro.beginfloatright.HTML = "
" 41 | macro.endfloat.HTML = "
" 42 | macro.clearfloat.HTML = "
" 43 | macro.emptyspan.HTML = "" 44 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin2/qfeedbacktestplugin.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include 30 | #include "qfeedbacktestplugin.h" 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | QFeedbackTestPlugin::QFeedbackTestPlugin() 40 | : QObject(qApp) 41 | { 42 | } 43 | 44 | QFeedbackTestPlugin::~QFeedbackTestPlugin() 45 | { 46 | } 47 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin3/qfeedbacktestplugin.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include 30 | #include "qfeedbacktestplugin.h" 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | QFeedbackTestPlugin::QFeedbackTestPlugin() 40 | : QObject(qApp) 41 | { 42 | } 43 | 44 | QFeedbackTestPlugin::~QFeedbackTestPlugin() 45 | { 46 | } 47 | -------------------------------------------------------------------------------- /doc/src/plugins/qml-feedback.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \group qml-feedback 30 | \title QML Feedback API 31 | Plugin for QML Support for the Qt Feedback API. 32 | 33 | */ 34 | 35 | 36 | /*! 37 | \page qml-feedback-api.html 38 | 39 | \title Qt Feedback QML Types 40 | 41 | \brief A QML plugin for the QtFeedback API. 42 | 43 | 44 | 45 | \section1 Overview 46 | 47 | The QML Feedback API allows application developers to implement various types of feedback (usually vibration) to their QML applications. 48 | Use this with the QML \e {QtFeedback import} statement. 49 | 50 | 51 | 52 | \section1 Feedback elements 53 | 54 | \annotatedlist qml-feedback-api 55 | 56 | */ 57 | 58 | 59 | -------------------------------------------------------------------------------- /doc/src/legal/editions.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \page editions.html 30 | \title Qt Editions 31 | \ingroup licensing 32 | \brief Information about the different editions of Qt. 33 | 34 | Qt can be used to create both commercial and non-commercial 35 | software for a wide range of different deployment environments, 36 | and is supplied in a number of different forms to suit the needs 37 | of different kinds of developers. 38 | 39 | In terms of license conditions, there are two main forms of Qt: 40 | 41 | \list 42 | \li The \l{Qt Commercial Edition} are the commercial 43 | versions of \l{About Qt}{Qt}. 44 | \li The \l{Open Source Versions of Qt} are freely available for download. 45 | \endlist 46 | 47 | On the Qt web site, you can find a 48 | \l{Qt Licensing Overview} and information on \l{Qt License Pricing} 49 | for commercial editions of Qt and other Qt-related products. 50 | */ 51 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin3/qfeedbacktestplugin.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QFEEDBACKTESTPLUGIN_H 30 | #define QFEEDBACKTESTPLUGIN_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | QT_BEGIN_HEADER 43 | QT_USE_NAMESPACE 44 | 45 | class QFeedbackTestPlugin : public QObject, public QFeedbackThemeInterface 46 | { 47 | Q_OBJECT 48 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackTestPlugin3") 49 | Q_INTERFACES(QFeedbackThemeInterface) 50 | public: 51 | QFeedbackTestPlugin(); 52 | virtual ~QFeedbackTestPlugin(); 53 | 54 | virtual PluginPriority pluginPriority() {return QFeedbackInterface::PluginLowPriority;} 55 | virtual bool play(QFeedbackEffect::Effect) {return false;} 56 | }; 57 | 58 | QT_END_HEADER 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin2/qfeedbacktestplugin.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QFEEDBACKTESTPLUGIN_H 30 | #define QFEEDBACKTESTPLUGIN_H 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | 42 | QT_BEGIN_HEADER 43 | QT_USE_NAMESPACE 44 | 45 | class QFeedbackTestPlugin : public QObject, public QFeedbackThemeInterface 46 | { 47 | Q_OBJECT 48 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackTestPlugin2") 49 | Q_INTERFACES(QFeedbackThemeInterface) 50 | public: 51 | QFeedbackTestPlugin(); 52 | virtual ~QFeedbackTestPlugin(); 53 | 54 | virtual PluginPriority pluginPriority() {return QFeedbackInterface::PluginNormalPriority;} 55 | virtual bool play(QFeedbackEffect::Effect) {return false;} 56 | }; 57 | 58 | 59 | QT_END_HEADER 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/feedback/qfeedbackglobal.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QFEEDBACKGLOBAL_H 41 | #define QFEEDBACKGLOBAL_H 42 | 43 | #include 44 | 45 | #ifndef QT_STATIC 46 | # if defined(QT_BUILD_FEEDBACK_LIB) 47 | # define Q_FEEDBACK_EXPORT Q_DECL_EXPORT 48 | # else 49 | # define Q_FEEDBACK_EXPORT Q_DECL_IMPORT 50 | # endif 51 | #else 52 | # define Q_FEEDBACK_EXPORT 53 | #endif 54 | 55 | #endif // QFEEDBACKGLOBAL_H 56 | 57 | -------------------------------------------------------------------------------- /doc/src/legal/gpl.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! \page lgpl.html 29 | \title GNU Lesser General Public License (LGPL) 30 | \ingroup licensing 31 | \brief About the LGPL license used for Qt. 32 | 33 | The Qt GUI Toolkit is Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).\br 34 | Contact: http://www.qt-project.org/legal 35 | 36 | Qt is available under the LGPL. 37 | 38 | \section1 The GNU Lesser General Public License (Version 2.1) 39 | 40 | Reference: \l{GNU Lesser General Public License, version 2.1} 41 | 42 | \snippet doc/src/snippets/code/doc_src_lgpl.qdoc LGPL v2.1 43 | 44 | \section1 Nokia Qt LGPL Exception version 1.0 45 | 46 | As a special exception to the GNU Lesser General Public License version 2.1, 47 | the object code form of a "work that uses the Library" may incorporate material 48 | from a header file that is part of the Library. You may distribute such object 49 | code under terms of your choice, provided that the incorporated material 50 | (i) does not exceed more than 5% of the total size of the Library; and 51 | (ii) is limited to numerical parameters, data structure layouts, accessors, 52 | macros, inline functions and templates. 53 | */ 54 | -------------------------------------------------------------------------------- /src/plugins/feedback/meegotouch/qfeedback.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QFEEDBACK_MEEGOTOUCH_H 41 | #define QFEEDBACK_MEEGOTOUCH_H 42 | 43 | #include 44 | #include 45 | 46 | QT_BEGIN_HEADER 47 | 48 | class QFeedbackMeegoTouch : public QObject, public QFeedbackThemeInterface { 49 | Q_OBJECT 50 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackPlugin" FILE "meegotouch.json") 51 | Q_INTERFACES(QFeedbackThemeInterface) 52 | public: 53 | QFeedbackMeegoTouch(QObject *parent = 0); 54 | 55 | virtual bool play(QFeedbackEffect::Effect); 56 | virtual QFeedbackInterface::PluginPriority pluginPriority(); 57 | }; 58 | 59 | QT_END_HEADER 60 | 61 | #endif // QFEEDBACK_MEEGOTOUCH_H 62 | -------------------------------------------------------------------------------- /examples/hapticsquare/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include 52 | #include "hapticsquare.h" 53 | 54 | int main(int argc, char *argv[]) 55 | { 56 | QApplication a(argc, argv); 57 | a.addLibraryPath("../../plugins"); // allows the plugins to be loaded 58 | HapticSquare w; 59 | w.show(); 60 | 61 | return a.exec(); 62 | } 63 | -------------------------------------------------------------------------------- /examples/hapticsplayer/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include 52 | #include "hapticsplayer.h" 53 | 54 | int main(int argc, char *argv[]) 55 | { 56 | QApplication a(argc, argv); 57 | a.addLibraryPath("../../plugins"); //allows the plugins to be loaded 58 | 59 | HapticsPlayer w; 60 | 61 | w.show(); 62 | 63 | 64 | return a.exec(); 65 | } 66 | -------------------------------------------------------------------------------- /doc/style/style.css: -------------------------------------------------------------------------------- 1 | a:link, a:visited { 2 | color: #00732F; 3 | text-decoration: none; 4 | font-weight: bold; 5 | } 6 | 7 | body { 8 | font: normal 400 14px/1.2 Arial; 9 | margin-top: 85px; 10 | } 11 | 12 | h1 { 13 | margin: 0; 14 | } 15 | 16 | h2 { 17 | font: 500 20px/1.2 Arial; 18 | } 19 | 20 | h3.fn, span.fn { 21 | -moz-border-radius: 7px 7px 7px 7px; 22 | -webkit-border-radius: 7px 7px 7px 7px; 23 | border-radius: 7px 7px 7px 7px; 24 | background-color: #F6F6F6; 25 | border-width: 1px; 26 | border-style: solid; 27 | border-color: #E6E6E6; 28 | word-spacing: 3px; 29 | padding: 3px 5px; 30 | } 31 | 32 | table, pre { 33 | -moz-border-radius: 7px 7px 7px 7px; 34 | -webkit-border-radius: 7px 7px 7px 7px; 35 | border-radius: 7px 7px 7px 7px; 36 | background-color: #F6F6F6; 37 | border: 1px solid #E6E6E6; 38 | border-collapse: separate; 39 | font-size: 12px; 40 | line-height: 1.2; 41 | margin-bottom: 25px; 42 | margin-left: 15px; 43 | } 44 | 45 | table td { 46 | padding: 3px 15px 3px 20px; 47 | } 48 | 49 | table tr.even { 50 | background-color: white; 51 | color: #66666E; 52 | } 53 | 54 | table tr.odd { 55 | background-color: #F6F6F6; 56 | color: #66666E; 57 | } 58 | 59 | li { 60 | margin-bottom: 10px; 61 | padding-left: 12px; 62 | } 63 | 64 | .cpp { 65 | display: block; 66 | margin: 10; 67 | overflow: hidden; 68 | overflow-x: hidden; 69 | overflow-y: hidden; 70 | padding: 20px 0 20px 0; 71 | } 72 | 73 | .footer { 74 | margin-top: 50px; 75 | } 76 | 77 | .memItemLeft { 78 | padding-right: 3px; 79 | } 80 | 81 | .memItemRight { 82 | padding: 3px 15px 3px 0; 83 | } 84 | 85 | .qml { 86 | display: block; 87 | margin: 10; 88 | overflow: hidden; 89 | overflow-x: hidden; 90 | overflow-y: hidden; 91 | padding: 20px 0 20px 0; 92 | } 93 | 94 | .qmldefault { 95 | padding-left: 5px; 96 | float: right; 97 | color: red; 98 | } 99 | 100 | .qmlreadonly { 101 | padding-left: 5px; 102 | float: right; 103 | color: #254117; 104 | } 105 | 106 | .rightAlign { 107 | padding: 3px 5px 3px 10px; 108 | text-align: right; 109 | } 110 | 111 | .title { 112 | background-color: white; 113 | color: #44A51C; 114 | font-family: Verdana; 115 | font-size: 35px; 116 | font-weight: normal; 117 | left: 0; 118 | padding-bottom: 5px; 119 | padding-left: 16px; 120 | padding-top: 20px; 121 | position: absolute; 122 | right: 0; 123 | top: 0; 124 | } 125 | 126 | .toc { 127 | float: right; 128 | -moz-border-radius: 7px 7px 7px 7px; 129 | -webkit-border-radius: 7px 7px 7px 7px; 130 | border-radius: 7px 7px 7px 7px; 131 | background-color: #F6F6F6; 132 | border: 1px solid #DDD; 133 | margin: 0 20px 10px 10px; 134 | padding: 20px 15px 20px 20px; 135 | height: auto; 136 | width: 200px; 137 | } 138 | -------------------------------------------------------------------------------- /examples/hapticsquare/hapticbutton.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #ifndef HAPTICBUTTON_H 52 | #define HAPTICBUTTON_H 53 | 54 | #include 55 | 56 | class HapticButton : public QWidget 57 | { 58 | Q_OBJECT 59 | public: 60 | explicit HapticButton(const QString &label); 61 | void setLabel(const QString& label); 62 | 63 | protected: 64 | void mousePressEvent(QMouseEvent *e); 65 | void paintEvent(QPaintEvent *e); 66 | 67 | private: 68 | QString m_label; 69 | 70 | signals: 71 | void clicked(); 72 | }; 73 | 74 | #endif // HAPTICBUTTON_H 75 | -------------------------------------------------------------------------------- /doc/src/legal/trademarks.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \page trademarks.html 30 | 31 | \title Trademarks 32 | \ingroup licensing 33 | \brief Information about trademarks owned by Nokia and other organisations. 34 | 35 | Nokia, the Nokia logo, Qt, and the Qt logo are trademarks of Nokia \reg 36 | Corporation and/or its subsidiaries in Finland and other countries. 37 | 38 | \list 39 | \li Intel, Intel Inside (logos), MMX and Pentium are \reg trademarks of 40 | Intel Corporation in the United States, other countries, or both. 41 | \li Java and all Java-based trademarks are trademarks of Sun Microsystems, 42 | Inc. in the United States, other countries, or both. 43 | \li Linux is a \reg trademark of Linus Torvalds in the United States, other 44 | countries or both. 45 | \li Mac, Mac OS and Macintosh are \reg trademarks of Apple Computer, Inc., 46 | registered in the U.S. and other countries. 47 | \li Microsoft, Windows, Windows NT, XP, Visual Studio and the Windows logo 48 | are \reg trademarks of Microsoft Corporation in the United States, other 49 | countries, or both. 50 | \li Motif is a registered trademark of The Open Group in the United States, 51 | other countries, or both. 52 | \li OpenGL is a \reg trademark of Silicon Graphics, Inc. in the United States 53 | and other countries. 54 | \li UNIX is a registered trademark of The Open Group in the United States 55 | and other countries. 56 | \li Versit is a \reg trademark of the Internet Mail Consortium in the United States 57 | and other countries. 58 | \li All other company, product, or service names may be trademarks or 59 | service marks of others and are the property of their respective owners. 60 | The use of the word partner does not imply a partnership relationship 61 | between Nokia and any other company. 62 | \endlist 63 | */ 64 | -------------------------------------------------------------------------------- /examples/hapticsquare/hapticbutton.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include "hapticbutton.h" 52 | #include 53 | 54 | HapticButton::HapticButton(const QString &label) : 55 | QWidget(0), m_label(label) 56 | { 57 | setMinimumSize(100, 100); 58 | } 59 | 60 | void HapticButton::setLabel(const QString& label) 61 | { 62 | m_label = label; 63 | } 64 | 65 | void HapticButton::mousePressEvent(QMouseEvent *) 66 | { 67 | emit clicked(); 68 | } 69 | 70 | void HapticButton::paintEvent(QPaintEvent *) 71 | { 72 | QPainter paint(this); 73 | 74 | QRect r(1, 1, width()-2, height()-2); 75 | paint.drawRoundedRect(r, 10, 10); 76 | paint.drawText(r, Qt::AlignCenter, m_label); 77 | } 78 | -------------------------------------------------------------------------------- /examples/hapticsquare/hapticsquare.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include 52 | 53 | #include 54 | class HapticButton; 55 | 56 | #ifndef HAPTICSQUARE_H_ 57 | #define HAPTICSQUARE_H_ 58 | 59 | //! [0] 60 | class HapticSquare : public QWidget 61 | { 62 | Q_OBJECT 63 | 64 | public: 65 | HapticSquare(); 66 | ~HapticSquare(); 67 | 68 | private Q_SLOTS: 69 | void playRumble(); 70 | void playOcean(); 71 | void playButtonClick(); 72 | void playNegativeEffect(); 73 | 74 | private: 75 | HapticButton *m_btnRumble; 76 | HapticButton *m_btnOcean; 77 | HapticButton *m_btnButtonClick; 78 | HapticButton *m_btnNegativeEffect; 79 | 80 | QFeedbackHapticsEffect m_rumble; 81 | QFeedbackHapticsEffect m_ocean; 82 | }; 83 | //! [0] 84 | 85 | #endif 86 | 87 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativefileeffect_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QDECLARATIVEFILEEFFECT_P_H 53 | #define QDECLARATIVEFILEEFFECT_P_H 54 | 55 | #include "qdeclarativefeedbackeffect_p.h" 56 | 57 | QT_USE_NAMESPACE 58 | 59 | class QDeclarativeFileEffect : public QDeclarativeFeedbackEffect 60 | { 61 | Q_OBJECT 62 | 63 | Q_PROPERTY(bool loaded READ isLoaded WRITE setLoaded NOTIFY loadedChanged) 64 | Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) 65 | Q_PROPERTY(QStringList supportedMimeTypes READ supportedMimeTypes) 66 | 67 | public: 68 | explicit QDeclarativeFileEffect(QObject *parent = 0); 69 | bool isLoaded() const; 70 | void setLoaded(bool v); 71 | QUrl source() const; 72 | void setSource(const QUrl & url); 73 | QStringList supportedMimeTypes(); 74 | 75 | signals: 76 | void loadedChanged(); 77 | void sourceChanged(); 78 | 79 | public slots: 80 | void load(); 81 | void unload(); 82 | 83 | private: 84 | QFeedbackFileEffect* d; 85 | }; 86 | 87 | QML_DECLARE_TYPE(QDeclarativeFileEffect) 88 | 89 | #endif // QDECLARATIVEFILEEFFECT_P_H 90 | -------------------------------------------------------------------------------- /doc/src/examples/hapticsplayer.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | 28 | /*! 29 | \example hapticsplayer 30 | \title Haptics Player 31 | 32 | \tableofcontents 33 | 34 | \section1 Overview 35 | 36 | This example shows how to use various haptic effects in an application via 37 | the \l{Feedback}{Qt Feedback API}. 38 | 39 | It provides an example of how to use the QtMobility libraries to: 40 | \list 41 | \li play "system theme" haptic effects corresponding to certain predefined events 42 | \li play a dynamic custom effect, single or repeating 43 | \li play a custom effect which is stored in a file 44 | \endlist 45 | 46 | \section2 Use Case 47 | 48 | This example is more feature complete than the \l{hapticsquare}{Haptic Square} example, 49 | but is intended more as a way to test the haptics provider plugins which 50 | are available on a system, than as an example for application developers. 51 | 52 | It is useful for people who wish to learn how to use the API to create and 53 | play custom effects dynamically, or to allow users of an application to 54 | select which haptic effect to play when a particular event occurs. It is also useful 55 | to test how effects are implemented on specific devices. 56 | 57 | It is a more complex example than the \l{hapticsquare}{Haptic Square} example, so it is 58 | suggested that developers look at that example first. 59 | 60 | \section2 Interface 61 | The application is designed to work on desktop and mobile platforms with 62 | minimal differences in code between the platforms. The interface consists 63 | of three tabs which allow the user to select and play different custom, 64 | system theme, and file effects, respectively. The custom effect tab also 65 | allows the user to modify the custom effect dynamically, and see the effect 66 | of attack and fade, intensity and duration, and periodicity, on the user 67 | experience. 68 | 69 | \section2 Known Issues 70 | The example will not work correctly on platforms which do not have a 71 | QFeedbackHapticInterface (haptic effect provider) plugin loaded. On such 72 | platforms, the example will do nothing. 73 | */ 74 | -------------------------------------------------------------------------------- /doc/qtfeedback.qdocconf: -------------------------------------------------------------------------------- 1 | include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) 2 | include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) 3 | 4 | # Name of the project. 5 | project = qtfeedback 6 | 7 | include(macros.qdocconf) 8 | include(compat.qdocconf) 9 | include(qt-cpp-ignore.qdocconf) 10 | include(qt-defines.qdocconf) 11 | 12 | # Directories in which to search for files to document and images. 13 | # By default set to the root directory of the project for sources 14 | # and headers and qdoc will therefore generate output for each file. 15 | # Images should be placed in /dic/images and examples in 16 | # /examples. 17 | # Paths are relative to the location of this file. 18 | exampledirs += src/snippets .. ../examples 19 | headerdirs += .. 20 | imagedirs += src/images 21 | sourcedirs += .. 22 | 23 | # The following parameters are for creating a qhp file, the qhelpgenerator 24 | # program can convert the qhp file into a qch file which can be opened in 25 | # Qt Assistant and/or Qt Creator. 26 | 27 | # Defines the name of the project. You cannot use operators (+, =, -) in 28 | # the name. Properties for this project are set using a qhp..property 29 | # format. 30 | qhp.projects = qtfeedback 31 | 32 | # Sets the name of the output qhp file. 33 | qhp.qtfeedback.file = qtfeedback.qhp 34 | 35 | # Namespace for the output file. This namespace is used to distinguish between 36 | # different documentation files in Creator/Assistant. Normal format for MP 37 | # projects should be: com.nokia.mp..version with version being 38 | # a number containing a major, minor and revision element. E.g. version 1.0 39 | # becomes 100. 40 | qhp.qtfeedback.namespace = com.nokia.mp.qtfeedback.100 41 | 42 | # Title for the package, will be the main title for the package in 43 | # Assistant/Creator. 44 | qhp.qtfeedback.indexTitle = Qt Feedback 45 | 46 | # Extra files to add to the output which are not linked to from anywhere 47 | # using a qdoc \l command. 48 | qhp.qtfeedback.extraFiles = style/style.css \ 49 | qtfeedback-index.html 50 | 51 | # Only updtae the name of the project for the next variables. 52 | qhp.qtfeedback.virtualFolder = qdoc 53 | qhp.qtfeedback.subprojects = qmltypes classes 54 | qhp.qtfeedback.subprojects.qmltypes.title = QML Types 55 | qhp.qtfeedback.subprojects.qmltypes.indexTitle = Qt Feedback QML Types 56 | qhp.qtfeedback.subprojects.qmltypes.selectors = qmlclass 57 | qhp.qtfeedback.subprojects.qmltypes.sortPages = true 58 | qhp.qtfeedback.subprojects.classes.title = C++ Classes 59 | qhp.qtfeedback.subprojects.classes.indexTitle = Qt Feedback C++ Classes 60 | qhp.qtfeedback.subprojects.classes.selectors = class fake:headerfile 61 | qhp.qtfeedback.subprojects.classes.sortPages = true 62 | 63 | 64 | 65 | # Do NOT change the variables after this line unless you know what you are doing. 66 | 67 | outputformats = HTML 68 | 69 | examples.fileextensions = "*.cpp *.h *.js *.svg *.xml *.ui *.qml" 70 | examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng" 71 | headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" 72 | sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" 73 | 74 | HTML.nobreadcrumbs = "true" 75 | 76 | HTML.templatedir = . 77 | HTML.stylesheets = style/style.css 78 | 79 | HTML.headerstyles = " \n" 80 | HTML.endheader = "\n\n" 81 | 82 | HTML.footer = "
Copyright (c) 2011 Nokia Corporation and/or its subsidiaries. All rights reserved.
\n" 83 | -------------------------------------------------------------------------------- /src/plugins/feedback/mmk/qfeedback.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QFEEDBACK_MMK_H 41 | #define QFEEDBACK_MMK_H 42 | 43 | #include 44 | 45 | #include 46 | 47 | #include 48 | 49 | QT_BEGIN_HEADER 50 | QT_BEGIN_NAMESPACE 51 | 52 | class QFeedbackMediaObject; 53 | 54 | class QFeedbackMMK : public QObject, public QFeedbackFileInterface 55 | { 56 | Q_OBJECT 57 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackPlugin" FILE "mmk.json") 58 | Q_INTERFACES(QFeedbackFileInterface) 59 | 60 | public: 61 | QFeedbackMMK(); 62 | virtual ~QFeedbackMMK(); 63 | 64 | virtual void setLoaded(QFeedbackFileEffect*, bool); 65 | virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State); 66 | virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *); 67 | virtual int effectDuration(const QFeedbackFileEffect*); 68 | virtual QStringList supportedMimeTypes(); 69 | private Q_SLOTS: 70 | void soundEffectStatusChanged(); 71 | void soundEffectPlayingChanged(); 72 | 73 | private: 74 | struct FeedbackInfo { 75 | FeedbackInfo() : soundEffect(0), loaded(false), playing(false) {} 76 | QSoundEffect* soundEffect; 77 | bool loaded; 78 | bool playing; 79 | }; 80 | 81 | QHash mEffects; 82 | QHash mEffectMap; 83 | }; 84 | 85 | QT_END_NAMESPACE 86 | QT_END_HEADER 87 | 88 | #endif // QFEEDBACK_MMK_H 89 | -------------------------------------------------------------------------------- /src/feedback/qfeedbackplugin_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QFEEDBACKPLUGIN_P_H 53 | #define QFEEDBACKPLUGIN_P_H 54 | 55 | #include "qfeedbackactuator.h" 56 | #include "qfeedbackeffect.h" 57 | #include "qfeedbackplugininterfaces.h" 58 | 59 | #include 60 | #include 61 | 62 | QT_BEGIN_NAMESPACE 63 | 64 | class QDummyBackend : QObject, public QFeedbackHapticsInterface 65 | { 66 | public: 67 | QDummyBackend() : QObject(qApp) { pluginPriority(); } 68 | 69 | QList actuators() { return QList(); } 70 | 71 | void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &) { } 72 | QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty) { return QVariant(); } 73 | bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability) { return false; } 74 | 75 | void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty) { } 76 | void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State) { } 77 | QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *) { return QFeedbackEffect::Stopped; } 78 | 79 | virtual PluginPriority pluginPriority() { return PluginLowPriority; } 80 | }; 81 | 82 | QT_END_NAMESPACE 83 | 84 | #endif // QFEEDBACKPLUGIN_P_H 85 | -------------------------------------------------------------------------------- /src/feedback/qfeedbackactuator.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QFEEDBACKACTUATOR_H 41 | #define QFEEDBACKACTUATOR_H 42 | 43 | #include "qfeedbackglobal.h" 44 | #include 45 | 46 | QT_BEGIN_HEADER 47 | QT_BEGIN_NAMESPACE 48 | 49 | class QFeedbackEffect; 50 | 51 | class Q_FEEDBACK_EXPORT QFeedbackActuator : public QObject 52 | { 53 | Q_OBJECT 54 | 55 | Q_ENUMS(Capability) 56 | Q_ENUMS(State) 57 | 58 | Q_PROPERTY(int id READ id) 59 | Q_PROPERTY(QString name READ name) 60 | Q_PROPERTY(QFeedbackActuator::State state READ state) 61 | Q_PROPERTY(bool valid READ isValid) 62 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) 63 | 64 | public: 65 | enum Capability { 66 | Envelope, 67 | Period 68 | }; 69 | 70 | enum State { 71 | Busy, 72 | Ready, 73 | Unknown 74 | }; 75 | 76 | explicit QFeedbackActuator(QObject *parent = Q_NULLPTR); 77 | 78 | int id() const; 79 | bool isValid() const; 80 | 81 | QString name() const; 82 | State state() const; 83 | 84 | Q_INVOKABLE bool isCapabilitySupported(Capability) const; 85 | 86 | bool isEnabled() const; 87 | void setEnabled(bool); 88 | 89 | static QList actuators(); 90 | bool operator==(const QFeedbackActuator&) const; 91 | 92 | Q_SIGNALS: 93 | void enabledChanged(); 94 | 95 | private: 96 | QFeedbackActuator(QObject *parent, int id); 97 | friend class QFeedbackHapticsInterface; 98 | int m_id; 99 | }; 100 | 101 | QT_END_NAMESPACE 102 | QT_END_HEADER 103 | 104 | #endif // QFEEDBACKACTUATOR_H 105 | -------------------------------------------------------------------------------- /doc/src/legal/opensourceedition.qdoc: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:FDL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Free Documentation License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Free 19 | ** Documentation License version 1.3 as published by the Free Software 20 | ** Foundation and appearing in the file included in the packaging of 21 | ** this file. Please review the following information to ensure 22 | ** the GNU Free Documentation License version 1.3 requirements 23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. 24 | ** $QT_END_LICENSE$ 25 | ** 26 | ****************************************************************************/ 27 | /*! 28 | \page opensourceedition.html 29 | 30 | \title Open Source Versions of Qt 31 | \ingroup licensing 32 | \brief Information about the license and features of the Open Source Edition. 33 | 34 | Free (or open source) software is software that comes with a license 35 | that gives users certain rights. In particular the right to use the 36 | software, to modify it, to obtain its source, and to pass it on (under 37 | the same terms). Notice that the term "free" is about rights, not 38 | money. The Free Software Foundation (creators of the GNU GPL) speaks 39 | of free in this context as in "free speech", not as in "no cost". 40 | 41 | Nokia supports the free software concept by providing the Qt Open Source 42 | Edition, which is licensed under the \l{GNU General Public License (GPL)} 43 | (version 3) and the \l{GNU Lesser General Public License (LGPL)} (version 2.1). 44 | You can use this edition of Qt to create and distribute software with licenses 45 | that are compatible to these free software licenses. 46 | 47 | The support of open source with the Open Source Versions of Qt has enabled large 48 | successful software projects like KDE to thrive, with thousands of developers 49 | around the world using open source versions of Qt at no cost to themselves. With 50 | the release of Qt 4, open source versions of Qt became available for Unix/X11, 51 | Mac OS X, and Windows platforms. 52 | 53 | The Open Source Edition can be downloaded from the \l{Downloads}{Qt website}. 54 | 55 | Please refer to the online \l{License FAQ} for answers to frequently asked 56 | questions on open source licensing and its implications. 57 | 58 | More information on Free and Open Source software is available online: 59 | 60 | \list 61 | \li GNU GPL: \l http://www.gnu.org/. 62 | \li Open Source licensing: \l http://www.opensource.org/. 63 | \endlist 64 | 65 | See \l{Licensing Information} for a collection of documents about licenses 66 | used in Qt. 67 | 68 | Information about Qt Commercial License Agreements is available 69 | in the \l{Qt Licensing Overview} on the Qt website or by contacting 70 | the sales department at http://qt.nokia.com/contact. 71 | 72 | If you are in doubt what edition of Qt is right for your project, 73 | please contact 74 | \l{mailto:qt-info@nokia.com}{qt-info@nokia.com}. 75 | 76 | */ 77 | -------------------------------------------------------------------------------- /src/imports/feedback/plugin.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include 41 | 42 | #include "qdeclarativehapticseffect_p.h" 43 | #include "qdeclarativefileeffect_p.h" 44 | #include "qdeclarativethemeeffect_p.h" 45 | #include "qdeclarativefeedbackeffect_p.h" 46 | #include "qdeclarativefeedbackactuator_p.h" 47 | 48 | QT_USE_NAMESPACE 49 | 50 | static QObject *createDeclarativeThemeEfect(QQmlEngine *engine, QJSEngine *jsengine) 51 | { 52 | Q_UNUSED(engine) 53 | Q_UNUSED(jsengine) 54 | 55 | return new QDeclarativeThemeEffect; 56 | } 57 | 58 | class QDeclarativeFeedbackPlugin : public QQmlExtensionPlugin 59 | { 60 | Q_OBJECT 61 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "plugin.json") 62 | 63 | public: 64 | virtual void registerTypes(const char *uri) 65 | { 66 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtFeedback")); 67 | 68 | int major = 5; 69 | int minor = 0; 70 | qmlRegisterUncreatableType(uri, major, minor, "Feedback", "this is the feedback namespace"); 71 | qmlRegisterUncreatableType(uri, major, minor, "FeedbackEffect", "this is the base feedback effect class"); 72 | qmlRegisterType(uri, major, minor, "Actuator"); 73 | qmlRegisterType(uri, major, minor, "FileEffect"); 74 | qmlRegisterType(uri, major, minor, "HapticsEffect"); 75 | qmlRegisterType(uri, major, minor, "ThemeEffect"); 76 | qmlRegisterSingletonType("QtFeedback", major, minor, "EffectPlayer", createDeclarativeThemeEfect); 77 | } 78 | }; 79 | 80 | #include "plugin.moc" 81 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin/qfeedbacktestplugin.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #ifndef QFEEDBACKTESTPLUGIN_H 30 | #define QFEEDBACKTESTPLUGIN_H 31 | 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | 43 | QT_BEGIN_HEADER 44 | QT_USE_NAMESPACE 45 | 46 | class QFeedbackTestPlugin : public QObject, public QFeedbackHapticsInterface, public QFeedbackFileInterface, public QFeedbackThemeInterface 47 | { 48 | Q_OBJECT 49 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackTestPlugin") 50 | Q_INTERFACES(QFeedbackHapticsInterface) 51 | Q_INTERFACES(QFeedbackFileInterface) 52 | Q_INTERFACES(QFeedbackThemeInterface) 53 | public: 54 | QFeedbackTestPlugin(); 55 | virtual ~QFeedbackTestPlugin(); 56 | 57 | virtual PluginPriority pluginPriority(); 58 | 59 | virtual QList actuators(); 60 | 61 | //for actuator handling 62 | virtual void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &); 63 | virtual QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty); 64 | virtual bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability); 65 | 66 | virtual void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty); 67 | virtual void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State); 68 | virtual QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *); 69 | 70 | //for loading files 71 | virtual void setLoaded(QFeedbackFileEffect*, bool); 72 | virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State); 73 | virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *); 74 | virtual int effectDuration(const QFeedbackFileEffect *); 75 | virtual QStringList supportedMimeTypes(); 76 | 77 | // For themes 78 | virtual bool play(QFeedbackEffect::Effect); 79 | 80 | private slots: 81 | void timerExpired(); 82 | 83 | private: 84 | QList actuators_; 85 | 86 | // Our hacky state 87 | QFeedbackEffect::State mHapticState; 88 | QFeedbackEffect::State mFileState; 89 | QMap mHapticEffects; 90 | QTimer* ensureTimer(const QFeedbackHapticsEffect* effect); 91 | }; 92 | 93 | QT_END_HEADER 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /examples/hapticsplayer/hapticsplayer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include "ui_hapticsplayer.h" 52 | 53 | #include 54 | #include 55 | 56 | #ifndef HAPTICSPLAYER_H_ 57 | #define HAPTICSPLAYER_H_ 58 | 59 | class HapticsPlayer : public QWidget 60 | { 61 | Q_OBJECT 62 | public: 63 | HapticsPlayer(); 64 | 65 | private Q_SLOTS: 66 | void actuatorChanged(); 67 | void enabledChanged(bool); 68 | void playPauseClicked(); 69 | void durationChanged(int); 70 | void intensityChanged(int); 71 | 72 | void attackTimeChanged(int); 73 | void attackIntensityChanged(int); 74 | void fadeTimeChanged(int); 75 | void fadeIntensityChanged(int); 76 | 77 | void periodChanged(int value); 78 | void periodToggled(bool on); 79 | 80 | //High-level API 81 | void instantPlayClicked(); 82 | 83 | //File API 84 | void browseClicked(); 85 | void filePlayPauseClicked(); 86 | 87 | protected: 88 | void timerEvent(QTimerEvent *); 89 | 90 | private: 91 | QFeedbackActuator* currentActuator(); 92 | Ui_HapticsPlayer ui; 93 | QFeedbackActuator* actuator; 94 | QFeedbackHapticsEffect effect; 95 | QFeedbackFileEffect fileEffect; 96 | }; 97 | 98 | #endif 99 | 100 | -------------------------------------------------------------------------------- /src/feedback/qfeedbackeffect_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QFEEDBACKEFFECT_P_H 53 | #define QFEEDBACKEFFECT_P_H 54 | 55 | #include 56 | #include 57 | 58 | QT_BEGIN_NAMESPACE 59 | 60 | class QFeedbackHapticsEffectPrivate 61 | { 62 | public: 63 | QFeedbackHapticsEffectPrivate() 64 | : duration(250) 65 | , attackTime(0) 66 | , fadeTime(0) 67 | , period(-1) 68 | , actuator(0) 69 | , intensity(1) 70 | , attackIntensity(0) 71 | , fadeIntensity(0) 72 | { 73 | 74 | } 75 | 76 | // Try to avoid holes (mostly where qreal == double) 77 | int duration; 78 | int attackTime; 79 | int fadeTime; 80 | int period; 81 | QFeedbackActuator *actuator; 82 | qreal intensity; 83 | qreal attackIntensity; 84 | qreal fadeIntensity; 85 | }; 86 | 87 | class QFeedbackFileEffectPrivate 88 | { 89 | public: 90 | QFeedbackFileEffectPrivate(QFeedbackFileEffect *effect) 91 | : effect(effect) 92 | , loaded(false) 93 | , backendUsed(-1) 94 | { 95 | } 96 | 97 | static QFeedbackFileEffectPrivate *get(QFeedbackFileEffect *e) { return e->priv.data(); } 98 | static const QFeedbackFileEffectPrivate *get(const QFeedbackFileEffect *e) { return e->priv.data(); } 99 | 100 | void loadFinished(bool success); 101 | 102 | QFeedbackFileEffect *effect; 103 | 104 | QUrl url; 105 | bool loaded; 106 | 107 | //used for loading the file 108 | int backendUsed; 109 | }; 110 | 111 | QT_END_NAMESPACE 112 | 113 | #endif // QFEEDBACKEFFECT_P_H 114 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativefeedbackactuator_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QDECLARATIVEFEEDBACKACTUATOR_P_H 53 | #define QDECLARATIVEFEEDBACKACTUATOR_P_H 54 | 55 | #include 56 | #include "qfeedbackactuator.h" 57 | 58 | QT_USE_NAMESPACE 59 | 60 | class QDeclarativeFeedbackActuator : public QObject 61 | { 62 | Q_OBJECT 63 | 64 | Q_PROPERTY(int actuatorId READ actuatorId) 65 | Q_PROPERTY(QString name READ name) 66 | Q_PROPERTY(State state READ state) 67 | Q_PROPERTY(bool valid READ isValid) 68 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) 69 | 70 | Q_ENUMS(Capability) 71 | Q_ENUMS(State) 72 | 73 | public: 74 | enum Capability { 75 | Envelope = QFeedbackActuator::Envelope, 76 | Period = QFeedbackActuator::Period 77 | }; 78 | 79 | enum State { 80 | Busy = QFeedbackActuator::Busy, 81 | Ready = QFeedbackActuator::Ready, 82 | Unknown = QFeedbackActuator::Unknown 83 | }; 84 | 85 | explicit QDeclarativeFeedbackActuator(QObject *parent = 0); 86 | explicit QDeclarativeFeedbackActuator(QObject *parent, QFeedbackActuator* actuator); 87 | QFeedbackActuator* feedbackActuator() const; 88 | int actuatorId() const; 89 | bool isValid() const; 90 | QString name() const; 91 | State state() const; 92 | Q_INVOKABLE bool isCapabilitySupported(Capability capability) const; 93 | bool isEnabled() const; 94 | void setEnabled(bool v); 95 | 96 | signals: 97 | void enabledChanged(); 98 | 99 | private: 100 | QFeedbackActuator* d; 101 | }; 102 | 103 | QML_DECLARE_TYPE(QDeclarativeFeedbackActuator) 104 | 105 | #endif // QDECLARATIVEFEEDBACKACTUATOR_P_H 106 | -------------------------------------------------------------------------------- /src/plugins/feedback/meegotouch/qfeedback.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qfeedback.h" 41 | #include "qfeedbackeffect.h" 42 | 43 | #include 44 | #include 45 | 46 | #include 47 | 48 | // TODO Use a style property based enum to play the correct feedback 49 | //enum MeegoTouchFeedback 50 | //{ 51 | // // MWidgetStyle 52 | // widgetPressFeedback, 53 | // widgetReleaseFeedback, 54 | // widgetCancelFeedback, 55 | // // MSliderStyle 56 | // sliderMoveFeedback, 57 | // // MTextEditStyle 58 | // textEditPressBoundaryFeedback, 59 | // textEditReleaseBoundaryFeedback, 60 | // textEditPressWordFeedback, 61 | // textEditReleaseWordFeedback, 62 | // textEditChangeSelectionFeedback 63 | //}; 64 | 65 | static QString convertToMeegoTouch(QFeedbackEffect::ThemeEffect effect) 66 | { 67 | switch (effect) { 68 | case QFeedbackEffect::Press: 69 | case QFeedbackEffect::Release: 70 | case QFeedbackEffect::PressWeak: 71 | case QFeedbackEffect::ReleaseWeak: 72 | case QFeedbackEffect::PressStrong: 73 | case QFeedbackEffect::ReleaseStrong: 74 | case QFeedbackEffect::DragStart: 75 | case QFeedbackEffect::DragDropInZone: 76 | case QFeedbackEffect::DragDropOutOfZone: 77 | case QFeedbackEffect::DragCrossBoundary: 78 | case QFeedbackEffect::Appear: 79 | case QFeedbackEffect::Disappear: 80 | case QFeedbackEffect::Move: 81 | return MFeedback::Press; 82 | default: 83 | return QString(); 84 | } 85 | } 86 | 87 | QFeedbackMeegoTouch::QFeedbackMeegoTouch(QObject *parent) : 88 | QObject(parent), 89 | QFeedbackThemeInterface() 90 | { 91 | } 92 | 93 | bool QFeedbackMeegoTouch::play(QFeedbackEffect::Effect effect) 94 | { 95 | const QString &feedbackString = convertToMeegoTouch(effect); 96 | if (feedbackString.isEmpty()) 97 | return false; 98 | 99 | MFeedback::play(feedbackString); 100 | return true; 101 | } 102 | 103 | QFeedbackInterface::PluginPriority QFeedbackMeegoTouch::pluginPriority() 104 | { 105 | return QFeedbackInterface::PluginLowPriority; 106 | } 107 | 108 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativethemeeffect_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QDECLARATIVETHEMEEFFECT_P_H 53 | #define QDECLARATIVETHEMEEFFECT_P_H 54 | 55 | #include 56 | #include 57 | 58 | QT_USE_NAMESPACE 59 | 60 | // Wrapper for theme effects 61 | class QDeclarativeThemeEffect : public QObject 62 | { 63 | Q_OBJECT 64 | 65 | Q_PROPERTY(bool supported READ effectSupported) 66 | Q_PROPERTY(Effect effect READ effect WRITE setEffect NOTIFY effectChanged) 67 | 68 | Q_CLASSINFO("DefaultMethod", "play()") 69 | Q_CLASSINFO("OverloadedMethod", "play(Effect)") 70 | 71 | Q_ENUMS(Effect) 72 | 73 | public: 74 | enum Effect { 75 | Undefined = QFeedbackEffect::Undefined, 76 | Press = QFeedbackEffect::Press, 77 | Release = QFeedbackEffect::Release, 78 | PressWeak = QFeedbackEffect::PressWeak, 79 | ReleaseWeak = QFeedbackEffect::ReleaseWeak, 80 | PressStrong = QFeedbackEffect::PressStrong, 81 | ReleaseStrong = QFeedbackEffect::ReleaseStrong, 82 | DragStart = QFeedbackEffect::DragStart, 83 | DragDropInZone = QFeedbackEffect::DragDropInZone, 84 | DragDropOutOfZone = QFeedbackEffect::DragDropOutOfZone, 85 | DragCrossBoundary = QFeedbackEffect::DragCrossBoundary, 86 | Appear = QFeedbackEffect::Appear, 87 | Disappear = QFeedbackEffect::Disappear, 88 | Move = QFeedbackEffect::Move, 89 | NumberOfEffects = QFeedbackEffect::NumberOfEffects, 90 | UserEffect = QFeedbackEffect::UserEffect 91 | }; 92 | 93 | QDeclarativeThemeEffect(QObject *parent = 0); 94 | bool effectSupported(); 95 | void setEffect(Effect effect); 96 | Effect effect() const; 97 | 98 | public slots: 99 | void play(); 100 | void play(Effect effect); 101 | 102 | signals: 103 | void effectChanged(); 104 | 105 | public: 106 | Effect m_effect; 107 | }; 108 | 109 | QML_DECLARE_TYPE(QDeclarativeThemeEffect) 110 | 111 | #endif // QDECLARATIVETHEMEEFFECT_P_H 112 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativefileeffect.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qdeclarativefileeffect_p.h" 41 | /*! 42 | \internal 43 | \qmltype FileEffect 44 | \brief The FileEffect element represents feedback data stored in a file. 45 | \ingroup qml-feedback-api 46 | \inherits FeedbackEffect 47 | 48 | \snippet doc/src/snippets/declarative/declarative-feedback.qml File Effect 49 | 50 | \sa HapticsEffect, {QFeedbackActuator} 51 | */ 52 | QDeclarativeFileEffect::QDeclarativeFileEffect(QObject *parent) 53 | : QDeclarativeFeedbackEffect(parent) 54 | { 55 | d = new QFeedbackFileEffect(this); 56 | setFeedbackEffect(d); 57 | } 58 | 59 | /*! 60 | \qmlproperty bool FileEffect::loaded 61 | 62 | This property is true if this feedback effect is loaded. 63 | */ 64 | bool QDeclarativeFileEffect::isLoaded() const 65 | { 66 | return d->isLoaded(); 67 | } 68 | void QDeclarativeFileEffect::setLoaded(bool v) 69 | { 70 | if (v != d->isLoaded()) { 71 | d->setLoaded(v); 72 | emit loadedChanged(); 73 | } 74 | } 75 | 76 | /*! 77 | \qmlproperty url FileEffect::source 78 | 79 | This property stores the URL for the feedback data. 80 | */ 81 | QUrl QDeclarativeFileEffect::source() const 82 | { 83 | return d->source(); 84 | } 85 | void QDeclarativeFileEffect::setSource(const QUrl & url) 86 | { 87 | if (url != d->source()) { 88 | d->setSource(url); 89 | emit sourceChanged(); 90 | } 91 | } 92 | 93 | /*! 94 | \qmlproperty list FileEffect::supportedMimeTypes 95 | 96 | This property holds the MIME types supported for playing effects from a file. 97 | */ 98 | QStringList QDeclarativeFileEffect::supportedMimeTypes() 99 | { 100 | return d->supportedMimeTypes(); 101 | } 102 | 103 | /*! 104 | \qmlmethod FileEffect::load() 105 | 106 | Makes sure that the file associated with the feedback object is loaded. 107 | \sa QFeedbackFileEffect::load() 108 | */ 109 | void QDeclarativeFileEffect::load() 110 | { 111 | if (!isLoaded()) { 112 | d->load(); 113 | emit loadedChanged(); 114 | } 115 | } 116 | 117 | /*! 118 | \qmlmethod FileEffect::unload() 119 | 120 | Makes sure that the file associated with the feedback object is unloaded. 121 | \sa QFeedbackFileEffect::unload() 122 | */ 123 | void QDeclarativeFileEffect::unload() 124 | { 125 | if (isLoaded()) { 126 | d->unload(); 127 | emit loadedChanged(); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackactuator/tst_qfeedbackactuator.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | //TESTED_COMPONENT=src/feedback 30 | 31 | #include 32 | 33 | #include 34 | 35 | QT_USE_NAMESPACE 36 | 37 | class tst_QFeedbackActuator : public QObject 38 | { 39 | Q_OBJECT 40 | public: 41 | tst_QFeedbackActuator(); 42 | ~tst_QFeedbackActuator(); 43 | 44 | public slots: 45 | void initTestCase(); 46 | void cleanupTestCase(); 47 | void init(); 48 | void cleanup(); 49 | 50 | private slots: 51 | void enumeration(); 52 | void setEnabled(); 53 | }; 54 | 55 | tst_QFeedbackActuator::tst_QFeedbackActuator() 56 | { 57 | } 58 | 59 | tst_QFeedbackActuator::~tst_QFeedbackActuator() 60 | { 61 | } 62 | 63 | void tst_QFeedbackActuator::initTestCase() 64 | { 65 | } 66 | 67 | void tst_QFeedbackActuator::cleanupTestCase() 68 | { 69 | } 70 | 71 | void tst_QFeedbackActuator::init() 72 | { 73 | //the list returned should always be the same with the same order 74 | QCOMPARE(QFeedbackActuator::actuators(), QFeedbackActuator::actuators()); 75 | } 76 | 77 | void tst_QFeedbackActuator::cleanup() 78 | { 79 | } 80 | 81 | 82 | #if defined(HAVE_ACTUATORS) 83 | //we're on meego/maemo 84 | #define CAPABILITY true //the capabilities are supported through Immersion 85 | #else 86 | #define CAPABILITY false 87 | #endif 88 | 89 | void tst_QFeedbackActuator::enumeration() 90 | { 91 | QList actuators = QFeedbackActuator::actuators(); 92 | #ifdef HAVE_ACTUATORS 93 | QVERIFY(!actuators.isEmpty()); 94 | #endif 95 | foreach(QFeedbackActuator* actuator, actuators) { 96 | if (actuator->name() == QString("test plugin") || actuator->name() == QString("5555")) 97 | continue; 98 | 99 | QVERIFY(actuator->isValid()); 100 | QVERIFY(actuator->id() >= 0); 101 | QCOMPARE(actuator->isCapabilitySupported(QFeedbackActuator::Envelope), CAPABILITY); 102 | QCOMPARE(actuator->isCapabilitySupported(QFeedbackActuator::Period), CAPABILITY); 103 | QVERIFY(!actuator->name().isEmpty()); 104 | } 105 | 106 | // Try comparisons 107 | if (actuators.count() > 1) { 108 | QFeedbackActuator* a1 = actuators.at(0); 109 | QFeedbackActuator* a2 = actuators.at(1); 110 | QFeedbackActuator* a1b = actuators.at(0); 111 | QFeedbackActuator* a2b = actuators.at(1); 112 | QVERIFY(a1->id() != a2->id()); 113 | // QVERIFY(*a1 != *a2); // doesn't work, no operator != !! 114 | QVERIFY(!(*a1 == *a2)); 115 | 116 | QVERIFY(*a1 == *a1b); 117 | QVERIFY(*a2 == *a2b); 118 | } 119 | } 120 | 121 | void tst_QFeedbackActuator::setEnabled() 122 | { 123 | foreach(QFeedbackActuator* actuator, QFeedbackActuator::actuators()) { 124 | if (actuator->name() == QString("test plugin") || actuator->name() == QString("5555")) 125 | continue; 126 | //this test might not always be true because you ight not be allowed to change the enabled property 127 | actuator->setEnabled(false); 128 | QVERIFY(!actuator->isEnabled()); 129 | actuator->setEnabled(true); 130 | QVERIFY(actuator->isEnabled()); 131 | } 132 | } 133 | 134 | 135 | 136 | 137 | QTEST_MAIN(tst_QFeedbackActuator) 138 | 139 | #include "tst_qfeedbackactuator.moc" 140 | -------------------------------------------------------------------------------- /src/feedback/qfeedbackpluginsearch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | #ifndef QFEEDBACKPLUGINSEARCH_H 40 | #define QFEEDBACKPLUGINSEARCH_H 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | QT_BEGIN_NAMESPACE 48 | 49 | #define CHECKDIR(dir) (dir).exists() 50 | 51 | inline QStringList getPluginPaths(const QString& plugintype) 52 | { 53 | #if QT_CONFIG(library) 54 | #if !defined QT_NO_DEBUG 55 | const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0; 56 | #endif 57 | 58 | QStringList paths = QCoreApplication::libraryPaths(); 59 | #if !defined QT_NO_DEBUG 60 | if (showDebug) 61 | qDebug() << "Plugin paths:" << paths; 62 | #endif 63 | 64 | // Temp variable to avoid multiple identical paths 65 | // (we don't convert the list to set first, because that loses the order) 66 | QSet processed; 67 | 68 | /* The list of discovered plugins */ 69 | QStringList plugins; 70 | 71 | /* Enumerate our plugin paths */ 72 | for (int i=0; i < paths.count(); i++) { 73 | if (processed.contains(paths.at(i))) 74 | continue; 75 | processed.insert(paths.at(i)); 76 | QDir pluginsDir(paths.at(i)); 77 | if (!CHECKDIR(pluginsDir)) 78 | continue; 79 | 80 | #if defined(Q_OS_WIN) 81 | if (pluginsDir.dirName().toLower() == QLatin1String("debug") || pluginsDir.dirName().toLower() == QLatin1String("release")) 82 | pluginsDir.cdUp(); 83 | #elif defined(Q_OS_MAC) 84 | if (pluginsDir.dirName() == QLatin1String("MacOS")) { 85 | pluginsDir.cdUp(); 86 | pluginsDir.cdUp(); 87 | pluginsDir.cdUp(); 88 | } 89 | #endif 90 | 91 | QString subdir(QLatin1String("plugins/")); 92 | subdir += plugintype; 93 | if (pluginsDir.path().endsWith(QLatin1String("/plugins")) 94 | || pluginsDir.path().endsWith(QLatin1String("/plugins/"))) 95 | subdir = plugintype; 96 | 97 | if (CHECKDIR(QDir(pluginsDir.filePath(subdir)))) { 98 | pluginsDir.cd(subdir); 99 | QStringList files = pluginsDir.entryList(QDir::Files); 100 | 101 | #if !defined QT_NO_DEBUG 102 | if (showDebug) 103 | qDebug() << "Looking for " << plugintype << " plugins in" << pluginsDir.path() << files; 104 | #endif 105 | 106 | for (int j=0; j < files.count(); j++) { 107 | plugins << pluginsDir.absoluteFilePath(files.at(j)); 108 | } 109 | } 110 | } 111 | 112 | return plugins; 113 | #else 114 | Q_UNUSED(plugintype) 115 | return QStringList(); 116 | #endif 117 | } 118 | 119 | QT_END_NAMESPACE 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativefeedbackeffect_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QDECLARATIVEFEEDBACKEFFECT_P_H 53 | #define QDECLARATIVEFEEDBACKEFFECT_P_H 54 | 55 | #include 56 | #include 57 | 58 | QT_USE_NAMESPACE 59 | 60 | class QDeclarativeFeedbackEffect : public QObject 61 | { 62 | Q_OBJECT 63 | 64 | Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) 65 | Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) 66 | Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) 67 | Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged) 68 | Q_PROPERTY(ErrorType error READ error NOTIFY errorChanged) 69 | 70 | Q_ENUMS(Duration) 71 | Q_ENUMS(State) 72 | Q_ENUMS(ErrorType) 73 | 74 | public: 75 | enum Duration { 76 | Infinite = QFeedbackEffect::Infinite 77 | }; 78 | 79 | enum State { 80 | Stopped = QFeedbackEffect::Stopped, 81 | Paused = QFeedbackEffect::Paused, 82 | Running = QFeedbackEffect::Running, 83 | Loading = QFeedbackEffect::Loading 84 | }; 85 | 86 | enum ErrorType { 87 | UnknownError = QFeedbackEffect::UnknownError, 88 | DeviceBusy = QFeedbackEffect::DeviceBusy 89 | }; 90 | 91 | QDeclarativeFeedbackEffect(QObject *parent = 0); 92 | void setFeedbackEffect(QFeedbackEffect* effect); 93 | QFeedbackEffect* feedbackEffect(); 94 | 95 | bool isRunning() const; 96 | bool isPaused() const; 97 | void setRunning(bool running); 98 | void setPaused(bool paused); 99 | virtual State state() const; 100 | virtual int duration() const; 101 | virtual void setState(State newState); 102 | virtual void setDuration(int newDuration); 103 | ErrorType error() const; 104 | 105 | signals: 106 | void runningChanged(); 107 | void pausedChanged(); 108 | void durationChanged(); 109 | void stateChanged(); 110 | void errorChanged(); 111 | 112 | public slots: 113 | void updateState(); 114 | void start(); 115 | void stop(); 116 | void pause(); 117 | 118 | private slots: 119 | void _error(QFeedbackEffect::ErrorType err); 120 | 121 | private: 122 | bool m_running; 123 | bool m_paused; 124 | QFeedbackEffect* m_effect; 125 | ErrorType m_error; 126 | }; 127 | 128 | QML_DECLARE_TYPE(QDeclarativeFeedbackEffect) 129 | 130 | #endif // QDECLARATIVEFEEDBACKEFFECT_P_H 131 | -------------------------------------------------------------------------------- /doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include 52 | #include 53 | 54 | #include 55 | 56 | 57 | void completeExample(); 58 | 59 | void completeExample() 60 | { 61 | //! [Play the system theme button click effect] 62 | QFeedbackEffect::playThemeEffect(QFeedbackEffect::Press); 63 | //! [Play the system theme button click effect] 64 | 65 | //! [Play the system theme bounce effect] 66 | QFeedbackEffect::playThemeEffect(QFeedbackEffect::DragStart); 67 | //! [Play the system theme bounce effect] 68 | 69 | //! [Define a custom haptic effect] 70 | QFeedbackHapticsEffect rumble; 71 | rumble.setAttackIntensity(0.0); 72 | rumble.setAttackTime(250); 73 | rumble.setIntensity(1.0); 74 | rumble.setDuration(1000); 75 | rumble.setFadeTime(250); 76 | rumble.setFadeIntensity(0.0); 77 | //! [Define a custom haptic effect] 78 | 79 | //! [Start playing a custom haptic effect] 80 | rumble.start(); 81 | //! [Start playing a custom haptic effect] 82 | 83 | //! [Pause a custom haptic effect] 84 | rumble.pause(); 85 | //! [Pause a custom haptic effect] 86 | 87 | //! [Stop playing a custom haptic effect] 88 | rumble.stop(); 89 | //! [Stop playing a custom haptic effect] 90 | 91 | //! [Query the state of a custom haptic effect] 92 | if (rumble.state() == QFeedbackEffect::Stopped) 93 | qDebug() << "The device has stopped rumbling!"; 94 | //! [Query the state of a custom haptic effect] 95 | 96 | //! [Set the actuator which should play the custom effect] 97 | QFeedbackActuator *actuator = 0; // default system actuator 98 | QList actuators = QFeedbackActuator::actuators(); 99 | foreach (QFeedbackActuator* temp, actuators) { 100 | if (temp->name() == "ExampleActuatorName") { 101 | actuator = temp; 102 | } 103 | } 104 | rumble.setActuator(actuator); 105 | //! [Set the actuator which should play the custom effect] 106 | 107 | //! [Play a haptic effect from a file] 108 | QFeedbackFileEffect hapticTune; 109 | hapticTune.setSource(QUrl::fromLocalFile("mySavedRumble.ivt")); 110 | hapticTune.load(); 111 | hapticTune.start(); 112 | //! [Play a haptic effect from a file] 113 | } 114 | -------------------------------------------------------------------------------- /doc/qt-cpp-ignore.qdocconf: -------------------------------------------------------------------------------- 1 | Cpp.ignoretokens = QAXFACTORY_EXPORT \ 2 | QDESIGNER_COMPONENTS_LIBRARY \ 3 | QDESIGNER_EXTENSION_LIBRARY \ 4 | QDESIGNER_SDK_LIBRARY \ 5 | QDESIGNER_SHARED_LIBRARY \ 6 | QDESIGNER_UILIB_LIBRARY \ 7 | QM_EXPORT_CANVAS \ 8 | QM_EXPORT_DNS \ 9 | QM_EXPORT_DOM \ 10 | QM_EXPORT_FTP \ 11 | QM_EXPORT_HTTP \ 12 | QM_EXPORT_ICONVIEW \ 13 | QM_EXPORT_NETWORK \ 14 | QM_EXPORT_OPENGL \ 15 | QM_EXPORT_OPENVG \ 16 | QM_EXPORT_SQL \ 17 | QM_EXPORT_TABLE \ 18 | QM_EXPORT_WORKSPACE \ 19 | QM_EXPORT_XML \ 20 | QT_ASCII_CAST_WARN \ 21 | QT_ASCII_CAST_WARN_CONSTRUCTOR \ 22 | QT_BEGIN_HEADER \ 23 | QT_DESIGNER_STATIC \ 24 | QT_END_HEADER \ 25 | QT_FASTCALL \ 26 | QT_WIDGET_PLUGIN_EXPORT \ 27 | Q_COMPAT_EXPORT \ 28 | Q_CORE_EXPORT \ 29 | Q_CORE_EXPORT_INLINE \ 30 | Q_EXPLICIT \ 31 | Q_EXPORT \ 32 | Q_EXPORT_CODECS_CN \ 33 | Q_EXPORT_CODECS_JP \ 34 | Q_EXPORT_CODECS_KR \ 35 | Q_EXPORT_PLUGIN \ 36 | Q_GFX_INLINE \ 37 | Q_AUTOTEST_EXPORT \ 38 | Q_GUI_EXPORT \ 39 | Q_GUI_EXPORT_INLINE \ 40 | Q_GUI_EXPORT_STYLE_CDE \ 41 | Q_GUI_EXPORT_STYLE_COMPACT \ 42 | Q_GUI_EXPORT_STYLE_MAC \ 43 | Q_GUI_EXPORT_STYLE_MOTIF \ 44 | Q_GUI_EXPORT_STYLE_MOTIFPLUS \ 45 | Q_GUI_EXPORT_STYLE_PLATINUM \ 46 | Q_GUI_EXPORT_STYLE_POCKETPC \ 47 | Q_GUI_EXPORT_STYLE_SGI \ 48 | Q_GUI_EXPORT_STYLE_WINDOWS \ 49 | Q_GUI_EXPORT_STYLE_WINDOWSXP \ 50 | QHELP_EXPORT \ 51 | Q_INLINE_TEMPLATE \ 52 | Q_INTERNAL_WIN_NO_THROW \ 53 | Q_LOCATION_EXPORT \ 54 | Q_NETWORK_EXPORT \ 55 | Q_OPENGL_EXPORT \ 56 | Q_OPENVG_EXPORT \ 57 | Q_OUTOFLINE_TEMPLATE \ 58 | Q_SQL_EXPORT \ 59 | Q_SVG_EXPORT \ 60 | Q_SCRIPT_EXPORT \ 61 | Q_SCRIPTTOOLS_EXPORT \ 62 | Q_TESTLIB_EXPORT \ 63 | Q_TYPENAME \ 64 | Q_XML_EXPORT \ 65 | Q_XMLSTREAM_EXPORT \ 66 | Q_XMLPATTERNS_EXPORT \ 67 | QDBUS_EXPORT \ 68 | Q_DBUS_EXPORT \ 69 | QT_BEGIN_NAMESPACE \ 70 | QT_BEGIN_INCLUDE_NAMESPACE \ 71 | QT_END_NAMESPACE \ 72 | QT_END_INCLUDE_NAMESPACE \ 73 | PHONON_EXPORT \ 74 | Q_DECLARATIVE_EXPORT \ 75 | Q_GADGET \ 76 | QWEBKIT_EXPORT \ 77 | Q_INVOKABLE \ 78 | Q_DECL_CONSTEXPR 79 | Cpp.ignoredirectives = Q_DECLARE_HANDLE \ 80 | Q_DECLARE_INTERFACE \ 81 | Q_DECLARE_METATYPE \ 82 | Q_DECLARE_OPERATORS_FOR_FLAGS \ 83 | Q_DECLARE_PRIVATE \ 84 | Q_DECLARE_PUBLIC \ 85 | Q_DECLARE_SHARED \ 86 | Q_DECLARE_TR_FUNCTIONS \ 87 | Q_DECLARE_TYPEINFO \ 88 | Q_DISABLE_COPY \ 89 | QT_FORWARD_DECLARE_CLASS \ 90 | Q_DUMMY_COMPARISON_OPERATOR \ 91 | Q_ENUMS \ 92 | Q_FLAGS \ 93 | Q_INTERFACES \ 94 | __attribute__ \ 95 | K_DECLARE_PRIVATE \ 96 | PHONON_OBJECT \ 97 | PHONON_HEIR \ 98 | Q_PRIVATE_PROPERTY \ 99 | Q_DECLARE_PRIVATE_D \ 100 | Q_CLASSINFO 101 | -------------------------------------------------------------------------------- /examples/hapticsquare/hapticsquare.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | #include "hapticsquare.h" 52 | #include "hapticbutton.h" 53 | 54 | #include 55 | #include 56 | 57 | //! [0] 58 | HapticSquare::HapticSquare() 59 | { 60 | m_rumble.setAttackIntensity(0.1); 61 | m_rumble.setAttackTime(250); 62 | m_rumble.setIntensity(1.0); 63 | m_rumble.setDuration(1000); 64 | m_rumble.setFadeTime(250); 65 | m_rumble.setFadeIntensity(0.1); 66 | //! [0] 67 | 68 | //! [1] 69 | m_ocean.setAttackIntensity(0.1); 70 | m_ocean.setAttackTime(450); 71 | m_ocean.setIntensity(0.8); 72 | m_ocean.setDuration(6000); 73 | m_ocean.setFadeTime(900); 74 | m_ocean.setFadeIntensity(0.05); 75 | m_ocean.setPeriod(1500); 76 | //! [1] 77 | 78 | //! [2] 79 | m_btnRumble = new HapticButton(tr("Rumble!")); 80 | m_btnOcean = new HapticButton(tr("Ocean")); 81 | m_btnButtonClick = new HapticButton(tr("Click")); 82 | m_btnNegativeEffect = new HapticButton(tr("Oops!")); 83 | QGridLayout *topLayout = new QGridLayout(this); 84 | topLayout->addWidget(m_btnRumble, 0, 0); 85 | topLayout->addWidget(m_btnOcean, 0, 1); 86 | topLayout->addWidget(m_btnButtonClick, 1, 0); 87 | topLayout->addWidget(m_btnNegativeEffect, 1, 1); 88 | 89 | connect(m_btnRumble, SIGNAL(clicked()), this, SLOT(playRumble())); 90 | connect(m_btnOcean, SIGNAL(clicked()), this, SLOT(playOcean())); 91 | connect(m_btnButtonClick, SIGNAL(clicked()), this, SLOT(playButtonClick())); 92 | connect(m_btnNegativeEffect, SIGNAL(clicked()), this, SLOT(playNegativeEffect())); 93 | } 94 | //! [2] 95 | 96 | HapticSquare::~HapticSquare() 97 | { 98 | delete m_btnRumble; 99 | delete m_btnOcean; 100 | delete m_btnButtonClick; 101 | delete m_btnNegativeEffect; 102 | } 103 | 104 | //! [3] 105 | void HapticSquare::playRumble() 106 | { 107 | m_rumble.start(); 108 | } 109 | 110 | void HapticSquare::playOcean() 111 | { 112 | if (m_ocean.state() == QFeedbackEffect::Stopped) { 113 | m_ocean.start(); 114 | } else { 115 | m_ocean.stop(); 116 | } 117 | } 118 | //! [3] 119 | 120 | //! [4] 121 | void HapticSquare::playButtonClick() 122 | { 123 | QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeBasicButton); 124 | } 125 | 126 | void HapticSquare::playNegativeEffect() 127 | { 128 | QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeNegativeTacticon); 129 | } 130 | //! [4] 131 | 132 | #include "moc_hapticsquare.cpp" 133 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativehapticseffect_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QDECLARATIVEHAPTICSEFFECT_P_H 53 | #define QDECLARATIVEHAPTICSEFFECT_P_H 54 | 55 | #include "qdeclarativefeedbackeffect_p.h" 56 | #include "qdeclarativefeedbackactuator_p.h" 57 | 58 | QT_USE_NAMESPACE 59 | 60 | class QDeclarativeHapticsEffect : public QDeclarativeFeedbackEffect 61 | { 62 | Q_OBJECT 63 | 64 | Q_PROPERTY(QQmlListProperty availableActuators READ availableActuators) 65 | Q_PROPERTY(qreal intensity READ intensity WRITE setIntensity NOTIFY intensityChanged) 66 | Q_PROPERTY(int attackTime READ attackTime WRITE setAttackTime NOTIFY attackTimeChanged) 67 | Q_PROPERTY(qreal attackIntensity READ attackIntensity WRITE setAttackIntensity NOTIFY attackIntensityChanged) 68 | Q_PROPERTY(int fadeTime READ fadeTime WRITE setFadeTime NOTIFY fadeTimeChanged) 69 | Q_PROPERTY(qreal fadeIntensity READ fadeIntensity WRITE setFadeIntensity NOTIFY fadeIntensityChanged) 70 | Q_PROPERTY(int period READ period WRITE setPeriod NOTIFY periodChanged) 71 | Q_PROPERTY(QDeclarativeFeedbackActuator* actuator READ actuator WRITE setActuator NOTIFY actuatorChanged) 72 | 73 | public: 74 | explicit QDeclarativeHapticsEffect(QObject *parent = 0); 75 | 76 | void setDuration(int msecs); 77 | int duration() const; 78 | void setIntensity(qreal intensity); 79 | qreal intensity() const; 80 | //the envelope 81 | void setAttackTime(int msecs); 82 | int attackTime() const; 83 | void setAttackIntensity(qreal intensity); 84 | qreal attackIntensity() const; 85 | void setFadeTime(int msecs); 86 | int fadeTime() const; 87 | void setFadeIntensity(qreal intensity); 88 | qreal fadeIntensity() const; 89 | void setPeriod(int msecs); 90 | int period() const; 91 | void setActuator(QDeclarativeFeedbackActuator *actuator); 92 | QDeclarativeFeedbackActuator* actuator() const; 93 | QQmlListProperty availableActuators(); 94 | static int actuator_count(QQmlListProperty *prop); 95 | static QDeclarativeFeedbackActuator *actuator_at(QQmlListProperty *prop, int index); 96 | 97 | signals: 98 | void intensityChanged(); 99 | void attackTimeChanged(); 100 | void attackIntensityChanged(); 101 | void fadeTimeChanged(); 102 | void fadeIntensityChanged(); 103 | void periodChanged(); 104 | void actuatorChanged(); 105 | 106 | private: 107 | QFeedbackHapticsEffect* d; 108 | QList m_actuators; 109 | QDeclarativeFeedbackActuator* m_actuator; 110 | }; 111 | 112 | QML_DECLARE_TYPE(QDeclarativeHapticsEffect) 113 | 114 | #endif // QDECLARATIVEHAPTICSEFFECT_P_H 115 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativethemeeffect.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qdeclarativethemeeffect_p.h" 41 | /*! 42 | \qmltype ThemeEffect 43 | \brief The ThemeEffect element represents a themed feedback effect. 44 | \ingroup qml-feedback-api 45 | 46 | This element is used for playing feedback effects that follow the 47 | system theme. The actual feedback might be haptic, audio or some other 48 | method. 49 | 50 | \snippet doc/src/snippets/declarative/declarative-feedback.qml Theme 51 | */ 52 | QDeclarativeThemeEffect::QDeclarativeThemeEffect(QObject *parent) 53 | : QObject(parent), 54 | m_effect(QDeclarativeThemeEffect::Undefined) 55 | { 56 | } 57 | 58 | /*! 59 | \qmlproperty bool ThemeEffect::supported 60 | 61 | This property is true if the system supports themed feedback effects. 62 | */ 63 | bool QDeclarativeThemeEffect::effectSupported() { 64 | return QFeedbackEffect::supportsThemeEffect(); 65 | } 66 | 67 | /*! 68 | \qmlproperty ThemeEffect ThemeEffect::effect 69 | 70 | This property holds the specific themed effect type to play. It is one of: 71 | 72 | \li Effect.Undefined - Undefined feedback. No feedback is given. 73 | \li Effect.Press - Feedback for when the screen is pressed. 74 | \li Effect.Release - Feedback for touch release. 75 | \li Effect.PressWeak - A weak feedback for press. 76 | \li Effect.ReleaseWeak - A weak feedback for release. 77 | \li Effect.PressStrong - A strong feedback for press. 78 | \li Effect.ReleaseStrong - A strong feedback for release. 79 | \li Effect.DragStart - Feedback for when dragging starts. 80 | \li Effect.DragDropInZone - Feedback for when dragging ends and touch is released inside a drop zone. 81 | \li Effect.DragDropOutOfZone - Feedback for when dragging ends and touch is released outside a drop zone. 82 | \li Effect.DragCrossBoundary - Feedback for when crossing a boundary while dragging. 83 | \li Effect.Appear - Feedback for when an item is shown. 84 | \li Effect.Disappear - Feedback for when an item item is closed. 85 | \li Effect.Move - Feedback for dragging on screen. 86 | \endlist 87 | 88 | \sa QFeedbackEffect::Effect 89 | */ 90 | void QDeclarativeThemeEffect::setEffect(QDeclarativeThemeEffect::Effect effect) 91 | { 92 | if (m_effect != effect) { 93 | m_effect = effect; 94 | emit effectChanged(); 95 | } 96 | } 97 | 98 | QDeclarativeThemeEffect::Effect QDeclarativeThemeEffect::effect() const 99 | { 100 | return m_effect; 101 | } 102 | 103 | /*! 104 | \qmlmethod ThemeEffect::play() 105 | 106 | Call this to play the themed effect. 107 | */ 108 | void QDeclarativeThemeEffect::play() 109 | { 110 | QFeedbackEffect::playThemeEffect(static_cast(m_effect)); 111 | } 112 | 113 | /*! 114 | \qmlmethod ThemeEffect::play(Effect) 115 | 116 | Call this to play the themed effect passed as parameter. 117 | 118 | */ 119 | void QDeclarativeThemeEffect::play(Effect effect) 120 | { 121 | QFeedbackEffect::playThemeEffect(static_cast(effect)); 122 | } 123 | -------------------------------------------------------------------------------- /src/imports/feedback/plugins.qmltypes: -------------------------------------------------------------------------------- 1 | import QtQuick.tooling 1.1 2 | 3 | // This file describes the plugin-supplied types contained in the library. 4 | // It is used for QML tooling purposes only. 5 | // 6 | // This file was auto-generated with the command 'qmlplugindump -notrelocatable QtFeedback 5.0'. 7 | 8 | Module { 9 | Component { 10 | name: "QDeclarativeFeedbackActuator" 11 | prototype: "QObject" 12 | exports: ["QtFeedback/Actuator 5.0"] 13 | exportMetaObjectRevisions: [0] 14 | Enum { 15 | name: "Capability" 16 | values: { 17 | "Envelope": 0, 18 | "Period": 1 19 | } 20 | } 21 | Enum { 22 | name: "State" 23 | values: { 24 | "Busy": 0, 25 | "Ready": 1, 26 | "Unknown": 2 27 | } 28 | } 29 | Property { name: "actuatorId"; type: "int"; isReadonly: true } 30 | Property { name: "name"; type: "string"; isReadonly: true } 31 | Property { name: "state"; type: "State"; isReadonly: true } 32 | Property { name: "valid"; type: "bool"; isReadonly: true } 33 | Property { name: "enabled"; type: "bool" } 34 | Method { 35 | name: "isCapabilitySupported" 36 | type: "bool" 37 | Parameter { name: "capability"; type: "Capability" } 38 | } 39 | } 40 | Component { 41 | name: "QDeclarativeFeedbackEffect" 42 | prototype: "QObject" 43 | exports: ["QtFeedback/Feedback 5.0", "QtFeedback/FeedbackEffect 5.0"] 44 | exportMetaObjectRevisions: [0, 0] 45 | Enum { 46 | name: "Duration" 47 | values: { 48 | "Infinite": -1 49 | } 50 | } 51 | Enum { 52 | name: "State" 53 | values: { 54 | "Stopped": 0, 55 | "Paused": 1, 56 | "Running": 2, 57 | "Loading": 3 58 | } 59 | } 60 | Enum { 61 | name: "ErrorType" 62 | values: { 63 | "UnknownError": 0, 64 | "DeviceBusy": 1 65 | } 66 | } 67 | Property { name: "running"; type: "bool" } 68 | Property { name: "paused"; type: "bool" } 69 | Property { name: "duration"; type: "int" } 70 | Property { name: "state"; type: "State" } 71 | Property { name: "error"; type: "ErrorType"; isReadonly: true } 72 | Method { name: "updateState" } 73 | Method { name: "start" } 74 | Method { name: "stop" } 75 | Method { name: "pause" } 76 | } 77 | Component { 78 | name: "QDeclarativeFileEffect" 79 | prototype: "QDeclarativeFeedbackEffect" 80 | exports: ["QtFeedback/FileEffect 5.0"] 81 | exportMetaObjectRevisions: [0] 82 | Property { name: "loaded"; type: "bool" } 83 | Property { name: "source"; type: "QUrl" } 84 | Property { name: "supportedMimeTypes"; type: "QStringList"; isReadonly: true } 85 | Method { name: "load" } 86 | Method { name: "unload" } 87 | } 88 | Component { 89 | name: "QDeclarativeHapticsEffect" 90 | prototype: "QDeclarativeFeedbackEffect" 91 | exports: ["QtFeedback/HapticsEffect 5.0"] 92 | exportMetaObjectRevisions: [0] 93 | Property { 94 | name: "availableActuators" 95 | type: "QDeclarativeFeedbackActuator" 96 | isList: true 97 | isReadonly: true 98 | } 99 | Property { name: "intensity"; type: "double" } 100 | Property { name: "attackTime"; type: "int" } 101 | Property { name: "attackIntensity"; type: "double" } 102 | Property { name: "fadeTime"; type: "int" } 103 | Property { name: "fadeIntensity"; type: "double" } 104 | Property { name: "period"; type: "int" } 105 | Property { name: "actuator"; type: "QDeclarativeFeedbackActuator"; isPointer: true } 106 | } 107 | Component { 108 | name: "QDeclarativeThemeEffect" 109 | prototype: "QObject" 110 | exports: ["QtFeedback/EffectPlayer 5.0", "QtFeedback/ThemeEffect 5.0"] 111 | exportMetaObjectRevisions: [0, 0] 112 | Enum { 113 | name: "Effect" 114 | values: { 115 | "Undefined": -1, 116 | "Press": 0, 117 | "Release": 1, 118 | "PressWeak": 2, 119 | "ReleaseWeak": 3, 120 | "PressStrong": 4, 121 | "ReleaseStrong": 5, 122 | "DragStart": 6, 123 | "DragDropInZone": 7, 124 | "DragDropOutOfZone": 8, 125 | "DragCrossBoundary": 9, 126 | "Appear": 10, 127 | "Disappear": 11, 128 | "Move": 12, 129 | "NumberOfEffects": 13, 130 | "UserEffect": 65535 131 | } 132 | } 133 | Property { name: "supported"; type: "bool"; isReadonly: true } 134 | Property { name: "effect"; type: "Effect" } 135 | Method { name: "play" } 136 | Method { 137 | name: "play" 138 | Parameter { name: "effect"; type: "Effect" } 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/feedback/qfeedbackplugininterfaces.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QFEEDBACKPLUGIN_H 41 | #define QFEEDBACKPLUGIN_H 42 | 43 | #include 44 | #include 45 | 46 | QT_BEGIN_HEADER 47 | QT_BEGIN_NAMESPACE 48 | 49 | class Q_FEEDBACK_EXPORT QFeedbackInterface 50 | { 51 | public: 52 | enum PluginPriority { 53 | PluginLowPriority, 54 | PluginNormalPriority, 55 | PluginHighPriority 56 | }; 57 | 58 | protected: 59 | static void reportError(const QFeedbackEffect *, QFeedbackEffect::ErrorType); 60 | }; 61 | 62 | class Q_FEEDBACK_EXPORT QFeedbackHapticsInterface : public QFeedbackInterface 63 | { 64 | public: 65 | //going with enums allow more flexibility without breaking BC 66 | enum EffectProperty { 67 | Duration, 68 | Intensity, 69 | AttackTime, 70 | AttackIntensity, 71 | FadeTime, 72 | FadeIntensity, 73 | Period //optional 74 | }; 75 | 76 | enum ActuatorProperty { 77 | Name, 78 | State, 79 | Enabled 80 | }; 81 | 82 | //static members for actuators management 83 | virtual QList actuators() = 0; 84 | virtual ~QFeedbackHapticsInterface() {} 85 | 86 | virtual PluginPriority pluginPriority() = 0; 87 | 88 | //for actuator handling 89 | virtual void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &) = 0; 90 | virtual QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty) = 0; 91 | virtual bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability) = 0; 92 | 93 | //effects 94 | virtual void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty) = 0; 95 | virtual void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State) = 0; 96 | virtual QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *) = 0; 97 | 98 | static QFeedbackHapticsInterface *instance(); 99 | 100 | protected: 101 | //utility function for the backends 102 | QFeedbackActuator* createFeedbackActuator(QObject* parent, int id); 103 | }; 104 | 105 | class QFeedbackThemeInterface : public QFeedbackInterface 106 | { 107 | public: 108 | virtual ~QFeedbackThemeInterface() {} 109 | virtual PluginPriority pluginPriority() = 0; 110 | virtual bool play(QFeedbackEffect::Effect) = 0; 111 | static QFeedbackThemeInterface *instance(); 112 | }; 113 | 114 | class Q_FEEDBACK_EXPORT QFeedbackFileInterface : public QFeedbackInterface 115 | { 116 | public: 117 | virtual ~QFeedbackFileInterface() {} 118 | virtual void setLoaded(QFeedbackFileEffect*, bool) = 0; 119 | virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State) = 0; 120 | virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *) = 0; 121 | virtual int effectDuration(const QFeedbackFileEffect*) = 0; 122 | virtual QStringList supportedMimeTypes() = 0; 123 | 124 | static QFeedbackFileInterface *instance(); 125 | 126 | protected: 127 | static void reportLoadFinished(QFeedbackFileEffect*, bool success); 128 | }; 129 | 130 | Q_DECLARE_INTERFACE(QFeedbackHapticsInterface, "com.nokia.qt.QFeedbackHapticsInterface/1.0") 131 | Q_DECLARE_INTERFACE(QFeedbackThemeInterface, "com.nokia.qt.QFeedbackThemeInterface/1.0") 132 | Q_DECLARE_INTERFACE(QFeedbackFileInterface, "com.nokia.qt.QFeedbackFileInterface/1.0") 133 | 134 | QT_END_NAMESPACE 135 | QT_END_HEADER 136 | 137 | #endif // QFEEDBACKPLUGININTERFACES_H 138 | -------------------------------------------------------------------------------- /src/plugins/feedback/immersion/qfeedback.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | // 41 | // W A R N I N G 42 | // ------------- 43 | // 44 | // This file is not part of the Qt API. It exists for the convenience 45 | // of Qt Feedback framework. This header file may change from version 46 | // to version without notice, or even be removed. 47 | // 48 | // We mean it. 49 | // 50 | // 51 | 52 | #ifndef QFEEDBACK_IMMERSION_H 53 | #define QFEEDBACK_IMMERSION_H 54 | 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | 62 | #include 63 | 64 | #include 65 | 66 | QT_BEGIN_HEADER 67 | QT_USE_NAMESPACE 68 | 69 | class QFeedbackImmersion : public QObject, public QFeedbackHapticsInterface, public QFeedbackFileInterface 70 | { 71 | Q_OBJECT 72 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackPlugin" FILE "immersion.json") 73 | 74 | Q_INTERFACES(QTM_NAMESPACE::QFeedbackHapticsInterface) 75 | Q_INTERFACES(QTM_NAMESPACE::QFeedbackFileInterface) 76 | 77 | public: 78 | QFeedbackImmersion(); 79 | virtual ~QFeedbackImmersion(); 80 | 81 | virtual PluginPriority pluginPriority(); 82 | 83 | virtual QList actuators(); 84 | 85 | //for actuator handling 86 | virtual void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &); 87 | virtual QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty); 88 | virtual bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability); 89 | 90 | virtual void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty); 91 | virtual void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State); 92 | virtual QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *); 93 | 94 | //for loading files 95 | virtual void setLoaded(QFeedbackFileEffect*, bool); 96 | virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State); 97 | virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *); 98 | virtual int effectDuration(const QFeedbackFileEffect *); 99 | virtual QStringList supportedMimeTypes(); 100 | 101 | private: 102 | VibeInt32 handleForActuator(const QFeedbackActuator &actuator); 103 | VibeInt32 handleForActuator(int actId); 104 | static VibeInt32 convertedDuration(int duration); 105 | QFeedbackEffect::State updateImmState(const QFeedbackEffect *effect, VibeInt32 effectHandle, VibeInt32 state); 106 | 107 | void killTimerForHandle(VibeInt32 handle); 108 | void startTimerForHandle(VibeInt32 handle, const QFeedbackHapticsEffect* effect); 109 | void startTimerForHandle(VibeInt32 handle, QFeedbackFileEffect* effect); 110 | 111 | QMutex mutex; 112 | QVector actuatorHandles; 113 | QList actuatorList; 114 | QHash effectHandles; 115 | QHash effectTimers; 116 | 117 | struct FileContent { 118 | FileContent() : refCount(0) { } 119 | FileContent(const QByteArray &arr) : ba(arr), refCount(1) { } 120 | const VibeUInt8 *constData() const {return reinterpret_cast(ba.constData()); } 121 | 122 | QByteArray ba; 123 | int refCount; 124 | }; 125 | QHash fileData; 126 | }; 127 | 128 | QT_END_HEADER 129 | 130 | #endif // QFEEDBACK_IMMERSION_H 131 | -------------------------------------------------------------------------------- /src/imports/feedback/qdeclarativefeedbackactuator.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #include "qdeclarativefeedbackactuator_p.h" 41 | 42 | /*! 43 | \qmltype Actuator 44 | \instantiates QFeedbackActuator 45 | \brief The Actuator element represents a feedback actuator. 46 | \ingroup qml-feedback-api 47 | 48 | The Actuator class maps directly to the QFeedbackActuator C++ class, and 49 | can be used with HapticsEffect elements. 50 | 51 | There are several predefined enumerations and constants provided in this object: 52 | 53 | 1. Capability 54 | \list 55 | \li Envelope - Value specifying that the device can bound its intensity by an envelope. 56 | \li Period - Value specifying that the device can play periodic effects. 57 | \endlist 58 | 59 | 2. State 60 | \list 61 | \li Busy - The actuator is busy. 62 | \li Ready - The actuator is ready to play an effect. 63 | \li Unknown - The actuator is in an unknown state. 64 | \endlist 65 | 66 | \sa HapticsEffect, {QFeedbackActuator} 67 | */ 68 | QDeclarativeFeedbackActuator::QDeclarativeFeedbackActuator(QObject *parent) 69 | :QObject(parent) 70 | { 71 | d = new QFeedbackActuator(this); 72 | connect(d, SIGNAL(enabledChanged()), this, SIGNAL(enabledChanged())); 73 | } 74 | 75 | QDeclarativeFeedbackActuator::QDeclarativeFeedbackActuator(QObject *parent, QFeedbackActuator* actuator) 76 | :QObject(parent) 77 | { 78 | d = actuator; 79 | connect(d, SIGNAL(enabledChanged()), this, SIGNAL(enabledChanged())); 80 | } 81 | 82 | QFeedbackActuator* QDeclarativeFeedbackActuator::feedbackActuator() const 83 | { 84 | return d; 85 | } 86 | 87 | /*! 88 | \qmlproperty int Actuator::actuatorId 89 | This property holds the id of the feedback actuator. 90 | This property is read only. 91 | */ 92 | int QDeclarativeFeedbackActuator::actuatorId() const 93 | { 94 | return d->id(); 95 | } 96 | 97 | /*! 98 | \qmlproperty bool Actuator::valid 99 | 100 | This property is true if the actuator is valid. 101 | This property is read only. 102 | */ 103 | bool QDeclarativeFeedbackActuator::isValid() const 104 | { 105 | return d->isValid(); 106 | } 107 | /*! 108 | \qmlproperty string Actuator::name 109 | This property holds the name of the feedback actuator. 110 | This property is read only. 111 | */ 112 | QString QDeclarativeFeedbackActuator::name() const 113 | { 114 | return d->name(); 115 | } 116 | 117 | /*! 118 | \qmlproperty enumeration Actuator::state 119 | This property holds the state of the feedback actuator. 120 | This property is read only. 121 | */ 122 | QDeclarativeFeedbackActuator::State QDeclarativeFeedbackActuator::state() const 123 | { 124 | return static_cast(d->state()); 125 | } 126 | 127 | /*! 128 | \qmlmethod bool Actuator::isCapabilitySupported(enumeration capability) 129 | Returns if the actuator supports the supplied \a capability, available capabilities are: 130 | \list 131 | \li Envelope - Value specifying that the device can bound its intensity by an Envelope. 132 | \li Period - Value specifying that the device can play periodic effects. 133 | \endlist 134 | */ 135 | bool QDeclarativeFeedbackActuator::isCapabilitySupported(Capability capability) const 136 | { 137 | return d->isCapabilitySupported(static_cast(capability)); 138 | } 139 | /*! 140 | \qmlproperty bool Actuator::enabled 141 | This property is true if the feedback actuator is enabled. 142 | */ 143 | 144 | bool QDeclarativeFeedbackActuator::isEnabled() const 145 | { 146 | return d->isEnabled(); 147 | } 148 | void QDeclarativeFeedbackActuator::setEnabled(bool v) 149 | { 150 | d->setEnabled(v); 151 | } 152 | -------------------------------------------------------------------------------- /src/feedback/qfeedbackeffect.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:LGPL$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU Lesser General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the 21 | ** packaging of this file. Please review the following information to 22 | ** ensure the GNU Lesser General Public License version 3 requirements 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 24 | ** 25 | ** GNU General Public License Usage 26 | ** Alternatively, this file may be used under the terms of the GNU 27 | ** General Public License version 2.0 or (at your option) the GNU General 28 | ** Public license version 3 or any later version approved by the KDE Free 29 | ** Qt Foundation. The licenses are as published by the Free Software 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 31 | ** included in the packaging of this file. Please review the following 32 | ** information to ensure the GNU General Public License requirements will 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. 35 | ** 36 | ** $QT_END_LICENSE$ 37 | ** 38 | ****************************************************************************/ 39 | 40 | #ifndef QFEEDBACKEFFECT_H 41 | #define QFEEDBACKEFFECT_H 42 | 43 | #include "qfeedbackglobal.h" 44 | 45 | #include 46 | #include 47 | #include 48 | 49 | QT_BEGIN_HEADER 50 | QT_BEGIN_NAMESPACE 51 | 52 | class QFeedbackActuator; 53 | class QFeedbackFileEffectPrivate; 54 | class QFeedbackHapticsEffectPrivate; 55 | 56 | class Q_FEEDBACK_EXPORT QFeedbackEffect : public QObject 57 | { 58 | Q_OBJECT 59 | Q_ENUMS(Effect) 60 | Q_ENUMS(Duration) 61 | Q_ENUMS(State) 62 | Q_ENUMS(ErrorType) 63 | 64 | Q_PROPERTY(int duration READ duration) 65 | Q_PROPERTY(State state READ state NOTIFY stateChanged) 66 | 67 | public: 68 | // Make sure these are kept up to date with the declarative version 69 | enum Effect { 70 | Undefined = -1, Press, Release, PressWeak, ReleaseWeak, PressStrong, ReleaseStrong, DragStart, 71 | DragDropInZone, DragDropOutOfZone, DragCrossBoundary, Appear, Disappear, Move, 72 | NumberOfEffects, 73 | UserEffect = 65535 74 | }; 75 | 76 | enum Duration { 77 | Infinite = -1 78 | }; 79 | 80 | enum State { 81 | Stopped, 82 | Paused, 83 | Running, 84 | Loading 85 | }; 86 | 87 | enum ErrorType { 88 | UnknownError, 89 | DeviceBusy 90 | }; 91 | 92 | explicit QFeedbackEffect(QObject *parent = Q_NULLPTR); 93 | 94 | virtual State state() const = 0; 95 | virtual int duration() const = 0; 96 | 97 | //for themes 98 | static bool supportsThemeEffect(); 99 | static bool playThemeEffect(Effect effect); 100 | 101 | public Q_SLOTS: 102 | void start(); 103 | void stop(); 104 | void pause(); 105 | 106 | protected: 107 | virtual void setState(State) = 0; 108 | 109 | Q_SIGNALS: 110 | void error(QFeedbackEffect::ErrorType) const; //when an error occurs 111 | void stateChanged(); 112 | 113 | private: 114 | friend class QFeedbackInterface; 115 | }; 116 | 117 | class Q_FEEDBACK_EXPORT QFeedbackHapticsEffect : public QFeedbackEffect 118 | { 119 | Q_OBJECT 120 | 121 | Q_PROPERTY(int duration READ duration WRITE setDuration) 122 | Q_PROPERTY(qreal intensity READ intensity WRITE setIntensity) 123 | Q_PROPERTY(int attackTime READ attackTime WRITE setAttackTime) 124 | Q_PROPERTY(qreal attackIntensity READ attackIntensity WRITE setAttackIntensity) 125 | Q_PROPERTY(int fadeTime READ fadeTime WRITE setFadeTime) 126 | Q_PROPERTY(qreal fadeIntensity READ fadeIntensity WRITE setFadeIntensity) 127 | Q_PROPERTY(int period READ period WRITE setPeriod) 128 | Q_PROPERTY(QFeedbackActuator* actuator READ actuator WRITE setActuator) 129 | 130 | public: 131 | explicit QFeedbackHapticsEffect(QObject *parent = Q_NULLPTR); 132 | ~QFeedbackHapticsEffect(); 133 | 134 | void setDuration(int msecs); 135 | int duration() const; 136 | 137 | void setIntensity(qreal intensity); 138 | qreal intensity() const; 139 | 140 | //the envelope 141 | void setAttackTime(int msecs); 142 | int attackTime() const; 143 | 144 | void setAttackIntensity(qreal intensity); 145 | qreal attackIntensity() const; 146 | 147 | void setFadeTime(int msecs); 148 | int fadeTime() const; 149 | 150 | void setFadeIntensity(qreal intensity); 151 | qreal fadeIntensity() const; 152 | 153 | void setPeriod(int msecs); 154 | int period() const; 155 | 156 | void setActuator(QFeedbackActuator *actuator); 157 | QFeedbackActuator* actuator() const; 158 | 159 | //reimplementations from QFeedbackEffect 160 | virtual State state() const; 161 | 162 | protected: 163 | virtual void setState(State); 164 | 165 | private: 166 | Q_DISABLE_COPY(QFeedbackHapticsEffect) 167 | friend class QFeedbackHapticsEffectPrivate; 168 | QScopedPointer priv; 169 | }; 170 | 171 | class Q_FEEDBACK_EXPORT QFeedbackFileEffect : public QFeedbackEffect 172 | { 173 | Q_OBJECT 174 | 175 | Q_PROPERTY(bool loaded READ isLoaded WRITE setLoaded) 176 | Q_PROPERTY(QUrl source READ source WRITE setSource) 177 | 178 | public: 179 | explicit QFeedbackFileEffect(QObject *parent = Q_NULLPTR); 180 | ~QFeedbackFileEffect(); 181 | 182 | int duration() const; 183 | 184 | bool isLoaded() const; 185 | 186 | void load(); 187 | void unload(); 188 | void setLoaded(bool); 189 | 190 | QUrl source() const; 191 | void setSource(const QUrl &); 192 | 193 | static QStringList supportedMimeTypes(); 194 | 195 | //reimplementations from QFeedbackEffect 196 | virtual State state() const; 197 | 198 | protected: 199 | virtual void setState(State); 200 | 201 | private: 202 | Q_DISABLE_COPY(QFeedbackFileEffect) 203 | friend class QFeedbackFileEffectPrivate; 204 | QScopedPointer priv; 205 | }; 206 | 207 | QT_END_NAMESPACE 208 | QT_END_HEADER 209 | 210 | #endif // QFEEDBACKEFFECT_H 211 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/testplugin/qfeedbacktestplugin.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | #include 30 | #include "qfeedbacktestplugin.h" 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | QFeedbackTestPlugin::QFeedbackTestPlugin() 40 | : QObject(qApp), mHapticState(QFeedbackEffect::Stopped), mFileState(QFeedbackEffect::Stopped) 41 | { 42 | actuators_ << createFeedbackActuator(this, 0) << createFeedbackActuator(this, 1); 43 | } 44 | 45 | QFeedbackTestPlugin::~QFeedbackTestPlugin() 46 | { 47 | } 48 | 49 | QFeedbackInterface::PluginPriority QFeedbackTestPlugin::pluginPriority() 50 | { 51 | return PluginHighPriority; // to make sure we get used 52 | } 53 | 54 | QList QFeedbackTestPlugin::actuators() 55 | { 56 | return actuators_; 57 | } 58 | 59 | void QFeedbackTestPlugin::setActuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop, const QVariant &value) 60 | { 61 | Q_UNUSED(actuator) 62 | Q_UNUSED(prop) 63 | Q_UNUSED(value) 64 | } 65 | 66 | QVariant QFeedbackTestPlugin::actuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop) 67 | { 68 | Q_UNUSED(actuator) 69 | 70 | switch (prop) { 71 | case Name: 72 | if (actuator.id() == 0) 73 | return QString(QLatin1String("test plugin")); 74 | else 75 | return QString(QLatin1String("5555")); 76 | 77 | case State: 78 | return static_cast(QFeedbackActuator::Unknown); 79 | 80 | case Enabled: 81 | return false; 82 | default: 83 | break; 84 | } 85 | 86 | return QVariant(); 87 | } 88 | 89 | bool QFeedbackTestPlugin::isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability cap) 90 | { 91 | switch (cap) { 92 | case QFeedbackActuator::Envelope: 93 | case QFeedbackActuator::Period: 94 | return true; 95 | default: 96 | break; 97 | } 98 | 99 | return false; 100 | } 101 | 102 | QTimer* QFeedbackTestPlugin::ensureTimer(const QFeedbackHapticsEffect* effect) 103 | { 104 | // Yes, this is slow 105 | QTimer *t = mHapticEffects.key(effect); 106 | if (!t) { 107 | t = new QTimer(); 108 | t->setSingleShot(true); 109 | t->setInterval(effect->duration()); 110 | connect(t, SIGNAL(timeout()), this, SLOT(timerExpired())); 111 | mHapticEffects.insert(t, effect); 112 | } 113 | return t; 114 | } 115 | 116 | 117 | void QFeedbackTestPlugin::updateEffectProperty(const QFeedbackHapticsEffect *effect, EffectProperty ep) 118 | { 119 | if (ep == QFeedbackHapticsInterface::Duration) { 120 | QTimer* t = ensureTimer(effect); 121 | t->setInterval(effect->duration()); 122 | } 123 | } 124 | 125 | void QFeedbackTestPlugin::setEffectState(const QFeedbackHapticsEffect *effect, QFeedbackEffect::State state) 126 | { 127 | Q_UNUSED(effect) 128 | if (mHapticState != state) { 129 | mHapticState = state; 130 | QTimer* t = ensureTimer(effect); 131 | if (mHapticState == QFeedbackEffect::Running) { 132 | t->start(); 133 | } else if (mHapticState == QFeedbackEffect::Stopped) { 134 | t->stop(); 135 | } else if (mHapticState == QFeedbackEffect::Paused) { 136 | // In theory should set the duration to the remainder... 137 | t->stop(); 138 | } 139 | } 140 | } 141 | 142 | QFeedbackEffect::State QFeedbackTestPlugin::effectState(const QFeedbackHapticsEffect *effect) 143 | { 144 | Q_UNUSED(effect) 145 | return mHapticState; 146 | } 147 | 148 | void QFeedbackTestPlugin::timerExpired() 149 | { 150 | mHapticState = QFeedbackEffect::Stopped; 151 | // Emit the stateChanged signal 152 | const QFeedbackHapticsEffect* effect = mHapticEffects.value(static_cast(sender())); 153 | if (effect) { 154 | QMetaObject::invokeMethod(const_cast(effect), "stateChanged"); 155 | } 156 | } 157 | 158 | 159 | 160 | void QFeedbackTestPlugin::setLoaded(QFeedbackFileEffect *effect, bool load) 161 | { 162 | if (effect->source() == QUrl("load")) { 163 | // Succeed the load 164 | if (load) { 165 | mFileState = QFeedbackEffect::Loading; 166 | reportLoadFinished(effect, true); // not strictly true 167 | } else 168 | mFileState = QFeedbackEffect::Stopped; 169 | } else { 170 | // Fail the load 171 | if (load) 172 | reportLoadFinished(effect, false); 173 | } 174 | } 175 | 176 | void QFeedbackTestPlugin::setEffectState(QFeedbackFileEffect *effect, QFeedbackEffect::State state) 177 | { 178 | Q_UNUSED(effect) 179 | if (effect->source() == QUrl("load")) // we only change state for good effects 180 | mFileState = state; 181 | } 182 | 183 | QFeedbackEffect::State QFeedbackTestPlugin::effectState(const QFeedbackFileEffect *effect) 184 | { 185 | Q_UNUSED(effect) 186 | return mFileState; 187 | } 188 | 189 | int QFeedbackTestPlugin::effectDuration(const QFeedbackFileEffect *effect) 190 | { 191 | Q_UNUSED(effect) 192 | return 5678; 193 | } 194 | 195 | QStringList QFeedbackTestPlugin::supportedMimeTypes() 196 | { 197 | return QStringList() << "x-test/this is a test"; 198 | } 199 | 200 | bool QFeedbackTestPlugin::play(QFeedbackEffect::Effect effect) 201 | { 202 | if (effect == QFeedbackEffect::Press) 203 | return true; 204 | else { 205 | reportError(0, QFeedbackEffect::UnknownError); 206 | return false; 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /doc/src/snippets/declarative/declarative-feedback.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the documentation of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | 52 | import QtQuick 2.0 53 | 54 | Rectangle { 55 | id: page 56 | width: 800 57 | height: 350 58 | color: "olive" 59 | 60 | //![File Effect] 61 | import QtFeedback 5.0 62 | 63 | FileEffect { 64 | id: myFileEffect 65 | loaded: false 66 | source: "file:///myfile.ivs" 67 | } 68 | 69 | MouseArea { 70 | onClicked: myFileEffect.start(); 71 | } 72 | 73 | //![File Effect] 74 | 75 | //![Haptics Effect] 76 | 77 | import QtFeedback 5.0 78 | 79 | HapticsEffect { 80 | id: rumbleEffect 81 | attackIntensity: 0.0 82 | attackTime: 250 83 | intensity: 1.0 84 | duration: 100 85 | fadeTime: 250 86 | fadeIntensity: 0.0 87 | } 88 | MouseArea { 89 | onClicked: { 90 | rumbleEffect.start(); // plays a rumble effect 91 | } 92 | 93 | //![Haptics Effect] 94 | 95 | //![Theme] 96 | //Example 1: using ThemeEffect declaring element 97 | 98 | import QtFeedback 5.0 99 | 100 | Rectangle { 101 | width: 180; height: 20 102 | radius:5 103 | color: "lightgrey" 104 | Text { 105 | anchors.centerIn: parent 106 | text: "Play Theme: Press" 107 | } 108 | ThemeEffect { 109 | id: myOtherThemeEffect 110 | effect: "Press" 111 | } 112 | MouseArea { 113 | anchors.fill: parent 114 | onClicked: { 115 | myOtherThemeEffect.play(); 116 | } 117 | } 118 | } 119 | 120 | //Example 2: using ThemeEffect without declaring element 121 | 122 | import QtFeedback.ThemeEffect 5.0 as Effect 123 | 124 | Rectangle { 125 | width: 180; height: 20 126 | radius:5 127 | color: "lightgrey" 128 | Text { 129 | anchors.centerIn: parent 130 | text: "Play Theme: Press" 131 | } 132 | MouseArea { 133 | anchors.fill: parent 134 | onClicked: { 135 | Effect.effect = "Press" 136 | Effect.play(); 137 | } 138 | } 139 | } 140 | 141 | //Example 3: using ThemeEffect without declaring element and calling overloaded play function 142 | 143 | import QtFeedback.ThemeEffect 5.0 as Effect 144 | 145 | Rectangle { 146 | width: 180; height: 20 147 | radius:5 148 | color: "lightgrey" 149 | Text { 150 | anchors.centerIn: parent 151 | text: "Play Theme: Press" 152 | } 153 | MouseArea { 154 | anchors.fill: parent 155 | onClicked: { 156 | Effect.play(Effect.Press) 157 | } 158 | } 159 | } 160 | 161 | //![Theme] 162 | 163 | //! [Play the system theme button click effect] 164 | import QtFeedback.ThemeEffect 5.0 as Effect 165 | 166 | Rectangle { 167 | width: 180; height: 20 168 | radius:5 169 | color: "lightgrey" 170 | Text { 171 | anchors.centerIn: parent 172 | text: "Play Theme: Press" 173 | } 174 | MouseArea { 175 | anchors.fill: parent 176 | onClicked: { 177 | Effect.play(Effect.Press) 178 | } 179 | } 180 | } 181 | //! [Play the system theme button click effect] 182 | 183 | //! [Start playing a custom haptic effect] 184 | rumble.start(); 185 | //! [Start playing a custom haptic effect] 186 | 187 | //! [Pause a custom haptic effect] 188 | rumble.pause(); 189 | //! [Pause a custom haptic effect] 190 | 191 | //! [Stop playing a custom haptic effect] 192 | rumble.stop(); 193 | //! [Stop playing a custom haptic effect] 194 | 195 | //! [Query the state of a custom haptic effect] 196 | if (rumble.state === Feedback.Stopped) 197 | console.log("The device has stopped rumbling.") 198 | //! [Query the state of a custom haptic effect] 199 | 200 | //! [Set the actuator which should play the custom effect] 201 | for (var i = 0; rumble.availableActuators[i]; i++) { 202 | if (rumble.availableActuators[i].name === "ExampleActuatorName") { 203 | rumble.actuator = rumble.availableActuators[i] 204 | } 205 | } 206 | //! [Set the actuator which should play the custom effect] 207 | -------------------------------------------------------------------------------- /tests/auto/qfeedbackplugin/unittest/tst_qfeedbackplugin.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2016 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the QtFeedback module of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** GNU General Public License Usage 18 | ** Alternatively, this file may be used under the terms of the GNU 19 | ** General Public License version 3 as published by the Free Software 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 21 | ** included in the packaging of this file. Please review the following 22 | ** information to ensure the GNU General Public License requirements will 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 24 | ** 25 | ** $QT_END_LICENSE$ 26 | ** 27 | ****************************************************************************/ 28 | 29 | //TESTED_COMPONENT=src/feedback 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | QT_USE_NAMESPACE 37 | 38 | class tst_QFeedbackPlugin : public QObject 39 | { 40 | Q_OBJECT 41 | public: 42 | tst_QFeedbackPlugin(); 43 | ~tst_QFeedbackPlugin(); 44 | 45 | public slots: 46 | void initTestCase(); 47 | void cleanupTestCase(); 48 | void init(); 49 | void cleanup(); 50 | 51 | private slots: 52 | void testPlugin(); 53 | void testFileEffect(); 54 | void testThemeEffect(); 55 | }; 56 | 57 | tst_QFeedbackPlugin::tst_QFeedbackPlugin() 58 | { 59 | } 60 | 61 | tst_QFeedbackPlugin::~tst_QFeedbackPlugin() 62 | { 63 | } 64 | 65 | void tst_QFeedbackPlugin::initTestCase() 66 | { 67 | } 68 | 69 | void tst_QFeedbackPlugin::cleanupTestCase() 70 | { 71 | } 72 | 73 | void tst_QFeedbackPlugin::init() 74 | { 75 | } 76 | 77 | void tst_QFeedbackPlugin::cleanup() 78 | { 79 | } 80 | 81 | void tst_QFeedbackPlugin::testThemeEffect() 82 | { 83 | QVERIFY(QFeedbackEffect::supportsThemeEffect()); 84 | QVERIFY(QFeedbackEffect::playThemeEffect(QFeedbackEffect::Press)); 85 | QVERIFY(!QFeedbackEffect::playThemeEffect(QFeedbackEffect::Release)); 86 | } 87 | 88 | void tst_QFeedbackPlugin::testFileEffect() 89 | { 90 | QFeedbackFileEffect fileEffect; 91 | QVERIFY(QFeedbackFileEffect::supportedMimeTypes().contains("x-test/this is a test")); 92 | 93 | QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); 94 | 95 | fileEffect.setSource(QUrl("load")); // this should call load 96 | QVERIFY(fileEffect.state() == QFeedbackEffect::Loading); 97 | 98 | fileEffect.setSource(QUrl("ignored")); // not stopped, should fail 99 | QVERIFY(fileEffect.source() == QUrl("load")); 100 | 101 | QVERIFY(fileEffect.isLoaded()); 102 | fileEffect.setLoaded(true); // should do nothing 103 | QVERIFY(fileEffect.isLoaded()); 104 | QCOMPARE(fileEffect.duration(), 5678); // from the plugin 105 | 106 | fileEffect.unload(); // should fail, since we're not STOPPED (HMM!!) 107 | QVERIFY(fileEffect.isLoaded()); 108 | 109 | fileEffect.stop(); 110 | QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); 111 | // Now we should be able to change things again 112 | 113 | // Make sure setting the source to the same thing is a noop 114 | fileEffect.setSource(fileEffect.source()); 115 | QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); 116 | 117 | // Now unload 118 | QVERIFY(fileEffect.isLoaded()); 119 | fileEffect.unload(); 120 | QVERIFY(!fileEffect.isLoaded()); 121 | QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); 122 | QCOMPARE(fileEffect.duration(), 0); // unloaded, shouldn't call? 123 | 124 | // Change the url 125 | fileEffect.setSource(QUrl("failload")); 126 | QVERIFY(!fileEffect.isLoaded()); 127 | // Spinning the event loop is necessary for mmk to fail a load 128 | QTRY_COMPARE(fileEffect.state(), QFeedbackEffect::Stopped); 129 | QCOMPARE(fileEffect.duration(), 0); // unknown 130 | 131 | fileEffect.setSource(QUrl("load")); 132 | QVERIFY(fileEffect.isLoaded()); 133 | QVERIFY(fileEffect.state() == QFeedbackEffect::Loading); 134 | fileEffect.start(); 135 | QVERIFY(fileEffect.state() == QFeedbackEffect::Running); 136 | fileEffect.start(); 137 | QVERIFY(fileEffect.state() == QFeedbackEffect::Running); 138 | fileEffect.stop(); 139 | QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); 140 | fileEffect.pause(); 141 | QVERIFY(fileEffect.state() == QFeedbackEffect::Paused); // XXX this is a strange transition 142 | } 143 | 144 | void tst_QFeedbackPlugin::testPlugin() 145 | { 146 | QFeedbackHapticsEffect testEffect; 147 | // first get the actuators. we want to use the test plugin actuator. 148 | QFeedbackActuator* testActuator; 149 | QList actuators = QFeedbackActuator::actuators(); 150 | QCOMPARE(actuators.count(), 2); 151 | 152 | QCOMPARE(actuators.at(0)->name(), QString("test plugin")); 153 | QCOMPARE(actuators.at(0)->id(), 0); 154 | QCOMPARE(actuators.at(1)->name(), QString("5555")); 155 | QCOMPARE(actuators.at(1)->id(), 1); 156 | 157 | // make sure we found the test actuator... 158 | testActuator = actuators.at(0); 159 | 160 | QCOMPARE(testActuator->name(), QString("test plugin")); 161 | QCOMPARE(testActuator->id(), 0); // test 162 | QVERIFY(testActuator->isCapabilitySupported(QFeedbackActuator::Period)); 163 | testActuator->setEnabled(true); 164 | QVERIFY(!testActuator->isEnabled()); // the test plugin always returns enabled = false. 165 | testActuator->setEnabled(false); 166 | QVERIFY(!testActuator->isEnabled()); // the test plugin always returns enabled = false. 167 | testActuator->setEnabled(true); 168 | QVERIFY(!testActuator->isEnabled()); // the test plugin always returns enabled = false. 169 | QCOMPARE(testActuator->state(), QFeedbackActuator::Unknown); // and it always returns state = unknown. 170 | // XXX TODO: ensure that a "working" plugin returns real values.. 171 | 172 | // then, ensure that the test effect uses this actuator. 173 | testEffect.setActuator(testActuator); 174 | 175 | // it will do nothing, so stick some values in and play it. 176 | testEffect.setAttackIntensity(0.0); 177 | testEffect.setAttackTime(250); 178 | testEffect.setIntensity(1.0); 179 | testEffect.setDuration(100); 180 | testEffect.setFadeTime(250); 181 | testEffect.setFadeIntensity(0.0); 182 | testEffect.start(); 183 | QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Running); 184 | testEffect.pause(); 185 | QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Paused); 186 | testEffect.start(); 187 | QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Running); 188 | testEffect.stop(); 189 | QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Stopped); 190 | } 191 | 192 | QTEST_MAIN(tst_QFeedbackPlugin) 193 | 194 | #include "tst_qfeedbackplugin.moc" 195 | --------------------------------------------------------------------------------