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
{
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

View File

@@ -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
};
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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