QML UI: only offer BT checkbox if BT is available

Right now we need to restart Subsurface-mobile in order to detect
Bluetooth devices - so simply turning on BT after Subsurface-mobile was
started is not sufficient.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-07-12 04:16:37 -07:00
parent 2c111bb4cc
commit b7b2e813ad

View file

@ -18,6 +18,7 @@ Kirigami.Page {
property bool selectAll : false property bool selectAll : false
property alias dcImportModel: importModel property alias dcImportModel: importModel
property bool divesDownloaded: false property bool divesDownloaded: false
property bool btEnabled: manager.btEnabled()
DCDownloadThread { DCDownloadThread {
id: downloadThread id: downloadThread
@ -85,11 +86,12 @@ Kirigami.Page {
currentIndex = productidx currentIndex = productidx
} }
} }
Kirigami.Label { text: qsTr("Bluetooth download:") } Kirigami.Label { text: btEnabled ? qsTr("Bluetooth download:") : qsTr("No Bluetooth support detected")}
CheckBox { CheckBox {
id: isBluetooth id: isBluetooth
checked: downloadThread.data().getDetectedVendorIndex(ComboBox.currentText) != -1 checked: downloadThread.data().getDetectedVendorIndex(ComboBox.currentText) != -1
indicator: Rectangle { indicator: Rectangle {
visible: btEnabled
implicitWidth: 20 implicitWidth: 20
implicitHeight: 20 implicitHeight: 20
x: isBluetooth.leftPadding x: isBluetooth.leftPadding
@ -105,7 +107,7 @@ Kirigami.Page {
y: 4 y: 4
radius: 3 radius: 3
color: isBluetooth.down ? subsurfaceTheme.PrimaryColor : subsurfaceTheme.darkerPrimaryColor color: isBluetooth.down ? subsurfaceTheme.PrimaryColor : subsurfaceTheme.darkerPrimaryColor
visible: isBluetooth.checked visible: btEnabled && isBluetooth.checked
} }
} }
} }