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

Method prevMod

src/modlistview.cpp:276–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276std::optional<unsigned int> ModListView::prevMod(unsigned int modIndex) const
277{
278 const QModelIndex start = indexModelToView(m_core->modList()->index(modIndex, 0));
279
280 auto index = start;
281
282 for (;;) {
283 index = prevIndex(index);
284
285 if (index == start || !index.isValid()) {
286 // wrapped around, give up
287 break;
288 }
289
290 modIndex = index.data(ModList::IndexRole).toInt();
291
292 // skip overwrite, backups and separators
293 ModInfo::Ptr mod = ModInfo::getByIndex(modIndex);
294 if (mod->isOverwrite() || mod->isBackup() || mod->isSeparator()) {
295 continue;
296 }
297
298 return modIndex;
299 }
300
301 return {};
302}
303
304void ModListView::invalidateFilter()
305{

Callers 1

onPreviousModMethod · 0.80

Calls 8

indexModelToViewFunction · 0.85
indexMethod · 0.45
modListMethod · 0.45
isValidMethod · 0.45
dataMethod · 0.45
isOverwriteMethod · 0.45
isBackupMethod · 0.45
isSeparatorMethod · 0.45

Tested by

no test coverage detected