From 48465074989a7c1f2e757b5b67d41b3583dbb7ac Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 14 Sep 2014 22:24:13 +0200 Subject: make the cover do something relatively useful --- qml/watch/WatchView.qml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 qml/watch/WatchView.qml (limited to 'qml/watch') diff --git a/qml/watch/WatchView.qml b/qml/watch/WatchView.qml new file mode 100644 index 0000000..ca880eb --- /dev/null +++ b/qml/watch/WatchView.qml @@ -0,0 +1,49 @@ +import QtQuick 2.0 + +Flickable { + id: watchView + width: 96 + height: 96 + clip: true + flickableDirection: Flickable.HorizontalFlick + + property int curPage: 0 + + WidgetView { + id: widgetView + model: curWidgets + editMode: true + onEmptyWidgetClicked: { + pageStack.push(Qt.resolvedUrl("../pages/AddWidget.qml"), { + 'addToPage': page, + 'addToPos': pos + }); + } + } + + contentWidth: widgetView.width + contentHeight: widgetView.height + + NumberAnimation { + id: pivotAnim + targets: watchView + property: "contentX" + to: curPage * watchView.width + duration: 100 + easing.type: Easing.InOutQuad + } + + onMovementStarted: { + pivotAnim.stop() + } + + onMovementEnded: { + curPage = Math.round(watchView.contentX / watchView.width) + pivotAnim.start() + } + + function switchToPage(page) { + curPage = page; + pivotAnim.start(); + } +} -- cgit v1.2.3