MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / highlightPlugins

Method highlightPlugins

src/pluginlist.cpp:122–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void 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
164void PluginList::refresh(const QString& profileName,
165 const DirectoryEntry& baseDirectory,

Callers 1

Calls 14

indexMethod · 0.95
columnCountMethod · 0.95
currentProfileMethod · 0.80
modEnabledMethod · 0.80
getIDMethod · 0.80
absolutePathMethod · 0.45
internalNameMethod · 0.45
sizeMethod · 0.45
findFileMethod · 0.45
getOriginMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected