[vlmc-devel] commit: Let the MediaCellView handle view related stuff. ( Hugo Beauzee-Luyssen )

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


vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Sun Mar  7 19:12:33 2010 +0100| [b93f3d4fc686e87ca1b0128949a8f3afb327b737] | committer: Hugo Beauzee-Luyssen 

Let the MediaCellView handle view related stuff.

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

 src/Gui/import/ImportMediaListController.cpp |    9 ---------
 src/Gui/library/ClipListViewController.cpp   |    6 ------
 src/Gui/library/MediaCellView.cpp            |    6 +++++-
 src/Gui/library/MediaListViewController.cpp  |    5 -----
 src/Media/Media.cpp                          |   10 +++++++++-
 src/Media/Media.h                            |    3 +++
 6 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/src/Gui/import/ImportMediaListController.cpp b/src/Gui/import/ImportMediaListController.cpp
index 860ace6..1cd171b 100644
--- a/src/Gui/import/ImportMediaListController.cpp
+++ b/src/Gui/import/ImportMediaListController.cpp
@@ -86,16 +86,7 @@ ImportMediaListController::addClip( Clip* clip )
     connect( cell, SIGNAL( cellDeleted( const QUuid& ) ),
              this, SLOT( clipDeletion( const QUuid& ) ) );
 
-    QString size;
-
-    size.setNum( m_mediaCellList->size() + 1 );
-
-    cell->setTitle( clip->getParent()->fileName() + "_" + size );
-    cell->setThumbnail( clip->getParent()->snapshot() );
-    cell->setLength( clip->lengthSecond(), false  );
-    cell->setEnabled( true );
     addCell( cell );
-
     m_mediaCellList->insert( clip->uuid(), cell );
 }
 
diff --git a/src/Gui/library/ClipListViewController.cpp b/src/Gui/library/ClipListViewController.cpp
index 5de0cc4..b2bb743 100644
--- a/src/Gui/library/ClipListViewController.cpp
+++ b/src/Gui/library/ClipListViewController.cpp
@@ -66,14 +66,8 @@ void    ClipListViewController::addClip( Clip* clip )
     connect( cell, SIGNAL( cellSelected( QUuid ) ), this, SLOT( cellSelection( const QUuid& ) ) );
     connect( cell, SIGNAL( cellDeleted( const QUuid& ) ), this, SLOT( clipDeletion( const QUuid& ) ) );
 
-    cell->setThumbnail( clip->getParent()->snapshot() );
-    QString number;
-    number.setNum( m_cells.size() + 1 );
-    cell->setTitle( clip->getParent()->fileName() + number );
-    cell->setLength( clip->lengthSecond(), false );
     addCell( cell );
     m_cells.insert( clip->uuid(), cell );
-    cell->setEnabled( true );
 }
 
 void    ClipListViewController::clean()
diff --git a/src/Gui/library/MediaCellView.cpp b/src/Gui/library/MediaCellView.cpp
index c67c373..ff7c8d5 100644
--- a/src/Gui/library/MediaCellView.cpp
+++ b/src/Gui/library/MediaCellView.cpp
@@ -41,11 +41,15 @@ MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) :
     connect( m_ui->arrow,
              SIGNAL( clicked( QWidget*, QMouseEvent* ) ),
              SLOT( arrowButtonClicked( QWidget*, QMouseEvent* ) ) );
-    setEnabled( false );
+    if ( clip->getParent()->isMetadataComputed() == false )
+        setEnabled( false );
     connect( clip->getParent(), SIGNAL( metaDataComputed(const Media*) ),
              this, SLOT( metadataUpdated( const Media*) ) );
     connect( clip->getParent(), SIGNAL( snapshotComputed(const Media*) ),
              this, SLOT( snapshotUpdated(const Media*) ) );
+    setThumbnail( clip->getParent()->snapshot() );
+    setTitle( clip->getParent()->fileName() );
+    setLength( clip->lengthSecond() * 1000 );
 }
 
 void
diff --git a/src/Gui/library/MediaListViewController.cpp b/src/Gui/library/MediaListViewController.cpp
index 89ab7f9..d655651 100644
--- a/src/Gui/library/MediaListViewController.cpp
+++ b/src/Gui/library/MediaListViewController.cpp
@@ -51,11 +51,6 @@ void        MediaListViewController::newMediaLoaded( Media* media )
     connect( media, SIGNAL( clipAdded( Clip* ) ),
              this, SLOT( newClipAdded(Clip*) ) );
     cell->setNbClips( media->clipsCount() );
-    cell->setThumbnail( media->snapshot() );
-    cell->setTitle( media->fileName() );
-    cell->setLength( media->lengthMS() );
-    if ( media->baseClip() != NULL )
-        cell->setEnabled(true);
     addCell(cell);
     m_cells->insert( media->baseClip()->uuid(), cell );
 }
diff --git a/src/Media/Media.cpp b/src/Media/Media.cpp
index c407f55..02b843d 100644
--- a/src/Media/Media.cpp
+++ b/src/Media/Media.cpp
@@ -49,7 +49,8 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
     m_height( 0 ),
     m_fps( .0f ),
     m_nbAudioTracks( 0 ),
-    m_nbVideoTracks( 0 )
+    m_nbVideoTracks( 0 ),
+    m_metadataComputed( false )
 {
     if ( filePath.startsWith( Media::streamPrefix ) == false )
     {
@@ -193,6 +194,7 @@ void            Media::emitMetaDataComputed()
     m_baseClip->setBegin( 0 );
     m_baseClip->setEnd( m_nbFrames );
     m_baseClip->computeLength();
+    m_metadataComputed = true;
     emit metaDataComputed( this );
 }
 
@@ -329,3 +331,9 @@ Media::nbVideoTracks() const
 {
     return m_nbVideoTracks;
 }
+
+bool
+Media::isMetadataComputed() const
+{
+    return m_metadataComputed;
+}
diff --git a/src/Media/Media.h b/src/Media/Media.h
index cb7e40f..dfd062d 100644
--- a/src/Media/Media.h
+++ b/src/Media/Media.h
@@ -148,6 +148,8 @@ public:
     Clip*                       baseClip() { return m_baseClip; }
     const Clip*                 baseClip() const { return m_baseClip; }
 
+    bool                        isMetadataComputed() const;
+
 private:
     void                        setFileType();
 
@@ -172,6 +174,7 @@ protected:
     QList<int>*                 m_audioValueList;
     int                         m_nbAudioTracks;
     int                         m_nbVideoTracks;
+    bool                        m_metadataComputed;
 
 signals:
     void                        metaDataComputed( const Media* );



More information about the Vlmc-devel mailing list