[vlmc-devel] commit: Fix effect resizing undo/redo ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Wed Sep 15 18:35:06 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Sep 15 12:28:10 2010 +0200| [b62b8949ca8796d096b30bf233fba29cd9b3d136] | committer: Hugo Beauzée-Luyssen 

Fix effect resizing undo/redo

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=b62b8949ca8796d096b30bf233fba29cd9b3d136
---

 src/Gui/timeline/AbstractGraphicsItem.cpp      |    8 ++++++++
 src/Gui/timeline/AbstractGraphicsItem.h        |    5 +++++
 src/Gui/timeline/AbstractGraphicsMediaItem.cpp |    8 --------
 src/Gui/timeline/AbstractGraphicsMediaItem.h   |    6 ------
 src/Gui/timeline/GraphicsEffectItem.cpp        |    2 ++
 5 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/Gui/timeline/AbstractGraphicsItem.cpp b/src/Gui/timeline/AbstractGraphicsItem.cpp
index abfd000..6adf58a 100644
--- a/src/Gui/timeline/AbstractGraphicsItem.cpp
+++ b/src/Gui/timeline/AbstractGraphicsItem.cpp
@@ -22,6 +22,7 @@
 
 #include "AbstractGraphicsItem.h"
 
+#include "Helper.h"
 #include "GraphicsTrack.h"
 #include "TracksView.h"
 #include "TracksScene.h"
@@ -263,3 +264,10 @@ AbstractGraphicsItem::width() const
 {
     return m_width;
 }
+
+
+void
+AbstractGraphicsItem::adjustLength()
+{
+    setWidth( helper()->length() );
+}
diff --git a/src/Gui/timeline/AbstractGraphicsItem.h b/src/Gui/timeline/AbstractGraphicsItem.h
index 4b34d5a..264bd9a 100644
--- a/src/Gui/timeline/AbstractGraphicsItem.h
+++ b/src/Gui/timeline/AbstractGraphicsItem.h
@@ -179,6 +179,11 @@ class AbstractGraphicsItem : public QObject, public QGraphicsItem
          * \return Returns True if the point is in a resize zone.
          */
         bool                resizeZone( const QPointF& position );
+        /**
+         * \brief Adjust the length of the item according to the associated Clip.
+         * \details This method should be called when the clip size change
+         */
+        void adjustLength();
 
         friend class        TracksView;
 
diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
index d83cc0a..75e323e 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
@@ -216,14 +216,6 @@ AbstractGraphicsMediaItem::maxEnd() const
     return clipHelper()->clip()->end();
 }
 
-
-void
-AbstractGraphicsMediaItem::adjustLength()
-{
-    Q_ASSERT( m_clipHelper );
-    setWidth( m_clipHelper->length() );
-}
-
 void
 AbstractGraphicsMediaItem::hoverEnterEvent( QGraphicsSceneHoverEvent* event )
 {
diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.h b/src/Gui/timeline/AbstractGraphicsMediaItem.h
index beebe82..2c213fd 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.h
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.h
@@ -76,12 +76,6 @@ protected:
     ClipHelper*         m_clipHelper;
 
 private slots:
-    /**
-     * \brief Adjust the length of the item according to the associated Clip.
-     * \details This method should be called when the clip size change
-     */
-    void adjustLength();
-
     void    clipDestroyed( Clip* clip );
 
 private:
diff --git a/src/Gui/timeline/GraphicsEffectItem.cpp b/src/Gui/timeline/GraphicsEffectItem.cpp
index 1ef58fd..555ba17 100644
--- a/src/Gui/timeline/GraphicsEffectItem.cpp
+++ b/src/Gui/timeline/GraphicsEffectItem.cpp
@@ -40,6 +40,7 @@ GraphicsEffectItem::GraphicsEffectItem( Effect *effect ) :
 {
     setOpacity( 0.8 );
     m_effectHelper = new EffectHelper( effect->createInstance() );
+    connect( m_effectHelper, SIGNAL( lengthUpdated() ), this, SLOT( adjustLength() ) );
     setWidth( m_effectHelper->length() );
 }
 
@@ -48,6 +49,7 @@ GraphicsEffectItem::GraphicsEffectItem( EffectHelper *helper ) :
 {
     setWidth( m_effectHelper->length() );
     m_effect = helper->effectInstance()->effect();
+    connect( helper, SIGNAL( lengthUpdated() ), this, SLOT( adjustLength() ) );
     setOpacity( 0.8 );
 }
 



More information about the Vlmc-devel mailing list