summaryrefslogtreecommitdiff
path: root/rockwork/qml/PebblesPage.qml
blob: a973b0ae8579f2ff81751ac6989b262797174e58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import QtQuick 2.4
import QtQuick.Layouts 1.1
import Ubuntu.Components 1.3

Page {
    title: i18n.tr("Manage Pebble Watches")

    head {
        actions: [
            Action {
                iconName: "settings"
                onTriggered: {
                    onClicked: Qt.openUrlExternally("settings://system/bluetooth")
                }
            }
        ]
    }

    ListView {
        anchors.fill: parent
        model: pebbles
        delegate: ListItem {
            RowLayout {
                anchors.fill: parent
                anchors.margins: units.gu(1)

                ColumnLayout {
                    Layout.fillHeight: true
                    Layout.fillWidth: true

                    Label {
                        text: model.name
                    }

                    Label {
                        text: model.connected ? i18n.tr("Connected") : i18n.tr("Disconnected")
                        fontSize: "small"
                    }
                }
            }

            onClicked: {
                var p = pebbles.get(index);
                print("opening pebble:", p.name, p.hardwarePlatform)
                pageStack.push(Qt.resolvedUrl("MainMenuPage.qml"), {pebble: pebbles.get(index)})
            }
        }
    }

    Column {
        anchors.centerIn: parent
        width: parent.width - units.gu(4)
        spacing: units.gu(4)
        visible: pebbles.count === 0

        Label {
            text: i18n.tr("No Pebble smartwatches configured yet. Please connect your Pebble smartwatch using System Settings.")
            fontSize: "large"
            width: parent.width
            wrapMode: Text.WordWrap
        }

        Button {
            text: i18n.tr("Open System Settings")
            anchors.horizontalCenter: parent.horizontalCenter
            onClicked: Qt.openUrlExternally("settings://system/bluetooth")
        }
    }
}