diff options
| author | Tomasz Sterna <tomek@xiaoka.com> | 2014-07-06 03:04:05 +0200 |
|---|---|---|
| committer | Tomasz Sterna <tomek@xiaoka.com> | 2014-07-09 01:57:32 +0200 |
| commit | 1358e9c672eb186abec781900465988a04a1413e (patch) | |
| tree | 4cf681690671344ffa5ac16266c3c217a5a30f20 | |
| parent | 66fcda8bf06abcc557d2d435b5dc0562de3a9566 (diff) | |
Modified App to talk to daemon
| -rw-r--r-- | app/qml/cover/CoverPage.qml | 4 | ||||
| -rw-r--r-- | app/qml/pages/WatchPage.qml | 63 |
2 files changed, 42 insertions, 25 deletions
diff --git a/app/qml/cover/CoverPage.qml b/app/qml/cover/CoverPage.qml index 06340aa..8b9942a 100644 --- a/app/qml/cover/CoverPage.qml +++ b/app/qml/cover/CoverPage.qml @@ -36,12 +36,12 @@ CoverBackground { Label { id: label anchors.centerIn: parent - text: "Pebble" + text: watchPage.name ? watchPage.name : "Pebble" } Label { anchors.top: label.bottom anchors.horizontalCenter: parent.horizontalCenter - text: watchPage.watchConnector.name font.pointSize: Theme.fontSizeSmall + text: watchPage.connected ? "connected" : "disconnected" } } diff --git a/app/qml/pages/WatchPage.qml b/app/qml/pages/WatchPage.qml index 39312b3..5848293 100644 --- a/app/qml/pages/WatchPage.qml +++ b/app/qml/pages/WatchPage.qml @@ -32,23 +32,45 @@ import QtQuick 2.0 import QtQml 2.1 import Sailfish.Silica 1.0 -import QtBluetooth 5.0 -import Sailfish.Bluetooth 1.0 -import Bluetooth 0.0 -import org.nemomobile.voicecall 1.0 -import org.nemomobile.notifications 1.0 -import org.nemomobile.messages.internal 1.0 -import org.nemomobile.commhistory 1.0 import watch 0.1 +import org.nemomobile.dbus 1.0 Page { id: page - property alias watchConnector: watchConnector + property string name + property string address + property bool connected: false + + onNameChanged: console.log(name) + onAddressChanged: console.log(address) + onConnectedChanged: console.log(connected?"connected":"disconnected") + WatchConnector { id: watchConnector } + DBusInterface { + id: pebbled + destination: "org.pebbled" + path: "/" + iface: "org.pebbled" + signalsEnabled: true + + function pebbleChanged() { + page.name = getProperty("name"); + page.address = getProperty("address"); + } + function connectedChanged() { + page.connected = getProperty("connected"); + } + + Component.onCompleted: { + pebbled.pebbleChanged(); + pebbled.connectedChanged(); + } + } + SilicaFlickable { anchors.fill: parent @@ -63,24 +85,19 @@ Page { title: "Pebble Manager" } Label { - visible: !watchConnector.isConnected + visible: !page.connected text: "Waiting for watch...\nIf it can't be found plase\ncheck it's available and\npaired in Bluetooth settings." width: column.width } - // Select the device - Repeater { - model: KnownDevicesModel { id: knownDevicesModel } - delegate: ListItem { - id: pairedItem - visible: (model.paired && watchConnector.isConnected) - Label { - text: model.alias.length ? model.alias : model.address - } - onVisibleChanged: { - if (pairedItem.visible) { - // Connect with the device - watchConnector.deviceConnect(model.alias, model.address); - } + ListItem { + visible: !!page.name + Label { + text: page.name + } + onVisibleChanged: { + if (parent.visible) { + // Connect with the device + watchConnector.deviceConnect(page.name, page.address); } } } |
