From 73d24173c991fa8b877175c3deb329288347fa6b Mon Sep 17 00:00:00 2001 From: janbar Date: Wed, 2 Oct 2024 16:54:15 +0200 Subject: [PATCH] upgrade qml 5.15 to 6.4 --- gui/controls2_640/MapView.qml | 44 ++++++++++++------- gui/controls2_640/Tracking.qml | 16 +++++-- .../components/NavigatorInfo.qml | 12 ++--- .../components/RouteOverview.qml | 2 +- gui/controls2_640/osmin.qml | 2 +- 5 files changed, 46 insertions(+), 30 deletions(-) diff --git a/gui/controls2_640/MapView.qml b/gui/controls2_640/MapView.qml index 79d850c9..c56f90e5 100644 --- a/gui/controls2_640/MapView.qml +++ b/gui/controls2_640/MapView.qml @@ -94,7 +94,7 @@ MapPage { // configure style from setting var flags = JSON.parse(settings.styleFlags); if (Array.isArray(flags)) { - flags.push({ "name": "daylight", "value": !nightView }); + flags.push({ "name": "daylight", "value": MapExtras.dayLight }); setStyleFlags(flags); } @@ -111,7 +111,6 @@ MapPage { property double lon: 0.0 } - property bool nightView: false property bool rotateEnabled: false property real rotation: 0.0 // rotation of the map (radians) property bool lockRotation: true // lock or unlock rotation of the map @@ -334,7 +333,7 @@ MapPage { ScaleIndicator{ id: scaleIndicator pixelSize: map.pixelSize - color: "black" + color: MapExtras.dayLight ? "black" : "lightGray" visible: !showToolbar anchors{ bottom: parent.bottom @@ -351,7 +350,7 @@ MapPage { text: "© OpenStreetMap contributors" font.pixelSize: units.fs("x-small") font.weight: Font.Thin - color: nightView ? "white" : "black" + color: MapExtras.dayLight ? "black" : "white" visible: !showToolbar && !navigation } @@ -483,7 +482,7 @@ MapPage { id: currentSpeed text: Converter.readableSpeed(Tracker.currentSpeed) font.pixelSize: 1.5 * units.fs("x-large") - color: nightView ? "white" : "black" + color: MapExtras.dayLight ? "black" : "white" } Row { spacing: units.gu(2) @@ -491,19 +490,19 @@ MapPage { id: duration text: Converter.panelDurationHMS(Tracker.duration) font.pixelSize: units.fs("medium") - color: nightView ? "white" : "black" + color: MapExtras.dayLight ? "black" : "white" } Label { id: distance text: Converter.panelDistance(Tracker.distance) font.pixelSize: units.fs("medium") - color: nightView ? "white" : "black" + color: MapExtras.dayLight ? "black" : "white" } } MapIcon { id: elevation source: "qrc:/images/trip/elevation.svg" - color: nightView ? "white" : "black" + color: MapExtras.dayLight ? "black" : "white" enabled: false height: units.gu(2) borderPadding: 0 @@ -786,8 +785,7 @@ MapPage { opacity: 0.7 height: units.gu(6) onClicked: { - nightView = !nightView; - MapExtras.setDaylight(!nightView); + MapExtras.setDaylight(!MapExtras.dayLight); } } } @@ -929,8 +927,7 @@ MapPage { opacity: 0.7 height: units.gu(6) onClicked: { - nightView = !nightView; - map.toggleDaylight(); + MapExtras.setDaylight(!MapExtras.dayLight); } } } @@ -1165,12 +1162,29 @@ MapPage { } } + property QtObject suspendedState: QtObject { + property bool navigation: false + } + Connections { target: mainView function onApplicationSuspendedChanged() { - // On android disable navigation when the app is suspended - if (DeviceMobile && applicationSuspended && navigation) - navigation = false; + // On device mobile (e.g Android) disable all when the app is suspended + if (DeviceMobile) { + if (applicationSuspended) { + rotateEnabled = false; + map.lockToPosition = false; + // save current state + suspendedState.navigation = navigation; + // disable navigation state + if (navigation) + navigation = false; + } else { + // restore navigation state + if (suspendedState.navigation) + navigation = true; + } + } } function onShowFavoritesChanged() { if (showFavorites) diff --git a/gui/controls2_640/Tracking.qml b/gui/controls2_640/Tracking.qml index 5bdd3d57..2c65b4e0 100644 --- a/gui/controls2_640/Tracking.qml +++ b/gui/controls2_640/Tracking.qml @@ -223,10 +223,18 @@ PopOver { color: styleMap.popover.highlightedColor font.pixelSize: units.fs("medium") } - Label { - text: Converter.readableDegreeGeocaching(180.0 * Tracker.bearing / Math.PI) - font.pixelSize: units.fs("large") - color: foregroundColor + Row { + spacing: units.gu(1) + Label { + text: Converter.readableDegree(180.0 * Tracker.bearing / Math.PI) + font.pixelSize: units.fs("large") + color: foregroundColor + } + Label { + text: "(" + Converter.readableCardinal(180.0 * Tracker.bearing / Math.PI) + ")" + font.pixelSize: units.fs("large") + color: foregroundColor + } } } } diff --git a/gui/controls2_640/components/NavigatorInfo.qml b/gui/controls2_640/components/NavigatorInfo.qml index c3d4048a..75367b74 100644 --- a/gui/controls2_640/components/NavigatorInfo.qml +++ b/gui/controls2_640/components/NavigatorInfo.qml @@ -194,16 +194,10 @@ Item { id: speed anchors.verticalCenter: parent.verticalCenter text: Converter.readableSpeed(navigator.currentSpeed > 0 ? navigator.currentSpeed : 0.0) - color: styleMap.popover.foregroundColor + color: (navigator.maximumSpeed > 0 && navigator.maximumSpeed < (navigator.currentSpeed - 10.0) + ? "red" : styleMap.popover.foregroundColor) font.pixelSize: units.fs("x-large") } - Label { - id: maxspeed - anchors.verticalCenter: parent.verticalCenter - text: navigator.maximumSpeed > 0 ? Converter.readableSpeed(navigator.maximumSpeed) : "" - color: styleMap.popover.highlightedColor - font.pixelSize: units.fs("medium") - } MapIcon { anchors.verticalCenter: parent.verticalCenter source: { @@ -226,7 +220,7 @@ Item { anchors.verticalCenter: parent.verticalCenter text: navigator.arrivalEstimate + " ~ " + Converter.panelDistance(navigator.remainingDistance) color: styleMap.popover.foregroundColor - font.pixelSize: units.fs("medium") + font.pixelSize: units.fs("large") } } } diff --git a/gui/controls2_640/components/RouteOverview.qml b/gui/controls2_640/components/RouteOverview.qml index 98b399b1..6d1f2dd9 100644 --- a/gui/controls2_640/components/RouteOverview.qml +++ b/gui/controls2_640/components/RouteOverview.qml @@ -52,7 +52,7 @@ Item { delegate: Row { id: row spacing: units.gu(2) - width: parent.width + width: stepsView.width height: Math.max(stepInfo.implicitHeight, icon.height) WAYIcon { diff --git a/gui/controls2_640/osmin.qml b/gui/controls2_640/osmin.qml index 05af0d72..867c63f2 100644 --- a/gui/controls2_640/osmin.qml +++ b/gui/controls2_640/osmin.qml @@ -50,7 +50,7 @@ ApplicationWindow { // Navigation settings property string systemOfUnits: "SI" property bool hillShadesEnabled: false - property bool renderingTypeTiled: false + property bool renderingTypeTiled: true property string lastVehicle: "car" property int maximumRouteStep: 255 property int courseId: 0