summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/heartrate-game/qml/Connect.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth/heartrate-game/qml/Connect.qml')
-rw-r--r--examples/bluetooth/heartrate-game/qml/Connect.qml37
1 files changed, 36 insertions, 1 deletions
diff --git a/examples/bluetooth/heartrate-game/qml/Connect.qml b/examples/bluetooth/heartrate-game/qml/Connect.qml
index d3b4a733..9e4efb17 100644
--- a/examples/bluetooth/heartrate-game/qml/Connect.qml
+++ b/examples/bluetooth/heartrate-game/qml/Connect.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.5
+import Shared 1.0
GamePage {
@@ -48,7 +49,9 @@ GamePage {
Rectangle {
id: viewContainer
anchors.top: parent.top
- anchors.bottom: searchButton.top
+ anchors.bottom:
+ // only BlueZ platform has address type selection
+ connectionHandler.requiresAddressType ? addressTypeButton.top : searchButton.top
anchors.topMargin: GameSettings.fieldMargin + messageHeight
anchors.bottomMargin: GameSettings.fieldMargin
anchors.horizontalCenter: parent.horizontalCenter
@@ -124,6 +127,38 @@ GamePage {
}
GameButton {
+ id: addressTypeButton
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: searchButton.top
+ anchors.bottomMargin: GameSettings.fieldMargin*0.5
+ width: viewContainer.width
+ height: GameSettings.fieldHeight
+ visible: connectionHandler.requiresAddressType // only required on BlueZ
+ state: "public"
+ onClicked: state == "public" ? state = "random" : state = "public"
+
+ states: [
+ State {
+ name: "public"
+ PropertyChanges { target: addressTypeText; text: qsTr("Public Address") }
+ PropertyChanges { target: deviceHandler; addressType: AddressType.PublicAddress }
+ },
+ State {
+ name: "random"
+ PropertyChanges { target: addressTypeText; text: qsTr("Random Address") }
+ PropertyChanges { target: deviceHandler; addressType: AddressType.RandomAddress }
+ }
+ ]
+
+ Text {
+ id: addressTypeText
+ anchors.centerIn: parent
+ font.pixelSize: GameSettings.tinyFontSize
+ color: GameSettings.textColor
+ }
+ }
+
+ GameButton {
id: searchButton
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom