summaryrefslogtreecommitdiff
path: root/rockwork/NotificationsPage.qml
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2016-02-18 09:13:32 +0100
committerAndrew Branson <andrew.branson@cern.ch>2016-02-18 09:13:32 +0100
commitf4910b3ac84c72a7e17c99895a3b9abb0e9534fe (patch)
tree91ae8cfd80dc3d7a2adedee9cab0d407c5c23c84 /rockwork/NotificationsPage.qml
parent7305ce8e080d0a6ee7505fe978a2e601b56a5ce8 (diff)
parent8f014f0915c7bdc97573f953aa9a3ae25a5f953a (diff)
Merge branch 'rockwork'
Conflicts: po/de.po po/en_GB.po po/eu.po po/fr.po po/hu.po po/it.po po/pt.po po/rockwork.mzanetti.pot po/ru.po po/template.pot rockwork/InfoPage.qml rockwork/Main.qml rockwork/NotificationsPage.qml rockworkd/rockworkd.pro version.pri
Diffstat (limited to 'rockwork/NotificationsPage.qml')
-rw-r--r--rockwork/NotificationsPage.qml88
1 files changed, 88 insertions, 0 deletions
diff --git a/rockwork/NotificationsPage.qml b/rockwork/NotificationsPage.qml
new file mode 100644
index 0000000..d3c9ff9
--- /dev/null
+++ b/rockwork/NotificationsPage.qml
@@ -0,0 +1,88 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.1
+import Ubuntu.Components 1.3
+import RockWork 1.0
+
+Page {
+ id: root
+ title: i18n.tr("Notifications")
+
+ property var pebble: null
+
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.topMargin: units.gu(1)
+
+ Item {
+ Layout.fillWidth: true
+ implicitHeight: infoLabel.height
+
+ Label {
+ id: infoLabel
+ anchors {
+ left: parent.left
+ right: parent.right
+ margins: units.gu(2)
+ }
+
+ wrapMode: Text.WordWrap
+ text: i18n.tr("Entries here will be added as notifications appear on the phone. Selected notifications will be shown on your Pebble smartwatch.")
+ }
+ }
+
+
+ ListView {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ clip: true
+ model: root.pebble.notifications
+
+ delegate: ListItem {
+ ListItemLayout {
+ title.text: model.name
+
+ UbuntuShape {
+ SlotsLayout.position: SlotsLayout.Leading;
+ height: units.gu(5)
+ width: height
+ backgroundColor: {
+ // Add some hacks for known icons
+ switch (model.icon) {
+ case "calendar":
+ return UbuntuColors.orange;
+ case "settings":
+ return "grey";
+ case "dialog-question-symbolic":
+ return UbuntuColors.red;
+ case "alarm-clock":
+ return UbuntuColors.purple;
+ case "gpm-battery-050":
+ return UbuntuColors.green;
+ }
+ return "black"
+ }
+ source: Image {
+ height: parent.height
+ width: parent.width
+ source: model.icon.indexOf("/") === 0 ? "file://" + model.icon : ""
+ }
+ Icon {
+ anchors.fill: parent
+ anchors.margins: units.gu(.5)
+ name: model.icon.indexOf("/") !== 0 ? model.icon : ""
+ color: "white"
+ }
+ }
+
+ Switch {
+ checked: model.enabled
+ SlotsLayout.position: SlotsLayout.Trailing;
+ onClicked: {
+ root.pebble.setNotificationFilter(model.id, checked)
+ }
+ }
+ }
+ }
+ }
+ }
+}