Warning, /libraries/kosmindoormap/src/app/IndoorMapInfoSheet.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 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.kosmindoormap 0012 import org.kde.osm.editorcontroller 0013 0014 Kirigami.OverlaySheet { 0015 id: elementDetailsSheet 0016 property var model 0017 property var mapData 0018 0019 header: Column { 0020 Kirigami.Heading { 0021 text: elementDetailsSheet.model.name 0022 } 0023 Kirigami.Heading { 0024 text: elementDetailsSheet.model.category 0025 level: 4 0026 visible: text != "" 0027 } 0028 } 0029 0030 ListView { 0031 id: contentView 0032 model: elementDetailsSheet.model 0033 clip: true 0034 Layout.preferredWidth: Kirigami.Units.gridUnit * 25 0035 0036 Component { 0037 id: infoStringDelegate 0038 RowLayout { 0039 x: Kirigami.Units.largeSpacing 0040 width: parent.ListView.view.width - 2 * x 0041 QQC2.Label { 0042 visible: row && row.keyLabel != "" 0043 text: row ? row.keyLabel + ":" : "" 0044 color: (row && row.category == OSMElementInformationModel.DebugCategory) ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor 0045 Layout.alignment: Qt.AlignTop 0046 } 0047 QQC2.Label { 0048 text: row ? row.value : "" 0049 color: (row && row.category == OSMElementInformationModel.DebugCategory) ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor 0050 wrapMode: Text.WordWrap 0051 Layout.fillWidth: true 0052 } 0053 } 0054 } 0055 0056 Component { 0057 id: infoLinkDelegate 0058 RowLayout { 0059 x: Kirigami.Units.largeSpacing 0060 width: parent.ListView.view.width - 2 * x 0061 QQC2.Label { 0062 visible: row && row.keyLabel != "" 0063 text: row ? row.keyLabel + ":" : "" 0064 color: (row && row.category == OSMElementInformationModel.DebugCategory) ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor 0065 Layout.alignment: Qt.AlignTop 0066 } 0067 QQC2.Label { 0068 text: row ? "<a href=\"" + row.url + "\">" + row.value + "</a>" : "" 0069 color: (row && row.category == OSMElementInformationModel.DebugCategory) ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor 0070 onLinkActivated: Qt.openUrlExternally(link) 0071 wrapMode: Text.WordWrap 0072 Layout.fillWidth: true 0073 } 0074 } 0075 } 0076 0077 Component { 0078 id: infoAddressDelegate 0079 QQC2.Label { 0080 x: Kirigami.Units.largeSpacing 0081 width: parent.ListView.view.width - 2 * x 0082 text: (row.value.street + " " + row.value.houseNumber + "\n" + row.value.postalCode + " " + row.value.city + "\n" + row.value.country).trim() 0083 } 0084 } 0085 0086 Component { 0087 id: infoOpeningHoursDelegate 0088 IndoorMapInfoSheetOpeningHoursDelegate { 0089 x: Kirigami.Units.largeSpacing 0090 width: parent.ListView.view.width - 2 * x 0091 mapData: elementDetailsSheet.mapData 0092 model: row 0093 } 0094 } 0095 0096 section.property: "categoryLabel" 0097 section.delegate: Kirigami.Heading { 0098 x: Kirigami.Units.largeSpacing 0099 level: 4 0100 text: section 0101 color: section == "Debug" ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor 0102 height: implicitHeight + Kirigami.Units.largeSpacing 0103 verticalAlignment: Qt.AlignBottom 0104 } 0105 section.criteria: ViewSection.FullString 0106 section.labelPositioning: ViewSection.InlineLabels 0107 0108 delegate: Loader { 0109 property var row: model 0110 sourceComponent: { 0111 switch (row.type) { 0112 case OSMElementInformationModel.Link: 0113 return infoLinkDelegate; 0114 case OSMElementInformationModel.PostalAddress: 0115 return infoAddressDelegate; 0116 case OSMElementInformationModel.OpeningHoursType: 0117 return infoOpeningHoursDelegate; 0118 case OSMElementInformationModel.String: 0119 default: 0120 return infoStringDelegate; 0121 } 0122 } 0123 } 0124 } 0125 0126 footer: RowLayout { 0127 Item { Layout.fillWidth: true } 0128 QQC2.Button { 0129 icon.name: "document-edit" 0130 text: "Edit with iD" 0131 onClicked: EditorController.editElement(elementDetailsSheet.model.element.element, Editor.ID) 0132 } 0133 QQC2.Button { 0134 icon.name: "org.openstreetmap.josm" 0135 text: "Edit with JOSM" 0136 visible: EditorController.hasEditor(Editor.JOSM) 0137 onClicked: EditorController.editElement(elementDetailsSheet.model.element.element, Editor.JOSM) 0138 } 0139 QQC2.Button { 0140 icon.name: "document-edit" 0141 text: "Edit with Vespucci" 0142 visible: EditorController.hasEditor(Editor.Vespucci) 0143 onClicked: EditorController.editElement(elementDetailsSheet.model.element.element, Editor.Vespucci) 0144 } 0145 } 0146 0147 onClosed: elementDetailsSheet.model.clear() 0148 }