X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcustomtrackview.cpp;h=029f004ccecfaf98b0f017b3deb1bc81ae080a85;hb=17a4a5bf6c8ab0cb1554a010a002a2e208d988c9;hp=45834e5da57414971620ad65373f2949670a002d;hpb=c2ff32876591d3e015410ac619b4d8e3746571dc;p=kdenlive diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 45834e5d..029f004c 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -52,6 +52,7 @@ #include "commands/changeeffectstatecommand.h" #include "commands/movegroupcommand.h" #include "ui_addtrack_ui.h" +#include "ui_importkeyframesdialog_ui.h" #include "initeffects.h" #include "commands/locktrackcommand.h" #include "commands/groupclipscommand.h" @@ -7514,3 +7515,69 @@ void CustomTrackView::slotGotFilterJobResults(const QString &/*id*/, int startPo } +void CustomTrackView::slotImportClipKeyframes(GRAPHICSRECTITEM type) +{ + if (!m_selectionGroup) { + emit displayMessage(i18n("You need to select one clip and one transition"), ErrorMessage); + return; + } + // Make sure there is no collision + QList children = m_selectionGroup->childItems(); + ClipItem *item; + for (int i = 0; i < children.count(); i++) { + if (children.at(i)->type() == AVWIDGET) { + item = (ClipItem*) children.at(i); + break; + } + } + QMap data = item->baseClip()->analysisData(); + if (data.isEmpty()) { + emit displayMessage(i18n("No keyframe data found in clip"), ErrorMessage); + return; + } + QPointer d = new QDialog(this); + Ui::ImportKeyframesDialog_UI ui; + ui.setupUi(d); + + // Set up data + int ix = 0; + QMap::const_iterator i = data.constBegin(); + while (i != data.constEnd()) { + ui.data_list->insertItem(ix, i.key()); + ui.data_list->setItemData(ix, i.value(), Qt::UserRole); + ++i; + ix++; + } + + if (d->exec() != QDialog::Accepted) { + delete d; + return; + } + QString keyframeData = ui.data_list->itemData(ui.data_list->currentIndex()).toString(); + QStringList keyframeList = keyframeData.split(';', QString::SkipEmptyParts); + QString result; + if (ui.import_position->isChecked()) { + if (ui.import_size->isChecked()) { + foreach(QString key, keyframeList) { + if (key.count(':') > 1) result.append(key.section(':', 0, 1)); + else result.append(key); + result.append(';'); + } + } + else { + foreach(QString key, keyframeList) { + result.append(key.section(':', 0, 0)); + result.append(';'); + } + } + } + else if (ui.import_size->isChecked()) { + foreach(QString key, keyframeList) { + result.append(key.section(':', 1, 1)); + result.append(';'); + } + } + emit importKeyframes(type, result); + delete d; +} +