Changeset 1bebae
- Timestamp:
- 10/27/11 16:33:54 (19 months ago)
- Branches:
- ('master', '033cf796174446f5fff5bbfad1cbf1e4af35c0d8')('controller-upgrade', '72b31cc86eeeef18f1371a3067b6e8a5ca21abfc')('windows_service_fixes', 'df6bd2788365991d36d5af2a75833b8de2a5860f')
- Children:
- ebfc9666eb8bddbb4df87f50dc0ec2bb21ea0cd4
- Parents:
- 194579cd2b6a39e0de825e0dee79dc6800098006
- git-author:
- Micke Prag <micke.prag@telldus.se>2011-10-27 16:33:54+02:00
- git-committer:
- Micke Prag <micke.prag@telldus.se>2011-10-27 16:33:54+02:00
- Location:
- telldus-gui/Plugins/Sensors
- Files:
-
- 6 added
- 5 edited
-
CMakeLists.txt (modified) (1 diff)
-
HeaderTitle.qml (added)
-
SensorValue.qml (added)
-
__init__.js (modified) (2 diffs)
-
header_bg.png (added)
-
icon_humidity.png (added)
-
icon_temp.png (added)
-
main.qml (modified) (1 diff)
-
qmldir (modified) (1 diff)
-
row_bg.png (added)
-
sensorsplugin.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
telldus-gui/Plugins/Sensors/CMakeLists.txt
rc41a84 r1bebae 25 25 26 26 SET( Plugin_EXTRA 27 header_bg.png 27 28 icon.png 29 icon_humidity.png 30 icon_temp.png 28 31 main.qml 32 HeaderTitle.qml 33 row_bg.png 29 34 qmldir 35 SensorValue.qml 30 36 ) 31 37 -
telldus-gui/Plugins/Sensors/__init__.js
r51e87f r1bebae 28 28 } 29 29 30 //com.telldus.core.sensorEvent.connect(sensorEvent); 31 view = new com.telldus.qml.view({ 32 }); 30 com.telldus.core.sensorEvent.connect(sensorEvent); 31 view = new com.telldus.qml.view({}); 33 32 34 33 view.setProperty('sensorModel', sensorList); … … 64 63 } 65 64 66 if (dataType == com.telldus.core.TELLSTICK_TEMPERATURE) {67 sensor.temperature = value;68 } else if (dataType == com.telldus.core.TELLSTICK_HUMIDITY) {69 sensor.humidity = value;70 }71 72 65 print("Sensor event", protocol, model, id, dataType, value, timestamp); 66 sensor.setValue(dataType, value, timestamp); 73 67 } 74 68 -
telldus-gui/Plugins/Sensors/main.qml
r51e87f r1bebae 4 4 id: main 5 5 6 Component { 7 id: sensorView 8 BorderImage { 9 source: "row_bg.png" 10 border.left: 5; border.top: 5 11 border.right: 5; border.bottom: 5 12 height: sensorInfo.height 13 width: parent.width 14 15 Text { 16 anchors.left: parent.left 17 anchors.leftMargin: 15 18 height: 40 19 verticalAlignment: Text.AlignVCenter 20 text: modelData.name; 21 color: "#004275" 22 } 23 Column { 24 id: sensorInfo 25 anchors.right: parent.right 26 width: 250 27 SensorValue { 28 visible: modelData.hasTemperature 29 text: visible ? modelData.sensorValue(1).value + '°C' : '' 30 icon: "icon_temp.png" 31 lastUpdated: visible ? modelData.sensorValue(1).lastUpdated : new Date() 32 } 33 SensorValue { 34 visible: modelData.hasHumidity 35 text: visible ? modelData.sensorValue(2).value + '%' : '' 36 icon: "icon_humidity.png" 37 lastUpdated: visible ? modelData.sensorValue(2).lastUpdated : new Date() 38 } 39 } 40 } 41 } 42 6 43 Column { 44 spacing: 1 45 BorderImage { 46 id: header 47 source: "header_bg.png" 48 width: parent.width; height: 40 49 border.left: 5; border.top: 5 50 border.right: 5; border.bottom: 5 51 52 HeaderTitle { 53 text: "Name" 54 anchors.left: parent.left 55 anchors.leftMargin: 15 56 } 57 HeaderTitle { 58 text: "Sensor information" 59 width: 150 60 anchors.right: timestampTitle.left 61 } 62 HeaderTitle { 63 id: timestampTitle 64 text: "Last updated" 65 width: 100 66 anchors.right: parent.right 67 } 68 } 7 69 Repeater { 8 70 model: sensorModel 9 delegate: Row { 10 spacing: 10 11 Text { text: modelData.name } 12 Text { text: modelData.protocol } 13 Text { text: modelData.model } 14 Text { text: modelData.temperature + '°C'; visible: modelData.hasTemperature } 15 Text { text: modelData.humidity + "%"; visible: modelData.hasHumidity } 16 } 71 delegate: sensorView 17 72 } 18 73 anchors.fill: parent -
telldus-gui/Plugins/Sensors/qmldir
r51e87f r1bebae 1 HeaderTitle 1.0 HeaderTitle.qml 2 SensorValue 1.0 SensorValue.qml -
telldus-gui/Plugins/Sensors/sensorsplugin.cpp
r51e87f r1bebae 1 1 #include "sensorsplugin.h" 2 2 #include "sensor.h" 3 #include "sensorvalue.h" 3 4 #include <QScriptEngine> 5 #include <QtDeclarative> 4 6 5 7 QScriptValue SensorCTor(QScriptContext *context, QScriptEngine *engine) { … … 13 15 :QScriptExtensionPlugin( parent ) 14 16 { 17 qmlRegisterType<SensorValue>("Telldus", 1, 0, "SensorValue"); 15 18 } 16 19
Note: See TracChangeset
for help on using the changeset viewer.
