MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / getAffectedMods

Method getAffectedMods

launcher/minecraft/mod/ModFolderModel.cpp:346–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346QModelIndexList ModFolderModel::getAffectedMods(const QModelIndexList& indexes, EnableAction action)
347{
348 if (indexes.isEmpty())
349 return {};
350
351 QModelIndexList affectedList = {};
352 auto affectedModsList = selectedMods(indexes);
353 auto affectedMods = QSet(affectedModsList.begin(), affectedModsList.end());
354 std::set<QString> seen;
355
356 switch (action) {
357 case EnableAction::ENABLE: {
358 affectedMods = collectMods(affectedMods, m_requires, seen, true);
359 break;
360 }
361 case EnableAction::DISABLE: {
362 affectedMods = collectMods(affectedMods, m_requiredBy, seen, false);
363 break;
364 }
365 case EnableAction::TOGGLE: {
366 return {}; // this function should not be called with TOGGLE
367 }
368 }
369 for (auto affected : affectedMods) {
370 auto affectedId = affected->mod_id();
371 auto row = m_resources_index[affected->internal_id()];
372 affectedList << index(row, 0);
373 }
374 return affectedList;
375}
376
377bool ModFolderModel::setResourceEnabled(const QModelIndexList& indexes, EnableAction action)
378{

Callers 1

removeItemsMethod · 0.80

Calls 4

collectModsFunction · 0.85
internal_idMethod · 0.80
isEmptyMethod · 0.45
mod_idMethod · 0.45

Tested by

no test coverage detected