1
0
Fork 0

Fix warnings / breakage from previous change.

This commit is contained in:
James Turner 2022-05-11 21:24:37 +01:00
parent 961c57b576
commit 0df1109d93
2 changed files with 11 additions and 6 deletions

View file

@ -346,6 +346,9 @@ void FlightPlanController::setCruiseAltitude(QuantityValue alt)
_fp->setCruiseAltitudeM(ival); _fp->setCruiseAltitudeM(ival);
break; break;
} }
default:
qWarning() << "Unsupported cruise altitude units" << alt.unit;
break;
} }
emit infoChanged(); emit infoChanged();
@ -394,8 +397,8 @@ QuantityValue FlightPlanController::cruiseSpeed() const
return {Units::Mach, _fp->cruiseSpeedMach()}; return {Units::Mach, _fp->cruiseSpeedMach()};
} }
if (_fp->cruiseSpeedKilometersPerHour() > 0) { if (_fp->cruiseSpeedKPH() > 0) {
return {Units::KilometersPerHour, _fp->cruiseSpeedKilometersPerHour()}; return {Units::KilometersPerHour, _fp->cruiseSpeedKPH()};
} }
return {Units::Knots, _fp->cruiseSpeedKnots()}; return {Units::Knots, _fp->cruiseSpeedKnots()};
@ -626,7 +629,6 @@ void FlightPlanController::setAlternate(QmlPositioned *apt)
void FlightPlanController::setCruiseSpeed(QuantityValue speed) void FlightPlanController::setCruiseSpeed(QuantityValue speed)
{ {
qInfo() << Q_FUNC_INFO << speed.unit << speed.value;
switch (speed.unit) { switch (speed.unit) {
case Units::Mach: { case Units::Mach: {
if (speed == QuantityValue(Units::Mach, _fp->cruiseSpeedMach())) { if (speed == QuantityValue(Units::Mach, _fp->cruiseSpeedMach())) {
@ -647,13 +649,16 @@ void FlightPlanController::setCruiseSpeed(QuantityValue speed)
} }
case Units::KilometersPerHour: { case Units::KilometersPerHour: {
const int kmhVal = static_cast<int>(speed.value); const int kmhVal = static_cast<int>(speed.value);
if (_fp->cruiseSpeedKilometersPerHour() == kmhVal) { if (_fp->cruiseSpeedKPH() == kmhVal) {
return; return;
} }
_fp->setCruiseSpeedKilometersPerHour(kmhVal); _fp->setCruiseSpeedKPH(kmhVal);
break; break;
} }
default:
qWarning() << "Unsupported cruise speed units" << speed.unit;
break;
} }
emit infoChanged(); emit infoChanged();

View file

@ -169,7 +169,7 @@ FlightPlanRef FlightPlan::clone(const string& newIdent, bool convertIntoFlightPl
} else if (_cruiseAirspeedKnots > 0) { } else if (_cruiseAirspeedKnots > 0) {
c->setCruiseSpeedKnots(_cruiseAirspeedKnots); c->setCruiseSpeedKnots(_cruiseAirspeedKnots);
} else if (_cruiseAirspeedKph > 0) { } else if (_cruiseAirspeedKph > 0) {
c->setCruiseSpeedKilometersPerHour(_cruiseAirspeedKph); c->setCruiseSpeedKPH(_cruiseAirspeedKph);
} }
c->_didLoadFP = true; // set the loaded flag to give delegates a chance c->_didLoadFP = true; // set the loaded flag to give delegates a chance