[vlmc-devel] commit: ClipMetadataDisplayer can now be assigned a new clip without beeing reconstructed . ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri May 14 18:51:29 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri May 14 17:20:57 2010 +0200| [55de1153585a4b41ac91b0f85a1d1d27c5fa5f54] | committer: Hugo Beauzée-Luyssen 

ClipMetadataDisplayer can now be assigned a new clip without beeing reconstructed.

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

 src/Gui/media/ClipMetadataDisplayer.cpp |   29 ++++++++++++++++++++---------
 src/Gui/media/ClipMetadataDisplayer.h   |    8 +++++---
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/Gui/media/ClipMetadataDisplayer.cpp b/src/Gui/media/ClipMetadataDisplayer.cpp
index 15bf588..3974ab7 100644
--- a/src/Gui/media/ClipMetadataDisplayer.cpp
+++ b/src/Gui/media/ClipMetadataDisplayer.cpp
@@ -27,20 +27,14 @@
 
 #include <QTime>
 
-ClipMetadataDisplayer::ClipMetadataDisplayer( Clip *clip, QWidget *parent /*= NULL*/ ) :
+ClipMetadataDisplayer::ClipMetadataDisplayer( const Clip *clip, QWidget *parent /*= NULL*/ ) :
     QWidget( parent ),
     m_ui( new Ui::ClipMetadataDisplayer ),
     m_watchedClip( clip )
 {
     m_ui->setupUi( this );
-    m_watchedMedia = clip->getMedia();
-    if ( m_watchedMedia->isMetadataComputed() == true )
-        metadataUpdated( m_watchedMedia );
-    else
-    {
-        connect( m_watchedMedia, SIGNAL( metaDataComputed(const Media*) ),
-                 this, SLOT( metadataUpdated( const Media*) ) );
-    }
+    if ( clip != NULL )
+        setWatchedClip( clip );
 }
 
 void
@@ -62,3 +56,20 @@ ClipMetadataDisplayer::metadataUpdated( const Media *media )
     m_ui->nbVideoTracksValueLabel->setText( QString::number( media->nbVideoTracks() ) );
     m_ui->nbAudioTracksValueLabel->setText( QString::number( media->nbAudioTracks() ) );
 }
+
+void
+ClipMetadataDisplayer::setWatchedClip( const Clip *clip )
+{
+    if ( m_watchedMedia )
+        disconnect( m_watchedMedia );
+
+    m_watchedClip = clip;
+    m_watchedMedia = clip->getMedia();
+    if ( m_watchedMedia->isMetadataComputed() == true )
+        metadataUpdated( m_watchedMedia );
+    else
+    {
+        connect( m_watchedMedia, SIGNAL( metaDataComputed(const Media*) ),
+                 this, SLOT( metadataUpdated( const Media*) ) );
+    }
+}
diff --git a/src/Gui/media/ClipMetadataDisplayer.h b/src/Gui/media/ClipMetadataDisplayer.h
index 3364fac..c27ed3c 100644
--- a/src/Gui/media/ClipMetadataDisplayer.h
+++ b/src/Gui/media/ClipMetadataDisplayer.h
@@ -36,12 +36,14 @@ class ClipMetadataDisplayer : public QWidget
     Q_DISABLE_COPY(ClipMetadataDisplayer);
 
     public:
-        explicit ClipMetadataDisplayer( Clip* clip, QWidget *parent = 0 );
+        explicit ClipMetadataDisplayer( const Clip* clip, QWidget *parent = 0 );
+
+        void                            setWatchedClip( const Clip *clip );
 
     private:
         Ui::ClipMetadataDisplayer       *m_ui;
-        Clip                            *m_watchedClip;
-        Media                           *m_watchedMedia;
+        const Clip                      *m_watchedClip;
+        const Media                     *m_watchedMedia;
 
     private slots:
         void                            metadataUpdated( const Media *media );



More information about the Vlmc-devel mailing list