Fix copy/paste of keyframes in transitions

parent 80b6dae1
......@@ -636,8 +636,9 @@ void CollapsibleEffect::importKeyframes(const QString &keyframes)
foreach(const QString &param, params) {
data.insert(param.section("=", 0, 0), param.section("=", 1));
}
} else {
data.insert(keyframes.section("=", 0, 0), keyframes.section("=", 1));
}
else data.insert(i18n("Geometry"), keyframes);
emit importClipKeyframes(AVWidget, m_itemInfo, m_effect.cloneNode().toElement(), data);
}
......
......@@ -148,7 +148,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement &d, ItemInfo info, boo
if (m_paramWidget) delete m_paramWidget;
m_paramWidget = new ParameterContainer(d, info, &m_metaInfo, m_baseWidget);
connect (m_paramWidget, SIGNAL(parameterChanged(QDomElement,QDomElement,int)), this, SIGNAL(parameterChanged(QDomElement,QDomElement,int)));
connect(m_paramWidget, &ParameterContainer::importKeyframes, this, &EffectStackEdit::importKeyframes);
connect(m_paramWidget, SIGNAL(startFilterJob(QMap<QString,QString>&, QMap<QString,QString>&,QMap <QString, QString>&)), this, SIGNAL(startFilterJob(QMap<QString,QString>&, QMap<QString,QString>&,QMap <QString, QString>&)));
connect (this, SIGNAL(syncEffectsPos(int)), m_paramWidget, SIGNAL(syncEffectsPos(int)));
......@@ -201,3 +201,16 @@ bool EffectStackEdit::doesAcceptDrops() const
return m_paramWidget->doesAcceptDrops();
}
void EffectStackEdit::importKeyframes(const QString &keyframes)
{
QMap <QString, QString> data;
if (keyframes.contains(QLatin1Char('\n'))) {
QStringList params = keyframes.split(QLatin1Char('\n'), QString::SkipEmptyParts);
foreach(const QString &param, params) {
data.insert(param.section("=", 0, 0), param.section("=", 1));
}
} else {
data.insert(keyframes.section("=", 0, 0), keyframes.section("=", 1));
}
emit importClipKeyframes(TransitionWidget, data);
}
......@@ -71,6 +71,10 @@ public slots:
/** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
void slotSyncEffectsPos(int pos);
private slots:
/** @brief Import keyframes for the transition. */
void importKeyframes(const QString &keyframes);
signals:
void parameterChanged(const QDomElement&, const QDomElement&, int);
void seekTimeline(int);
......
......@@ -743,6 +743,7 @@ void ParameterContainer::makeDrag(const QString &name)
QString value = EffectsList::parameter(m_effect, name);
if (value.isEmpty())
return;
value.prepend(name + QStringLiteral("="));
QDrag *dr = new QDrag(qApp);
// The data to be transferred by the drag and drop operation is contained in a QMimeData object
QMimeData *mimeData = new QMimeData;
......
......@@ -139,7 +139,7 @@ void Transition::setTransitionParameters(const QDomElement &params)
for (int i = 0; i < namenode.count() ; ++i) {
QDomElement pa = namenode.item(i).toElement();
QString paramType = pa.attribute(QStringLiteral("type"));
if (paramType == QLatin1String("geometry") || paramType == QLatin1String("animated")) {
if (paramType == QLatin1String("geometry") || paramType == QLatin1String("animated") || paramType == QLatin1String("animatedrect")) {
hasGeometry = true;
break;
}
......@@ -476,6 +476,7 @@ void Transition::updateKeyframes(QDomElement /*effect*/)
//virtual
void Transition::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
qDebug()<<"* * * ENTER TRANSITION DRAG";
if (isItemLocked()) event->setAccepted(false);
else if (event->mimeData()->hasFormat(QStringLiteral("kdenlive/geometry"))) {
event->acceptProposedAction();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment