diff options
Diffstat (limited to 'src/modlist.cpp')
| -rw-r--r-- | src/modlist.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index 218604b2..c772f5bd 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -637,18 +637,6 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role) } emit postDataChanged(); - - IModList::ModStates newState = state(modID); - if (oldState != newState) { - try { - m_ModStateChanged(info->name(), newState); - } catch (const std::exception &e) { - log::error("failed to invoke state changed notification: {}", e.what()); - } catch (...) { - log::error("failed to invoke state changed notification: unknown exception"); - } - } - return result; } @@ -957,9 +945,6 @@ bool ModList::setActive(const QString &name, bool active) return false; } else { m_Profile->setModEnabled(modIndex, active); - - IModList::ModStates newState = state(modIndex); - m_ModStateChanged(name, newState); return true; } } @@ -987,12 +972,6 @@ int ModList::setActive(const QStringList& names, bool active) { m_Profile->setModsEnabled({}, indices); } - // Notify callbacks: - for (auto modIndex : indices) { - IModList::ModStates newState = state(modIndex); - m_ModStateChanged(ModInfo::getByIndex(modIndex)->name(), newState); - } - return indices.size(); } @@ -1028,6 +1007,13 @@ bool ModList::onModStateChanged(const std::function<void (const QString &, IModL return conn.connected(); } +void ModList::notifyModStateChanged(QList<unsigned int> modIndices) const { + for (auto modIndex : modIndices) { + ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); + m_ModStateChanged(modInfo->name(), state(modIndex)); + } +} + bool ModList::onModMoved(const std::function<void (const QString &, int, int)> &func) { auto conn = m_ModMoved.connect(func); |
