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     property alias room: liveLocationModel.room
0022 
0023     bubbleContent: ColumnLayout {
0024         LiveLocationsModel {
0025             id: liveLocationModel
0026             eventId: root.eventId
0027         }
0028         MapView {
0029             id: mapView
0030             Layout.fillWidth: true
0031             Layout.preferredHeight: root.contentMaxWidth / 16 * 9
0032 
0033             map.center: QtPositioning.coordinate(liveLocationModel.boundingBox.y, liveLocationModel.boundingBox.x)
0034             map.zoomLevel: 15
0035 
0036             map.plugin: OsmLocationPlugin.plugin
0037 
0038             MapItemView {
0039                 model: liveLocationModel
0040                 delegate: LocationMapItem {}
0041             }
0042 
0043             TapHandler {
0044                 acceptedButtons: Qt.LeftButton
0045                 onTapped: {
0046                     let map = fullScreenMap.createObject(parent, {liveLocationModel: liveLocationModel});
0047                     map.open()
0048                 }
0049                 onLongPressed: openMessageContext("")
0050             }
0051             TapHandler {
0052                 acceptedButtons: Qt.RightButton
0053                 onTapped: openMessageContext("")
0054             }
0055             Connections {
0056                 target: mapView.map
0057                 function onCopyrightLinkActivated() {
0058                     Qt.openUrlExternally(link)
0059                 }
0060             }
0061         }
0062         Component {
0063             id: fullScreenMap
0064             FullScreenMap {}
0065         }
0066 
0067         RichLabel {
0068             textMessage: root.display
0069             visible: root.display !== ""
0070         }
0071     }
0072 }