]> git.sesse.net Git - kdenlive/commitdiff
Merge branch 'master' into feature/pkey
authorEd Rogalsky <ed.rogalsky@googlemail.com>
Tue, 30 Oct 2012 07:05:15 +0000 (08:05 +0100)
committerEd Rogalsky <ed.rogalsky@googlemail.com>
Tue, 30 Oct 2012 07:05:15 +0000 (08:05 +0100)
src/customtrackview.cpp
src/customtrackview.h
src/mainwindow.cpp
src/mainwindow.h

index 84952f9bc9d3aeb10347f8103c766f77a425bead..c9c4df4a8450b326ecc797e8baf24534bdfbe968 100644 (file)
@@ -405,6 +405,15 @@ void CustomTrackView::slotCheckPositionScrolling()
     }
 }
 
+void CustomTrackView::slotAlignPlayheadToMousePos()
+{
+       /* get curser point ref in screen coord */
+       QPoint ps = QCursor::pos();
+       /* get xPos in scene coord */
+       int mappedXPos = qMax((int)(mapToScene(mapFromGlobal(ps)).x() + 0.5), 0);
+       /* move playhead to new xPos*/
+       seekCursorPos(mappedXPos);
+}
 
 // virtual
 void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
index f27f9710d489ee7a850bf5f1e3d6bcdbd30c49e8..42341874912e805f8d58758e023836bbeca2cd98 100644 (file)
@@ -307,6 +307,8 @@ public slots:
 
     /** @brief Get effect parameters ready for MLT*/
     static void adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, MltVideoProfile profile, const QString &prefix = QString());
+       /** @brief Move playhead to mouse curser position if defined key is pressed */
+    void slotAlignPlayheadToMousePos();
 
 protected:
     virtual void drawBackground(QPainter * painter, const QRectF & rect);
index 9139b6d2ec72b6ef2b6460a0131c4152f61b025a..7355b8d33b3c581b3c63947bb26d5fa55393866a 100644 (file)
@@ -1402,6 +1402,11 @@ void MainWindow::setupActions()
     collection.addAction("delete_timeline_clip", deleteItem);
     connect(deleteItem, SIGNAL(triggered(bool)), this, SLOT(slotDeleteItem()));
 
+    KAction* alignPlayhead = new KAction(i18n("Align Playhead to Mouse Position"), this);
+    alignPlayhead->setShortcut(Qt::Key_P);
+    collection.addAction("align_playhead", alignPlayhead);
+    connect(alignPlayhead, SIGNAL(triggered(bool)), this, SLOT(slotAlignPlayheadToMousePos()));
+
     /*KAction* editTimelineClipSpeed = new KAction(i18n("Change Clip Speed"), this);
     collection.addAction("change_clip_speed", editTimelineClipSpeed);
     editTimelineClipSpeed->setData("change_speed");
@@ -4587,6 +4592,10 @@ void MainWindow::slotProcessImportKeyframes(GRAPHICSRECTITEM type, const QString
     }
 }
 
+void MainWindow::slotAlignPlayheadToMousePos()
+{
+       m_activeTimeline->projectView()->slotAlignPlayheadToMousePos();
+}
 
 #include "mainwindow.moc"
 
index 4833d77b85657129fd46b99aeec88e3fe5591cf7..67f31ea10b723663a630c9371cdcbfcd84d39e61 100644 (file)
@@ -568,6 +568,8 @@ private slots:
     void slotSaveTimelineClip();
     /** @brief Process keyframe data sent from a clip to effect / transition stack. */
     void slotProcessImportKeyframes(GRAPHICSRECTITEM type, const QString& data);
+    /** @brief Move playhead to mouse curser position if defined key is pressed */
+    void slotAlignPlayheadToMousePos();
 
 signals:
     Q_SCRIPTABLE void abortRenderJob(const QString &url);