Create the OSM QtLocation plugin only once
Just loading that plugin already triggers an HTTP request, so lets only do that when really needed and even more importantly, not for every single location delegate again.
This commit is contained in:
@@ -283,6 +283,7 @@ int main(int argc, char *argv[])
|
||||
qmlRegisterSingletonType("org.kde.neochat", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
|
||||
return engine->toScriptValue(KAboutData::applicationData());
|
||||
});
|
||||
qmlRegisterSingletonType(QUrl("qrc:/OsmLocationPlugin.qml"), "org.kde.neochat", 1, 0, "OsmLocationPlugin");
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
qRegisterMetaTypeStreamOperators<Emoji>();
|
||||
|
||||
@@ -47,18 +47,8 @@ TimelineContainer {
|
||||
|
||||
center: QtPositioning.coordinate(root.latitude, root.longitude)
|
||||
zoomLevel: 15
|
||||
plugin: 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/"
|
||||
}
|
||||
}
|
||||
|
||||
plugin: OsmLocationPlugin.plugin
|
||||
onCopyrightLinkActivated: Qt.openUrlExternally(link)
|
||||
|
||||
|
||||
|
||||
21
src/qml/Component/Timeline/OsmLocationPlugin.qml
Normal file
21
src/qml/Component/Timeline/OsmLocationPlugin.qml
Normal file
@@ -0,0 +1,21 @@
|
||||
// SPDX-FileCopyrightText: 2021 Tobias Fella <fella@posteo.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtLocation 5.15
|
||||
|
||||
QtObject {
|
||||
property var plugin: 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/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,5 +126,6 @@
|
||||
<file alias="InvitationView.qml">qml/Component/InvitationView.qml</file>
|
||||
<file alias="AvatarTabButton.qml">qml/Component/AvatarTabButton.qml</file>
|
||||
<file alias="SpaceDrawer.qml">qml/Page/RoomList/SpaceDrawer.qml</file>
|
||||
<file alias="OsmLocationPlugin.qml">qml/Component/Timeline/OsmLocationPlugin.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user