From 4e11faf1c8b19013da6d5686f79b67c1c746653b Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sun, 25 Oct 2020 15:52:53 +0100 Subject: Move IOrganizer::onModInstalled() to IModList. Add IModList::onModRemoved(). --- src/modlist.h | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'src/modlist.h') diff --git a/src/modlist.h b/src/modlist.h index 5312db34..baaeede3 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -70,8 +70,10 @@ public: COL_LASTCOLUMN = COL_NOTES, }; - typedef boost::signals2::signal&)> SignalModStateChanged; - typedef boost::signals2::signal SignalModMoved; + using SignalModInstalled = boost::signals2::signal; + using SignalModRemoved = boost::signals2::signal; + using SignalModStateChanged = boost::signals2::signal&)>; + using SignalModMoved = boost::signals2::signal; public: @@ -124,6 +126,22 @@ public: void highlightMods(const QItemSelectionModel *selection, const MOShared::DirectoryEntry &directoryEntry); + /** + * @brief Notify the mod list that the given mod has been installed. This is used + * to notify the plugin that registered through onModInstalled(). + * + * @param mod The installed mod. + */ + void notifyModInstalled(MOBase::IModInterface *mod) const; + + /** + * @brief Notify the mod list that a mod has been removed. This is used + * to notify the plugin that registered through onModRemoved(). + * + * @param modName Name of the removed mod. + */ + void notifyModRemoved(QString const& modName) const; + /** * @brief Notify the mod list that the state of the specified mods has changed. This is used * to notify the plugin that registered through onModStateChanged(). @@ -155,11 +173,10 @@ public: /// \copydoc MOBase::IModList::setPriority virtual bool setPriority(const QString &name, int newPriority) override; - /// \copydoc MOBase::IModList::onModStateChanged - virtual bool onModStateChanged(const std::function&)>& func) override; - - /// \copydoc MOBase::IModList::onModMoved - virtual bool onModMoved(const std::function &func) override; + bool onModInstalled(const std::function& func) override; + bool onModRemoved(const std::function& func) override; + bool onModStateChanged(const std::function&)>& func) override; + bool onModMoved(const std::function &func) override; public: // implementation of virtual functions of QAbstractItemModel @@ -362,8 +379,10 @@ private: TModInfoChange m_ChangeInfo; - SignalModStateChanged m_ModStateChanged; + SignalModInstalled m_ModInstalled; SignalModMoved m_ModMoved; + SignalModRemoved m_ModRemoved; + SignalModStateChanged m_ModStateChanged; QElapsedTimer m_LastCheck; -- cgit v1.3.1