From c06e69931a0e23568ffd1c7a41515d3e3b82dadd Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sun, 18 Jun 2023 10:16:14 +0200 Subject: [PATCH] Add fullscreen map to live location delegates as well --- src/qml/Component/FullScreenMap.qml | 17 ++++++++++++----- .../Component/Timeline/LiveLocationDelegate.qml | 8 ++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/qml/Component/FullScreenMap.qml b/src/qml/Component/FullScreenMap.qml index 3831ca27a..a9ec96812 100644 --- a/src/qml/Component/FullScreenMap.qml +++ b/src/qml/Component/FullScreenMap.qml @@ -11,10 +11,11 @@ import org.kde.kirigami 2.15 as Kirigami ApplicationWindow { id: root - required property real latitude - required property real longitude - required property string asset - required property var author + property real latitude: NaN + property real longitude: NaN + property string asset + property var author + property QtObject liveLocationModel: null flags: Qt.FramelessWindowHint | Qt.WA_TranslucentBackground visibility: Qt.WindowFullScreen @@ -35,7 +36,8 @@ ApplicationWindow { Map { id: map anchors.fill: parent - center: QtPositioning.coordinate(root.latitude, root.longitude) + center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x) + : QtPositioning.coordinate(root.latitude, root.longitude) zoomLevel: 15 plugin: OsmLocationPlugin.plugin LocationMapItem { @@ -44,6 +46,11 @@ ApplicationWindow { asset: root.asset author: root.author isLive: true + visible: !isNaN(root.latitude) && !isNaN(root.longitude) + } + MapItemView { + model: root.liveLocationModel + delegate: LocationMapItem {} } onCopyrightLinkActivated: { Qt.openUrlExternally(link) diff --git a/src/qml/Component/Timeline/LiveLocationDelegate.qml b/src/qml/Component/Timeline/LiveLocationDelegate.qml index e3831d7a0..5d96c7fed 100644 --- a/src/qml/Component/Timeline/LiveLocationDelegate.qml +++ b/src/qml/Component/Timeline/LiveLocationDelegate.qml @@ -47,6 +47,10 @@ TimelineContainer { TapHandler { acceptedButtons: Qt.LeftButton + onTapped: { + let map = fullScreenMap.createObject(parent, {liveLocationModel: liveLocationModel}); + map.open() + } onLongPressed: openMessageContext("") } TapHandler { @@ -54,5 +58,9 @@ TimelineContainer { onTapped: openMessageContext("") } } + Component { + id: fullScreenMap + FullScreenMap {} + } } }