From 6540e95425eb4c8aad56c5c5388c25b2180817cb Mon Sep 17 00:00:00 2001 From: Sebastian Kügler Date: Tue, 12 Jan 2016 01:15:02 +0100 Subject: dive details navigation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch reworks the navigation of the dive details. - The detailsview is now a list view with page-sized delegates. This allows horizontal swiping to the next and previous dive. - The central button now allows to open the edit mode for the dive. Original patch was done by Marco Martin, but needed to be reapplied by hand. Signed-off-by: Sebastian Kügler --- qt-mobile/qml/DiveList.qml | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'qt-mobile/qml/DiveList.qml') diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml index 06da8dee1..07b437c99 100644 --- a/qt-mobile/qml/DiveList.qml +++ b/qt-mobile/qml/DiveList.qml @@ -21,28 +21,11 @@ MobileComponents.Page { property real detailsOpacity : 0 property int horizontalPadding: MobileComponents.Units.gridUnit / 2 - MobileComponents.Units.smallSpacing + 1 - //When clicked, the mode changes to details view - + // When clicked, the mode changes to details view onClicked: { diveListView.currentIndex = model.index - detailsWindow.width = parent.width - detailsWindow.location = dive.location - detailsWindow.gps = dive.gps - detailsWindow.dive_id = dive.id - detailsWindow.diveNumber = dive.number - detailsWindow.duration = dive.duration - detailsWindow.depth = dive.depth - detailsWindow.rating = dive.rating - detailsWindow.buddy = dive.buddy - detailsWindow.suit = dive.suit - detailsWindow.airtemp = dive.airTemp - detailsWindow.watertemp = dive.waterTemp - detailsWindow.divemaster = dive.divemaster - detailsWindow.notes = dive.notes - detailsWindow.number = dive.number - detailsWindow.date = dive.date + " " + dive.time - // detailsWindow.weight = dive.weights - stackView.push(detailsWindow) + detailsWindow.showDiveIndex(index); + stackView.push(detailsWindow); } Item { @@ -154,6 +137,7 @@ MobileComponents.Page { } } } + ScrollView { anchors.fill: parent ListView { @@ -161,10 +145,14 @@ MobileComponents.Page { anchors.fill: parent model: diveModel currentIndex: -1 + Connections { + target: detailsWindow + onCurrentIndexChanged: diveListView.currentIndex = detailsWindow.currentIndex + } delegate: diveDelegate boundsBehavior: Flickable.StopAtBounds maximumFlickVelocity: parent.height * 5 - cacheBuffer: parent.height * 5 + cacheBuffer: Math.max(5000, parent.height * 5) //highlight: Rectangle { color: MobileComponents.Theme.highlightColor; width: MobileComponents.Units.smallSpacing } focus: true clip: true -- cgit v1.2.3-70-g09d2