Fix location delegates
- Mark OSMLocationPlugina as singleton in cmake - Use this plugin for the LocationChooser
This commit is contained in:
@@ -174,6 +174,10 @@ add_library(neochat STATIC
|
|||||||
sharehandler.h
|
sharehandler.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_source_files_properties(qml/OsmLocationPlugin.qml PROPERTIES
|
||||||
|
QT_QML_SINGLETON_TYPE TRUE
|
||||||
|
)
|
||||||
|
|
||||||
qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
|
qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
|
||||||
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat
|
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat
|
||||||
QML_FILES
|
QML_FILES
|
||||||
|
|||||||
@@ -47,10 +47,12 @@ ApplicationWindow {
|
|||||||
isLive: true
|
isLive: true
|
||||||
heading: NaN
|
heading: NaN
|
||||||
visible: !isNaN(root.latitude) && !isNaN(root.longitude)
|
visible: !isNaN(root.latitude) && !isNaN(root.longitude)
|
||||||
|
Component.onCompleted: mapView.map.addMapItem(this)
|
||||||
}
|
}
|
||||||
MapItemView {
|
MapItemView {
|
||||||
model: root.liveLocationModel
|
model: root.liveLocationModel
|
||||||
delegate: LocationMapItem {}
|
delegate: LocationMapItem {}
|
||||||
|
Component.onCompleted: mapView.map.addMapItemView(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -35,52 +35,25 @@ Components.AbstractMaximizeComponent {
|
|||||||
|
|
||||||
content: MapView {
|
content: MapView {
|
||||||
id: mapView
|
id: mapView
|
||||||
map.plugin: Plugin {
|
map.plugin: OsmLocationPlugin.plugin
|
||||||
name: "osm"
|
|
||||||
PluginParameter {
|
|
||||||
name: "osm.useragent"
|
|
||||||
value: Application.name + "/" + Application.version + " (kde-devel@kde.org)"
|
|
||||||
}
|
|
||||||
PluginParameter {
|
|
||||||
name: "osm.mapping.providersrepository.address"
|
|
||||||
value: "https://autoconfig.kde.org/qtlocation/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.location = mapView.map.toCoordinate(Qt.point(mouseX, mouseY), false);
|
root.location = mapView.map.toCoordinate(Qt.point(mouseX, mouseY), false);
|
||||||
|
mapView.map.addMapItem(mapView.locationMapItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MapQuickItem {
|
readonly property LocationMapItem locationMapItem: LocationMapItem {
|
||||||
id: point
|
latitude: root.location.latitude
|
||||||
|
longitude: root.location.longitude
|
||||||
visible: root.location
|
isLive: false
|
||||||
anchorPoint.x: sourceItem.width / 2
|
heading: NaN
|
||||||
anchorPoint.y: sourceItem.height * 0.85
|
asset: null
|
||||||
coordinate: root.location
|
author: null
|
||||||
autoFadeIn: false
|
|
||||||
|
|
||||||
sourceItem: Kirigami.Icon {
|
|
||||||
width: height
|
|
||||||
height: Kirigami.Units.iconSizes.huge
|
|
||||||
source: "gps"
|
|
||||||
isMask: true
|
|
||||||
color: Kirigami.Theme.highlightColor
|
|
||||||
|
|
||||||
Kirigami.Icon {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
anchors.verticalCenterOffset: -parent.height / 8
|
|
||||||
width: height
|
|
||||||
height: parent.height / 3 + 1
|
|
||||||
source: "pin"
|
|
||||||
isMask: true
|
|
||||||
color: Kirigami.Theme.highlightColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: mapView.map
|
target: mapView.map
|
||||||
function onCopyrightLinkActivated() {
|
function onCopyrightLinkActivated() {
|
||||||
|
|||||||
@@ -29,17 +29,22 @@ Kirigami.Page {
|
|||||||
map.zoomLevel: LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), mapView.width, mapView.height)
|
map.zoomLevel: LocationHelper.zoomToFit(LocationHelper.unite(locationsModel.boundingBox, liveLocationsModel.boundingBox), mapView.width, mapView.height)
|
||||||
|
|
||||||
MapItemView {
|
MapItemView {
|
||||||
|
Component.onCompleted: mapView.map.addMapItemView(this)
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
model: LocationsModel {
|
model: LocationsModel {
|
||||||
id: locationsModel
|
id: locationsModel
|
||||||
room: root.room
|
room: root.room
|
||||||
}
|
}
|
||||||
delegate: LocationMapItem {
|
delegate: LocationMapItem {
|
||||||
isLive: true
|
isLive: false
|
||||||
heading: NaN
|
heading: NaN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MapItemView {
|
MapItemView {
|
||||||
|
Component.onCompleted: mapView.map.addMapItemView(this)
|
||||||
|
anchors.fill: parent
|
||||||
model: LiveLocationsModel {
|
model: LiveLocationsModel {
|
||||||
id: liveLocationsModel
|
id: liveLocationsModel
|
||||||
room: root.room
|
room: root.room
|
||||||
@@ -49,7 +54,7 @@ Kirigami.Page {
|
|||||||
|
|
||||||
Kirigami.PlaceholderMessage {
|
Kirigami.PlaceholderMessage {
|
||||||
text: i18n("There are no locations shared in this room.")
|
text: i18n("There are no locations shared in this room.")
|
||||||
visible: mapView.mapItems.length === 0
|
visible: mapView.map.mapItems.length === 0
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -7,11 +7,14 @@ import QtQuick
|
|||||||
import QtLocation
|
import QtLocation
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property string userAgent: Application.name + "/" + Application.version + " (kde-devel@kde.org)"
|
||||||
property var plugin: Plugin {
|
property var plugin: Plugin {
|
||||||
name: "osm"
|
name: "osm"
|
||||||
PluginParameter {
|
PluginParameter {
|
||||||
name: "osm.useragent"
|
name: "osm.useragent"
|
||||||
value: Application.name + "/" + Application.version + " (kde-devel@kde.org)"
|
value: root.userAgent
|
||||||
}
|
}
|
||||||
PluginParameter {
|
PluginParameter {
|
||||||
name: "osm.mapping.providersrepository.address"
|
name: "osm.mapping.providersrepository.address"
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ ColumnLayout {
|
|||||||
|
|
||||||
map.plugin: OsmLocationPlugin.plugin
|
map.plugin: OsmLocationPlugin.plugin
|
||||||
|
|
||||||
LocationMapItem {
|
readonly property LocationMapItem locationMapItem: LocationMapItem {
|
||||||
latitude: root.latitude
|
latitude: root.latitude
|
||||||
longitude: root.longitude
|
longitude: root.longitude
|
||||||
asset: root.asset
|
asset: root.asset
|
||||||
@@ -85,6 +85,8 @@ ColumnLayout {
|
|||||||
heading: NaN
|
heading: NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: map.addMapItem(locationMapItem)
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
onTapped: {
|
onTapped: {
|
||||||
|
|||||||
Reference in New Issue
Block a user