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

Method insertNode

MediaLibrary/labelmodel.cpp:430–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430TagNode *LabelModel::insertNode(TagNode *parent, const QString &strPath, int count, TagNode::TagType type, char split)
431{
432 auto titles(QStringView(strPath).split(split, Qt::SkipEmptyParts));
433 //auto titles(strPath.splitRef(split, QString::SkipEmptyParts));
434 if(titles.size()==0) return parent;
435 TagNode *current = parent;
436 QString curPath;
437 bool titleStart = strPath.startsWith(split);
438 for(auto &title : titles)
439 {
440 if(!curPath.isEmpty() || titleStart) curPath.append(split);
441 curPath.append(title);
442 if(!current->subNodes) current->subNodes = new QVector<TagNode *>;
443 auto iter = std::find_if(current->subNodes->begin(), current->subNodes->end(), [=](TagNode *node){return node->tagTitle == title;});
444 TagNode *next = nullptr;
445 if(iter == current->subNodes->end())
446 {
447 next = new TagNode(title.toString(), current, 0, type);
448 next->tagFilter = curPath;
449 }
450 else
451 {
452 next = *iter;
453 }
454 current->animeCount += count;
455 current = next;
456 }
457 current->animeCount += count;
458 return current;
459
460}
461
462TagNode *LabelModel::insertNodeIndex(TagNode *parent, const QString &strPath, int count, TagNode::TagType type, char split)
463{

Callers

nothing calls this directly

Calls 7

splitMethod · 0.80
sizeMethod · 0.45
isEmptyMethod · 0.45
appendMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected