diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-26 20:06:30 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-26 20:06:30 -0800 |
commit | 35e60a7355e23b50fc7f48f48efe68a26b445454 (patch) | |
tree | 8353c0dce3d6f63fb4f0047c4497c873c57e98b5 /qt-mobile/qml/DiveList.qml | |
parent | 6a8768ee262aa3debfe8868fa7a5da13e0ba3a3b (diff) | |
download | subsurface-35e60a7355e23b50fc7f48f48efe68a26b445454.tar.gz |
QML UI: don't combine multiple trips to the same location into one
The way sectioning of the dive list works is by watching for different strings
in the section.property. In order to be able to tell different trips apart we
combine the address of the dive trip variable with the location (which will
create a new section for a new trip, even if the location text is the same) and
then strip that information out before showing the trip header.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml/DiveList.qml')
-rw-r--r-- | qt-mobile/qml/DiveList.qml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml index 21858afb4..7b300ed24 100644 --- a/qt-mobile/qml/DiveList.qml +++ b/qt-mobile/qml/DiveList.qml @@ -106,7 +106,19 @@ MobileComponents.Page { MobileComponents.Heading { id: sectionText - text: {section == "--" ? "" : section } + text: { + // if the tripMeta (which we get as "section") ends in ::-- we know + // that there's no trip -- otherwise strip the meta information before + // the :: and show the trip location + var shownText + var endsWithDoubleDash = /::--$/; + if (endsWithDoubleDash.test(section)) { + shownText = "" + } else { + shownText = section.replace(/.*::/, "") + } + shownText + } anchors { top: parent.top left: parent.left @@ -150,7 +162,7 @@ MobileComponents.Page { boundsBehavior: Flickable.StopAtBounds maximumFlickVelocity: parent.height * 5 cacheBuffer: 0 // seems to avoid empty rendered profiles - section.property: "dive.trip" + section.property: "dive.tripMeta" section.criteria: ViewSection.FullString section.delegate: tripHeading header: MobileComponents.Heading { |