Warning, /pim/itinerary/src/app/JourneyPathPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as QQC2
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kpublictransport
0012 import org.kde.itinerary
0013 
0014 Kirigami.ScrollablePage {
0015     property alias path: pathModel.path
0016 
0017     Component {
0018         id: pathDelegate
0019         QQC2.ItemDelegate {
0020             highlighted: false
0021             width: ListView.view.width
0022             property var section: model.section
0023             contentItem: GridLayout {
0024                 rows: 2
0025                 columns: 4
0026 
0027                 Kirigami.Icon {
0028                     Layout.row: 0
0029                     Layout.column: 0
0030                     Layout.rowSpan: 2
0031                     source: {
0032                         switch (section.maneuver) {
0033                             case PathSection.Stairs:
0034                                 return "qrc:/images/stairs.svg";
0035                             case PathSection.Elevator:
0036                                 return "qrc:/images/elevator.svg";
0037                             case PathSection.Escalator:
0038                                 return "qrc:/images/escalator.svg";
0039                             default:
0040                                 return "qrc:/images/walk.svg";
0041                         }
0042                     }
0043                     width: height
0044                     height: Kirigami.Units.iconSizes.medium
0045                     isMask: true
0046                 }
0047 
0048                 // floor level change indicator
0049                 Kirigami.Icon {
0050                     Layout.row: 0
0051                     Layout.column: 1
0052                     Layout.rowSpan: 2
0053                     width: height
0054                     height: Kirigami.Units.iconSizes.medium
0055                     source: section.floorLevelChange == 0 ? "" : section.floorLevelChange < 0 ? "go-down-skip" : "go-up-skip"
0056                 }
0057 
0058                 QQC2.Label {
0059                     Layout.row: 0
0060                     Layout.column: 2
0061                     Layout.fillWidth: true
0062                     text: section.description
0063                 }
0064                 QQC2.Label {
0065                     Layout.row: 1
0066                     Layout.column: 2
0067                     visible: section.distance > 0
0068                     text: Localizer.formatDistance(section.distance)
0069                 }
0070 
0071                 // direction indicator
0072                 Kirigami.Icon {
0073                     Layout.row: 0
0074                     Layout.column: 3
0075                     Layout.rowSpan: 2
0076                     width: height
0077                     height: Kirigami.Units.iconSizes.medium
0078                     source: "go-up-symbolic"
0079                     visible: model.turnDirection >= 0
0080                     rotation: model.turnDirection
0081                     smooth: true
0082                 }
0083             }
0084         }
0085     }
0086 
0087     PathModel {
0088         id: pathModel
0089     }
0090 
0091     ListView {
0092         model: pathModel
0093         delegate: pathDelegate
0094     }
0095 }