diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-07-03 16:18:03 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-07-15 20:39:40 +0200 |
commit | c39189a922ce7057b410eba12e80abac589712cf (patch) | |
tree | 338815352496d1b1e2d0234f8fd81488e6dc84c5 /examples/bluetooth/lowenergyscanner/assets | |
parent | 4a52ec355e2b2541d1867f785ef58c8c483b7316 (diff) |
Port lowenergyscanner example to new API
Some minor improvements have been incorporated too but the focus is on
the port. More code and UI cleanups are required.
Change-Id: I56f226b8418b78190d498df04d67686220a3644e
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/assets')
4 files changed, 35 insertions, 16 deletions
diff --git a/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml index bb308f2f..37d6a999 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Characteristics.qml @@ -1,6 +1,7 @@ /*************************************************************************** ** ** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtBluetooth module of the Qt Toolkit. @@ -76,7 +77,6 @@ Rectangle { textContent: modelData.characteristicName anchors.top: parent.top anchors.topMargin: 5 - } Label { @@ -114,7 +114,6 @@ Rectangle { height: 2 color: "#363636" } - } } @@ -124,6 +123,8 @@ Rectangle { menuWidth: parent.width menuText: device.update menuHeight: (parent.height/6) - onButtonClick: {device.disconnectFromService(); pageLoader.source = "Services.qml"} + onButtonClick: { + pageLoader.source = "Services.qml" + } } } diff --git a/examples/bluetooth/lowenergyscanner/assets/Menu.qml b/examples/bluetooth/lowenergyscanner/assets/Menu.qml index 796c27be..7c043f30 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Menu.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Menu.qml @@ -1,6 +1,7 @@ /*************************************************************************** ** ** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtBluetooth module of the Qt Toolkit. @@ -54,6 +55,8 @@ Rectangle { id: search width: parent.width height: parent.height + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter; color: "#363636" border.width: 1 border.color: "#E3E3E3" diff --git a/examples/bluetooth/lowenergyscanner/assets/Services.qml b/examples/bluetooth/lowenergyscanner/assets/Services.qml index 31775884..ba9f3831 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Services.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Services.qml @@ -1,6 +1,7 @@ /*************************************************************************** ** ** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtBluetooth module of the Qt Toolkit. @@ -56,7 +57,10 @@ Rectangle { visible: false } - Component.onCompleted: { info.visible = true; info.dialogText = "Scanning for services...";} + Component.onCompleted: { + info.visible = true; + info.dialogText = "Scanning for services..."; + } ListView { id: servicesview @@ -75,8 +79,10 @@ Rectangle { anchors.fill: parent onPressed: { servicebox.height= 135; bottomarea.height = 7} onReleased: { servicebox.height= 140; bottomarea.height = 2} - onClicked: { device.connectToService(modelData.serviceUuid); pageLoader.source = "Characteristics.qml";} - + onClicked: { + device.connectToService(modelData.serviceUuid); + pageLoader.source = "Characteristics.qml"; + } } Label { @@ -88,6 +94,7 @@ Rectangle { Label { id: serviceUuid + font.pointSize: serviceName1.font.pointSize * 0.5 textContent: modelData.serviceUuid anchors.bottom: bottomarea.top anchors.bottomMargin: 5 @@ -100,7 +107,6 @@ Rectangle { height: 2 color: "#363636" } - } } @@ -110,6 +116,9 @@ Rectangle { menuWidth: parent.width menuText: "Back" menuHeight: (parent.height/6) - onButtonClick: pageLoader.source = "main.qml" + onButtonClick: { + device.disconnectFromDevice() + pageLoader.source = "main.qml" + } } } diff --git a/examples/bluetooth/lowenergyscanner/assets/main.qml b/examples/bluetooth/lowenergyscanner/assets/main.qml index c7c201e8..b5a1f14d 100644 --- a/examples/bluetooth/lowenergyscanner/assets/main.qml +++ b/examples/bluetooth/lowenergyscanner/assets/main.qml @@ -1,6 +1,7 @@ /*************************************************************************** ** ** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtBluetooth module of the Qt Toolkit. @@ -53,7 +54,7 @@ Rectangle { Header { id: header anchors.top: parent.top - headerText: "Start a Device Discovery" + headerText: "Start Discovery" } Dialog { @@ -74,15 +75,19 @@ Rectangle { id: box height:140 width: parent.width - Component.onCompleted: { info.visible = false; + Component.onCompleted: { + info.visible = false; header.headerText = "Select a device"; } MouseArea { anchors.fill: parent - onPressed: { box.height= 135; downpart.height = 7} - onReleased: { box.height= 140; downpart.height = 2} - onClicked: {device.scanServices(modelData.deviceAddress); pageLoader.source = "Services.qml"} + onPressed: { box.height = 135; downpart.height = 7} + onReleased: { box.height = 140; downpart.height = 2} + onClicked: { + device.scanServices(modelData.deviceAddress); + pageLoader.source = "Services.qml" + } } @@ -107,7 +112,6 @@ Rectangle { height: 2 color: "#363636" } - } } @@ -117,12 +121,14 @@ Rectangle { menuWidth: parent.width menuHeight: (parent.height/6) menuText: device.update - onButtonClick: { device.startDeviceDiscovery(); info.dialogText = "Searching..."; info.visible = true;} + onButtonClick: { + device.startDeviceDiscovery(); + info.dialogText = "Searching..."; + info.visible = true;} } Loader { id: pageLoader anchors.fill: parent - } } |