X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fgeometrywidget.cpp;h=55a234046c1cfd309378345da8d743bd9380e21a;hb=89a6e8726eab2f264b3c7fd01480fe7594b74b3a;hp=df76b254ee3db09e7b414f200bd94cf8daeccd25;hpb=be563b527d022b673971f83ed35975fc81d5acbd;p=kdenlive diff --git a/src/geometrywidget.cpp b/src/geometrywidget.cpp index df76b254..55a23404 100644 --- a/src/geometrywidget.cpp +++ b/src/geometrywidget.cpp @@ -88,7 +88,7 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, m_ui.buttonSync->setChecked(KdenliveSettings::transitionfollowcursor()); m_ui.buttonSync->setIconSize(iconSize); - connect(m_timeline, SIGNAL(positionChanged(int)), this, SLOT(slotPositionChanged(int))); + connect(m_timeline, SIGNAL(requestSeek(int)), this, SLOT(slotRequestSeek(int))); connect(m_timeline, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int))); connect(m_timeline, SIGNAL(addKeyframe(int)), this, SLOT(slotAddKeyframe(int))); connect(m_timeline, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteKeyframe(int))); @@ -123,7 +123,10 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, connect(fitToHeight, SIGNAL(triggered()), this, SLOT(slotFitToHeight())); menu->addAction(fitToHeight); menu->addSeparator(); - + QAction *importKeyframes = new QAction(i18n("Import keyframes from clip"), this); + connect(importKeyframes, SIGNAL(triggered()), this, SIGNAL(importClipKeyframes())); + menu->addAction(importKeyframes); + menu->addSeparator(); QAction *alignleft = new QAction(KIcon("kdenlive-align-left"), i18n("Align left"), this); connect(alignleft, SIGNAL(triggered()), this, SLOT(slotMoveLeft())); menu->addAction(alignleft); @@ -344,6 +347,12 @@ void GeometryWidget::slotSyncPosition(int relTimelinePos) } } +void GeometryWidget::slotRequestSeek(int pos) +{ + if (KdenliveSettings::transitionfollowcursor()) + emit seekToPos(m_clipPos + pos); +} + void GeometryWidget::slotPositionChanged(int pos, bool seek) { @@ -352,9 +361,9 @@ void GeometryWidget::slotPositionChanged(int pos, bool seek) else m_timePos->setValue(pos); - m_timeline->blockSignals(true); + //m_timeline->blockSignals(true); m_timeline->setValue(pos); - m_timeline->blockSignals(false); + //m_timeline->blockSignals(false); Mlt::GeometryItem item; Mlt::GeometryItem previousItem; @@ -725,4 +734,41 @@ void GeometryWidget::slotFitToHeight() updateMonitorGeometry(); } +void GeometryWidget::importKeyframes(const QString &data) +{ + QStringList list = data.split(';', QString::SkipEmptyParts); + QPoint screenSize = m_frameSize; + if (screenSize == QPoint() || screenSize.x() == 0 || screenSize.y() == 0) { + screenSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight()); + } + for (int i = 0; i < list.count(); i++) { + Mlt::GeometryItem item; + QString geom = list.at(i); + if (geom.contains('=')) { + item.frame(geom.section('=', 0, 0).toInt()); + } + geom = geom.section('=', 1); + if (geom.contains('/')) { + item.x(geom.section('/', 0, 0).toDouble()); + item.y(geom.section('/', 1, 1).section(':', 0, 0).toDouble()); + } + else { + item.x(0); + item.y(0); + } + if (geom.contains('x')) { + item.w(geom.section('x', 0, 0).section(':', 1, 1).toDouble()); + item.h(geom.section('x', 1, 1).section(':', 0, 0).toDouble()); + } + else { + item.w(screenSize.x()); + item.h(screenSize.y()); + } + //TODO: opacity + item.mix(100); + m_geometry->insert(item); + } + emit parameterChanged(); +} + #include "geometrywidget.moc"