MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / removeNodeIndex

Method removeNodeIndex

MediaLibrary/labelmodel.cpp:506–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506void LabelModel::removeNodeIndex(TagNode *parent, const QString &strPath, bool removeAll, char split)
507{
508 auto titles(QStringView(strPath).split(split, Qt::SkipEmptyParts));
509 //auto titles(strPath.splitRef(split, Qt::SkipEmptyParts));
510 if(titles.size()==0) return;
511 TagNode *current = parent;
512 QModelIndex currentIndex;
513 if(current->parent) currentIndex = createIndex(current->parent->subNodes->indexOf(current), 0, current);
514 QModelIndexList indexList({currentIndex});
515
516 for(auto &title : titles)
517 {
518 if(!current->subNodes) return;
519 auto iter = std::find_if(current->subNodes->begin(), current->subNodes->end(), [=](TagNode *node){return node->tagTitle == title;});
520 if(iter == current->subNodes->end()) return;
521 TagNode *next = *iter;
522 currentIndex = index(iter - current->subNodes->begin(), 0, currentIndex);
523 indexList.append(currentIndex);
524 current = next;
525 }
526
527 while(!indexList.isEmpty())
528 {
529 currentIndex = indexList.takeLast();
530 --current->animeCount;
531 if(current->animeCount<=0 || removeAll)
532 {
533 if(current->tagType == TagNode::TAG_ROOT_CATE) break;
534 TagNode *parent = current->parent;
535 beginRemoveRows(currentIndex.parent(), currentIndex.row(), currentIndex.row());
536 current->parent->removeSubNode(currentIndex.row());
537 endRemoveRows();
538 current = parent;
539 }
540 else
541 {
542 emit dataChanged(currentIndex, currentIndex);
543 current = current->parent;
544 }
545 }
546}
547
548void LabelModel::setCheckStatus(TagNode *node, bool checked)
549{

Callers

nothing calls this directly

Calls 8

splitMethod · 0.80
removeSubNodeMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
appendMethod · 0.45
isEmptyMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected