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

Method counters

src/modlistview.cpp:500–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500ModListView::ModCounters ModListView::counters() const
501{
502 ModCounters c;
503
504 auto hasFlag = [](std::vector<ModInfo::EFlag> flags, ModInfo::EFlag filter) {
505 return std::find(flags.begin(), flags.end(), filter) != flags.end();
506 };
507
508 for (unsigned int index = 0; index < ModInfo::getNumMods(); ++index) {
509 auto info = ModInfo::getByIndex(index);
510 const auto flags = info->getFlags();
511
512 const bool enabled = m_core->currentProfile()->modEnabled(index);
513 const bool visible = m_sortProxy->filterMatchesMod(info, enabled);
514
515 if (info->isBackup()) {
516 c.backup++;
517 if (visible)
518 c.visible.backup++;
519 } else if (info->isForeign()) {
520 c.foreign++;
521 if (visible)
522 c.visible.foreign++;
523 } else if (info->isSeparator()) {
524 c.separator++;
525 if (visible)
526 c.visible.separator++;
527 } else if (!info->isOverwrite()) {
528 c.regular++;
529 if (visible)
530 c.visible.regular++;
531 if (enabled) {
532 c.active++;
533 if (visible)
534 c.visible.active++;
535 }
536 }
537 }
538
539 return c;
540}
541
542void ModListView::updateModCount()
543{

Callers 1

Calls 10

modEnabledMethod · 0.80
currentProfileMethod · 0.80
filterMatchesModMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getFlagsMethod · 0.45
isBackupMethod · 0.45
isForeignMethod · 0.45
isSeparatorMethod · 0.45
isOverwriteMethod · 0.45

Tested by

no test coverage detected