| 245 | } |
| 246 | |
| 247 | std::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 | |
| 276 | std::optional<unsigned int> ModListView::prevMod(unsigned int modIndex) const |
| 277 | { |
no test coverage detected