[vlmc-devel] commit: TracksView: Fixing effects useless moves detection ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Fri Sep 24 16:50:53 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Sep 24 14:19:42 2010 +0200| [5d4b683caec721e0e4da25b5687d90e27636a902] | committer: Hugo Beauzée-Luyssen
TracksView: Fixing effects useless moves detection
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=5d4b683caec721e0e4da25b5687d90e27636a902
---
src/Gui/timeline/AbstractGraphicsItem.cpp | 2 +-
src/Gui/timeline/AbstractGraphicsItem.h | 2 +-
src/Gui/timeline/GraphicsEffectItem.cpp | 7 ++++++-
src/Gui/timeline/GraphicsEffectItem.h | 1 +
src/Gui/timeline/TracksView.cpp | 24 +++++++++++++++++++-----
5 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/Gui/timeline/AbstractGraphicsItem.cpp b/src/Gui/timeline/AbstractGraphicsItem.cpp
index 57bee23..3224f7f 100644
--- a/src/Gui/timeline/AbstractGraphicsItem.cpp
+++ b/src/Gui/timeline/AbstractGraphicsItem.cpp
@@ -111,7 +111,7 @@ AbstractGraphicsItem::setStartPos( qint64 position )
}
qint64
-AbstractGraphicsItem::startPos()
+AbstractGraphicsItem::startPos() const
{
return qRound64( QGraphicsItem::pos().x() );
}
diff --git a/src/Gui/timeline/AbstractGraphicsItem.h b/src/Gui/timeline/AbstractGraphicsItem.h
index 10e7f0c..cbdad48 100644
--- a/src/Gui/timeline/AbstractGraphicsItem.h
+++ b/src/Gui/timeline/AbstractGraphicsItem.h
@@ -88,7 +88,7 @@ class AbstractGraphicsItem : public QObject, public QGraphicsItem
virtual void setStartPos( qint64 position );
/// Return the position of the item (in frames) for the x-axis.
- qint64 startPos();
+ qint64 startPos() const;
void setColor( const QColor& color );
QColor itemColor();
diff --git a/src/Gui/timeline/GraphicsEffectItem.cpp b/src/Gui/timeline/GraphicsEffectItem.cpp
index 0c5fcdd..af23ffc 100644
--- a/src/Gui/timeline/GraphicsEffectItem.cpp
+++ b/src/Gui/timeline/GraphicsEffectItem.cpp
@@ -313,6 +313,12 @@ GraphicsEffectItem::setContainer( AbstractGraphicsMediaItem *item )
}
}
+const AbstractGraphicsMediaItem*
+GraphicsEffectItem::container() const
+{
+ return m_container;
+}
+
void
GraphicsEffectItem::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
{
@@ -336,4 +342,3 @@ GraphicsEffectItem::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
update();
}
}
-
diff --git a/src/Gui/timeline/GraphicsEffectItem.h b/src/Gui/timeline/GraphicsEffectItem.h
index b6ddaa4..7753c3b 100644
--- a/src/Gui/timeline/GraphicsEffectItem.h
+++ b/src/Gui/timeline/GraphicsEffectItem.h
@@ -60,6 +60,7 @@ class GraphicsEffectItem : public AbstractGraphicsItem
virtual qint32 zSelected() const;
virtual qint32 zNotSelected() const;
void setContainer( AbstractGraphicsMediaItem *item );
+ const AbstractGraphicsMediaItem *container() const;
protected:
virtual bool hasResizeBoundaries() const;
virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent *event );
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 388d7bf..0c34c13 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -1103,11 +1103,26 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
{
Q_ASSERT( m_actionItem );
m_actionItem->setOpacity( 1.0 );
+ GraphicsEffectItem *effectItem = qgraphicsitem_cast<GraphicsEffectItem*>( m_actionItem );
- //Check if the clip moved.
- if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() &&
- m_actionItem->startPos() == m_actionItem->track()->trackWorkflow()->getClipPosition( m_actionItem->uuid() ) )
- return ;
+ //Check if the item moved.
+ if ( effectItem != NULL )
+ {
+ if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() )
+ {
+ const AbstractGraphicsMediaItem *container = effectItem->container();
+ if ( container != NULL && container->startPos() + effectItem->begin() == effectItem->startPos() )
+ return ;
+ else if ( container == NULL && effectItem->startPos() == effectItem->begin() )
+ return ;
+ }
+ }
+ else
+ {
+ if ( m_actionItem->m_oldTrack == m_actionItem->track()->trackWorkflow() &&
+ m_actionItem->startPos() == m_actionItem->track()->trackWorkflow()->getClipPosition( m_actionItem->uuid() ) )
+ return ;
+ }
updateDuration();
@@ -1117,7 +1132,6 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
addTrack( Workflow::AudioTrack );
EffectUser *target = m_actionItem->track()->trackWorkflow();
- GraphicsEffectItem *effectItem = qgraphicsitem_cast<GraphicsEffectItem*>( m_actionItem );
qint64 targetPos = m_actionItem->startPos();
if ( effectItem != NULL )
{
More information about the Vlmc-devel
mailing list