Ref T129, flight plan component formatting

This commit is contained in:
Klaus Basan
2017-10-04 21:58:35 +02:00
committed by Mathew Sutcliffe
parent 8df801e7cc
commit 9ce37d94be
2 changed files with 12 additions and 10 deletions

View File

@@ -119,7 +119,7 @@ namespace BlackGui
void CFlightPlanComponent::loginDataSet() void CFlightPlanComponent::loginDataSet()
{ {
if (this->m_flightPlan.wasSentOrLoaded()) { return; } // when loaded or sent do not override if (m_flightPlan.wasSentOrLoaded()) { return; } // when loaded or sent do not override
if (!sGui->getIContextOwnAircraft()) { return; } if (!sGui->getIContextOwnAircraft()) { return; }
const CSimulatedAircraft ownAircraft(sGui->getIContextOwnAircraft()->getOwnAircraft()); const CSimulatedAircraft ownAircraft(sGui->getIContextOwnAircraft()->getOwnAircraft());
@@ -129,7 +129,7 @@ namespace BlackGui
void CFlightPlanComponent::prefillWithAircraftData(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft) void CFlightPlanComponent::prefillWithAircraftData(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft)
{ {
if (this->m_flightPlan.wasSentOrLoaded()) { return; } if (m_flightPlan.wasSentOrLoaded()) { return; }
// only override with valid values // only override with valid values
if (CCallsign::isValidAircraftCallsign(ownAircraft.getCallsignAsString())) if (CCallsign::isValidAircraftCallsign(ownAircraft.getCallsignAsString()))
@@ -148,7 +148,7 @@ namespace BlackGui
void CFlightPlanComponent::prefillWithUserData(const Network::CUser &user) void CFlightPlanComponent::prefillWithUserData(const Network::CUser &user)
{ {
if (this->m_flightPlan.wasSentOrLoaded()) { return; } if (m_flightPlan.wasSentOrLoaded()) { return; }
if (user.hasValidRealName()) if (user.hasValidRealName())
{ {
ui->le_PilotsName->setText(user.getRealName()); ui->le_PilotsName->setText(user.getRealName());
@@ -173,7 +173,7 @@ namespace BlackGui
ui->le_TakeOffTimePlanned->setText(flightPlan.getTakeoffTimePlannedHourMin()); ui->le_TakeOffTimePlanned->setText(flightPlan.getTakeoffTimePlannedHourMin());
ui->le_FuelOnBoard->setText(flightPlan.getFuelTimeHourMin()); ui->le_FuelOnBoard->setText(flightPlan.getFuelTimeHourMin());
ui->le_EstimatedTimeEnroute->setText(flightPlan.getEnrouteTimeHourMin()); ui->le_EstimatedTimeEnroute->setText(flightPlan.getEnrouteTimeHourMin());
ui->le_CruiseTrueAirspeed->setText(flightPlan.getCruiseTrueAirspeed().valueRoundedWithUnit(BlackMisc::PhysicalQuantities::CSpeedUnit::kts(), 0)); ui->le_CruiseTrueAirspeed->setText(flightPlan.getCruiseTrueAirspeed().valueRoundedWithUnit(CSpeedUnit::kts(), 0));
const CAltitude cruiseAlt = flightPlan.getCruiseAltitude(); const CAltitude cruiseAlt = flightPlan.getCruiseAltitude();
if (cruiseAlt.isFlightLevel()) if (cruiseAlt.isFlightLevel())
@@ -182,7 +182,9 @@ namespace BlackGui
} }
else else
{ {
ui->le_CrusingAltitude->setText(cruiseAlt.valueRoundedWithUnit(BlackMisc::PhysicalQuantities::CLengthUnit::ft(), 0)); ui->le_CrusingAltitude->setText(cruiseAlt.valueRoundedWithUnit(CLengthUnit::ft(), 0));
}
switch (flightPlan.getFlightRulesAsVFRorIFR()) switch (flightPlan.getFlightRulesAsVFRorIFR())
{ {
case CFlightPlan::VFR: case CFlightPlan::VFR:
@@ -196,10 +198,10 @@ namespace BlackGui
CFlightPlan CFlightPlanComponent::getFlightPlan() const CFlightPlan CFlightPlanComponent::getFlightPlan() const
{ {
return this->m_flightPlan; return m_flightPlan;
} }
BlackMisc::CStatusMessageList CFlightPlanComponent::validateAndInitializeFlightPlan(BlackMisc::Aviation::CFlightPlan &flightPlan) BlackMisc::CStatusMessageList CFlightPlanComponent::validateAndInitializeFlightPlan(CFlightPlan &flightPlan)
{ {
BlackMisc::CStatusMessageList messages; BlackMisc::CStatusMessageList messages;
QString v; QString v;
@@ -309,7 +311,7 @@ namespace BlackGui
} }
v = ui->le_CruiseTrueAirspeed->text(); v = ui->le_CruiseTrueAirspeed->text();
BlackMisc::PhysicalQuantities::CSpeed cruiseTAS; CSpeed cruiseTAS;
cruiseTAS.parseFromString(v, CPqString::SeparatorsLocale); cruiseTAS.parseFromString(v, CPqString::SeparatorsLocale);
if (cruiseTAS.isNull()) if (cruiseTAS.isNull())
{ {
@@ -375,7 +377,7 @@ namespace BlackGui
ui->le_LastSent->clear(); ui->le_LastSent->clear();
CLogMessage(this).error("No errors, but not connected, cannot send flight plan"); CLogMessage(this).error("No errors, but not connected, cannot send flight plan");
} }
this->m_flightPlan = flightPlan; // last valid FP m_flightPlan = flightPlan; // last valid FP
} }
} }

View File

@@ -27,8 +27,8 @@
class QWidget; class QWidget;
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
namespace Ui { class CFlightPlanComponent; } namespace Ui { class CFlightPlanComponent; }
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
namespace BlackGui namespace BlackGui
{ {
namespace Components namespace Components