Optimize startup and scan.
[qzeecontrol] / qml / QZeeControl / MainPage.qml
index 5d878b1..848babc 100644 (file)
@@ -28,6 +28,8 @@ Page {
 
     orientationLock: PageOrientation.LockPortrait
 
+    property bool initializing: true
+
     Component.onCompleted: {
         SettingsStorage.initialize();
 
@@ -45,6 +47,7 @@ Page {
         }
 
         loadKeyBindings()
+        initializing = false
     }
 
     function setKeyBindingsToDefault(){
@@ -245,6 +248,9 @@ Page {
                     text: "No device found yet."
 
                     onTextChanged: {
+                        if(initializing)
+                            return
+
                         if(text === "No device found yet.")
                             return
 
@@ -261,6 +267,9 @@ Page {
                     validator: IntValidator{}
 
                     onTextChanged: {
+                        if(initializing)
+                            return
+
                         if(text === "na")
                             return
 
@@ -300,7 +309,6 @@ Page {
 
                 onClicked: {
                     btConn.disconnect()
-
                 }
             }
 
@@ -393,6 +401,8 @@ Page {
             if(service.serviceName === "Zeemote"){
                 addressField.text = service.deviceAddress
                 portField.text = service.servicePort
+                discovery = false
+                console.log("Found device. Stopped further discovery.")
             }
         }
     }