Skip to content

Commit

Permalink
upgrade qml 5.15 to 6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Oct 5, 2024
1 parent 615323f commit 73d2417
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 30 deletions.
44 changes: 29 additions & 15 deletions gui/controls2_640/MapView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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
Expand Down Expand Up @@ -334,7 +333,7 @@ MapPage {
ScaleIndicator{
id: scaleIndicator
pixelSize: map.pixelSize
color: "black"
color: MapExtras.dayLight ? "black" : "lightGray"
visible: !showToolbar
anchors{
bottom: parent.bottom
Expand All @@ -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
}

Expand Down Expand Up @@ -483,27 +482,27 @@ 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)
Label {
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
Expand Down Expand Up @@ -786,8 +785,7 @@ MapPage {
opacity: 0.7
height: units.gu(6)
onClicked: {
nightView = !nightView;
MapExtras.setDaylight(!nightView);
MapExtras.setDaylight(!MapExtras.dayLight);
}
}
}
Expand Down Expand Up @@ -929,8 +927,7 @@ MapPage {
opacity: 0.7
height: units.gu(6)
onClicked: {
nightView = !nightView;
map.toggleDaylight();
MapExtras.setDaylight(!MapExtras.dayLight);
}
}
}
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 12 additions & 4 deletions gui/controls2_640/Tracking.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down
12 changes: 3 additions & 9 deletions gui/controls2_640/components/NavigatorInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gui/controls2_640/components/RouteOverview.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gui/controls2_640/osmin.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 73d2417

Please sign in to comment.