diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-11-12 20:47:12 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-11-12 20:47:20 +0100 |
| commit | 15059907c9bd0061f502c64457fce20c7e60a07f (patch) | |
| tree | 77c6dfed6e514a870244802983095b044d0fcd73 /src/plugincontainer.h | |
| parent | 4fa44fe37e9b2f9837f7fcbaf9361f9675669782 (diff) | |
Proper handling of proxied plugins that implement multiple interfaces.
Diffstat (limited to 'src/plugincontainer.h')
| -rw-r--r-- | src/plugincontainer.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/plugincontainer.h b/src/plugincontainer.h index b37b48cd..89ab5528 100644 --- a/src/plugincontainer.h +++ b/src/plugincontainer.h @@ -91,11 +91,15 @@ private: // constructed object before calling init().
void fetchRequirements();
+ // Set the master for this plugin. This is required to "fake" masters for proxied plugins.
+ void setMaster(MOBase::IPlugin* master);
+
friend class PluginContainer;
PluginContainer* m_PluginContainer;
MOBase::IPlugin* m_Plugin;
MOBase::IPluginProxy* m_PluginProxy;
+ MOBase::IPlugin* m_Master;
std::vector<std::unique_ptr<const MOBase::IPluginRequirement>> m_Requirements;
MOBase::IOrganizer* m_Organizer;
std::vector<MOBase::IPlugin*> m_RequiredFor;
@@ -107,6 +111,9 @@ private: };
+/**
+ *
+ */
class PluginContainer : public QObject, public MOBase::IPluginDiagnose
{
@@ -229,6 +236,10 @@ public: * @param t Name of the plugin to retrieve, or non-IPlugin interface.
*
* @return the corresponding plugin, or a null pointer.
+ *
+ * @note It is possible to have multiple plugins for the same name when
+ * dealing with proxied plugins (e.g. Python), in which case the
+ * most important one will be returned, as specified in PluginTypeOrder.
*/
MOBase::IPlugin* plugin(QString const& pluginName) const;
MOBase::IPlugin* plugin(MOBase::IPluginDiagnose* diagnose) const;
@@ -321,6 +332,17 @@ private: friend class PluginRequirements;
/**
+ * @brief Check if a plugin implements a "better" interface than another
+ * one, as specified by PluginTypeOrder.
+ *
+ * @param lhs, rhs The plugin to compare.
+ *
+ * @return true if the left plugin implements a better interface than the right
+ * one, false otherwise (or if both implements the same interface).
+ */
+ bool isBetterInterface(QObject* lhs, QObject* rhs) const;
+
+ /**
* @brief Find the QObject* corresponding to the given plugin.
*
* @param plugin The plugin to find the QObject* for.
@@ -341,7 +363,7 @@ private: void registerGame(MOBase::IPluginGame *game);
- bool registerPlugin(QObject *pluginObj, const QString &fileName, MOBase::IPluginProxy *proxy);
+ MOBase::IPlugin* registerPlugin(QObject *pluginObj, const QString &fileName, MOBase::IPluginProxy *proxy);
OrganizerCore *m_Organizer;
|
