summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2017-10-02 12:54:24 +0200
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2017-10-04 08:14:49 +0000
commit21350aac26961e48e2610f157725a2a8873b285b (patch)
tree1308b295aceabe0af9cdb5e73d8f730f05bc2a37
parentba42ff33c9d84bf8da482e673f61e9d1de33e1a3 (diff)
iot-sensortag: Use double-click to select connection
Change-Id: I46c3860799018e51f74df8d24dd54eccab02db7a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--tradeshow/iot-sensortag/resources/base/SensorSettings.qml52
1 files changed, 29 insertions, 23 deletions
diff --git a/tradeshow/iot-sensortag/resources/base/SensorSettings.qml b/tradeshow/iot-sensortag/resources/base/SensorSettings.qml
index 7661325..5302816 100644
--- a/tradeshow/iot-sensortag/resources/base/SensorSettings.qml
+++ b/tradeshow/iot-sensortag/resources/base/SensorSettings.qml
@@ -63,6 +63,30 @@ Rectangle {
height: 800
anchors.horizontalCenter: parent.horizontalCenter
+ function createSensorConnection() {
+ clickBait.deactivate()
+
+ var currentPool = getCurrentPool();
+ if (currentPool.dataProviders[sensorListView.currentIndex] === singleSensorSource) {
+ console.log("Same data provider selected, nothing to change...")
+ return;
+ }
+
+ if (singleSensorSource)
+ singleSensorSource.endDataFetching();
+ // UI gets information about the intended setup of the
+ // sensor even though they have not been really discovered yet
+ if (currentPool) {
+ singleSensorSource = currentPool.dataProviders[sensorListView.currentIndex]
+ currentPool.currentProviderIndex = sensorListView.currentIndex
+
+ seriesStorage.setDataProviderPool(currentPool);
+ seriesStorage.dataProviderPoolChanged();
+
+ singleSensorSource.startDataFetching()
+ }
+ }
+
Image {
source: "images/bg_blue.jpg"
anchors.fill: parent
@@ -151,6 +175,10 @@ Rectangle {
MouseArea {
anchors.fill: parent
onClicked: sensorListView.currentIndex = index
+ onDoubleClicked: {
+ sensorListView.currentIndex = index
+ createSensorConnection()
+ }
}
}
}
@@ -173,29 +201,7 @@ Rectangle {
id: connectButtonArea
anchors.fill: parent
enabled: sensorListView.currentIndex != -1
- onClicked: {
- clickBait.deactivate()
-
- var currentPool = getCurrentPool();
- if (currentPool.dataProviders[sensorListView.currentIndex] === singleSensorSource) {
- console.log("Same data provider selected, nothing to change...")
- return;
- }
-
- if (singleSensorSource)
- singleSensorSource.endDataFetching();
- // UI gets information about the intended setup of the
- // sensor even though they have not been really discovered yet
- if (currentPool) {
- singleSensorSource = currentPool.dataProviders[sensorListView.currentIndex]
- currentPool.currentProviderIndex = sensorListView.currentIndex
-
- seriesStorage.setDataProviderPool(currentPool);
- seriesStorage.dataProviderPoolChanged();
-
- singleSensorSource.startDataFetching()
- }
- }
+ onClicked: createSensorConnection()
}
}