| 291 | } |
| 292 | |
| 293 | void |
| 294 | NodeViewerContextPrivate::createKnobs(const KnobsVec& knobsOrdered) |
| 295 | { |
| 296 | NodeGuiPtr thisNode = getNode(); |
| 297 | |
| 298 | assert( !knobsOrdered.empty() ); |
| 299 | |
| 300 | |
| 301 | knobsMapping.clear(); |
| 302 | |
| 303 | |
| 304 | QWidget* lastRowContainer = new QWidget(widgetsContainer); |
| 305 | QHBoxLayout* lastRowLayout = new QHBoxLayout(lastRowContainer); |
| 306 | lastRowLayout->setContentsMargins(TO_DPIX(3), TO_DPIY(2), 0, 0); |
| 307 | lastRowLayout->setSpacing(0); |
| 308 | widgetsContainerLayout->addWidget(lastRowContainer); |
| 309 | |
| 310 | KnobsVec knobsOnSameLine; |
| 311 | KnobsVec::const_iterator next = knobsOrdered.begin(); |
| 312 | |
| 313 | ++next; |
| 314 | for (KnobsVec::const_iterator it = knobsOrdered.begin(); it != knobsOrdered.end(); ++it) { |
| 315 | KnobGuiPtr ret( appPTR->createGuiForKnob(*it, publicInterface) ); |
| 316 | if (!ret) { |
| 317 | assert(false); |
| 318 | continue; |
| 319 | } |
| 320 | ret->initialize(); |
| 321 | |
| 322 | knobsMapping.insert( std::make_pair(*it, ret) ); |
| 323 | |
| 324 | bool makeNewLine = (*it)->getInViewerContextNewLineActivated(); |
| 325 | KnobClickableLabel* label = 0; |
| 326 | std::string inViewerLabel = (*it)->getInViewerContextLabel(); |
| 327 | if ( !inViewerLabel.empty() ) { |
| 328 | label = new KnobClickableLabel(QString::fromUtf8( inViewerLabel.c_str() ) + QLatin1String(":"), ret, widgetsContainer); |
| 329 | QObject::connect( label, SIGNAL(clicked(bool)), ret.get(), SIGNAL(labelClicked(bool)) ); |
| 330 | } |
| 331 | ret->createGUI(lastRowContainer, 0, label, 0 /*warningIndicator*/, lastRowLayout, makeNewLine, 0, knobsOnSameLine); |
| 332 | |
| 333 | if (makeNewLine) { |
| 334 | knobsOnSameLine.clear(); |
| 335 | lastRowLayout->addStretch(); |
| 336 | lastRowContainer = new QWidget(widgetsContainer); |
| 337 | lastRowLayout = new QHBoxLayout(lastRowContainer); |
| 338 | lastRowLayout->setContentsMargins(TO_DPIX(3), TO_DPIY(2), 0, 0); |
| 339 | lastRowLayout->setSpacing(0); |
| 340 | widgetsContainerLayout->addWidget(lastRowContainer); |
| 341 | } else { |
| 342 | knobsOnSameLine.push_back(*it); |
| 343 | if ( next != knobsOrdered.end() ) { |
| 344 | if ( (*it)->getInViewerContextAddSeparator() ) { |
| 345 | addSpacer(lastRowLayout); |
| 346 | } else { |
| 347 | int spacing = (*it)->getInViewerContextItemSpacing(); |
| 348 | lastRowLayout->addSpacing( TO_DPIX(spacing) ); |
| 349 | } |
| 350 | } |
no test coverage detected