MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / buildPluginGroupHierarchy

Method buildPluginGroupHierarchy

Gui/PreferencesPanel.cpp:414–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414PluginTreeNodeList::iterator
415PreferencesPanelPrivate::buildPluginGroupHierarchy(const QStringList& groupingSplit)
416{
417 if ( groupingSplit.isEmpty() ) {
418 return pluginsList.end();
419 }
420
421 const QString & lastGroupName = groupingSplit.back();
422
423 // Find out whether the deepest parent group of the action already exist
424 PluginTreeNodeList::iterator foundGuiGroup = pluginsList.end();
425 for (PluginTreeNodeList::iterator it2 = pluginsList.begin(); it2 != pluginsList.end(); ++it2) {
426 if (it2->item->text(0) == lastGroupName) {
427 foundGuiGroup = it2;
428 break;
429 }
430 }
431
432 QTreeWidgetItem* groupParent;
433 if ( foundGuiGroup != pluginsList.end() ) {
434 groupParent = foundGuiGroup->item;
435 } else {
436 groupParent = 0;
437 for (int i = 0; i < groupingSplit.size(); ++i) {
438 QTreeWidgetItem* groupingItem;
439 bool existAlready = false;
440 if (groupParent) {
441 for (int j = 0; j < groupParent->childCount(); ++j) {
442 QTreeWidgetItem* child = groupParent->child(j);
443 if (child->text(0) == groupingSplit[i]) {
444 groupingItem = child;
445 existAlready = true;
446 break;
447 }
448 }
449 if (!existAlready) {
450 groupingItem = new QTreeWidgetItem(groupParent);
451 groupParent->addChild(groupingItem);
452 }
453 } else {
454 for (int j = 0; j < pluginsView->topLevelItemCount(); ++j) {
455 QTreeWidgetItem* topLvlItem = pluginsView->topLevelItem(j);
456 if (topLvlItem->text(0) == groupingSplit[i]) {
457 groupingItem = topLvlItem;
458 existAlready = true;
459 break;
460 }
461 }
462 if (!existAlready) {
463 groupingItem = new QTreeWidgetItem(pluginsView);
464 pluginsView->addTopLevelItem(groupingItem);
465 }
466 }
467 if (!existAlready) {
468 groupingItem->setExpanded(false);
469 groupingItem->setFlags(Qt::ItemIsEnabled);
470 groupingItem->setText(COL_PLUGIN_LABEL, groupingSplit[i]);
471 }

Callers 1

createPluginsViewMethod · 0.80

Calls 9

childCountMethod · 0.80
addChildMethod · 0.80
setFlagsMethod · 0.80
isEmptyMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
setTextMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected