mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Remove obsolete plugin storage
Plugin storage was used before the value cache existed. With the value cache this is no longer used and can be removed. refs #660
This commit is contained in:
@@ -342,7 +342,7 @@ namespace BlackCore
|
||||
Q_ASSERT(this->getIContextNetwork()->isUsingImplementingObject());
|
||||
IOwnAircraftProvider *ownAircraftProvider = this->getRuntime()->getCContextOwnAircraft();
|
||||
IRemoteAircraftProvider *renderedAircraftProvider = this->getRuntime()->getCContextNetwork();
|
||||
ISimulator *simulator = factory->create(simulatorInfo, ownAircraftProvider, renderedAircraftProvider, m_plugins, &m_weatherManager);
|
||||
ISimulator *simulator = factory->create(simulatorInfo, ownAircraftProvider, renderedAircraftProvider, &m_weatherManager);
|
||||
Q_ASSERT_X(simulator, Q_FUNC_INFO, "no simulator driver can be created");
|
||||
|
||||
bool c = connect(simulator, &ISimulator::simulatorStatusChanged, this, &CContextSimulator::ps_onSimulatorStatusChanged);
|
||||
|
||||
@@ -27,38 +27,6 @@ namespace BlackCore
|
||||
{
|
||||
}
|
||||
|
||||
CVariant CPluginManagerSimulator::getPluginData(const QObject *obj, const QString &key) const
|
||||
{
|
||||
const QObject *p = obj;
|
||||
while (p && !p->inherits("BlackCore::ISimulatorFactory"))
|
||||
{
|
||||
p = p->parent();
|
||||
}
|
||||
|
||||
if (!p) return CVariant();
|
||||
|
||||
QString id = getIdByPlugin(p);
|
||||
Q_ASSERT(!id.isEmpty());
|
||||
const PluginExtended &pe = m_plugins[id];
|
||||
return pe.storage.value(key);
|
||||
}
|
||||
|
||||
void CPluginManagerSimulator::setPluginData(const QObject *obj, const QString &key, const CVariant &value)
|
||||
{
|
||||
const QObject *p = obj;
|
||||
while (p && !p->inherits("BlackCore::ISimulatorFactory"))
|
||||
{
|
||||
p = p->parent();
|
||||
}
|
||||
|
||||
if (!p) return;
|
||||
|
||||
QString id = getIdByPlugin(p);
|
||||
Q_ASSERT(!id.isEmpty());
|
||||
PluginExtended &pe = m_plugins[id];
|
||||
pe.storage.insert(key, value);
|
||||
}
|
||||
|
||||
ISimulatorFactory *CPluginManagerSimulator::getFactory(const QString &pluginId)
|
||||
{
|
||||
return getPluginById<ISimulatorFactory>(pluginId);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/pluginmanager.h"
|
||||
#include "blackmisc/pluginstorageprovider.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
@@ -34,8 +33,7 @@ namespace BlackCore
|
||||
* Manages plugins for the simulator context.
|
||||
*/
|
||||
class BLACKCORE_EXPORT CPluginManagerSimulator :
|
||||
public BlackCore::IPluginManager,
|
||||
public BlackMisc::IPluginStorageProvider
|
||||
public BlackCore::IPluginManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -43,12 +41,6 @@ namespace BlackCore
|
||||
//! Ctor
|
||||
CPluginManagerSimulator(QObject *parent = nullptr);
|
||||
|
||||
//! \copydoc BlackMisc::IPluginStorageProvider::getPluginData
|
||||
virtual BlackMisc::CVariant getPluginData(const QObject *obj, const QString &key) const override;
|
||||
|
||||
//! \copydoc BlackMisc::IPluginStorageProvider::setPluginData
|
||||
virtual void setPluginData(const QObject *obj, const QString &key, const BlackMisc::CVariant &value) override;
|
||||
|
||||
//! Get simulator factory from the plugin
|
||||
ISimulatorFactory *getFactory(const QString &pluginId);
|
||||
|
||||
@@ -81,7 +73,6 @@ namespace BlackCore
|
||||
{
|
||||
BlackMisc::Simulation::CSimulatorPluginInfo info;
|
||||
ISimulatorListener *listener = nullptr;
|
||||
QHash<QString, BlackMisc::CVariant> storage; //!< Permanent plugin storage - data stored here will be kept even when plugin is unloaded
|
||||
};
|
||||
|
||||
QMap<QString, PluginExtended> m_plugins; //!< Id <-> extended data pairs
|
||||
|
||||
@@ -62,7 +62,6 @@ namespace BlackCore
|
||||
struct PluginExtended
|
||||
{
|
||||
BlackMisc::Weather::CWeatherDataPluginInfo info;
|
||||
QHash<QString, BlackMisc::CVariant> storage; //!< Permanent plugin storage - data stored here will be kept even when plugin is unloaded
|
||||
};
|
||||
|
||||
QMap<QString, PluginExtended> m_plugins; //!< Id <-> extended data pairs
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
class IPluginStorageProvider;
|
||||
namespace Aviation { class CCallsign; }
|
||||
namespace Network { class CTextMessage; }
|
||||
namespace Simulation
|
||||
@@ -291,14 +290,12 @@ namespace BlackCore
|
||||
//! \param info metadata about simulator
|
||||
//! \param ownAircraftProvider in memory access to own aircraft data
|
||||
//! \param remoteAircraftProvider in memory access to rendered aircraft data such as situation history and aircraft itself
|
||||
//! \param pluginStorageProvider in memory access to persistent plugin data store
|
||||
//! \param weatherGridProvider in memory access to weather grid data
|
||||
//! \return driver instance
|
||||
virtual ISimulator *create(
|
||||
const BlackMisc::Simulation::CSimulatorPluginInfo &info,
|
||||
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
|
||||
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
BlackMisc::IPluginStorageProvider *pluginStorageProvider,
|
||||
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider) = 0;
|
||||
|
||||
//! Simulator listener instance
|
||||
|
||||
@@ -36,13 +36,11 @@ namespace BlackCore
|
||||
CSimulatorCommon::CSimulatorCommon(const CSimulatorPluginInfo &info,
|
||||
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
|
||||
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
IPluginStorageProvider *pluginStorageProvider,
|
||||
IWeatherGridProvider *weatherGridProvider,
|
||||
QObject *parent)
|
||||
: ISimulator(parent),
|
||||
COwnAircraftAware(ownAircraftProvider),
|
||||
CRemoteAircraftAware(remoteAircraftProvider),
|
||||
CPluginStorageAware(pluginStorageProvider),
|
||||
CWeatherGridAware(weatherGridProvider),
|
||||
m_simulatorPluginInfo(info)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/aviation/callsignset.h"
|
||||
#include "blackmisc/connectionguard.h"
|
||||
#include "blackmisc/pluginstorageprovider.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "blackmisc/pq/units.h"
|
||||
@@ -58,7 +57,6 @@ namespace BlackCore
|
||||
public BlackCore::ISimulator,
|
||||
public BlackMisc::Simulation::COwnAircraftAware, // gain access to in memory own 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::Weather::CWeatherGridAware // gain access to in memory weather grid
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -110,7 +108,6 @@ namespace BlackCore
|
||||
CSimulatorCommon(const BlackMisc::Simulation::CSimulatorPluginInfo &info,
|
||||
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
|
||||
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
BlackMisc::IPluginStorageProvider *pluginStorageProvider,
|
||||
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
|
||||
QObject *parent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user