From 2646629ea49cf808220ef54c77df613cc9fea474 Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Wed, 28 Mar 2012 16:55:14 +1000 Subject: Add .qmltypes files for Creator. Only doing this for the actual QML APIs, not the examples ones. Can run make rebuild_qmltypes from a build directory to rebuild the .qmltypes files automatically. Change-Id: Ie1253646dde25861673c303b015a9ba9a4f0fbe3 Reviewed-by: Lorn Potter --- examples/sensors/grue/import/import.pro | 2 +- examples/sensors/sensor_explorer/import/import.pro | 2 +- qtsensors.pro | 7 + src/imports/sensors/plugin.qmltypes | 265 +++++++++++++++++++++ src/imports/sensors/qmldir | 1 + src/imports/sensors/sensors.pro | 8 +- src/imports/sensors2/plugin.qmltypes | 83 +++++++ src/imports/sensors2/qmldir | 1 + src/imports/sensors2/sensors2.pro | 8 +- 9 files changed, 370 insertions(+), 7 deletions(-) create mode 100644 src/imports/sensors/plugin.qmltypes create mode 100644 src/imports/sensors2/plugin.qmltypes diff --git a/examples/sensors/grue/import/import.pro b/examples/sensors/grue/import/import.pro index a689931b..34027c7c 100644 --- a/examples/sensors/grue/import/import.pro +++ b/examples/sensors/grue/import/import.pro @@ -24,4 +24,4 @@ qmldir.path=$$DESTPATH INSTALLS += qmldir OTHER_FILES += \ - plugin.json + plugin.json qmldir diff --git a/examples/sensors/sensor_explorer/import/import.pro b/examples/sensors/sensor_explorer/import/import.pro index 175433e6..1f97b67e 100644 --- a/examples/sensors/sensor_explorer/import/import.pro +++ b/examples/sensors/sensor_explorer/import/import.pro @@ -22,4 +22,4 @@ qmldir.path=$$DESTPATH INSTALLS += qmldir OTHER_FILES += \ - plugin.json + plugin.json qmldir diff --git a/qtsensors.pro b/qtsensors.pro index bdbe7920..6d09c4bd 100644 --- a/qtsensors.pro +++ b/qtsensors.pro @@ -35,3 +35,10 @@ include(doc/config/qtsensors_doc.pri) module_qtsensors_middleware.depends = module_qtsensors_src } +# Commands to rebuild the plugin.qmltypes files for our imports +# Run "make rebuild_qmltypes" after completing a build +sensors_qmltypes.commands = qmlplugindump QtMobility.sensors 1.3 $$QT.sensors.imports > $$PWD/src/imports/sensors/plugin.qmltypes +sensors2_qmltypes.commands = qmlplugindump QtSensors 5.0 $$QT.sensors.imports > $$PWD/src/imports/sensors2/plugin.qmltypes +TYPES = sensors_qmltypes sensors2_qmltypes +rebuild_qmltypes.depends = $$TYPES +QMAKE_EXTRA_TARGETS += rebuild_qmltypes $$TYPES diff --git a/src/imports/sensors/plugin.qmltypes b/src/imports/sensors/plugin.qmltypes new file mode 100644 index 00000000..fa5fd598 --- /dev/null +++ b/src/imports/sensors/plugin.qmltypes @@ -0,0 +1,265 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. + +Module { + Component { + name: "QAccelerometer" + prototype: "QSensor" + exports: [ + "Accelerometer 1.1", + "Accelerometer 1.2", + "Accelerometer 1.3" + ] + } + Component { + name: "QAccelerometerReading" + prototype: "QSensorReading" + exports: [ + "AccelerometerReading 1.1", + "AccelerometerReading 1.2", + "AccelerometerReading 1.3" + ] + Property { name: "x"; type: "qreal"; isReadonly: true } + Property { name: "y"; type: "qreal"; isReadonly: true } + Property { name: "z"; type: "qreal"; isReadonly: true } + } + Component { + name: "QAmbientLightReading" + prototype: "QSensorReading" + exports: [ + "AmbientLightReading 1.1", + "AmbientLightReading 1.2", + "AmbientLightReading 1.3" + ] + Enum { + name: "LightLevel" + values: { + "Undefined": 0, + "Dark": 1, + "Twilight": 2, + "Light": 3, + "Bright": 4, + "Sunny": 5 + } + } + Property { name: "lightLevel"; type: "LightLevel"; isReadonly: true } + } + Component { + name: "QAmbientLightSensor" + prototype: "QSensor" + exports: [ + "AmbientLightSensor 1.1", + "AmbientLightSensor 1.2", + "AmbientLightSensor 1.3" + ] + } + Component { + name: "QCompass" + prototype: "QSensor" + exports: ["Compass 1.1", "Compass 1.2", "Compass 1.3"] + } + Component { + name: "QCompassReading" + prototype: "QSensorReading" + exports: [ + "CompassReading 1.1", + "CompassReading 1.2", + "CompassReading 1.3" + ] + Property { name: "azimuth"; type: "qreal"; isReadonly: true } + Property { name: "calibrationLevel"; type: "qreal"; isReadonly: true } + } + Component { + name: "QGyroscope" + prototype: "QSensor" + exports: ["Gyroscope 1.2", "Gyroscope 1.3"] + } + Component { + name: "QGyroscopeReading" + prototype: "QSensorReading" + exports: ["GyroscopeReading 1.2", "GyroscopeReading 1.3"] + Property { name: "x"; type: "qreal"; isReadonly: true } + Property { name: "y"; type: "qreal"; isReadonly: true } + Property { name: "z"; type: "qreal"; isReadonly: true } + } + Component { + name: "QIRProximityReading" + prototype: "QSensorReading" + exports: ["IRProximityReading 1.3"] + Property { name: "reflectance"; type: "qreal"; isReadonly: true } + } + Component { + name: "QIRProximitySensor" + prototype: "QSensor" + exports: ["IRProximitySensor 1.3"] + } + Component { + name: "QLightReading" + prototype: "QSensorReading" + exports: ["LightReading 1.2", "LightReading 1.3"] + Property { name: "lux"; type: "qreal"; isReadonly: true } + } + Component { + name: "QLightSensor" + prototype: "QSensor" + exports: ["LightSensor 1.2", "LightSensor 1.3"] + } + Component { + name: "QMagnetometer" + prototype: "QSensor" + exports: ["Magnetometer 1.1", "Magnetometer 1.2", "Magnetometer 1.3"] + } + Component { + name: "QMagnetometerReading" + prototype: "QSensorReading" + exports: [ + "MagnetometerReading 1.1", + "MagnetometerReading 1.2", + "MagnetometerReading 1.3" + ] + Property { name: "x"; type: "qreal"; isReadonly: true } + Property { name: "y"; type: "qreal"; isReadonly: true } + Property { name: "z"; type: "qreal"; isReadonly: true } + Property { name: "calibrationLevel"; type: "qreal"; isReadonly: true } + } + Component { + name: "QOrientationReading" + prototype: "QSensorReading" + exports: [ + "OrientationReading 1.1", + "OrientationReading 1.2", + "OrientationReading 1.3" + ] + Enum { + name: "Orientation" + values: { + "Undefined": 0, + "TopUp": 1, + "TopDown": 2, + "LeftUp": 3, + "RightUp": 4, + "FaceUp": 5, + "FaceDown": 6 + } + } + Property { name: "orientation"; type: "Orientation"; isReadonly: true } + } + Component { + name: "QOrientationSensor" + prototype: "QSensor" + exports: [ + "OrientationSensor 1.1", + "OrientationSensor 1.2", + "OrientationSensor 1.3" + ] + } + Component { + name: "QProximityReading" + prototype: "QSensorReading" + exports: [ + "ProximityReading 1.1", + "ProximityReading 1.2", + "ProximityReading 1.3" + ] + Property { name: "close"; type: "bool"; isReadonly: true } + } + Component { + name: "QProximitySensor" + prototype: "QSensor" + exports: [ + "ProximitySensor 1.1", + "ProximitySensor 1.2", + "ProximitySensor 1.3" + ] + } + Component { + name: "QRotationReading" + prototype: "QSensorReading" + exports: [ + "RotationReading 1.1", + "RotationReading 1.2", + "RotationReading 1.3" + ] + Property { name: "x"; type: "qreal"; isReadonly: true } + Property { name: "y"; type: "qreal"; isReadonly: true } + Property { name: "z"; type: "qreal"; isReadonly: true } + } + Component { + name: "QRotationSensor" + prototype: "QSensor" + exports: [ + "RotationSensor 1.1", + "RotationSensor 1.2", + "RotationSensor 1.3" + ] + } + Component { + name: "QSensor" + prototype: "QObject" + exports: ["Sensor 1.2", "Sensor 1.3"] + exportMetaObjectRevisions: [0, 1] + Property { name: "sensorid"; type: "QByteArray" } + Property { name: "type"; type: "QByteArray"; isReadonly: true } + Property { name: "connectedToBackend"; type: "bool"; isReadonly: true } + Property { name: "availableDataRates"; type: "qrangelist"; isReadonly: true } + Property { name: "dataRate"; type: "int" } + Property { name: "reading"; type: "QSensorReading"; isReadonly: true; isPointer: true } + Property { name: "busy"; type: "bool"; isReadonly: true } + Property { name: "active"; type: "bool" } + Property { name: "outputRanges"; type: "qoutputrangelist"; isReadonly: true } + Property { name: "outputRange"; type: "int" } + Property { name: "description"; type: "string"; isReadonly: true } + Property { name: "error"; type: "int"; isReadonly: true } + Property { name: "alwaysOn"; revision: 1; type: "bool" } + Signal { + name: "sensorError" + Parameter { name: "error"; type: "int" } + } + Signal { name: "availableSensorsChanged" } + Method { name: "start"; type: "bool" } + Method { name: "stop" } + Method { name: "connectToBackend"; type: "bool" } + } + Component { + name: "QSensorReading" + prototype: "QObject" + exports: [ + "SensorReading 1.1", + "SensorReading 1.2", + "SensorReading 1.3" + ] + Property { name: "timestamp"; type: "quint64"; isReadonly: true } + } + Component { + name: "QTapReading" + prototype: "QSensorReading" + exports: ["TapReading 1.1", "TapReading 1.2", "TapReading 1.3"] + Enum { + name: "TapDirection" + values: { + "Undefined": 0, + "X": 1, + "Y": 2, + "Z": 4, + "X_Pos": 17, + "Y_Pos": 34, + "Z_Pos": 68, + "X_Neg": 257, + "Y_Neg": 514, + "Z_Neg": 1028, + "X_Both": 273, + "Y_Both": 546, + "Z_Both": 1092 + } + } + Property { name: "tapDirection"; type: "TapDirection"; isReadonly: true } + Property { name: "doubleTap"; type: "bool"; isReadonly: true } + } + Component { + name: "QTapSensor" + prototype: "QSensor" + exports: ["TapSensor 1.1", "TapSensor 1.2", "TapSensor 1.3"] + } +} diff --git a/src/imports/sensors/qmldir b/src/imports/sensors/qmldir index f8b110d5..17dc9501 100644 --- a/src/imports/sensors/qmldir +++ b/src/imports/sensors/qmldir @@ -1 +1,2 @@ plugin declarative_sensors +typeinfo plugin.qmltypes diff --git a/src/imports/sensors/sensors.pro b/src/imports/sensors/sensors.pro index 8f60d6c8..72ebb871 100644 --- a/src/imports/sensors/sensors.pro +++ b/src/imports/sensors/sensors.pro @@ -1,5 +1,8 @@ TARGET = declarative_sensors TARGETPATH = QtMobility/sensors +IMPORT_NAME = $$TARGETPATH +IMPORT_NAME~=s,/,.,g +IMPORT_VERSION = 1.3 # Doesn't matter, as long as it's a valid version?! include(qsensorsimport.pri) @@ -10,7 +13,7 @@ SOURCES += sensors.cpp DESTDIR = $$QT.sensors.imports/$$TARGETPATH target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH -qmldir.files += $$PWD/qmldir +qmldir.files += $$PWD/qmldir $$PWD/plugin.qmltypes qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH INSTALLS += target qmldir @@ -29,5 +32,4 @@ symbian { } OTHER_FILES += \ - plugin.json - + plugin.json qmldir plugin.qmltypes diff --git a/src/imports/sensors2/plugin.qmltypes b/src/imports/sensors2/plugin.qmltypes new file mode 100644 index 00000000..590bf263 --- /dev/null +++ b/src/imports/sensors2/plugin.qmltypes @@ -0,0 +1,83 @@ +import QtQuick.tooling 1.1 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. + +Module { + Component { + name: "QSensor2AmbientLight" + prototype: "qsensor2common" + exports: ["AmbientLightSensor 5.0"] + Enum { + name: "LightLevel" + values: { + "Unknown": 0, + "Dark": 1, + "Twilight": 2, + "Light": 3, + "Bright": 4, + "Sunny": 5 + } + } + Property { name: "lightLevel"; type: "LightLevel"; isReadonly: true } + } + Component { + name: "QSensor2Gesture" + prototype: "QObject" + exports: ["SensorGesture 5.0"] + Property { name: "availableGestures"; type: "QStringList"; isReadonly: true } + Property { name: "gestures"; type: "QStringList" } + Property { name: "validGestures"; type: "QStringList"; isReadonly: true } + Property { name: "invalidGestures"; type: "QStringList"; isReadonly: true } + Property { name: "enabled"; type: "bool" } + Signal { + name: "detected" + Parameter { name: "gesture"; type: "string" } + } + } + Component { + name: "QSensor2Proximity" + prototype: "qsensor2common" + exports: ["ProximitySensor 5.0"] + Property { name: "near"; type: "bool"; isReadonly: true } + } + Component { + name: "QSensor2Tilt" + prototype: "qsensor2common" + exports: ["TiltSensor 5.0"] + Enum { + name: "Unit" + values: { + "Radians": 0, + "Degrees": 1 + } + } + Enum { + name: "Speed" + values: { + "Slow": 0, + "Medium": 1, + "Fast": 2 + } + } + Property { name: "yRotation"; type: "qreal"; isReadonly: true } + Property { name: "xRotation"; type: "qreal"; isReadonly: true } + Property { name: "unit"; type: "Unit" } + Property { name: "speed"; type: "Speed" } + Property { name: "accuracy"; type: "qreal" } + Property { name: "settings"; type: "QByteArray" } + Signal { + name: "tiltChanged" + Parameter { name: "deltaX"; type: "qreal" } + Parameter { name: "deltaY"; type: "qreal" } + } + Method { name: "calibrate" } + } + Component { + name: "qsensor2common" + prototype: "QObject" + exports: ["Sensor 5.0"] + Property { name: "enabled"; type: "bool" } + Property { name: "alwaysOn"; type: "bool" } + } +} diff --git a/src/imports/sensors2/qmldir b/src/imports/sensors2/qmldir index 14c82f3b..81220bb4 100644 --- a/src/imports/sensors2/qmldir +++ b/src/imports/sensors2/qmldir @@ -1 +1,2 @@ plugin declarative_qtsensors5 +typeinfo plugin.qmltypes diff --git a/src/imports/sensors2/sensors2.pro b/src/imports/sensors2/sensors2.pro index 91c0bc0b..6779878c 100644 --- a/src/imports/sensors2/sensors2.pro +++ b/src/imports/sensors2/sensors2.pro @@ -1,5 +1,8 @@ TARGET = declarative_qtsensors5 TARGETPATH = QtSensors +IMPORT_NAME = $$TARGETPATH +IMPORT_NAME~=s,/,.,g +IMPORT_VERSION = 5.0 # Doesn't matter, as long as it's a valid version?! include(qsensors2import.pri) @@ -21,7 +24,7 @@ HEADERS += qsensor2ambientlight.h \ DESTDIR = $$QT.sensors.imports/$$TARGETPATH target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH -qmldir.files += $$PWD/qmldir +qmldir.files += $$PWD/qmldir $$PWD/plugin.qmltypes qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH INSTALLS += target qmldir @@ -40,4 +43,5 @@ symbian { } OTHER_FILES += \ - plugin.json + plugin.json qmldir plugin.qmltypes + -- cgit v1.2.3