From 4118aef2a28964d1bffdb489bf2223fbd6f994db Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Fri, 4 Dec 2020 13:32:47 +0100 Subject: Remove disconnectPlugins() from OrganizerCore. --- src/organizercore.cpp | 19 ------------------- src/organizercore.h | 1 - src/plugincontainer.cpp | 5 ----- src/plugincontainer.h | 47 ++++++++++++++++++----------------------------- 4 files changed, 18 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 6a333a22..256833a8 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -301,25 +301,6 @@ void OrganizerCore::connectPlugins(PluginContainer *container) [&](IPlugin* plugin) { m_PluginDisabled(plugin); }); } -void OrganizerCore::disconnectPlugins() -{ - m_AboutToRun.disconnect_all_slots(); - m_FinishedRun.disconnect_all_slots(); - m_UserInterfaceInitialized.disconnect_all_slots(); - m_ProfileChanged.disconnect_all_slots(); - m_PluginSettingChanged.disconnect_all_slots(); - - m_ModList.disconnectSlots(); - m_PluginList.disconnectSlots(); - m_Updater.setPluginContainer(nullptr); - m_DownloadManager.setPluginContainer(nullptr); - m_ModList.setPluginContainer(nullptr); - - m_Settings.plugins().clearPlugins(); - m_GamePlugin = nullptr; - m_PluginContainer = nullptr; -} - void OrganizerCore::setManagedGame(MOBase::IPluginGame *game) { m_GameName = game->gameName(); diff --git a/src/organizercore.h b/src/organizercore.h index cb612eae..f2b904cd 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -201,7 +201,6 @@ public: void setUserInterface(IUserInterface* ui); void connectPlugins(PluginContainer *container); - void disconnectPlugins(); void setManagedGame(MOBase::IPluginGame *game); diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp index 3c8050cf..a2f0d5f0 100644 --- a/src/plugincontainer.cpp +++ b/src/plugincontainer.cpp @@ -943,11 +943,6 @@ void PluginContainer::reloadPlugin(QString const& filepath) void PluginContainer::unloadPlugins() { - // disconnect all slots before unloading plugins so plugins don't have to take care of that - if (m_Organizer) { - m_Organizer->disconnectPlugins(); - } - bf::for_each(m_Plugins, [](auto& t) { t.second.clear(); }); bf::for_each(m_AccessPlugins, [](auto& t) { t.second.clear(); }); m_Requirements.clear(); diff --git a/src/plugincontainer.h b/src/plugincontainer.h index d6503a43..bd19e7ef 100644 --- a/src/plugincontainer.h +++ b/src/plugincontainer.h @@ -209,7 +209,6 @@ public: void reloadPlugin(QString const& filepath); void loadPlugins(); - void unloadPlugins(); /** * @brief Find the game plugin corresponding to the given name. @@ -370,22 +369,30 @@ private: friend class PluginRequirements; - /** - * @return the organizer proxy for the given plugin. - */ + // Unload all the plugins. + void unloadPlugins(); + + // Retrieve the organizer proxy for the given plugin. OrganizerProxy* organizerProxy(MOBase::IPlugin* plugin) const; - /** - * @return the proxy plugin that instantiated the given plugin, or a null pointer - * if the plugin was not instantiated by a proxy. - */ + // Retrieve the proxy plugin that instantiated the given plugin, or a null pointer + // if the plugin was not instantiated by a proxy. MOBase::IPluginProxy* pluginProxy(MOBase::IPlugin* plugin) const; - /** - * @return the path to the file or folder corresponding to the plugin. - */ + // Retrieve the path to the file or folder corresponding to the plugin. QString filepath(MOBase::IPlugin* plugin) const; + // Load plugins from the given filepath using the given proxy. + std::vector loadProxied(const QString& filepath, MOBase::IPluginProxy* proxy); + + // Load the Qt plugin from the given file. + QObject* loadQtPlugin(const QString& filepath); + + // 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& plugins) const; + /** * @brief Unload the given plugin. * @@ -397,24 +404,6 @@ private: */ void unloadPlugin(MOBase::IPlugin* plugin, QObject* object); - /** - * @brief Load plugins from the given filepath using the given proxy. - * - * @param filepath Path to a folder/file containing plugin(s) that can be load by the given proxy. - * @param proxy Proxy to use to load plugins. - * - * @return the list of created plugins. - */ - std::vector loadProxied(const QString& filepath, MOBase::IPluginProxy* proxy); - - // Load the Qt plugin from the given file. - QObject* loadQtPlugin(const QString& filepath); - - // 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& plugins) const; - /** * @brief Retrieved the (localized) names of interfaces implemented by the given * plugin. -- cgit v1.3.1