summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorRJ <122295667+Liderate@users.noreply.github.com>2025-05-23 03:15:43 -0400
committerGitHub <noreply@github.com>2025-05-23 09:15:43 +0200
commit3ef0db4cca1971ed1552c0314e0039dac792d2e5 (patch)
tree52b3edcbc28326916f2d6800f20b780b54696ae6 /src/mainwindow.cpp
parent15f3d2ba0596924c29787938339f1fa3c67135fe (diff)
Speedup refresh when archive parsing is enabled and updateBSAList (#2239)
* Precompute load order for ModThreads * Precompute file infos for plugin association check --------- Co-authored-by: RJ <Liderate@users.noreply.github.com>
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index bdc40f68..c8847534 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1919,12 +1919,18 @@ void MainWindow::updateBSAList(const QStringList& defaultArchives,
fileName.endsWith(".esl", Qt::CaseInsensitive);
});
+ QList<std::pair<QString, QString>> pluginNamePairs;
+ pluginNamePairs.reserve(plugins.size());
+ for (const QString& pluginName : plugins) {
+ QFileInfo pluginInfo(pluginName);
+ pluginNamePairs.append(
+ std::make_pair(pluginInfo.completeBaseName(), pluginInfo.fileName()));
+ }
+
auto hasAssociatedPlugin = [&](const QString& bsaName) -> bool {
- for (const QString& pluginName : plugins) {
- QFileInfo pluginInfo(pluginName);
- if (bsaName.startsWith(QFileInfo(pluginName).completeBaseName(),
- Qt::CaseInsensitive) &&
- (m_OrganizerCore.pluginList()->state(pluginInfo.fileName()) ==
+ for (const auto& [completeBaseName, fileName] : pluginNamePairs) {
+ if (bsaName.startsWith(completeBaseName, Qt::CaseInsensitive) &&
+ (m_OrganizerCore.pluginList()->state(fileName) ==
IPluginList::STATE_ACTIVE)) {
return true;
}