X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcustomtrackview.cpp;h=fc84608d5dfbd4706811dab170c553bf843e201a;hb=d731c34c1cf29491f2c31c32f337d3da67071e3b;hp=83202edc58c7e951e3ca88652a900b77b65dbc87;hpb=8e611ffe38c243e720409292dfeabde3ebe4f555;p=kdenlive diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 83202edc..fc84608d 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -301,6 +301,10 @@ void CustomTrackView::mousePressEvent ( QMouseEvent * event ) kDebug()<<"//////// NO ITEM FOUND ON CLICK"; m_dragItem = NULL; setCursor(Qt::ArrowCursor); + QList itemList = items(); + for (int i = 0; i < itemList.count(); i++) + itemList.at(i)->setSelected(false); + emit clipItemSelected(NULL); setCursorPos((int) mapToScene(event->x(), 0).x()); emit cursorMoved(cursorPos()); } @@ -325,39 +329,55 @@ void CustomTrackView::dragEnterEvent ( QDragEnterEvent * event ) } } -void CustomTrackView::addEffect(int track, GenTime pos, QString tag, QMap args) +void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect) { - m_document->renderer()->mltAddEffect(track, pos, tag, args); ClipItem *clip = getClipItemAt(pos.frames(m_document->fps()) + 1, m_tracksCount - track); - if (clip){ - clip->addEffect(args); - emit clipItemSelected(clip); - } + if (clip){ + QMap effectParams = clip->addEffect(effect); + m_document->renderer()->mltAddEffect(track, pos, effectParams); + emit clipItemSelected(clip); + } } -void CustomTrackView::deleteEffect(int track, GenTime pos, QString tag) +void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect) { - m_document->renderer()->mltRemoveEffect(track, pos, tag, -1); + QString index = effect.attribute("kdenlive_ix"); + m_document->renderer()->mltRemoveEffect(track, pos, index); ClipItem *clip = getClipItemAt(pos.frames(m_document->fps()) + 1, m_tracksCount - track); if (clip){ - clip->deleteEffect(tag); + clip->deleteEffect(index); emit clipItemSelected(clip); } } -void CustomTrackView::slotAddEffect(QMap filter) +void CustomTrackView::slotAddEffect(QDomElement effect) { QList itemList = items(); for (int i = 0; i < itemList.count(); i++) { if (itemList.at(i)->type() == 70000 && itemList.at(i)->isSelected()) { ClipItem *item = (ClipItem *)itemList.at(i); - QString tag = filter.value("mlt_service"); - AddEffectCommand *command = new AddEffectCommand(this, m_tracksCount - item->track(),GenTime(item->startPos(), m_document->fps()), tag, filter, true); + // the kdenlive_ix int is used to identify an effect in the stack and in mlt's playlist + effect.setAttribute("kdenlive_ix", QString::number(item->effectsCount())); + AddEffectCommand *command = new AddEffectCommand(this, m_tracksCount - item->track(),GenTime(item->startPos(), m_document->fps()), effect, true); m_commandStack->push(command); } } } +void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect) +{ + AddEffectCommand *command = new AddEffectCommand(this, m_tracksCount - clip->track(), GenTime(clip->startPos(), m_document->fps()), effect, false); + m_commandStack->push(command); +} + + +void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, QDomElement effect) +{ + QMap effectParams = clip->getEffectArgs(effect); + m_document->renderer()->mltEditEffect(m_tracksCount - clip->track(), GenTime(clip->startPos(), m_document->fps()), effectParams); +} + + void CustomTrackView::addItem(DocClipBase *clip, QPoint pos) { int in =0;