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

Method nextMod

src/modlistview.cpp:247–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247std::optional<unsigned int> ModListView::nextMod(unsigned int modIndex) const
248{
249 const QModelIndex start = indexModelToView(m_core->modList()->index(modIndex, 0));
250
251 auto index = start;
252
253 for (;;) {
254 index = nextIndex(index);
255
256 if (index == start || !index.isValid()) {
257 // wrapped around, give up
258 break;
259 }
260
261 modIndex = index.data(ModList::IndexRole).toInt();
262
263 ModInfo::Ptr mod = ModInfo::getByIndex(modIndex);
264
265 // skip overwrite, backups and separators
266 if (mod->isOverwrite() || mod->isBackup() || mod->isSeparator()) {
267 continue;
268 }
269
270 return modIndex;
271 }
272
273 return {};
274}
275
276std::optional<unsigned int> ModListView::prevMod(unsigned int modIndex) const
277{

Callers 1

onNextModMethod · 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