[vlmc-devel] commit: Clip: Adding the root clip concept. (Hugo Beauzee-Luyssen )

git at videolan.org git at videolan.org
Wed Mar 10 14:52:56 CET 2010


vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Tue Mar  9 01:25:18 2010 +0100| [02d13fc1457d3edaa4078e809181f7d993efa190] | committer: Hugo Beauzee-Luyssen 

Clip: Adding the root clip concept.

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

 src/Gui/library/MediaCellView.cpp           |    4 +++-
 src/Gui/library/MediaListViewController.cpp |    7 +------
 src/Gui/library/StackViewController.cpp     |    2 +-
 src/Media/Clip.cpp                          |   20 +++++++++++++++-----
 src/Media/Clip.h                            |   10 +++++++++-
 src/Media/Media.cpp                         |    1 +
 6 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/Gui/library/MediaCellView.cpp b/src/Gui/library/MediaCellView.cpp
index af19a74..1557c29 100644
--- a/src/Gui/library/MediaCellView.cpp
+++ b/src/Gui/library/MediaCellView.cpp
@@ -28,6 +28,8 @@
 
 #include <QTime>
 
+#include <QtDebug>
+
 MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) :
         QWidget( parent ),
         m_ui( new Ui::MediaCellView ),
@@ -38,7 +40,7 @@ MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) :
     setAutoFillBackground( true );
     connect( m_ui->delLabel, SIGNAL( clicked( QWidget*, QMouseEvent* ) ),
              this, SLOT( deleteButtonClicked( QWidget*, QMouseEvent* ) ) );
-    if ( clip->isBaseClip() == true )
+    if ( clip->isRootClip() == true )
     {
         connect( m_ui->arrow,
                  SIGNAL( clicked( QWidget*, QMouseEvent* ) ),
diff --git a/src/Gui/library/MediaListViewController.cpp b/src/Gui/library/MediaListViewController.cpp
index 524f7e0..c59e68b 100644
--- a/src/Gui/library/MediaListViewController.cpp
+++ b/src/Gui/library/MediaListViewController.cpp
@@ -101,7 +101,7 @@ void    MediaListViewController::showClipList( const QUuid& uuid )
          m_mediaContainer->media( uuid )-> clipsCount() == 0 )
         return ;
     m_lastUuidClipListAsked = uuid;
-    m_clipsListView = new MediaListViewController( m_nav, Library::getInstance() );
+    m_clipsListView = new MediaListViewController( m_nav, m_mediaContainer );
     m_clipsListView->newMediaLoaded( m_mediaContainer->media( uuid ) );
     connect( m_clipsListView, SIGNAL( clipSelected( const QUuid& ) ),
             this, SLOT( clipSelection( const QUuid& ) ) );
@@ -110,10 +110,5 @@ void    MediaListViewController::showClipList( const QUuid& uuid )
 
 void    MediaListViewController::restoreContext()
 {
-    MediaCellView*  cell = qobject_cast<MediaCellView*>( m_cells->value( m_lastUuidClipListAsked, 0 ) );
-    if ( cell != 0 )
-    {
-        qDebug() << "FIXME: Update clip count";
-    }
     delete m_clipsListView;
 }
diff --git a/src/Gui/library/StackViewController.cpp b/src/Gui/library/StackViewController.cpp
index 2695c7b..a8de250 100644
--- a/src/Gui/library/StackViewController.cpp
+++ b/src/Gui/library/StackViewController.cpp
@@ -100,7 +100,7 @@ void        StackViewController::popViewController( bool animated )
     else
     {
        m_nav->previousButton()->setText( "< " +
-           m_controllerStack->value( m_controllerStack->size() - 1 )->title() );
+       m_controllerStack->value( m_controllerStack->size() - 1 )->title() );
     }
 }
 
diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
index 65405f6..002610a 100644
--- a/src/Media/Clip.cpp
+++ b/src/Media/Clip.cpp
@@ -36,8 +36,10 @@ Clip::Clip( Media *parent, const QString& uuid ) :
         m_begin( 0 ),
         m_end( parent->nbFrames() ),
         m_maxBegin( 0 ),
-        m_maxEnd( parent->nbFrames() )
+        m_maxEnd( parent->nbFrames() ),
+        m_rootClip( NULL )
 {
+    Q_ASSERT( parent->baseClip() == NULL );
     if ( uuid.isEmpty() == true )
         m_uuid = QUuid::createUuid();
     else
@@ -52,7 +54,8 @@ Clip::Clip( Clip *clip, qint64 begin /*= 0*/, qint64 end /*= -1*/ ) :
         m_metaTags( clip->m_metaTags ),
         m_notes( clip->m_notes ),
         m_maxBegin( clip->m_begin ),
-        m_maxEnd( clip->m_end )
+        m_maxEnd( clip->m_end ),
+        m_rootClip( clip->getParent()->baseClip() )
 {
     if ( begin == -1 )
         m_begin = clip->begin();
@@ -68,7 +71,8 @@ Clip::Clip( Media *parent, qint64 begin, qint64 end /*= -1*/,
         m_begin( begin ),
         m_end( end ),
         m_maxBegin( begin ),
-        m_maxEnd( end )
+        m_maxEnd( end ),
+        m_rootClip( parent->baseClip() )
 {
     if ( end < 0 )
     {
@@ -237,8 +241,14 @@ Clip::maxEnd() const
     return m_maxEnd;
 }
 
+Clip*
+Clip::rootClip()
+{
+    return m_rootClip;
+}
+
 bool
-Clip::isBaseClip() const
+Clip::isRootClip() const
 {
-    return ( m_parent->baseClip() == this );
+    return ( m_rootClip == NULL );
 }
diff --git a/src/Media/Clip.h b/src/Media/Clip.h
index d3fe44b..a5c3e51 100644
--- a/src/Media/Clip.h
+++ b/src/Media/Clip.h
@@ -115,7 +115,8 @@ class   Clip : public QObject
 
         void                computeLength();
 
-        bool                isBaseClip() const;
+        bool                isRootClip() const;
+        Clip*               rootClip();
 
     private:
         Media               *m_parent;
@@ -159,6 +160,13 @@ class   Clip : public QObject
          */
         qint64              m_maxEnd;
 
+        /**
+         *  \brief          Return the root clip.
+         *
+         *  The root clip is the base clip for the parent media.
+         */
+        Clip*               m_rootClip;
+
     signals:
         void                lengthUpdated();
 };
diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index 215134a..7f0472a 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -48,6 +48,7 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
     m_width( 0 ),
     m_height( 0 ),
     m_fps( .0f ),
+    m_baseClip( NULL ),
     m_nbAudioTracks( 0 ),
     m_nbVideoTracks( 0 ),
     m_metadataComputed( false )



More information about the Vlmc-devel mailing list