In /usr/share/harbour-gpsinfo/qml/pages/
I could now make a second slider, copying and modifying the one for Update Interval. Starting from line 137:
Label {
anchors.left: parent.left
anchors.leftMargin: Theme.paddingMedium * 2
text: qsTr("Update interval")
}
Slider {
minimumValue: 1
maximumValue: 120
stepSize: 1
value: settings.updateInterval
valueText: value + "s"
width: parent.width
onReleased: settings.updateInterval = value
}
Label {
anchors.left: parent.left
anchors.leftMargin: Theme.paddingMedium * 2
text: qsTr("Altitude Offset")
}
Slider {
minimumValue: -100
maximumValue: 100
stepSize: 1
value: settings.altitudeOffset
valueText: value + "m"
width: parent.width
onReleased: settings.altitudeOffset = value
}
This works, now the slider occurs in the settings page between the Update Interval slider and the Magnetic Declination input field. The lines in my post #3 looks now this way:
// return locationFormatter.roundToDecimal(providers.position.position.coordinate.altitude, 2) + " m"
return locationFormatter.roundToDecimal(providers.position.position.coordinate.altitude - settings.altitudeOffset, 2) + " m"
} else {
// return locationFormatter.roundToDecimal(providers.position.position.coordinate.altitude * 3.2808399, 2) + " ft"
return locationFormatter.roundToDecimal((providers.position.position.coordinate.altitude - settings.altitudeOffset) * 3.2808399, 2) + " ft"
It works if a value is set manually after going to the settings page and setting some value, but GPSInfo doesn’t store the setting made here. After each app start it has to be set new. If not, the Altitude shows ‘NaN m’.
What can I do that the app remembers the setting at next app start? What can I do to have a default value of 0 if nothing is set by user?
Thanks for any help!