Commit 55de1153 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

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

parent 474885fa
......@@ -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*) ) );
}
}
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment