1
0
Fork 0

Bug fixes for location saving

This commit is contained in:
James Turner 2018-06-28 15:21:01 +01:00
parent 5ebee55632
commit 7d7dc725a8
3 changed files with 19 additions and 6 deletions

View file

@ -699,6 +699,8 @@ void LocationController::restoreLocation(QVariantMap l)
m_locationIsLatLon = false;
if (FGPositioned::isAirportType(m_location.ptr())) {
m_airportLocation = static_cast<FGAirport*>(m_location.ptr());
} else {
m_airportLocation.clear();
}
m_baseQml->setInner(m_location);
}
@ -793,6 +795,8 @@ QVariantMap LocationController::saveLocation() const
} // of m_location is valid
if (m_altitudeType != Off) {
locationSet.insert("altitude-type", m_altitudeType);
if ((m_altitudeType == MSL_Feet) || (m_altitudeType == AGL_Feet)) {
locationSet.insert("altitude", m_altitudeFt);
}

View file

@ -102,7 +102,9 @@ Item {
ToggleSwitch {
id: headingToggle
checked: _location.headingEnabled
onCheckedChanged: _location.headingEnabled = checked;
function toggle(newChecked) {
_location.headingEnabled = newChecked;
}
}
IntegerSpinbox {
@ -126,8 +128,11 @@ Item {
ToggleSwitch {
id: altitudeToggle
checked: _location.altitudeType !== LocationController.Off
onCheckedChanged: _location.altitudeType = (checked ? LocationController.MSL_Feet
: LocationController.Off)
function toggle(newChecked) {
_location.altitudeType = (newChecked ? LocationController.MSL_Feet
: LocationController.Off)
}
}
IntegerSpinbox {

View file

@ -2,6 +2,7 @@ import QtQuick 2.4
import "."
Item {
id: root
property bool checked: false
property alias label: label.text
property bool enabled: true
@ -17,6 +18,11 @@ Item {
sliderBehaviour.enabled = true;
}
function toggle(newChecked)
{
checked = newChecked
}
Rectangle {
id: track
width: height * 2
@ -65,8 +71,6 @@ Item {
enabled: root.enabled
hoverEnabled: true
onClicked: {
checked = !checked
}
onClicked: root.toggle(!checked)
}
}