| 413 | } // getChoiceIndexFromKnobType |
| 414 | |
| 415 | AddKnobDialog::AddKnobDialog(DockablePanel* panel, |
| 416 | const KnobIPtr& knob, |
| 417 | const std::string& selectedPageName, |
| 418 | const std::string& selectedGroupName, |
| 419 | QWidget* parent) |
| 420 | : QDialog(parent) |
| 421 | , _imp( new AddKnobDialogPrivate(panel) ) |
| 422 | { |
| 423 | _imp->knob = knob; |
| 424 | assert( !knob || knob->isUserKnob() ); |
| 425 | |
| 426 | { |
| 427 | EffectInstance* effect = dynamic_cast<EffectInstance*>( panel->getHolder() ); |
| 428 | QString title = QString::fromUtf8("Add Parameter"); |
| 429 | if (!knob) { |
| 430 | // Add... |
| 431 | if (effect) { |
| 432 | title += QString::fromUtf8(" to "); |
| 433 | title += QString::fromUtf8( effect->getScriptName().c_str() ); |
| 434 | } |
| 435 | } else { |
| 436 | // Edit... |
| 437 | title = QString::fromUtf8("Edit Parameter "); |
| 438 | if (effect) { |
| 439 | title += QString::fromUtf8( effect->getScriptName().c_str() ); |
| 440 | title += QChar::fromLatin1('.'); |
| 441 | } |
| 442 | title += QString::fromUtf8( knob->getName().c_str() ); |
| 443 | } |
| 444 | setWindowTitle(title); |
| 445 | } |
| 446 | |
| 447 | //QFont font(NATRON_FONT,NATRON_FONT_SIZE_11); |
| 448 | |
| 449 | _imp->vLayout = new QVBoxLayout(this); |
| 450 | _imp->vLayout->setContentsMargins(0, 0, 15, 0); |
| 451 | |
| 452 | _imp->mainContainer = new QWidget(this); |
| 453 | _imp->mainLayout = new QFormLayout(_imp->mainContainer); |
| 454 | _imp->mainLayout->setLabelAlignment(Qt::AlignVCenter | Qt::AlignRight); |
| 455 | _imp->mainLayout->setFormAlignment(Qt::AlignVCenter | Qt::AlignLeft); |
| 456 | _imp->mainLayout->setSpacing(3); |
| 457 | _imp->mainLayout->setContentsMargins(0, 0, 15, 0); |
| 458 | |
| 459 | _imp->vLayout->addWidget(_imp->mainContainer); |
| 460 | |
| 461 | { |
| 462 | KnobIPtr isAlias; |
| 463 | KnobIPtr listener; |
| 464 | if (knob) { |
| 465 | KnobI::ListenerDimsMap listeners; |
| 466 | knob->getListeners(listeners); |
| 467 | if ( !listeners.empty() ) { |
| 468 | listener = listeners.begin()->first.lock(); |
| 469 | if (listener) { |
| 470 | isAlias = listener->getAliasMaster(); |
| 471 | } |
| 472 | if (isAlias != knob) { |
nothing calls this directly
no test coverage detected