From: Ruediger Gad Date: Thu, 12 Apr 2012 17:43:58 +0000 (+0200) Subject: Fix DB. Suspend test output when inactive. X-Git-Url: http://git.maemo.org/git/?p=qzeecontrol;a=commitdiff_plain;h=6247d73c245fd4b8c700863fe0e0edf9d3f9deb2 Fix DB. Suspend test output when inactive. --- diff --git a/QZeeControl.pro.user b/QZeeControl.pro.user index 64a2f6c..9df03b1 100644 --- a/QZeeControl.pro.user +++ b/QZeeControl.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/qml/QZeeControl/MainPage.qml b/qml/QZeeControl/MainPage.qml index 54ef7ed..05bfb23 100644 --- a/qml/QZeeControl/MainPage.qml +++ b/qml/QZeeControl/MainPage.qml @@ -20,11 +20,88 @@ import QtQuick 1.1 import com.nokia.meego 1.0 import QtMobility.connectivity 1.2 +import "settingsstorage.js" as SettingsStorage import qzeecontrol 1.0 Page { tools: commonTools + Component.onCompleted: { + SettingsStorage.initialize(); + + var address = SettingsStorage.getSetting("address"); + var port = SettingsStorage.getSetting("port"); + if(address !== "Unknown" && port !== "Unknown"){ + console.log("Loaded address " + address + " and port " + port + " from DB.") + addressField.text = address + portField.text = port + } + } + + states: [ + State { + name: "active" + PropertyChanges { + target: cursorRectangle + x: moveArea.x + (moveArea.width * 0.5) + btConn.x - (cursorRectangle.width * 0.5) + y: moveArea.y + (moveArea.height * 0.5) + btConn.y - (cursorRectangle.height * 0.5) + } + PropertyChanges { + target: labelA + color: btConn.a ? "red" : "blue" + } + PropertyChanges { + target: labelB + color: btConn.b ? "red" : "blue" + } + PropertyChanges { + target: labelC + color: btConn.c ? "red" : "blue" + } + PropertyChanges { + target: labelD + color: btConn.d ? "red" : "blue" + } + }, + State { + name: "inactive" + PropertyChanges { + target: cursorRectangle + x: moveArea.x + (moveArea.width * 0.5) - (cursorRectangle.width * 0.5) + y: moveArea.y + (moveArea.height * 0.5) - (cursorRectangle.height * 0.5) + } + PropertyChanges { + target: labelA + color: "blue" + } + PropertyChanges { + target: labelB + color: "blue" + } + PropertyChanges { + target: labelC + color: "blue" + } + PropertyChanges { + target: labelD + color: "blue" + } + } + + ] + + Connections { + target: platformWindow + + onActiveChanged: { + if(platformWindow.active){ + state = "active" + }else{ + state = "inactive" + } + } + } + Button{ id: scanButton anchors{bottom: addressRow.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} @@ -47,15 +124,28 @@ Page { text: "No device found yet." onTextChanged: { + if(text === "No device found yet.") + return + connectButton.enabled = true infoText.text = "Press \"Connect\" to connect to the device." + console.log("Storing address in DB: " + text) + SettingsStorage.setSetting("address", text) } } TextField{ id: portField - text: "-" + text: "na" width: 60 validator: IntValidator{} + + onTextChanged: { + if(text === "na") + return + + console.log("Storing port in DB: " + text) + SettingsStorage.setSetting("port", text) + } } }