| 120 | } |
| 121 | |
| 122 | void PluginList::highlightPlugins(const std::vector<unsigned int>& modIndices, |
| 123 | const MOShared::DirectoryEntry& directoryEntry) |
| 124 | { |
| 125 | auto* profile = m_Organizer.currentProfile(); |
| 126 | |
| 127 | for (auto& esp : m_ESPs) { |
| 128 | esp.modSelected = false; |
| 129 | } |
| 130 | |
| 131 | for (auto& modIndex : modIndices) { |
| 132 | ModInfo::Ptr selectedMod = ModInfo::getByIndex(modIndex); |
| 133 | if (!selectedMod.isNull() && profile->modEnabled(modIndex)) { |
| 134 | QDir dir(selectedMod->absolutePath()); |
| 135 | QStringList plugins = dir.entryList(QStringList() << "*.esp" |
| 136 | << "*.esm" |
| 137 | << "*.esl"); |
| 138 | const MOShared::FilesOrigin& origin = |
| 139 | directoryEntry.getOriginByName(selectedMod->internalName().toStdWString()); |
| 140 | if (plugins.size() > 0) { |
| 141 | for (auto plugin : plugins) { |
| 142 | MOShared::FileEntryPtr file = directoryEntry.findFile(plugin.toStdWString()); |
| 143 | if (file && file->getOrigin() != origin.getID()) { |
| 144 | const auto alternatives = file->getAlternatives(); |
| 145 | if (std::find_if(alternatives.begin(), alternatives.end(), |
| 146 | [&](const FileAlternative& element) { |
| 147 | return element.originID() == origin.getID(); |
| 148 | }) == alternatives.end()) |
| 149 | continue; |
| 150 | } |
| 151 | std::map<QString, int>::iterator iter = m_ESPsByName.find(plugin); |
| 152 | if (iter != m_ESPsByName.end()) { |
| 153 | m_ESPs[iter->second].modSelected = true; |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | emit dataChanged(this->index(0, 0), this->index(static_cast<int>(m_ESPs.size()) - 1, |
| 161 | this->columnCount() - 1)); |
| 162 | } |
| 163 | |
| 164 | void PluginList::refresh(const QString& profileName, |
| 165 | const DirectoryEntry& baseDirectory, |
no test coverage detected