summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-10-25 15:52:53 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2020-10-25 15:52:53 +0100
commit4e11faf1c8b19013da6d5686f79b67c1c746653b (patch)
tree14a132b9f70eca24eb08fed8b35957e36f6fc114 /src/modlist.cpp
parent52cfb8e8a7609c8b763652e1575a769dd5fe1b02 (diff)
Move IOrganizer::onModInstalled() to IModList. Add IModList::onModRemoved().
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 2499bac0..90433963 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -77,6 +77,8 @@ ModList::ModList(PluginContainer *pluginContainer, OrganizerCore *organizer)
ModList::~ModList()
{
+ m_ModInstalled.disconnect_all_slots();
+ m_ModRemoved.disconnect_all_slots();
m_ModStateChanged.disconnect_all_slots();
m_ModMoved.disconnect_all_slots();
}
@@ -1001,10 +1003,29 @@ bool ModList::setPriority(const QString &name, int newPriority)
}
}
+bool ModList::onModInstalled(const std::function<void(MOBase::IModInterface*)>& func)
+{
+ return m_ModInstalled.connect(func).connected();
+}
+
+bool ModList::onModRemoved(const std::function<void(QString const&)>& func)
+{
+ return m_ModRemoved.connect(func).connected();
+}
+
bool ModList::onModStateChanged(const std::function<void(const std::map<QString, ModStates>&)>& func)
{
- auto conn = m_ModStateChanged.connect(func);
- return conn.connected();
+ return m_ModStateChanged.connect(func).connected();
+}
+
+void ModList::notifyModInstalled(MOBase::IModInterface* mod) const
+{
+ m_ModInstalled(mod);
+}
+
+void ModList::notifyModRemoved(QString const& modName) const
+{
+ m_ModRemoved(modName);
}
void ModList::notifyModStateChanged(QList<unsigned int> modIndices) const