[vlmc-devel] commit: TracksView: Fix clip effect moving. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Wed Sep 15 00:53:49 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Sep 14 23:39:57 2010 +0200| [84b27b51cade969110b0cc11268df54ad5ae3355] | committer: Hugo Beauzée-Luyssen
TracksView: Fix clip effect moving.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=84b27b51cade969110b0cc11268df54ad5ae3355
---
src/Gui/timeline/GraphicsEffectItem.cpp | 2 +-
src/Gui/timeline/TracksView.cpp | 22 ++++++++++++++--------
src/Gui/timeline/TracksView.h | 1 +
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/Gui/timeline/GraphicsEffectItem.cpp b/src/Gui/timeline/GraphicsEffectItem.cpp
index d4e8a24..1ef58fd 100644
--- a/src/Gui/timeline/GraphicsEffectItem.cpp
+++ b/src/Gui/timeline/GraphicsEffectItem.cpp
@@ -248,7 +248,7 @@ GraphicsEffectItem::helper()
void
GraphicsEffectItem::triggerMove( EffectUser *target )
{
- Commands::trigger( new Commands::Effect::Move( m_effectHelper, m_effectHelper->oldTarget(),
+ Commands::trigger( new Commands::Effect::Move( m_effectHelper, m_effectHelper->target(),
target, startPos() ) );
}
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 26f6a4e..54af7bd 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -66,6 +66,7 @@ TracksView::TracksView( QGraphicsScene *scene, MainWorkflow *mainWorkflow,
m_dragVideoItem = NULL;
m_dragAudioItem = NULL;
m_lastKnownTrack = NULL;
+ m_effectMoveTarget = NULL;
m_action = None;
m_actionRelativeX = -1;
m_actionItem = NULL;
@@ -899,7 +900,15 @@ TracksView::mouseMoveEvent( QMouseEvent *event )
m_actionItem->setOpacity( 0.6 );
if ( m_actionRelativeX < 0 )
m_actionRelativeX = event->pos().x() - mapFromScene( m_actionItem->pos() ).x();
- moveItem( m_actionItem, QPoint( event->pos().x() - m_actionRelativeX, event->pos().y() ) );
+ QPoint pos( event->pos().x() - m_actionRelativeX, event->pos().y() );
+ moveItem( m_actionItem, pos );
+ GraphicsEffectItem *effectItem = qgraphicsitem_cast<GraphicsEffectItem*>( m_actionItem );
+ if ( effectItem != NULL )
+ {
+ QList<AbstractGraphicsMediaItem*> list = mediaItems<AbstractGraphicsMediaItem>( pos );
+ if ( list.size() >= 1 )
+ m_effectMoveTarget = list.at( 0 );
+ }
}
else if ( event->modifiers() == Qt::NoModifier &&
event->buttons() == Qt::LeftButton &&
@@ -994,6 +1003,7 @@ TracksView::mousePressEvent( QMouseEvent *event )
{
m_action = Move;
m_actionItem = item;
+ m_effectMoveTarget = NULL;
}
scene()->clearSelection();
item->setSelected( true );
@@ -1054,14 +1064,10 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
UndoStack::getInstance()->beginMacro( "Move clip" );
-// m_actionItem->triggerMove( m_oldTrack, m_actionItem->track()->trackWorkflow(),
-// m_actionItem->helper(), m_actionItem->startPos() );
EffectUser *target = m_actionItem->track()->trackWorkflow();
-// GraphicsEffectItem *effectItem = qobject_cast<GraphicsEffectItem*>( m_actionItem );
-// if ( effectItem != NULL )
-// {
-
-// }
+ GraphicsEffectItem *effectItem = qgraphicsitem_cast<GraphicsEffectItem*>( m_actionItem );
+ if ( effectItem != NULL && m_effectMoveTarget != NULL )
+ target = m_effectMoveTarget->clipHelper()->clipWorkflow();
m_actionItem->triggerMove( target );
// Update the linked item too
if ( m_actionItem->groupItem() )
diff --git a/src/Gui/timeline/TracksView.h b/src/Gui/timeline/TracksView.h
index 7b0d1fc..24a30b4 100644
--- a/src/Gui/timeline/TracksView.h
+++ b/src/Gui/timeline/TracksView.h
@@ -343,6 +343,7 @@ private:
GraphicsMovieItem *m_dragVideoItem;
GraphicsAudioItem *m_dragAudioItem;
GraphicsEffectItem *m_dragEffectItem;
+ AbstractGraphicsMediaItem *m_effectMoveTarget;
QGraphicsWidget *m_separator;
ToolButtons m_tool;
More information about the Vlmc-devel
mailing list