From aee0d02368ebd2e5b7e80399667c42e16940c747 Mon Sep 17 00:00:00 2001 From: Andras Becsi Date: Tue, 4 Aug 2015 13:51:51 +0200 Subject: Replace static page indicators with Repeater and delegate This way the maximum number of bookmarks can be changed by updating the gridViewMaxBookmarks constant. --- src/qml/HomeScreen.qml | 52 +++++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/src/qml/HomeScreen.qml b/src/qml/HomeScreen.qml index 39e216e..4e62040 100644 --- a/src/qml/HomeScreen.qml +++ b/src/qml/HomeScreen.qml @@ -423,42 +423,24 @@ Rectangle { bottom: parent.bottom horizontalCenter: parent.horizontalCenter } - Rectangle { - property bool active: gridView.contentX < gridView.page - width: 10 - height: width - radius: width / 2 - color: !active ? inactivePagerColor : uiColor - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: gridView.contentX = 0 - } - } - Rectangle { - property bool active: gridView.page <= gridView.contentX && gridView.contentX < 2 * gridView.page - width: 10 - visible: gridView.count > 8 - height: width - radius: width / 2 - color: !active ? inactivePagerColor : uiColor - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: gridView.contentX = gridView.page + Repeater { + model: { + var c = gridView.count % gridViewPageItemCount + if (c > 0) + c = 1 + return Math.floor(gridView.count / gridViewPageItemCount) + c } - } - Rectangle { - property bool active: 2 * gridView.page <= gridView.contentX - width: 10 - visible: gridView.count > 16 - height: width - radius: width / 2 - color: !active ? inactivePagerColor : uiColor - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: gridView.contentX = 2 * gridView.page + delegate: Rectangle { + property bool active: index * gridView.page <= gridView.contentX && gridView.contentX < (index + 1) * gridView.page + width: 10 + height: width + radius: width / 2 + color: !active ? inactivePagerColor : uiColor + anchors.verticalCenter: parent.verticalCenter + MouseArea { + anchors.fill: parent + onClicked: gridView.contentX = index * gridView.page + } } } } -- cgit v1.2.3