diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-12-04 08:50:31 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-12-04 08:50:31 +0100 |
| commit | a30d49f4fc845164ef6bba4d2a834efce1dc01d7 (patch) | |
| tree | 5aa8becd18a2eae3795e602db0f499a864dab40f /src/plugincontainer.h | |
| parent | f229dbaaa7f516dc1958d0a0555b47cb17136377 (diff) | |
Avoid duplicating code to simulate startup.
Diffstat (limited to 'src/plugincontainer.h')
| -rw-r--r-- | src/plugincontainer.h | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/plugincontainer.h b/src/plugincontainer.h index 43c7973f..d6503a43 100644 --- a/src/plugincontainer.h +++ b/src/plugincontainer.h @@ -186,10 +186,23 @@ public: public:
- PluginContainer(OrganizerCore *organizer);
+ PluginContainer(OrganizerCore* organizer);
virtual ~PluginContainer();
- void setUserInterface(IUserInterface *userInterface);
+ /**
+ * @brief Start the plugins.
+ *
+ * This function should not be called before MO2 is ready and plugins can be
+ * started, and will do the following:
+ * - connect the callbacks of the plugins,
+ * - set the parent widget for plugins that can have one,
+ * - notify plugins that MO2 has been started, including:
+ * - triggering a call to the "profile changed" callback for the initial profile,
+ * - triggering a call to the "user interface initialized" callback.
+ *
+ * @param userInterface The main user interface to use for the plugins.
+ */
+ void startPlugins(IUserInterface* userInterface);
void loadPlugin(QString const& filepath);
void unloadPlugin(QString const& filepath);
@@ -392,21 +405,15 @@ private: *
* @return the list of created plugins.
*/
- std::vector<MOBase::IPlugin*> loadProxied(const QString& filepath, MOBase::IPluginProxy* proxy);
+ std::vector<QObject*> loadProxied(const QString& filepath, MOBase::IPluginProxy* proxy);
- /**
- * @brief Load the Qt plugin from the given file.
- *
- * @param filepath Path to the DLL containing the Qt plugin.
- */
- MOBase::IPlugin* loadQtPlugin(const QString& filepath);
+ // Load the Qt plugin from the given file.
+ QObject* loadQtPlugin(const QString& filepath);
- /**
- * @brief Simulate MO2 startup for the given plugins.
- *
- * @param plugins Plugins to simulate startup for.
- */
- void simulateStartup(const std::vector<MOBase::IPlugin*>& plugins) const;
+ // See startPlugins for more details. This is simply an intermediate function
+ // that can be used when loading plugins after initialization. This uses the
+ // user interface in m_UserInterface.
+ void startPluginsImpl(const std::vector<QObject*>& plugins) const;
/**
* @brief Retrieved the (localized) names of interfaces implemented by the given
|
