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

0001 // SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls
0006 import QtQuick.Layouts
0007 import QtLocation
0008 import QtPositioning
0009 
0010 import org.kde.kirigamiaddons.labs.components as Components
0011 
0012 import org.kde.kirigami as Kirigami
0013 
0014 import org.kde.neochat
0015 
0016 Components.AbstractMaximizeComponent {
0017     id: root
0018 
0019     required property NeoChatRoom room
0020     property var location
0021 
0022     title: i18n("Choose a Location")
0023 
0024     actions: [
0025         Kirigami.Action {
0026             icon.name: "document-send"
0027             text: i18n("Send this location")
0028             onTriggered: {
0029                 root.room.sendLocation(root.location.latitude, root.location.longitude, "");
0030                 root.close();
0031             }
0032             enabled: !!root.location
0033         }
0034     ]
0035 
0036     content: MapView {
0037         id: mapView
0038         map.plugin: Plugin {
0039             name: "osm"
0040             PluginParameter {
0041                 name: "osm.useragent"
0042                 value: Application.name + "/" + Application.version + " (kde-devel@kde.org)"
0043             }
0044             PluginParameter {
0045                 name: "osm.mapping.providersrepository.address"
0046                 value: "https://autoconfig.kde.org/qtlocation/"
0047             }
0048         }
0049 
0050         MouseArea {
0051             anchors.fill: parent
0052             onClicked: {
0053                 root.location = mapView.map.toCoordinate(Qt.point(mouseX, mouseY), false);
0054             }
0055         }
0056 
0057         MapQuickItem {
0058             id: point
0059 
0060             visible: root.location
0061             anchorPoint.x: sourceItem.width / 2
0062             anchorPoint.y: sourceItem.height * 0.85
0063             coordinate: root.location
0064             autoFadeIn: false
0065 
0066             sourceItem: Kirigami.Icon {
0067                 width: height
0068                 height: Kirigami.Units.iconSizes.huge
0069                 source: "gps"
0070                 isMask: true
0071                 color: Kirigami.Theme.highlightColor
0072 
0073                 Kirigami.Icon {
0074                     anchors.centerIn: parent
0075                     anchors.verticalCenterOffset: -parent.height / 8
0076                     width: height
0077                     height: parent.height / 3 + 1
0078                     source: "pin"
0079                     isMask: true
0080                     color: Kirigami.Theme.highlightColor
0081                 }
0082             }
0083         }
0084         Connections {
0085             target: mapView.map
0086             function onCopyrightLinkActivated() {
0087                 Qt.openUrlExternally(link);
0088             }
0089         }
0090     }
0091 }