mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
refs #791, further improve reverse lookup
* utility function if web data are already available * moved setOwnAircraftModel as reverseLookupAndUpdateOwnAircraftModel to CSimulatorCommon * reverseLookupAndUpdateOwnAircraftModel also handles async lookup when data are not yet available * removed context ps_allSwiftWebDataRead reverse lookup, done in CSimulatorCommon now
This commit is contained in:
@@ -67,27 +67,6 @@ namespace BlackSimPlugin
|
||||
return m_airportsInRange;
|
||||
}
|
||||
|
||||
void CSimulatorFsCommon::setOwnAircraftModel(const QString &modelName)
|
||||
{
|
||||
CAircraftModel model = getOwnAircraftModel();
|
||||
model.setModelString(modelName);
|
||||
this->setOwnAircraftModel(model);
|
||||
}
|
||||
|
||||
void CSimulatorFsCommon::setOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model)
|
||||
{
|
||||
if (!model.hasModelString()) { return; }
|
||||
if (this->getOwnAircraftModel() != model)
|
||||
{
|
||||
const CAircraftModel newModel = reverseLookupModel(model);
|
||||
const bool updated = this->updateOwnModel(newModel); // update in provider (normally the context)
|
||||
if (updated)
|
||||
{
|
||||
emit this->ownAircraftModelChanged(this->getOwnAircraftModel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CSimulatorFsCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
// remove upfront, and then enable / disable again
|
||||
|
||||
@@ -66,12 +66,6 @@ namespace BlackSimPlugin
|
||||
BlackMisc::Aviation::CComSystem m_simCom1; //!< cockpit COM1 state in simulator
|
||||
BlackMisc::Aviation::CComSystem m_simCom2; //!< cockpit COM2 state in simulator
|
||||
BlackMisc::Aviation::CTransponder m_simTransponder; //!< cockpit xpdr state in simulator
|
||||
|
||||
//! Set own model
|
||||
void setOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
//! Set own model
|
||||
void setOwnAircraftModel(const QString &modelName);
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user