Warning, /network/neochat/src/qml/LiveLocationDelegate.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
0002 // SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Controls
0007 import QtQuick.Layouts
0008 import QtLocation
0009 import QtPositioning
0010 
0011 import org.kde.neochat
0012 
0013 /**
0014  * @brief A timeline delegate for a location message.
0015  *
0016  * @inherit MessageDelegate
0017  */
0018 MessageDelegate {
0019     id: root
0020 
0021     bubbleContent: ColumnLayout {
0022         LiveLocationsModel {
0023             id: liveLocationModel
0024             eventId: root.eventId
0025             room: root.room
0026         }
0027         MapView {
0028             id: mapView
0029             Layout.fillWidth: true
0030             Layout.preferredHeight: root.contentMaxWidth / 16 * 9
0031 
0032             map.center: QtPositioning.coordinate(liveLocationModel.boundingBox.y, liveLocationModel.boundingBox.x)
0033             map.zoomLevel: 15
0034 
0035             map.plugin: OsmLocationPlugin.plugin
0036 
0037             MapItemView {
0038                 model: liveLocationModel
0039                 delegate: LocationMapItem {}
0040             }
0041 
0042             TapHandler {
0043                 acceptedButtons: Qt.LeftButton
0044                 onTapped: {
0045                     let map = fullScreenMap.createObject(parent, {
0046                         liveLocationModel: liveLocationModel
0047                     });
0048                     map.open();
0049                 }
0050                 onLongPressed: openMessageContext("")
0051             }
0052             TapHandler {
0053                 acceptedButtons: Qt.RightButton
0054                 onTapped: openMessageContext("")
0055             }
0056             Connections {
0057                 target: mapView.map
0058                 function onCopyrightLinkActivated() {
0059                     Qt.openUrlExternally(link);
0060                 }
0061             }
0062         }
0063         Component {
0064             id: fullScreenMap
0065             FullScreenMap {}
0066         }
0067 
0068         RichLabel {
0069             textMessage: root.display
0070             visible: root.display !== ""
0071         }
0072     }
0073 }