[vlmc-devel] commit: MainWorkflow: Check for TrackHandler length changes. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Thu Aug 26 23:03:07 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Aug 26 00:49:03 2010 +0200| [55b9c5189f44fdd75194381ac71c704cf383c266] | committer: Hugo Beauzée-Luyssen 

MainWorkflow: Check for TrackHandler length changes.

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

 src/Workflow/MainWorkflow.cpp |   19 +++++++++++++++++++
 src/Workflow/MainWorkflow.h   |    2 ++
 src/Workflow/TrackHandler.cpp |   22 ++++++++++------------
 src/Workflow/TrackHandler.h   |    1 +
 4 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index b6d0a61..adf92eb 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -55,6 +55,8 @@ MainWorkflow::MainWorkflow( int trackCount ) :
         m_tracks[i] = new TrackHandler( trackCount, trackType );
         connect( m_tracks[i], SIGNAL( tracksEndReached() ),
                  this, SLOT( tracksEndReached() ) );
+        connect( m_tracks[i], SIGNAL( lengthChanged(qint64) ),
+                 this, SLOT( lengthUpdated( qint64 ) ) );
         m_currentFrame[i] = 0;
     }
 }
@@ -488,3 +490,20 @@ MainWorkflow::blackOutput() const
 {
     return m_blackOutput;
 }
+
+void
+MainWorkflow::lengthUpdated( qint64 )
+{
+    qint64  maxLength = 0;
+
+    for ( unsigned int i = 0; i < Workflow::NbTrackType; ++i )
+    {
+        if ( m_tracks[i]->getLength() > maxLength )
+            maxLength = m_tracks[i]->getLength();
+    }
+    if ( m_lengthFrame != maxLength )
+    {
+        m_lengthFrame = maxLength;
+        emit lengthChanged( m_lengthFrame );
+    }
+}
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index 21b8a0f..3dbe92d 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -414,6 +414,8 @@ class   MainWorkflow : public QObject, public Singleton<MainWorkflow>
          */
         void                            clear();
 
+        void                            lengthUpdated( qint64 lengthUpdated );
+
     signals:
         /**
          *  \brief      Used to notify a change to the timeline and preview widget cursor
diff --git a/src/Workflow/TrackHandler.cpp b/src/Workflow/TrackHandler.cpp
index c9d18a7..dcf3727 100644
--- a/src/Workflow/TrackHandler.cpp
+++ b/src/Workflow/TrackHandler.cpp
@@ -278,20 +278,18 @@ TrackHandler::stopFrameComputing()
 }
 
 void
-TrackHandler::lengthUpdated( qint64 newLength )
+TrackHandler::lengthUpdated( qint64 )
 {
-    //If the new length is bigger, or if the track that has been resized was the
-    if ( newLength > m_length )
-        m_length = newLength;
-    else
-    {
-        qint64      maxLength = 0;
+    qint64      maxLength = 0;
 
-        for ( unsigned int i = 0; i < m_trackCount; ++i )
-        {
-            if ( m_tracks[i]->getLength() > maxLength )
-                maxLength = m_tracks[i]->getLength();
-        }
+    for ( unsigned int i = 0; i < m_trackCount; ++i )
+    {
+        if ( m_tracks[i]->getLength() > maxLength )
+            maxLength = m_tracks[i]->getLength();
+    }
+    if ( maxLength != m_length )
+    {
         m_length = maxLength;
+        emit lengthChanged( m_length );
     }
 }
diff --git a/src/Workflow/TrackHandler.h b/src/Workflow/TrackHandler.h
index 29132f2..cc80405 100644
--- a/src/Workflow/TrackHandler.h
+++ b/src/Workflow/TrackHandler.h
@@ -120,6 +120,7 @@ class   TrackHandler : public QObject
 
     signals:
         void                            tracksEndReached();
+        void                            lengthChanged( qint64 );
 };
 
 #endif // TRACKHANDLER_H



More information about the Vlmc-devel mailing list