mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
refs #891, formatting
This commit is contained in:
committed by
Mathew Sutcliffe
parent
05abf7e359
commit
e2b573b850
@@ -26,11 +26,8 @@ using namespace BlackMisc;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
IPluginManager::IPluginManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
{ }
|
||||
|
||||
void IPluginManager::collectPlugins()
|
||||
{
|
||||
@@ -103,21 +100,24 @@ namespace BlackCore
|
||||
|
||||
CLogMessage(this).debug() << "Loading plugin: " << path;
|
||||
QPluginLoader loader(path);
|
||||
QJsonObject json = loader.metaData();
|
||||
const QJsonObject json = loader.metaData();
|
||||
if (!isValid(json))
|
||||
{
|
||||
CLogMessage(this).warning("Plugin %1 invalid, not loading it") << path;
|
||||
return false;
|
||||
}
|
||||
|
||||
QString identifier = pluginIdentifier(json);
|
||||
const QString identifier = pluginIdentifier(json);
|
||||
m_paths.insert(identifier, path);
|
||||
m_metadatas.push_back(json);
|
||||
m_metadata.push_back(json);
|
||||
|
||||
if (json.value("MetaData").toObject().contains("config")) {
|
||||
QString configId = json.value("MetaData").toObject().value("config").toString();
|
||||
if (json.value("MetaData").toObject().contains("config"))
|
||||
{
|
||||
const QString configId = json.value("MetaData").toObject().value("config").toString();
|
||||
if (!configId.isEmpty())
|
||||
{
|
||||
m_configs.insert(identifier, configId);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -151,6 +151,4 @@ namespace BlackCore
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
|
||||
/*!
|
||||
* Base class for all contexts that provide plugin support.
|
||||
* It is responsible for locating, validating and loading plugins.
|
||||
@@ -73,9 +72,9 @@ namespace BlackCore
|
||||
QString getIdByPlugin(const QObject *instance) const;
|
||||
|
||||
//! Gets direct access to all plugins' metadata
|
||||
const BlackMisc::CSequence<QJsonObject> &getPlugins()
|
||||
const BlackMisc::CSequence<QJsonObject> &getPlugins() const
|
||||
{
|
||||
return m_metadatas;
|
||||
return m_metadata;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -86,12 +85,11 @@ namespace BlackCore
|
||||
//! Returns `nullptr` on failure.
|
||||
QObject *getPluginByIdImpl(const QString &identifier);
|
||||
|
||||
BlackMisc::CSequence<QJsonObject> m_metadatas;
|
||||
BlackMisc::CSequence<QJsonObject> m_metadata; //!< plugin metadata
|
||||
QMap<QString, QString> m_paths; //!< identifier <-> file path pairs
|
||||
QMap<QString, QObject *> m_instances; //!< identifier <-> instance pairs
|
||||
QMap<QString, QString> m_configs; //!< identifier <-> identifier pairs
|
||||
QMap<const QObject *, QString> m_instanceIds; //!< instance <-> identifier pairs
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,7 @@ namespace BlackCore
|
||||
};
|
||||
|
||||
QMap<QString, PluginExtended> m_plugins; //!< Id <-> extended data pairs
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // BLACKCORE_PLUGIN_MANAGER_SIMULATOR_H
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user