| 274 | } |
| 275 | |
| 276 | std::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 | |
| 304 | void ModListView::invalidateFilter() |
| 305 | { |
no test coverage detected