mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T275, override simulator setup provider functions to emit signals
* the provider itself is no QObject and cannot emit signals * removed redundant function setInterpolationAndRenderingSetup
This commit is contained in:
@@ -317,7 +317,7 @@ namespace BlackCore
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << setup; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return; }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
m_simulatorPlugin.second->setInterpolationAndRenderingSetup(setup);
|
||||
m_simulatorPlugin.second->setInterpolationSetupGlobal(setup);
|
||||
}
|
||||
|
||||
CTime CContextSimulator::getTimeSynchronizationOffset() const
|
||||
|
||||
@@ -140,6 +140,31 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
bool ISimulator::setInterpolationSetupGlobal(const CInterpolationAndRenderingSetupGlobal &setup)
|
||||
{
|
||||
if (!IInterpolationSetupProvider::setInterpolationSetupGlobal(setup)) { return false; }
|
||||
const bool r = setup.isRenderingRestricted();
|
||||
const bool e = setup.isRenderingEnabled();
|
||||
|
||||
emit this->interpolationAndRenderingSetupChanged();
|
||||
emit this->renderRestrictionsChanged(r, e, setup.getMaxRenderedAircraft(), setup.getMaxRenderedDistance());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISimulator::setInterpolationSetupsPerCallsign(const CInterpolationSetupList &setups, bool ignoreSameAsGlobal)
|
||||
{
|
||||
if (!IInterpolationSetupProvider::setInterpolationSetupsPerCallsign(setups, ignoreSameAsGlobal)) { return false; }
|
||||
emit this->interpolationAndRenderingSetupChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISimulator::setInterpolationSetupPerCallsign(const CInterpolationAndRenderingSetupPerCallsign &setup, const CCallsign &callsign, bool removeGlobalSetup)
|
||||
{
|
||||
if (!IInterpolationSetupProvider::setInterpolationSetupPerCallsign(setup, callsign, removeGlobalSetup)) { return false; }
|
||||
emit this->interpolationAndRenderingSetupChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
ISimulatorListener::ISimulatorListener(const CSimulatorPluginInfo &info) :
|
||||
QObject(), m_info(info)
|
||||
{
|
||||
|
||||
@@ -145,14 +145,6 @@ namespace BlackCore
|
||||
//! Time synchronization offset
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const = 0;
|
||||
|
||||
//! Consolidate setup with other data like from BlackMisc::Simulation::IRemoteAircraftProvider
|
||||
//! \threadsafe
|
||||
BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupConsolidated(const BlackMisc::Aviation::CCallsign &callsign) const;
|
||||
|
||||
//! Enable debugging messages etc.
|
||||
//! \threadsafe
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) = 0;
|
||||
|
||||
//! Is the aircraft rendered (displayed in simulator)?
|
||||
//! This shall only return true if the aircraft is really visible in the simulator
|
||||
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||
@@ -216,6 +208,16 @@ namespace BlackCore
|
||||
//! Parse command line
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0;
|
||||
|
||||
//! Consolidate setup with other data like from BlackMisc::Simulation::IRemoteAircraftProvider
|
||||
//! \threadsafe
|
||||
BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupConsolidated(const BlackMisc::Aviation::CCallsign &callsign) const;
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupGlobal
|
||||
virtual bool setInterpolationSetupGlobal(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override;
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupsPerCallsign
|
||||
virtual bool setInterpolationSetupsPerCallsign(const BlackMisc::Simulation::CInterpolationSetupList &setups, bool ignoreSameAsGlobal = true) override;
|
||||
|
||||
//! Register help
|
||||
static void registerHelp();
|
||||
|
||||
@@ -287,6 +289,9 @@ namespace BlackCore
|
||||
//! A requested elevation has been received
|
||||
virtual void callbackReceivedRequestedElevation(const BlackMisc::Geo::CElevationPlane &plane, const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupPerCallsign
|
||||
virtual bool setInterpolationSetupPerCallsign(const BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign &setup, const BlackMisc::Aviation::CCallsign &callsign, bool removeGlobalSetup) override;
|
||||
|
||||
//! Emit the combined status
|
||||
//! \param oldStatus optionally one can capture and provide the old status for comparison. In case of equal status values no signal will be sent
|
||||
//! \sa simulatorStatusChanged;
|
||||
|
||||
@@ -401,16 +401,6 @@ namespace BlackCore
|
||||
return renderedOnes.intersection(disabledOnes);
|
||||
}
|
||||
|
||||
void CSimulatorCommon::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetupGlobal &setup)
|
||||
{
|
||||
if (!this->setInterpolationSetupGlobal(setup)) { return; }
|
||||
const bool r = setup.isRenderingRestricted();
|
||||
const bool e = setup.isRenderingEnabled();
|
||||
|
||||
emit this->interpolationAndRenderingSetupChanged();
|
||||
emit this->renderRestrictionsChanged(r, e, setup.getMaxRenderedAircraft(), setup.getMaxRenderedDistance());
|
||||
}
|
||||
|
||||
void CSimulatorCommon::highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime)
|
||||
{
|
||||
const CCallsign cs(aircraftToHighlight.getCallsign());
|
||||
@@ -558,10 +548,6 @@ namespace BlackCore
|
||||
{
|
||||
const CCallsign cs(parser.part(2));
|
||||
const bool changed = this->setInterpolationMode(part1, cs);
|
||||
if (changed)
|
||||
{
|
||||
emit this->interpolationAndRenderingSetupChanged();
|
||||
}
|
||||
CLogMessage(this).info(changed ? "Changed interpolation mode for '%1'" : "Unchanged interpolation mode for '%1'") << cs.asString();
|
||||
return true;
|
||||
}
|
||||
@@ -569,7 +555,7 @@ namespace BlackCore
|
||||
{
|
||||
CInterpolationAndRenderingSetupGlobal setup = this->getInterpolationSetupGlobal();
|
||||
const bool changed = setup.setInterpolatorMode(part1);
|
||||
if (changed) { this->setInterpolationAndRenderingSetup(setup); }
|
||||
if (changed) { this->setInterpolationSetupGlobal(setup); }
|
||||
CLogMessage(this).info(changed ? "Changed interpolation mode globally" : "Unchanged interpolation mode");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace BlackCore
|
||||
virtual ~CSimulatorCommon();
|
||||
|
||||
// --------- ISimulator implementations ------------
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override;
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool followAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual const BlackMisc::Simulation::CSimulatorInternals &getSimulatorInternals() const override;
|
||||
|
||||
@@ -61,11 +61,11 @@ namespace BlackMisc
|
||||
protected:
|
||||
//! Set the global setup
|
||||
//! \threadsafe
|
||||
bool setInterpolationSetupGlobal(const CInterpolationAndRenderingSetupGlobal &setup);
|
||||
virtual bool setInterpolationSetupGlobal(const CInterpolationAndRenderingSetupGlobal &setup);
|
||||
|
||||
//! Insert specialized setup
|
||||
//! \threadsafe
|
||||
bool setInterpolationSetupPerCallsign(const CInterpolationAndRenderingSetupPerCallsign &setup, const Aviation::CCallsign &callsign, bool removeGlobalSetup = true);
|
||||
virtual bool setInterpolationSetupPerCallsign(const CInterpolationAndRenderingSetupPerCallsign &setup, const Aviation::CCallsign &callsign, bool removeGlobalSetup = true);
|
||||
|
||||
//! Log/un-log given callsign
|
||||
//! \threadsafe
|
||||
|
||||
Reference in New Issue
Block a user