refs #891, formatting

This commit is contained in:
Klaus Basan
2017-02-28 04:29:10 +01:00
committed by Mathew Sutcliffe
parent 05abf7e359
commit e2b573b850
9 changed files with 17 additions and 29 deletions

View File

@@ -26,11 +26,8 @@ using namespace BlackMisc;
namespace BlackCore namespace BlackCore
{ {
IPluginManager::IPluginManager(QObject *parent) : QObject(parent) IPluginManager::IPluginManager(QObject *parent) : QObject(parent)
{ { }
}
void IPluginManager::collectPlugins() void IPluginManager::collectPlugins()
{ {
@@ -103,22 +100,25 @@ namespace BlackCore
CLogMessage(this).debug() << "Loading plugin: " << path; CLogMessage(this).debug() << "Loading plugin: " << path;
QPluginLoader loader(path); QPluginLoader loader(path);
QJsonObject json = loader.metaData(); const QJsonObject json = loader.metaData();
if (!isValid(json)) if (!isValid(json))
{ {
CLogMessage(this).warning("Plugin %1 invalid, not loading it") << path; CLogMessage(this).warning("Plugin %1 invalid, not loading it") << path;
return false; return false;
} }
QString identifier = pluginIdentifier(json); const QString identifier = pluginIdentifier(json);
m_paths.insert(identifier, path); m_paths.insert(identifier, path);
m_metadatas.push_back(json); m_metadata.push_back(json);
if (json.value("MetaData").toObject().contains("config")) { if (json.value("MetaData").toObject().contains("config"))
QString configId = json.value("MetaData").toObject().value("config").toString(); {
const QString configId = json.value("MetaData").toObject().value("config").toString();
if (!configId.isEmpty()) if (!configId.isEmpty())
{
m_configs.insert(identifier, configId); m_configs.insert(identifier, configId);
} }
}
return true; return true;
} }
@@ -151,6 +151,4 @@ namespace BlackCore
return nullptr; return nullptr;
} }
} }
} // namespace } // namespace

View File

@@ -22,7 +22,6 @@
namespace BlackCore namespace BlackCore
{ {
/*! /*!
* Base class for all contexts that provide plugin support. * Base class for all contexts that provide plugin support.
* It is responsible for locating, validating and loading plugins. * It is responsible for locating, validating and loading plugins.
@@ -73,9 +72,9 @@ namespace BlackCore
QString getIdByPlugin(const QObject *instance) const; QString getIdByPlugin(const QObject *instance) const;
//! Gets direct access to all plugins' metadata //! 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: private:
@@ -86,12 +85,11 @@ namespace BlackCore
//! Returns `nullptr` on failure. //! Returns `nullptr` on failure.
QObject *getPluginByIdImpl(const QString &identifier); 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, QString> m_paths; //!< identifier <-> file path pairs
QMap<QString, QObject *> m_instances; //!< identifier <-> instance pairs QMap<QString, QObject *> m_instances; //!< identifier <-> instance pairs
QMap<QString, QString> m_configs; //!< identifier <-> identifier pairs QMap<QString, QString> m_configs; //!< identifier <-> identifier pairs
QMap<const QObject *, QString> m_instanceIds; //!< instance <-> identifier pairs QMap<const QObject *, QString> m_instanceIds; //!< instance <-> identifier pairs
}; };
} }

View File

@@ -77,9 +77,7 @@ namespace BlackCore
}; };
QMap<QString, PluginExtended> m_plugins; //!< Id <-> extended data pairs QMap<QString, PluginExtended> m_plugins; //!< Id <-> extended data pairs
}; };
} // namespace } // namespace
#endif // BLACKCORE_PLUGIN_MANAGER_SIMULATOR_H #endif // guard

View File

@@ -31,14 +31,12 @@ namespace BlackGui
*/ */
class BLACKGUI_EXPORT IPluginConfig class BLACKGUI_EXPORT IPluginConfig
{ {
public: public:
//! Dtor. //! Dtor.
virtual ~IPluginConfig() {} virtual ~IPluginConfig() {}
//! Creates a new config window and returns its pointer. //! Creates a new config window and returns its pointer.
virtual CPluginConfigWindow *createConfigWindow(QWidget *parent) = 0; virtual CPluginConfigWindow *createConfigWindow(QWidget *parent) = 0;
}; };
} }

View File

@@ -35,5 +35,4 @@ namespace BlackGui {
Q_UNUSED(event); Q_UNUSED(event);
} }
} }

View File

@@ -34,8 +34,7 @@ namespace BlackGui
protected: protected:
//! \copydoc QWidget::showEvent() //! \copydoc QWidget::showEvent()
virtual void showEvent(QShowEvent *event) override; virtual void showEvent(QShowEvent *event) override;
}; };
} }
#endif // CPLUGINCONFIGWINDOW_H #endif // guard

View File

@@ -23,8 +23,8 @@ class QSignalMapper;
namespace BlackGui namespace BlackGui
{ {
/*! /*!
* Shows all available plugins in nice list and lets user enable, disable and configure * Shows all available plugins in a nice list and lets
* each of them. * user enable, disable and configure each of them.
*/ */
class BLACKGUI_EXPORT CPluginSelector : public QWidget class BLACKGUI_EXPORT CPluginSelector : public QWidget
{ {

View File

@@ -470,8 +470,7 @@ namespace BlackSimPlugin
} }
CSimulatorFs9Factory::~CSimulatorFs9Factory() CSimulatorFs9Factory::~CSimulatorFs9Factory()
{ { }
}
BlackCore::ISimulator *CSimulatorFs9Factory::create( BlackCore::ISimulator *CSimulatorFs9Factory::create(
const CSimulatorPluginInfo &info, const CSimulatorPluginInfo &info,

View File

@@ -21,7 +21,6 @@
class QWidget; class QWidget;
namespace BlackGui { class CPluginConfigWindow; } namespace BlackGui { class CPluginConfigWindow; }
namespace BlackSimPlugin namespace BlackSimPlugin
{ {
namespace XPlane namespace XPlane