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

Method NodeCreationDialog

Gui/NodeCreationDialog.cpp:367–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367NodeCreationDialog::NodeCreationDialog(const QString& initialFilter,
368 QWidget* parent)
369 : QDialog(parent)
370 , _imp( new NodeCreationDialogPrivate() )
371{
372 setWindowTitle( tr("Node Creation Tool") );
373 setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
374 setObjectName( QString::fromUtf8("nodeCreationDialog") );
375 setAttribute(Qt::WA_DeleteOnClose, true);
376 _imp->layout = new QVBoxLayout(this);
377 _imp->layout->setContentsMargins(0, 0, 0, 0);
378
379
380 CompleterLineEdit::PluginsNamesMap pluginsMap;
381 QString initialFilterName;
382 std::string stdInitialFilter = initialFilter.toStdString();
383 int i = 0;
384 for (PluginsMap::iterator it = _imp->items.begin(); it != _imp->items.end(); ++it) {
385 if ( it->second.empty() ) {
386 continue;
387 }
388
389
390 if (it->second.size() == 1) {
391 std::pair<QString, QString> idNamePair;
392 Plugin* p = ( *it->second.begin() );
393 if ( !p->getIsUserCreatable() ) {
394 continue;
395 }
396
397 idNamePair.second = p->generateUserFriendlyPluginID();
398
399 int indexOfBracket = idNamePair.second.lastIndexOf( QString::fromUtf8(" [") );
400 if (indexOfBracket != -1) {
401 idNamePair.first = idNamePair.second.left(indexOfBracket);
402 }
403
404 int weight = getPluginWeight( p->getPluginID(), p->getMajorVersion() );
405 pluginsMap.insert( std::make_pair(weight, idNamePair) );
406
407 if (it->first == stdInitialFilter) {
408 initialFilterName = idNamePair.first;
409 }
410 ++i;
411 } else {
412 QString bestMajorName;
413 for (PluginVersionsOrdered::reverse_iterator it2 = it->second.rbegin(); it2 != it->second.rend(); ++it2) {
414 if ( !(*it2)->getIsUserCreatable() ) {
415 continue;
416 }
417 std::pair<QString, QString> idNamePair;
418 if ( it2 == it->second.rbegin() ) {
419 idNamePair.second = (*it2)->generateUserFriendlyPluginID();
420 bestMajorName = idNamePair.second;
421 } else {
422 idNamePair.second = (*it2)->generateUserFriendlyPluginIDMajorEncoded();
423 }
424

Callers

nothing calls this directly

Calls 15

getPluginWeightFunction · 0.85
sizeHintFunction · 0.85
toStdStringMethod · 0.80
emptyMethod · 0.80
getIsUserCreatableMethod · 0.80
addWidgetMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
leftMethod · 0.45

Tested by

no test coverage detected