From e3c3c2dcc4c31e831ef17687cbf02ba1519f7450 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 15 May 2016 13:06:31 +0200 Subject: fixed: after running an external application the plugin list was potentially not updated correctly --- src/mainwindow.cpp | 5 +---- src/organizercore.cpp | 25 +++++++++++++------------ src/pluginlist.cpp | 2 ++ 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0ede643b..c27ca50a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4340,10 +4340,7 @@ void MainWindow::on_bossButton_clicked() QFile::remove(m_OrganizerCore.currentProfile()->getLoadOrderFileName()); } m_OrganizerCore.refreshESPList(); - if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) { - // the load order should have been retrieved from file time, now save it to our own format - m_OrganizerCore.savePluginList(); - } + m_OrganizerCore.savePluginList(); } } diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 8f308c88..9c900d53 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1066,7 +1066,6 @@ void OrganizerCore::spawnBinary(const QFileInfo &binary, if (m_UserInterface != nullptr) { m_UserInterface->setWindowEnabled(true); } - refreshDirectoryStructure(); // need to remove our stored load order because it may be outdated if a // foreign tool changed the // file time. After removing that file, refreshESPList will use the file @@ -1076,13 +1075,10 @@ void OrganizerCore::spawnBinary(const QFileInfo &binary, qDebug("removing loadorder.txt"); QFile::remove(m_CurrentProfile->getLoadOrderFileName()); } + refreshDirectoryStructure(); + refreshESPList(); - if (managedGame()->loadOrderMechanism() - == IPluginGame::LoadOrderMechanism::FileTime) { - // the load order should have been retrieved from file time, now save it - // to our own format - savePluginList(); - } + savePluginList(); m_FinishedRun(binary.absoluteFilePath(), processExitCode); } @@ -1361,7 +1357,9 @@ void OrganizerCore::refreshESPList() if (m_DirectoryUpdate) { // don't mess up the esp list if we're currently updating the directory // structure - m_PostRefreshTasks.append([this]() { this->refreshESPList(); }); + m_PostRefreshTasks.append([this]() { + this->refreshESPList(); + }); return; } m_CurrentProfile->modlistWriter().write(); @@ -1579,9 +1577,6 @@ void OrganizerCore::directory_refreshed() return; } m_DirectoryUpdate = false; - if (m_CurrentProfile != nullptr) { - refreshLists(); - } for (int i = 0; i < m_ModList.rowCount(); ++i) { ModInfo::Ptr modInfo = ModInfo::getByIndex(i); @@ -1590,6 +1585,10 @@ void OrganizerCore::directory_refreshed() for (auto task : m_PostRefreshTasks) { task(); } + + if (m_CurrentProfile != nullptr) { + refreshLists(); + } } void OrganizerCore::profileRefresh() @@ -1784,7 +1783,9 @@ void OrganizerCore::savePluginList() { if (m_DirectoryUpdate) { // delay save till after directory update - m_PostRefreshTasks.append([&]() { this->savePluginList(); }); + m_PostRefreshTasks.append([this]() { + this->savePluginList(); + }); return; } m_PluginList.saveTo(m_CurrentProfile->getLockedOrderFileName(), diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 1978c749..002c17e1 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -535,6 +535,8 @@ void PluginList::setState(const QString &name, PluginStates state) auto iter = m_ESPsByName.find(name.toLower()); if (iter != m_ESPsByName.end()) { m_ESPs[iter->second].m_Enabled = state == IPluginList::STATE_ACTIVE; + } else { + qWarning("plugin %s not found", qPrintable(name)); } } -- cgit v1.3.1