mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
Some fixes as follow up of refs #533
* made plugin aware functions protected * set setup for FSX ( refs #547 ) and made setup protected * removed CLogHandler::instance()->disconnect(); as discussed in slack * some formatting
This commit is contained in:
@@ -33,7 +33,7 @@ namespace BlackCore
|
|||||||
CPluginStorageAware(pluginStorageProvider),
|
CPluginStorageAware(pluginStorageProvider),
|
||||||
m_simulatorPluginInfo(info)
|
m_simulatorPluginInfo(info)
|
||||||
{
|
{
|
||||||
this->setObjectName("Simulator:" + info.getIdentifier());
|
this->setObjectName("Simulator: " + info.getIdentifier());
|
||||||
|
|
||||||
// provider signals
|
// provider signals
|
||||||
m_remoteAircraftProviderConnections.append(
|
m_remoteAircraftProviderConnections.append(
|
||||||
@@ -222,8 +222,7 @@ namespace BlackCore
|
|||||||
void CSimulatorCommon::unload()
|
void CSimulatorCommon::unload()
|
||||||
{
|
{
|
||||||
this->disconnectFrom(); // disconnect from simulator
|
this->disconnectFrom(); // disconnect from simulator
|
||||||
this->m_remoteAircraftProviderConnections.disconnectAll();
|
this->m_remoteAircraftProviderConnections.disconnectAll(); // disconnect signals from provider
|
||||||
CLogHandler::instance()->disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CLength CSimulatorCommon::getRenderedDistanceBoundary() const
|
CLength CSimulatorCommon::getRenderedDistanceBoundary() const
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
|
|
||||||
//! Common base class with providers, interface and some base functionality
|
//! Common base class with providers, interface and some base functionality
|
||||||
class BLACKCORE_EXPORT CSimulatorCommon :
|
class BLACKCORE_EXPORT CSimulatorCommon :
|
||||||
public BlackCore::ISimulator,
|
public BlackCore::ISimulator,
|
||||||
@@ -40,7 +39,6 @@ namespace BlackCore
|
|||||||
public BlackMisc::Simulation::CRemoteAircraftAware, // gain access to in memory remote aircraft data
|
public BlackMisc::Simulation::CRemoteAircraftAware, // gain access to in memory remote aircraft data
|
||||||
public BlackMisc::CPluginStorageAware // gain access to in memory plugin storage
|
public BlackMisc::CPluginStorageAware // gain access to in memory plugin storage
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -140,6 +138,7 @@ namespace BlackCore
|
|||||||
protected:
|
protected:
|
||||||
IInterpolator *m_interpolator = nullptr; //!< interpolator instance
|
IInterpolator *m_interpolator = nullptr; //!< interpolator instance
|
||||||
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
bool m_pausedSimFreezesInterpolation = false; //!< paused simulator will also pause interpolation (so AI aircraft will hold)
|
||||||
|
BlackMisc::Simulation::CSimulatorSetup m_simulatorSetup; //!< setup object
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_debugMessages = false; //!< Display debug messages
|
bool m_debugMessages = false; //!< Display debug messages
|
||||||
@@ -148,7 +147,6 @@ namespace BlackCore
|
|||||||
int m_timerCounter = 0; //!< allows to calculate n seconds
|
int m_timerCounter = 0; //!< allows to calculate n seconds
|
||||||
QTimer m_oneSecondTimer {this}; //!< timer
|
QTimer m_oneSecondTimer {this}; //!< timer
|
||||||
BlackMisc::Simulation::CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
BlackMisc::Simulation::CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
||||||
BlackMisc::Simulation::CSimulatorSetup m_simulatorSetup; //!< setup object
|
|
||||||
BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored
|
BlackMisc::Simulation::CSimulatedAircraftList m_highlightedAircraft; //!< all other aircraft are to be ignored
|
||||||
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
||||||
int m_maxRenderedAircraft = MaxAircraftInfinite; //!< max.rendered aircraft
|
int m_maxRenderedAircraft = MaxAircraftInfinite; //!< max.rendered aircraft
|
||||||
|
|||||||
@@ -17,44 +17,39 @@
|
|||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
|
|
||||||
//! Interface for a plugin storage provider.
|
//! Interface for a plugin storage provider.
|
||||||
//! It allows plugins to store any arbitrary data which can be packed into a \sa CVariant
|
//! It allows plugins to store any arbitrary data which can be packed into a \sa CVariant
|
||||||
//! Every plugin shall have its own data area. This means mulitple plugins can store
|
//! Every plugin shall have its own data area. This means mulitple plugins can store
|
||||||
//! data under the same key without overwriting each other.
|
//! data under the same key without overwriting each other.
|
||||||
class IPluginStorageProvider
|
class IPluginStorageProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~IPluginStorageProvider() {}
|
virtual ~IPluginStorageProvider() {}
|
||||||
|
|
||||||
//! Get plugin data stored for object and identified by key
|
//! Get plugin data stored for object and identified by key
|
||||||
virtual CVariant getPluginData(const QObject *obj, const QString& key) const = 0;
|
virtual CVariant getPluginData(const QObject *obj, const QString &key) const = 0;
|
||||||
|
|
||||||
//! Store plugin data for object, identified by key and packed into value
|
//! Store plugin data for object, identified by key and packed into value
|
||||||
virtual void setPluginData(const QObject *obj, const QString& key, const CVariant &value) = 0;
|
virtual void setPluginData(const QObject *obj, const QString &key, const CVariant &value) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Delegating class which can be directly used to access an \sa IPluginStorageProvider instance
|
//! Delegating class which can be directly used to access an \sa IPluginStorageProvider instance
|
||||||
class CPluginStorageAware
|
class CPluginStorageAware
|
||||||
{
|
{
|
||||||
public:
|
protected:
|
||||||
//! \copydoc IPluginStorageProvider::getPluginData
|
//! \copydoc IPluginStorageProvider::getPluginData
|
||||||
virtual CVariant getPluginData(const QObject *obj, const QString& key) const
|
virtual CVariant getPluginData(const QObject *obj, const QString &key) const
|
||||||
{
|
{
|
||||||
return m_pluginStorageProvider->getPluginData(obj, key);
|
return m_pluginStorageProvider->getPluginData(obj, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IOwnAircraftProvider::ownAircraft
|
//! \copydoc IOwnAircraftProvider::ownAircraft
|
||||||
virtual void setPluginData(const QObject *obj, const QString& key, const CVariant &value)
|
virtual void setPluginData(const QObject *obj, const QString &key, const CVariant &value)
|
||||||
{
|
{
|
||||||
m_pluginStorageProvider->setPluginData(obj, key, value);
|
m_pluginStorageProvider->setPluginData(obj, key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CPluginStorageAware(IPluginStorageProvider *pluginStorageProvider) :
|
CPluginStorageAware(IPluginStorageProvider *pluginStorageProvider) :
|
||||||
m_pluginStorageProvider(pluginStorageProvider)
|
m_pluginStorageProvider(pluginStorageProvider)
|
||||||
@@ -63,7 +58,6 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
IPluginStorageProvider *m_pluginStorageProvider = nullptr; //!< access to object
|
IPluginStorageProvider *m_pluginStorageProvider = nullptr; //!< access to object
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CFsxSimulatorSetup::KeyLocalSimConnectCfgFilename()
|
const QString &CFsxSimulatorSetup::KeyLocalSimConnectCfgFilename()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
Q_ASSERT(ownAircraftProvider);
|
Q_ASSERT(ownAircraftProvider);
|
||||||
Q_ASSERT(remoteAircraftProvider);
|
Q_ASSERT(remoteAircraftProvider);
|
||||||
CSimulatorSetup setup(CFsxSimulatorSetup::getInitialSetup());
|
this->m_simulatorSetup = CFsxSimulatorSetup::getInitialSetup();
|
||||||
|
|
||||||
m_useFsuipc = false; // do not use FSUIPC at the moment with FSX
|
m_useFsuipc = false; // do not use FSUIPC at the moment with FSX
|
||||||
this->m_interpolator = new CInterpolatorLinear(remoteAircraftProvider, this);
|
this->m_interpolator = new CInterpolatorLinear(remoteAircraftProvider, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user