diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-12-02 23:02:51 +0100 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2011-12-02 23:02:51 +0100 |
commit | d5b5cfc83e1247ebc18ef2024f07bdd37d41164b (patch) | |
tree | d6c44ffe944c730f4bb16a3e5a412db78027f324 /notificationswatchlet | |
parent | 1abf33ab7bcbf73ebb9eeb6c388c3c1c4abef445 (diff) | |
download | sowatch-d5b5cfc83e1247ebc18ef2024f07bdd37d41164b.tar.gz sowatch-d5b5cfc83e1247ebc18ef2024f07bdd37d41164b.zip |
provide a set of metawatch common qml elements
Diffstat (limited to 'notificationswatchlet')
-rw-r--r-- | notificationswatchlet/metawatch-digital.qml | 57 | ||||
-rw-r--r-- | notificationswatchlet/notificationswatchlet.pro | 1 |
2 files changed, 28 insertions, 30 deletions
diff --git a/notificationswatchlet/metawatch-digital.qml b/notificationswatchlet/metawatch-digital.qml index be662ab..e5764ec 100644 --- a/notificationswatchlet/metawatch-digital.qml +++ b/notificationswatchlet/metawatch-digital.qml @@ -1,4 +1,5 @@ import QtQuick 1.0 +import com.javispedro.sowatch.metawatch 1.0 Rectangle { width: 96 @@ -6,33 +7,39 @@ Rectangle { color: "white" - ListView { + MWTitle { + id: title + text: qsTr("Notifications") + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + } + + MWListView { id: notifs - anchors.fill: parent + anchors.top: title.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom model: watch.notifications - delegate: Column { - width: parent.width - Text { - width: parent.width - text: model.modelData.title - wrapMode: Text.Wrap - } + delegate: Rectangle { + property bool selected: ListView.isCurrentItem + width: notifs.width + height: childrenRect.height + color: ListView.isCurrentItem ? "black" : "white" Text { - width: parent.width - text: model.modelData.body - wrapMode: Text.Wrap - } - Rectangle { - width: parent.width - height: 1 - color: "black" + width: 96 + text: "<b>" + model.modelData.title + "</b><br>" + model.modelData.body + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + color: parent.selected ? "white" : "black" } } visible: count > 0; } Text { - anchors.fill: parent + anchors.top: title.bottom + anchors.horizontalCenter: parent.horizontalCenter text: qsTr("No notifications"); visible: notifs.count == 0; wrapMode: Text.Wrap @@ -41,22 +48,12 @@ Rectangle { Connections { target: watch onButtonPressed : { - var increment = (3 * (notifs.width / 4)); - var maxy = notifs.contentHeight - notifs.height; - var newy; - - if (maxy < 0) maxy = 0; - switch (button) { case 1: - newy = notifs.contentY - increment; - if (newy < 0) newy = 0; - notifs.contentY = newy; + notifs.scrollUp(); break; case 2: - newy = notifs.contentY + increment; - if (newy > maxy) newy = maxy; - notifs.contentY = newy; + notifs.scrollDown(); break; } } diff --git a/notificationswatchlet/notificationswatchlet.pro b/notificationswatchlet/notificationswatchlet.pro index cf3beff..9791ed6 100644 --- a/notificationswatchlet/notificationswatchlet.pro +++ b/notificationswatchlet/notificationswatchlet.pro @@ -17,6 +17,7 @@ else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch INCLUDEPATH += $$PWD/../libsowatch DEPENDPATH += $$PWD/../libsowatch +QML_IMPORT_PATH += $$PWD/../metawatch/qml unix:!symbian { !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 { |