X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=qml%2FQZeeControl%2FMainPage.qml;h=c086e98a839495612d22bd5d37b059fe868e2eb4;hb=db655e3a0a177afaba64053c4ea653e6342bf21b;hp=dc08d055509b27d25524165b7c71aeb01b74e981;hpb=64d71daf21d1e0775a6c1f810a5a1beec7ac32c3;p=qzeecontrol diff --git a/qml/QZeeControl/MainPage.qml b/qml/QZeeControl/MainPage.qml index dc08d05..c086e98 100644 --- a/qml/QZeeControl/MainPage.qml +++ b/qml/QZeeControl/MainPage.qml @@ -26,6 +26,8 @@ import qzeecontrol 1.0 Page { tools: commonTools + orientationLock: PageOrientation.LockPortrait + Component.onCompleted: { SettingsStorage.initialize(); @@ -102,132 +104,156 @@ Page { } } - Button{ - id: scanButton - anchors{bottom: addressRow.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} - enabled: true + Item { + anchors.fill: parent + + Image { + id: header + height: 72 + source: "image://theme/color8-meegotouch-view-header-fixed" + anchors.left: parent.left + anchors.top: parent.top + anchors.right: parent.right + + Text { + text: "QZeeControl" + color: "white" + font.family: "Nokia Pure Text Light" + font.pixelSize: 32 + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.verticalCenter: parent.verticalCenter + } + } + + Button{ + id: scanButton + anchors{bottom: addressRow.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} + enabled: true - text: "Scan" + text: "Scan" - onClicked: { - btDiscovery.discovery = true + onClicked: { + btDiscovery.discovery = true + } } - } - Row{ - id: addressRow - spacing: 5 - anchors{bottom: infoText.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} + Row{ + id: addressRow + spacing: 5 + anchors{bottom: infoText.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} - TextField{ - id: addressField - text: "No device found yet." + TextField{ + id: addressField + text: "No device found yet." - onTextChanged: { - if(text === "No device found yet.") - return + 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) + 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: "na" - width: 60 - validator: IntValidator{} - - onTextChanged: { - if(text === "na") - return - - console.log("Storing port in DB: " + text) - SettingsStorage.setSetting("port", text) + TextField{ + id: portField + text: "na" + width: 60 + validator: IntValidator{} + + onTextChanged: { + if(text === "na") + return + + console.log("Storing port in DB: " + text) + SettingsStorage.setSetting("port", text) + } } } - } - Label { - id: infoText - anchors{bottom: connectButton.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} - width: parent.width + Label { + id: infoText + anchors{bottom: connectButton.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} + width: parent.width - text: "Please scan for a device first." - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - } + text: "Please scan for a device first." + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + } - Button{ - id: connectButton - anchors{bottom: disconnectButton.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} - enabled: false + Button{ + id: connectButton + anchors{bottom: disconnectButton.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} + enabled: false - text: "Connect" + text: "Connect" - onClicked: { - enabled = false - btConn.connect(addressField.text, parseInt(portField.text)) + onClicked: { + enabled = false + btConn.connect(addressField.text, parseInt(portField.text)) + } } - } - Button{ - id: disconnectButton - anchors{bottom: buttonRow.top; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} + Button{ + id: disconnectButton + anchors.centerIn: parent - text: "Disconnect" + text: "Disconnect" - onClicked: { - btConn.disconnect() + onClicked: { + btConn.disconnect() + } } - } - Row{ - id: buttonRow - anchors.centerIn: parent - spacing: 20 + Row{ + id: buttonRow + anchors{top: disconnectButton.bottom; bottomMargin: 10; horizontalCenter: parent.horizontalCenter} - Label{ - id: labelA - text: "A" - color: btConn.a ? "red" : "blue" - } - Label{ - id: labelB - text: "B" - color: btConn.b ? "red" : "blue" - } - Label{ - id: labelC - text: "C" - color: btConn.c ? "red" : "blue" - } - Label{ - id: labelD - text: "D" - color: btConn.d ? "red" : "blue" + spacing: 20 + + Label{ + id: labelA + text: "A" + color: btConn.a ? "red" : "blue" + } + Label{ + id: labelB + text: "B" + color: btConn.b ? "red" : "blue" + } + Label{ + id: labelC + text: "C" + color: btConn.c ? "red" : "blue" + } + Label{ + id: labelD + text: "D" + color: btConn.d ? "red" : "blue" + } } - } - Rectangle{ - id: moveArea - anchors{top: buttonRow.bottom; topMargin: 10; horizontalCenter: parent.horizontalCenter} - color: "gray" + Rectangle{ + id: moveArea + anchors{top: buttonRow.bottom; topMargin: 10; horizontalCenter: parent.horizontalCenter} + color: "gray" - width: 256 - height: 256 - } + width: 256 + height: 256 + } - Rectangle{ - id: cursorRectangle - width: 10 - height: 10 - color: "red" + Rectangle{ + id: cursorRectangle + width: 10 + height: 10 + color: "red" - 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) + 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) + } } BluetoothDiscoveryModel{