import qzeecontrol 1.0
Page {
+ id: mainPage
tools: commonTools
orientationLock: PageOrientation.LockPortrait
btConn.keyBindingRight = SettingsStorage.getSetting("Right")
}
- function updateConnectButton(){
- if((addressField.text !== "No device found yet.") && deviceInfo.currentBluetoothPowerState){
- connectButton.enabled = true
- infoText.text = "Press \"Connect\" to connect to the device."
+ function updateConnectAndScanButton(){
+ if(!deviceInfo.currentBluetoothPowerState){
+ scanButton.enabled = false
+ connectButton.enabled = false
+ infoText.text = "To get started please turn Bluetooth on."
+ return
}
+
+ scanButton.enabled = true
+ connectButton.enabled = (addressField.text !== "No device found yet.")
+ infoText = (addressField.text !== "No device found yet.") ?
+ "To enable remote control please press \"Connect\" when ready." :
+ "Please scan for a Zeemote first."
+
}
states: [
Button{
id: scanButton
- enabled: deviceInfo.currentBluetoothPowerState
+ enabled: false
anchors.horizontalCenter: parent.horizontalCenter
text: "Scan"
text: "No device found yet."
onTextChanged: {
- if(initializing)
+ if(mainPage.initializing)
return
if(text === "No device found yet.")
return
- updateConnectButton();
+ updateConnectAndScanButton();
console.log("Storing address in DB: " + text)
SettingsStorage.setSetting("address", text)
validator: IntValidator{}
onTextChanged: {
- if(initializing)
+ if(mainPage.initializing)
return
if(text === "na")
monitorBluetoothStateChanges: true
onBluetoothStateChanged: {
- updateConnectButton()
+ updateConnectAndScanButton()
}
}