summaryrefslogtreecommitdiffstats
path: root/qml/LaunchScreen.qml
diff options
context:
space:
mode:
Diffstat (limited to 'qml/LaunchScreen.qml')
-rw-r--r--qml/LaunchScreen.qml61
1 files changed, 15 insertions, 46 deletions
diff --git a/qml/LaunchScreen.qml b/qml/LaunchScreen.qml
index 66b50bf..096914b 100644
--- a/qml/LaunchScreen.qml
+++ b/qml/LaunchScreen.qml
@@ -24,58 +24,42 @@ Item {
property real size: Math.min(root.width, root.height);
property int itemsPerScreen: 2
- ListView {
+ PathView {
id: list
y: 10
width: parent.width
height: parent.height
- property real cellWidth: (list.width - (root.itemsPerScreen - 1) * list.spacing) / root.itemsPerScreen
+ property real cellWidth: (list.width - (root.itemsPerScreen - 1) /** list.spacing*/) / root.itemsPerScreen
property real cellHeight: (list.height / root.itemsPerScreen)
- cacheBuffer: count * (cellWidth + spacing)
- orientation: ListView.Horizontal
-
maximumFlickVelocity: 5000
+ pathItemCount: list.count
model: applicationsModel;
+ preferredHighlightBegin: 1/(list.count/2)
+ preferredHighlightEnd: 1
+ currentIndex: -1
- spacing: 10
+ path: Path {
+ startX:-list.cellWidth; startY: list.y + list.cellHeight/2
+ PathLine{x: list.cellWidth*list.count - list.cellWidth; y: list.y + list.cellHeight/2}
+ }
- leftMargin: width / 2 - cellWidth / 2
- rightMargin: width / 2 - cellWidth / 2
+ highlightMoveDuration: 700
- highlight: Rectangle { color: "red" }
- highlightFollowsCurrentItem: false
- highlightMoveDuration: 10
delegate: ApplicationIcon {
id: iconRoot;
width: list.cellWidth
height: list.cellHeight
-
- offset: list.contentX;
-
function select() {
- list.targetContentX = iconRoot.x - (list.width / 2 - list.cellWidth / 2);
- list.targetIndex = index;
- if (Math.abs(list.targetContentX - list.contentX) < 50) {
- moveAnimation.duration = 50
- } else {
- moveAnimation.duration = 500
- }
- animateToCenter.running = true;
+ list.currentIndex = index;
}
- onClicked: select()
- }
-
- property int targetIndex;
- property real targetContentX: 0
- SequentialAnimation {
- id: animateToCenter;
- NumberAnimation { id: moveAnimation; target: list; property: "contentX"; to: list.targetContentX; duration: 300; easing.type: Easing.InOutCubic }
- PropertyAction { target: list; property: "currentIndex"; value: list.targetIndex }
+ onClicked: {
+ select()
+ }
}
onCurrentIndexChanged: {
@@ -88,22 +72,7 @@ Item {
}
}
- onMovementEnded: {
- var hCenter = mapToItem(contentItem, width / 2, engine.centimeter())
- var demo = itemAt(hCenter.x, hCenter.y)
- if (demo)
- demo.select()
- }
-
onCountChanged: if (count > 0 && currentIndex < 0) currentIndex = 0
-
- MouseArea {
- anchors.fill: parent
- onPressed: {
- animateToCenter.stop()
- mouse.accepted = false
- }
- }
}
Text {