aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-29 19:42:34 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-29 19:42:34 -0500
commit83c72e7a79458826b677e82f108f3e92022c58b6 (patch)
treef43b82e444cb61866aeb8e2fdb337374e3960dc8
parent1b0c3d8df51ff310cd62b36769d09c158b79a84b (diff)
downloadsubsurface-83c72e7a79458826b677e82f108f3e92022c58b6.tar.gz
QML UI: make dive list fold dive trips
This makes it MUCH easier to deal with a lot of dives. Instead of needing a more complicated model we simply use the meta data that allows us to create the dive trip sections to hide (make invisible + height 0) all dives that aren't in the selected trip. I'll admit that this was much easier than I expected it to be. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-mobile/qml/DiveList.qml10
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml
index dd4b955b6..988221efd 100644
--- a/qt-mobile/qml/DiveList.qml
+++ b/qt-mobile/qml/DiveList.qml
@@ -14,12 +14,15 @@ MobileComponents.Page {
property int credentialStatus: manager.credentialStatus
property int numDives: diveListView.count
property color textColor: subsurfaceTheme.diveListTextColor
+ property string activeTrip
Component {
id: diveDelegate
MobileComponents.ListItem {
enabled: true
checked: diveListView.currentIndex === model.index
width: parent.width
+ height: dive.tripMeta == activeTrip ? diveDelegateItem.height : 0
+ visible: dive.tripMeta == activeTrip ? true : false
property real detailsOpacity : 0
property int horizontalPadding: MobileComponents.Units.gridUnit / 2 - MobileComponents.Units.smallSpacing + 1
@@ -34,6 +37,7 @@ MobileComponents.Page {
}
Item {
+ id: diveDelegateItem
width: parent.width - MobileComponents.Units.gridUnit
height: childrenRect.height - MobileComponents.Units.smallSpacing
@@ -135,6 +139,12 @@ MobileComponents.Page {
}
color: textColor
level: 2
+ MouseArea {
+ anchors.fill: sectionText
+ onClicked: {
+ activeTrip = section
+ }
+ }
}
Rectangle {
height: Math.max(2, MobileComponents.Units.gridUnit / 12) // we want a thicker line