From 0f3d090bd1dc9a6b912eb0b1e587602573304b4a Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 17 Feb 2016 20:41:52 +0100 Subject: First attempt at QML hacking. Main and ServiceControl adapted. Project files --- rockwork/qml/NotificationsPage.qml | 137 ++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 63 deletions(-) (limited to 'rockwork/qml/NotificationsPage.qml') diff --git a/rockwork/qml/NotificationsPage.qml b/rockwork/qml/NotificationsPage.qml index 9802b05..3942ecf 100644 --- a/rockwork/qml/NotificationsPage.qml +++ b/rockwork/qml/NotificationsPage.qml @@ -1,84 +1,95 @@ -import QtQuick 2.4 -import QtQuick.Layouts 1.1 -import Ubuntu.Components 1.3 -import RockWork 1.0 +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import RockPool 1.0 Page { id: root - title: i18n.tr("Notifications") property var pebble: null - ColumnLayout { + SilicaFlickable { + id: flickable anchors.fill: parent - anchors.topMargin: units.gu(1) + contentHeight: column.height + PageHeader { + title: qsTr("Notifications") + } + Column { - Item { - Layout.fillWidth: true - implicitHeight: infoLabel.height + anchors.fill: parent + anchors.topMargin: units.gu(1) - 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.") + + Item { + width: parent.width + 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 + ListView { + width: parent.width + //Layout.fillHeight: true + clip: true + model: root.pebble.notifications - delegate: ListItem { - ListItemLayout { - title.text: model.name + delegate: ListItem { + Item { + Rectangle { + //SlotsLayout.position: SlotsLayout.Leading; + height: units.gu(5) + width: height + color: { + // Add some hacks for known icons + switch (model.icon) { + case "calendar": + return "orange"; + case "settings": + return "grey"; + case "dialog-question-symbolic": + return "red"; + case "alarm-clock": + return "purple"; + case "gpm-battery-050": + return "green"; + } + return "black" + } + // source: Image { + // height: parent.height + // width: parent.width + // source: model.icon.indexOf("/") === 0 ? "file://" + model.icon : "" + // } + Label { + 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; + IconButton { + anchors.fill: parent + anchors.margins: units.gu(.5) + icon.source: model.icon.indexOf("/") !== 0 ? model.icon : "" + //color: "white" } - 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.name, checked) + Switch { + checked: model.enabled + // SlotsLayout.position: SlotsLayout.Trailing; + onClicked: { + root.pebble.setNotificationFilter(model.name, checked) + } } } } -- cgit v1.2.3