[vlmc-devel] Fix outdated metadata related signals/slots

Hugo Beauzée-Luyssen git at videolan.org
Mon Feb 24 20:09:40 CET 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Feb 24 02:57:41 2014 +0200| [863c07098551c4f8aa6cd1ef4c2823e8dc1954b7] | committer: Hugo Beauzée-Luyssen

Fix outdated metadata related signals/slots

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

 src/Gui/import/ImportController.cpp     |    2 +-
 src/Gui/library/MediaCellView.cpp       |   12 ++++++------
 src/Gui/library/MediaCellView.h         |    2 +-
 src/Gui/media/ClipMetadataDisplayer.cpp |   16 ++++++++--------
 src/Gui/media/ClipMetadataDisplayer.h   |    2 +-
 src/Media/Clip.cpp                      |    8 ++++----
 src/Media/Clip.h                        |    2 +-
 7 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index b0708d0..1a8c18f 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -158,7 +158,7 @@ ImportController::importMedia( const QString &filePath )
         return ;
 
     Media*  media = m_temporaryMedias->addMedia( filePath );
-    connect( media, SIGNAL( metaDataComputed( const Media* ) ), this, SLOT( mediaLoaded() ) );
+    connect( media, SIGNAL( metaDataComputed() ), this, SLOT( mediaLoaded() ) );
     if ( media == NULL )
     {
         vlmcCritical() << "An error occurred while loading media:" << filePath;
diff --git a/src/Gui/library/MediaCellView.cpp b/src/Gui/library/MediaCellView.cpp
index bc10941..04aa1f3 100644
--- a/src/Gui/library/MediaCellView.cpp
+++ b/src/Gui/library/MediaCellView.cpp
@@ -69,10 +69,10 @@ MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) :
         connect( MetaDataManager::getInstance(), SIGNAL( startingComputing( const Media* )),
                  this, SLOT( metadataComputingStarted( const Media* ) ), Qt::DirectConnection );
     }
-    connect( clip->getMedia(), SIGNAL( metaDataComputed(const Media*) ),
-             this, SLOT( metadataUpdated( const Media*) ) );
+    connect( clip->getMedia(), SIGNAL( metaDataComputed() ),
+             this, SLOT( metadataUpdated() ) );
     // Snapshot generation will generate a QPixmap, which has to be done on GUI thread
-    connect( clip->getMedia(), SIGNAL( snapshotComputed() ),
+    connect( clip->getMedia(), SIGNAL( snapshotAvailable() ),
              this, SLOT( snapshotUpdated() ), Qt::QueuedConnection );
 
     setThumbnail( clip->getMedia()->snapshot() );
@@ -98,13 +98,13 @@ MediaCellView::metadataComputingStarted( const Media *media )
 }
 
 void
-MediaCellView::metadataUpdated( const Media *media )
+MediaCellView::metadataUpdated()
 {
-    setLength( media->source()->length() );
+    setLength( m_clip->getMedia()->source()->length() );
     m_ui->thumbnail->setEnabled( true );
     //If the media is a Video or an Image, we must wait for the snapshot to be computer
     //before allowing deletion.
-    if ( media->fileType() == Media::Audio )
+    if ( m_clip->getMedia()->fileType() == Media::Audio )
         m_ui->delLabel->setEnabled( true );
 }
 
diff --git a/src/Gui/library/MediaCellView.h b/src/Gui/library/MediaCellView.h
index 865385d..3112516 100644
--- a/src/Gui/library/MediaCellView.h
+++ b/src/Gui/library/MediaCellView.h
@@ -75,7 +75,7 @@ public slots:
 private slots:
     void                snapshotUpdated();
     void                metadataComputingStarted( const Media *media );
-    void                metadataUpdated( const Media *media );
+    void                metadataUpdated();
     void                nbClipUpdated();
 
 signals:
diff --git a/src/Gui/media/ClipMetadataDisplayer.cpp b/src/Gui/media/ClipMetadataDisplayer.cpp
index 44211fa..9fddd1e 100644
--- a/src/Gui/media/ClipMetadataDisplayer.cpp
+++ b/src/Gui/media/ClipMetadataDisplayer.cpp
@@ -37,17 +37,17 @@ ClipMetadataDisplayer::ClipMetadataDisplayer( QWidget *parent /*= NULL*/ ) :
 }
 
 void
-ClipMetadataDisplayer::metadataUpdated( const Media *media )
+ClipMetadataDisplayer::metadataUpdated()
 {
     QTime   duration;
     duration = duration.addSecs( m_watchedClip->lengthSecond() );
 
-    const Backend::ISource* source = media->source();
+    const Backend::ISource* source = m_watchedMedia->source();
     updateInterface();
     //Duration
     m_ui->durationValueLabel->setText( duration.toString( "hh:mm:ss" ) );
     //Filename || title
-    m_ui->nameValueLabel->setText( media->fileInfo()->fileName() );
+    m_ui->nameValueLabel->setText( m_watchedMedia->fileInfo()->fileName() );
     //Resolution
     m_ui->resolutionValueLabel->setText( QString::number( source->width() )
                                        + " x " + QString::number( source->height() ) );
@@ -57,9 +57,9 @@ ClipMetadataDisplayer::metadataUpdated( const Media *media )
     m_ui->nbVideoTracksValueLabel->setText( QString::number( source->nbVideoTracks() ) );
     m_ui->nbAudioTracksValueLabel->setText( QString::number( source->nbAudioTracks() ) );
     //Path:
-    m_ui->pathValueLabel->setText( media->fileInfo()->absoluteFilePath() );
+    m_ui->pathValueLabel->setText( m_watchedMedia->fileInfo()->absoluteFilePath() );
     //Workspace:
-    workspaceStateChanged( media->isInWorkspace() );
+    workspaceStateChanged( m_watchedMedia->isInWorkspace() );
 }
 
 void
@@ -98,11 +98,11 @@ ClipMetadataDisplayer::setWatchedClip( const Clip *clip )
     m_watchedMedia = clip->getMedia();
     connect( m_watchedClip, SIGNAL( unloaded( Clip* ) ), this, SLOT( clipDestroyed( Clip* ) ) );
     if ( m_watchedMedia->isMetadataComputed() == true )
-        metadataUpdated( m_watchedMedia );
+        metadataUpdated();
     else
     {
-        connect( m_watchedMedia, SIGNAL( metaDataComputed(const Media*) ),
-                 this, SLOT( metadataUpdated( const Media*) ) );
+        connect( m_watchedMedia, SIGNAL( metaDataComputed() ),
+                 this, SLOT( metadataUpdated() ) );
     }
     connect( m_watchedMedia, SIGNAL( workspaceStateChanged( bool ) ),
              this, SLOT( workspaceStateChanged( bool ) ) );
diff --git a/src/Gui/media/ClipMetadataDisplayer.h b/src/Gui/media/ClipMetadataDisplayer.h
index b9ad791..5b54de8 100644
--- a/src/Gui/media/ClipMetadataDisplayer.h
+++ b/src/Gui/media/ClipMetadataDisplayer.h
@@ -53,7 +53,7 @@ class ClipMetadataDisplayer : public QWidget
         const Media                     *m_watchedMedia;
 
     private slots:
-        void                            metadataUpdated( const Media *media );
+        void                            metadataUpdated();
         void                            workspaceStateChanged( bool state );
         void                            clipDestroyed( Clip* clip );
 
diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
index 8d7459b..7e53499 100644
--- a/src/Media/Clip.cpp
+++ b/src/Media/Clip.cpp
@@ -47,8 +47,8 @@ Clip::Clip( Media *media, qint64 begin /*= 0*/, qint64 end /*= -1*/, const QStri
     m_childs = new MediaContainer( this );
     m_rootClip = media->baseClip();
     computeLength();
-    connect( media, SIGNAL( metaDataComputed( const Media* ) ),
-             this, SLOT( mediaMetadataUpdated( const Media* ) ) );
+    connect( media, SIGNAL( metaDataComputed() ),
+             this, SLOT( mediaMetadataUpdated() ) );
 }
 
 Clip::Clip( Clip *parent, qint64 begin /*= -1*/, qint64 end /*= -1*/,
@@ -281,9 +281,9 @@ Clip::isChild( const QUuid &uuid) const
 }
 
 void
-Clip::mediaMetadataUpdated( const Media *media )
+Clip::mediaMetadataUpdated()
 {
-    Q_ASSERT ( isRootClip() == true && m_media == media );
+    Q_ASSERT ( isRootClip() == true );
     if ( m_end == 0 )
     {
         m_begin = 0;
diff --git a/src/Media/Clip.h b/src/Media/Clip.h
index 86dee97..976bc0a 100644
--- a/src/Media/Clip.h
+++ b/src/Media/Clip.h
@@ -187,7 +187,7 @@ class   Clip : public QObject
         Clip*               m_parent;
 
     private slots:
-        void                mediaMetadataUpdated( const Media* media );
+        void                mediaMetadataUpdated();
 
     signals:
         /**



More information about the Vlmc-devel mailing list