diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-10-25 15:52:53 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-10-25 15:52:53 +0100 |
| commit | 4e11faf1c8b19013da6d5686f79b67c1c746653b (patch) | |
| tree | 14a132b9f70eca24eb08fed8b35957e36f6fc114 /src/modlist.h | |
| parent | 52cfb8e8a7609c8b763652e1575a769dd5fe1b02 (diff) | |
Move IOrganizer::onModInstalled() to IModList. Add IModList::onModRemoved().
Diffstat (limited to 'src/modlist.h')
| -rw-r--r-- | src/modlist.h | 35 |
1 files changed, 27 insertions, 8 deletions
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<void (const std::map<QString, ModStates>&)> SignalModStateChanged;
- typedef boost::signals2::signal<void (const QString &, int, int)> SignalModMoved;
+ using SignalModInstalled = boost::signals2::signal<void(MOBase::IModInterface*)>;
+ using SignalModRemoved = boost::signals2::signal<void(QString const&)>;
+ using SignalModStateChanged = boost::signals2::signal<void (const std::map<QString, ModStates>&)>;
+ using SignalModMoved = boost::signals2::signal<void (const QString &, int, int)>;
public:
@@ -125,6 +127,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<void(const std::map<QString, ModStates>&)>& func) override;
-
- /// \copydoc MOBase::IModList::onModMoved
- virtual bool onModMoved(const std::function<void (const QString &, int, int)> &func) override;
+ bool onModInstalled(const std::function<void(MOBase::IModInterface*)>& func) override;
+ bool onModRemoved(const std::function<void(QString const&)>& func) override;
+ bool onModStateChanged(const std::function<void(const std::map<QString, ModStates>&)>& func) override;
+ bool onModMoved(const std::function<void (const QString &, int, int)> &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;
|
