Ejemplo n.º 1
0
PasteKnobClipBoardUndoCommand::PasteKnobClipBoardUndoCommand(const KnobIPtr& knob,
                                                             KnobClipBoardType type,
                                                             DimSpec fromDimension,
                                                             DimSpec targetDimensionIn,
                                                             ViewSetSpec fromView,
                                                             ViewSetSpec targetViewIn,
                                                             const KnobIPtr& fromKnob)
: QUndoCommand(0)
, _imp( new PasteKnobClipBoardUndoCommandPrivate() )
{
    assert(knob && fromKnob);

    // If target view is all but target is not multi-view, convert back to main view
    // Also, if all dimensions are folded, convert to all dimensions
    knob->convertDimViewArgAccordingToKnobState(targetDimensionIn, targetViewIn, &_imp->targetDimension, &_imp->targetView);


    _imp->fromKnob = fromKnob;
    _imp->knob = knob;
    _imp->type = type;
    _imp->fromDimension = fromDimension;
    _imp->fromView = fromView;

    _imp->toKnobSerialization.reset(new SERIALIZATION_NAMESPACE::KnobSerialization);
    knob->toSerialization(_imp->toKnobSerialization.get());
    _imp->fromKnobSerialization.reset(new SERIALIZATION_NAMESPACE::KnobSerialization);
    fromKnob->toSerialization(_imp->fromKnobSerialization.get());


    QString text;
    switch (type) {
    case eKnobClipBoardTypeCopyAnim:
        text = tr("Paste Animation on %1").arg( QString::fromUtf8( knob->getLabel().c_str() ) );
        break;
    case eKnobClipBoardTypeCopyValue:
        text = tr("Paste Value on %1").arg( QString::fromUtf8( knob->getLabel().c_str() ) );
        break;
    case eKnobClipBoardTypeCopyLink:
        text = tr("Link %1 to %2").arg( QString::fromUtf8( fromKnob->getLabel().c_str() ) ).arg( QString::fromUtf8( knob->getLabel().c_str() ) );
        break;
    case eKnobClipBoardTypeCopyExpressionLink:
        text = tr("Link with Expression %1 to %2").arg( QString::fromUtf8( fromKnob->getLabel().c_str() ) ).arg( QString::fromUtf8( knob->getLabel().c_str() ) );
        break;
    case eKnobClipBoardTypeCopyExpressionMultCurveLink:
        text = tr("Set curve(frame)*%1 on %2").arg( QString::fromUtf8( fromKnob->getLabel().c_str() ) ).arg( QString::fromUtf8( knob->getLabel().c_str() ) );
        break;
    }
    setText(text);
}
Ejemplo n.º 2
0
std::string
KnobGuiWidgets::getDescriptionLabel() const
{
    std::string ret;
    KnobGuiPtr knob = getKnobGui();
    if (!knob) {
        return ret;
    }
    KnobIPtr internalKnob = knob->getKnob();
    if (!internalKnob) {
        return ret;
    }
    ret = internalKnob->getLabel();
    return ret;
}