refs #780, fixes login/flightplan preset

* empty airline is valid
* sync with flightplan (new signal to indicate changed login values)
* better preset of own model
This commit is contained in:
Klaus Basan
2016-10-21 15:38:25 +02:00
parent 492649c061
commit cdea8cff95
12 changed files with 127 additions and 25 deletions

View File

@@ -59,6 +59,7 @@ namespace BlackGui
ui(new Ui::CFlightPlanComponent)
{
Q_ASSERT_X(sGui, Q_FUNC_INFO, "missing sGui");
Q_ASSERT_X(sGui->hasWebDataServices(), Q_FUNC_INFO, "missing web services");
// UI
ui->setupUi(this);
@@ -119,7 +120,10 @@ namespace BlackGui
{
if (this->m_flightPlan.wasSentOrLoaded()) { return; } // when loaded or sent do not override
if (!sGui->getIContextOwnAircraft()) { return; }
this->prefillWithAircraftData(sGui->getIContextOwnAircraft()->getOwnAircraft());
const CSimulatedAircraft ownAircraft(sGui->getIContextOwnAircraft()->getOwnAircraft());
this->prefillWithAircraftData(ownAircraft);
this->prefillWithUserData(ownAircraft.getPilot());
}
void CFlightPlanComponent::prefillWithAircraftData(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft)
@@ -139,6 +143,18 @@ namespace BlackGui
}
}
void CFlightPlanComponent::prefillWithUserData(const Network::CUser &user)
{
if (user.hasValidRealName())
{
ui->le_PilotsName->setText(user.getRealName());
}
if (user.hasHomeBase())
{
ui->le_PilotsHomeBase->setText(user.getHomeBase().getIcaoCode());
}
}
void CFlightPlanComponent::fillWithFlightPlanData(const BlackMisc::Aviation::CFlightPlan &flightPlan)
{
ui->le_AlternateAirport->setText(flightPlan.getAlternateAirportIcao().asString());