mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 05:55:33 +08:00
ChangedModel in ownAircraft context was not really used.
However, there are cases where the "own model" is changed via own model context, mostly in the emulated driver. * made changedModel -> ps_changedModel a "private" signal * connected it to simulator context * used identifier to avoid roundtrips So the "ownAircraftModelChanged" signal of the simulator context is to be used
This commit is contained in:
committed by
Mat Sutcliffe
parent
d12f164d26
commit
73e566a76e
@@ -104,9 +104,6 @@ namespace BlackCore
|
||||
//! Own pilot (aka the swift user) changed
|
||||
void changedPilot(const BlackMisc::Network::CUser &pilot);
|
||||
|
||||
//! Changed aircraft model
|
||||
void changedModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
//! Aircraft has been moved from one location to another (changed scenery)
|
||||
void movedAircraft();
|
||||
|
||||
|
||||
@@ -238,6 +238,11 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateOwnModel(const CAircraftModel &model)
|
||||
{
|
||||
return updateOwnModel(model, this->identifier());
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateOwnModel(const CAircraftModel &model, const CIdentifier &identifier)
|
||||
{
|
||||
CAircraftModel updateModel(this->reverseLookupModel(model));
|
||||
{
|
||||
@@ -248,7 +253,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// changed model
|
||||
emit this->changedModel(updateModel);
|
||||
emit this->ps_changedModel(updateModel, identifier);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -433,9 +438,9 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
void CContextOwnAircraft::xCtxChangedSimulatorModel(const CAircraftModel &model)
|
||||
void CContextOwnAircraft::xCtxChangedSimulatorModel(const CAircraftModel &model, const CIdentifier &identifier)
|
||||
{
|
||||
this->updateOwnModel(model);
|
||||
this->updateOwnModel(model, identifier);
|
||||
}
|
||||
|
||||
void CContextOwnAircraft::xCtxChangedSimulatorStatus(int status)
|
||||
|
||||
@@ -113,6 +113,11 @@ namespace BlackCore
|
||||
//! \copydoc BlackMisc::IProvider::asQObject
|
||||
virtual QObject *asQObject() override { return this; }
|
||||
|
||||
signals:
|
||||
//! Changed aircraft model
|
||||
//! \private Use ISimulatorContext::ownAircraftModelChanged
|
||||
void ps_changedModel(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &identifier);
|
||||
|
||||
public slots:
|
||||
//! \copydoc IContextOwnAircraft::getOwnAircraft()
|
||||
//! \ingroup ownaircraftprovider
|
||||
@@ -226,7 +231,7 @@ namespace BlackCore
|
||||
|
||||
//! Simulator model has been changed
|
||||
//! \ingroup crosscontextfunction
|
||||
void xCtxChangedSimulatorModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
void xCtxChangedSimulatorModel(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &identifier);
|
||||
|
||||
//! Simulator status changed
|
||||
//! \ingroup crosscontextfunction
|
||||
@@ -249,6 +254,9 @@ namespace BlackCore
|
||||
//! Update position history
|
||||
void evaluateUpdateHistory();
|
||||
|
||||
//! Update own model and emit signal with identifier
|
||||
bool updateOwnModel(const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &identifier);
|
||||
|
||||
//! Reverse lookup of the model against DB data
|
||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
};
|
||||
|
||||
@@ -51,9 +51,6 @@ namespace BlackCore
|
||||
s = connection.connect(serviceName, IContextOwnAircraft::ObjectPath(), IContextOwnAircraft::InterfaceName(),
|
||||
"changedPilot", this, SIGNAL(changedPilot(BlackMisc::Network::CUser)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextOwnAircraft::ObjectPath(), IContextOwnAircraft::InterfaceName(),
|
||||
"changedModel", this, SIGNAL(changedModel(BlackMisc::Simulation::CAircraftModel)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextOwnAircraft::ObjectPath(), IContextOwnAircraft::InterfaceName(),
|
||||
"movedAircraft", this, SIGNAL(movedAircraft()));
|
||||
Q_ASSERT(s);
|
||||
|
||||
@@ -682,6 +682,14 @@ namespace BlackCore
|
||||
m_simulatorPlugin.second->changeRemoteAircraftModel(aircraft);
|
||||
}
|
||||
|
||||
void CContextSimulator::xCtxChangedOwnAircraftModel(const CAircraftModel &aircraftModel, const CIdentifier &originator)
|
||||
{
|
||||
if (CIdentifiable::isMyIdentifier(originator)) { return; }
|
||||
if (!this->isSimulatorAvailable()) { return; }
|
||||
|
||||
emit this->ownAircraftModelChanged(aircraftModel);
|
||||
}
|
||||
|
||||
void CContextSimulator::xCtxChangedRemoteAircraftEnabled(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
if (!this->isSimulatorAvailable()) { return; }
|
||||
|
||||
@@ -186,6 +186,9 @@ namespace BlackCore
|
||||
//! Changed remote aircraft model
|
||||
void xCtxChangedRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||
|
||||
//! Changed own aircraft model
|
||||
void xCtxChangedOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &aircraftModel, const BlackMisc::CIdentifier &originator);
|
||||
|
||||
//! Enable / disable aircraft
|
||||
void xCtxChangedRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user