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.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/modlist.cpp') 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& func) +{ + return m_ModInstalled.connect(func).connected(); +} + +bool ModList::onModRemoved(const std::function& func) +{ + return m_ModRemoved.connect(func).connected(); +} + bool ModList::onModStateChanged(const std::function&)>& 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 modIndices) const -- cgit v1.3.1