From 6837d143b456eb1f253b68704a5ff1b48bef4de4 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 1 Sep 2014 13:46:59 +0200 Subject: Add support for random vs public address selection to lowenergyscanner Change-Id: I963f47f0089d072249b73bdfb0c715d43186b08d Reviewed-by: Lars Knoll --- .../lowenergyscanner/assets/Characteristics.qml | 9 ++++++--- .../bluetooth/lowenergyscanner/assets/Dialog.qml | 22 +++++++++++++++++++-- .../lowenergyscanner/assets/busy_dark.png | Bin 0 -> 1130 bytes .../bluetooth/lowenergyscanner/assets/main.qml | 20 ++++++++++++++++++- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 examples/bluetooth/lowenergyscanner/assets/busy_dark.png (limited to 'examples/bluetooth/lowenergyscanner/assets') diff --git a/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml index 4a7db471..ac3b7151 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml @@ -62,10 +62,13 @@ Rectangle { target: device onCharacteristicsUpdated: { menu.menuText = "Back" - if (characteristicview.count === 0) + if (characteristicview.count === 0) { info.dialogText = "No characteristic found" - else - info.visible = false; + info.busyImage = false + } else { + info.visible = false + info.busyImage = true + } } onDisconnected: { diff --git a/examples/bluetooth/lowenergyscanner/assets/Dialog.qml b/examples/bluetooth/lowenergyscanner/assets/Dialog.qml index be5388b5..2b8580f3 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Dialog.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Dialog.qml @@ -41,21 +41,39 @@ import QtQuick 2.0 Rectangle { - width: parent.width/2 + width: parent.width/3*2 height: 62 z: 50 property string dialogText: "" + property bool busyImage: true border.width: 1 border.color: "#363636" radius: 10 Text { + id: dialogTextId horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - anchors.fill: parent + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top; + anchors.topMargin: 10 + elide: Text.ElideMiddle text: dialogText color: "#363636" wrapMode: Text.Wrap } + + Image { + id: background + + width:20 + height:20 + anchors.top: dialogTextId.bottom + anchors.horizontalCenter: dialogTextId.horizontalCenter + visible: parent.busyImage + source: "busy_dark.png" + fillMode: Image.PreserveAspectFit + NumberAnimation on rotation { duration: 3000; from:0; to: 360; loops: Animation.Infinite} + } } diff --git a/examples/bluetooth/lowenergyscanner/assets/busy_dark.png b/examples/bluetooth/lowenergyscanner/assets/busy_dark.png new file mode 100644 index 00000000..3a105953 Binary files /dev/null and b/examples/bluetooth/lowenergyscanner/assets/busy_dark.png differ diff --git a/examples/bluetooth/lowenergyscanner/assets/main.qml b/examples/bluetooth/lowenergyscanner/assets/main.qml index 9f0395d5..e135d699 100644 --- a/examples/bluetooth/lowenergyscanner/assets/main.qml +++ b/examples/bluetooth/lowenergyscanner/assets/main.qml @@ -69,7 +69,7 @@ Rectangle { clip: true anchors.top: header.bottom - anchors.bottom: menu.top + anchors.bottom: connectToggle.top model: device.devicesList delegate: Rectangle { @@ -111,6 +111,24 @@ Rectangle { } } + Menu { + id: connectToggle + + menuWidth: parent.width + anchors.bottom: menu.top + menuText: { if (device.devicesList.length) + visible = true + else + visible = false + if (device.useRandomAddress) + "Address type: Random" + else + "Address type: Public" + } + + onButtonClick: device.useRandomAddress = !device.useRandomAddress; + } + Menu { id: menu anchors.bottom: parent.bottom -- cgit v1.2.3