From 14782a374c727c8fb2c6733ba0556fca9dc9eda6 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Sat, 5 Jan 2019 02:56:43 -0600 Subject: Improve performance by removing redundant actions when changing mod states --- src/modlistsortproxy.cpp | 16 ++++++++++------ src/organizercore.cpp | 9 ++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 833e16c3..1a00d764 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -58,16 +58,20 @@ void ModListSortProxy::updateFilterActive() void ModListSortProxy::setCategoryFilter(const std::vector &categories) { - m_CategoryFilter = categories; - updateFilterActive(); - invalidate(); + if (categories != m_CategoryFilter) { + m_CategoryFilter = categories; + updateFilterActive(); + invalidate(); + } } void ModListSortProxy::setContentFilter(const std::vector &content) { - m_ContentFilter = content; - updateFilterActive(); - invalidate(); + if (content != m_ContentFilter) { + m_ContentFilter = content; + updateFilterActive(); + invalidate(); + } } Qt::ItemFlags ModListSortProxy::flags(const QModelIndex &modelIndex) const diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 884b699c..9ebe9f47 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1787,7 +1787,9 @@ void OrganizerCore::updateModActiveState(int index, bool active) if (active != m_PluginList.isEnabled(esm) && file->getAlternatives().empty()) { + m_PluginList.blockSignals(true); m_PluginList.enableESP(esm, active); + m_PluginList.blockSignals(false); } } int enabled = 0; @@ -1801,7 +1803,9 @@ void OrganizerCore::updateModActiveState(int index, bool active) if (active != m_PluginList.isEnabled(esl) && file->getAlternatives().empty()) { + m_PluginList.blockSignals(true); m_PluginList.enableESP(esl, active); + m_PluginList.blockSignals(false); ++enabled; } } @@ -1815,7 +1819,9 @@ void OrganizerCore::updateModActiveState(int index, bool active) if (active != m_PluginList.isEnabled(esp) && file->getAlternatives().empty()) { + m_PluginList.blockSignals(true); m_PluginList.enableESP(esp, active); + m_PluginList.blockSignals(false); ++enabled; } } @@ -1842,7 +1848,9 @@ void OrganizerCore::updateModInDirectoryStructure(unsigned int index, refreshESPList(true); // activate all esps of the specified mod so the bsas get activated along with // it + m_PluginList.blockSignals(true); updateModActiveState(index, true); + m_PluginList.blockSignals(false); // now we need to refresh the bsa list and save it so there is no confusion // about what archives are avaiable and active refreshBSAList(); @@ -2005,7 +2013,6 @@ void OrganizerCore::modStatusChanged(unsigned int index) updateModInDirectoryStructure(index, modInfo); } else { updateModActiveState(index, false); - refreshESPList(true); if (m_DirectoryStructure->originExists(ToWString(modInfo->name()))) { FilesOrigin &origin = m_DirectoryStructure->getOriginByName(ToWString(modInfo->name())); -- cgit v1.3.1