aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2024-09-01 20:14:29 +0900
committerNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2024-09-27 08:19:56 +0900
commit8c79f5fa6f8bcfabde810c9f76f3e358bb985d7a (patch)
tree4027709f63e9edd3bdb236cf35d8ed2941927a03
parent10c3f7996d4bbe04d237baff2ef16573bc9eb9ed (diff)
Mominavi porting to Qt6
Mominavi has some Qt5 dependency. It need some change to port to Qt6. In the Qt6, QtLocation was dropped support for some map provider support such as MapBox. In this patch, the map plugin change from mapbox to osm. Bug-AGL: SPEC-5162 Change-Id: I353d4a134191c178d7ec0f28c9ee1e69e4eab4d8 Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
-rw-r--r--BtnArrow.qml5
-rw-r--r--BtnEnlarge.qml5
-rw-r--r--BtnGuidance.qml9
-rw-r--r--BtnMapDirection.qml7
-rw-r--r--BtnPresentPosition.qml5
-rw-r--r--BtnShrink.qml5
-rw-r--r--ProgressNextCross.qml20
-rw-r--r--RouteView.qml10
-rw-r--r--mominavi.cpp12
-rw-r--r--mominavi.pro3
-rw-r--r--mominavi.qml87
11 files changed, 83 insertions, 85 deletions
diff --git a/BtnArrow.qml b/BtnArrow.qml
index 4d6f987..d2fd2a6 100644
--- a/BtnArrow.qml
+++ b/BtnArrow.qml
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
-import QtQuick 2.0
-import QtQuick.Controls 1.5
+// Copyright (C) 2024 Automotive Grade Linux
+import QtQuick
+import QtQuick.Controls
Item {
Button {
diff --git a/BtnEnlarge.qml b/BtnEnlarge.qml
index 187207c..dabe641 100644
--- a/BtnEnlarge.qml
+++ b/BtnEnlarge.qml
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
+// Copyright (C) 2024 Automotive Grade Linux
-import QtQuick 2.0
-import QtQuick.Controls 1.5
+import QtQuick
+import QtQuick.Controls
Item {
Button {
diff --git a/BtnGuidance.qml b/BtnGuidance.qml
index 189d40c..cb97f48 100644
--- a/BtnGuidance.qml
+++ b/BtnGuidance.qml
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
+// Copyright (C) 2024 Automotive Grade Linux
-import QtQuick 2.0
-import QtQuick.Controls 1.5
-import QtLocation 5.9
-import QtPositioning 5.6
+import QtQuick
+import QtQuick.Controls
+import QtLocation
+import QtPositioning
Item {
id: btn_guidance
diff --git a/BtnMapDirection.qml b/BtnMapDirection.qml
index 8858e8a..59eb966 100644
--- a/BtnMapDirection.qml
+++ b/BtnMapDirection.qml
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
+// Copyright (C) 2024 Automotive Grade Linux
-import QtQuick 2.0
-import QtQuick.Controls 1.5
+import QtQuick
+import QtQuick.Controls
Item {
Image {
@@ -19,7 +20,7 @@ Item {
id: btn_map_direction
width: 100
height: 100
- iconSource: ""
+ icon.source: ""
opacity: 0
visible: true
clip: false
diff --git a/BtnPresentPosition.qml b/BtnPresentPosition.qml
index 282259b..af6662d 100644
--- a/BtnPresentPosition.qml
+++ b/BtnPresentPosition.qml
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
+// Copyright (C) 2024 Automotive Grade Linux
-import QtQuick 2.0
-import QtQuick.Controls 1.5
+import QtQuick
+import QtQuick.Controls
Item {
id: btn_present_position
diff --git a/BtnShrink.qml b/BtnShrink.qml
index 01ec6d2..e34489d 100644
--- a/BtnShrink.qml
+++ b/BtnShrink.qml
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
+// Copyright (C) 2024 Automotive Grade Linux
-import QtQuick 2.0
-import QtQuick.Controls 1.5
+import QtQuick
+import QtQuick.Controls
Item {
Button {
diff --git a/ProgressNextCross.qml b/ProgressNextCross.qml
index 89a2b7b..bc6b426 100644
--- a/ProgressNextCross.qml
+++ b/ProgressNextCross.qml
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
-import QtQuick 2.0
-import QtQuick.Controls 1.5
-import QtQuick.Controls.Styles 1.4
+// Copyright (C) 2024 Automotive Grade Linux
+import QtQuick
+import QtQuick.Controls
Item {
id: progress_next_cross
@@ -14,7 +14,7 @@ Item {
// when over the ProgressBar.maximumValue/m, progress bar indicates max (same as ProgressBar.maximumValue/m)
function setProgress(val) {
if (val > bar.value ) {
- bar.maximumValue = val
+ bar.to = val
}
if ( 0 < val ) {
@@ -28,16 +28,10 @@ Item {
id: bar
width: 800
height: 20
- orientation: Qt.Horizontal
+ //orientation: Qt.Horizontal
value: 0
- minimumValue: 0
- maximumValue: 800
-
- style: ProgressBarStyle {
- progress: Rectangle {
- color: "green"
- }
- }
+ from: 0
+ to: 800
}
states: [
State {
diff --git a/RouteView.qml b/RouteView.qml
index c8dcbc4..ee1ce8a 100644
--- a/RouteView.qml
+++ b/RouteView.qml
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
-import QtQuick 2.0
+// Copyright (C) 2024 Automotive Grade Linux
+
+import QtQuick
Item {
Rectangle {
@@ -29,9 +31,3 @@ Item {
routeText.text = string
}
}
-
-/*##^##
-Designer {
- D{i:0;autoSize:true;height:480;width:640}
-}
-##^##*/
diff --git a/mominavi.cpp b/mominavi.cpp
index 6716193..1fa4338 100644
--- a/mominavi.cpp
+++ b/mominavi.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
+// Copyright (C) 2024 Automotive Grade Linux
#include <QGuiApplication>
#include <QQmlApplicationEngine>
@@ -8,8 +9,6 @@
int main(int argc, char *argv[])
{
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
-
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
@@ -21,15 +20,6 @@ int main(int argc, char *argv[])
}, Qt::QueuedConnection);
engine.load(url);
- QObject *rootObject = engine.rootObjects().constFirst();
- QString StrEnv = qgetenv("MOMIMAP_MAPBOX_ACCESS_TOKEN");
- rootObject->setProperty("mapbox_access_token", StrEnv);
-
- QString StrEnvStyle = qgetenv("MOMIMAP_MAPBOX_STYLE");
- if (StrEnvStyle.size() > 0) {
- rootObject->setProperty("mapbox_style_urls", StrEnvStyle);
- }
-
QString StrEnvLat = qgetenv("MOMIMAP_INITIAL_LATITUDE");
if (StrEnvLat.size() > 0) {
rootObject->setProperty("car_position_lat", StrEnvLat);
diff --git a/mominavi.pro b/mominavi.pro
index 3dd5fbc..2b2b21e 100644
--- a/mominavi.pro
+++ b/mominavi.pro
@@ -1,9 +1,10 @@
# SPDX-License-Identifier: GPL-3.0+
# Copyright (C) 2021 AISIN CORPORATION
+# Copyright (C) 2024 Automotive Grade Linux
QT += quick positioning qml
-CONFIG += c++11
+CONFIG += c++17
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
diff --git a/mominavi.qml b/mominavi.qml
index ff0b456..e676d47 100644
--- a/mominavi.qml
+++ b/mominavi.qml
@@ -2,6 +2,7 @@
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2021 AISIN CORPORATION
+** Copyright (C) 2024 Automotive Grade Linux
** Contact: https://www.qt.io/licensing/
**
** SPDX-License-Identifier: BSD-3-Clause-Clear
@@ -50,11 +51,11 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Layouts 1.12
-import QtQuick.Controls 2.12
-import QtLocation 5.9
-import QtPositioning 5.6
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.Controls
+import QtLocation
+import QtPositioning
ApplicationWindow {
@@ -74,9 +75,11 @@ ApplicationWindow {
property real car_accumulated_distance : 0
property real positionTimer_interval : 100
property real car_moving_distance : (car_driving_speed / 3.6) / (1000/positionTimer_interval) // Metric unit
- property string mapbox_access_token : ""
- property string mapbox_style_urls : "mapbox://styles/wata2ki/ckoy853ue11a117nss0uxut76"
- property string mapbox_cache_dir : "/var/cache/momimap"
+
+ Plugin {
+ id: mapPlugin
+ name: "osm"
+ }
Map{
id: map
@@ -100,12 +103,7 @@ ApplicationWindow {
width: parent.width
height: parent.height
- plugin: Plugin {
- name: "mapboxgl"
- PluginParameter { name: "mapboxgl.access_token"; value: mapbox_access_token }
- PluginParameter { name: "mapboxgl.mapping.additional_style_urls"; value: mapbox_style_urls }
- PluginParameter { name: "mapboxgl.mapping.cache.directory"; value: mapbox_cache_dir }
- }
+ plugin: mapPlugin
center: QtPositioning.coordinate(car_position_lat, car_position_lon)
zoomLevel: default_zoom_level
bearing: 0
@@ -120,7 +118,7 @@ ApplicationWindow {
}
onLocationsChanged:
{
- if (count == 1) {
+ if (count === 1) {
map.center.latitude = get(0).coordinate.latitude
map.center.longitude = get(0).coordinate.longitude
}
@@ -256,11 +254,8 @@ ApplicationWindow {
id: routeModel
objectName: "routeModel"
plugin : Plugin {
- name: "mapbox"
- PluginParameter { name: "mapbox.access_token";
- value: mapbox_access_token
- }
- }
+ name: "osm"
+ }
query: RouteQuery {
id: routeQuery
}
@@ -446,37 +441,53 @@ ApplicationWindow {
acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed : {
- map.lastX = mouse.x
- map.lastY = mouse.y
- map.pressX = mouse.x
- map.pressY = mouse.y
- lastCoordinate = map.toCoordinate(Qt.point(mouse.x, mouse.y))
+ map.lastX = mouseX
+ map.lastY = mouseY
+ map.pressX = mouseX
+ map.pressY = mouseY
+ lastCoordinate = map.toCoordinate(Qt.point(mouseX, mouseY))
}
onPositionChanged: {
- if (mouse.button === Qt.LeftButton) {
- map.lastX = mouse.x
- map.lastY = mouse.y
- }
+ if ((pressedButtons & Qt.LeftButton) === true) {
+ map.lastX = mouseX
+ map.lastY = mouseY
+ }
}
onPressAndHold:{
if((btn_guidance.state !== "onGuide") && (btn_guidance.state !== "Routing"))
{
- if (Math.abs(map.pressX - mouse.x ) < map.jitterThreshold
- && Math.abs(map.pressY - mouse.y ) < map.jitterThreshold) {
+ if (Math.abs(map.pressX - mouseX ) < map.jitterThreshold
+ && Math.abs(map.pressY - mouseY ) < map.jitterThreshold) {
map.addDestination(lastCoordinate)
}
}
}
- }
- gesture.onFlickStarted: {
- btn_present_position.state = "Optional"
- }
- gesture.onPanStarted: {
- btn_present_position.state = "Optional"
- }
+ }
+ PinchHandler {
+ id: pinch
+ target: null
+ onActiveChanged: if (active) {
+ map.startCentroid = map.toCoordinate(pinch.centroid.position, false)
+ }
+ onScaleChanged: (delta) => {
+ map.zoomLevel += Math.log2(delta)
+ map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position)
+ }
+ onRotationChanged: (delta) => {
+ map.bearing -= delta
+ map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position)
+ }
+ grabPermissions: PointerHandler.TakeOverForbidden
+ }
+ DragHandler {
+ id: drag
+ target: null
+ onTranslationChanged: (delta) => map.pan(-delta.x, -delta.y)
+ }
+
function updatePositon()
{
if(pathcounter <= routeModel.get(0).path.length - 1){