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

0001 // SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtLocation
0006 import QtPositioning
0007 
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.neochat
0010 
0011 Kirigami.Page {
0012     id: root
0013 
0014     required property var room
0015 
0016     title: i18nc("Locations on a map", "Locations")
0017 
0018     padding: 0
0019 
0020     MapView {
0021         id: mapView
0022         anchors.fill: parent
0023         map.plugin: OsmLocationPlugin.plugin
0024 
0025         map.center: {
0026             let c = LocationHelper.center(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox));
0027             return QtPositioning.coordinate(c.y, c.x);
0028         }
0029         map.zoomLevel: LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), mapView.width, mapView.height)
0030 
0031         MapItemView {
0032             model: LocationsModel {
0033                 id: locationsModel
0034                 room: root.room
0035             }
0036             delegate: LocationMapItem {
0037                 isLive: true
0038                 heading: NaN
0039             }
0040         }
0041 
0042         MapItemView {
0043             model: LiveLocationsModel {
0044                 id: liveLocationsModel
0045                 room: root.room
0046             }
0047             delegate: LocationMapItem {}
0048         }
0049 
0050         Kirigami.PlaceholderMessage {
0051             text: i18n("There are no locations shared in this room.")
0052             visible: mapView.mapItems.length === 0
0053             anchors.centerIn: parent
0054         }
0055         Connections {
0056             target: mapView.map
0057             function onCopyrightLinkActivated() {
0058                 Qt.openUrlExternally(link);
0059             }
0060         }
0061     }
0062 }