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

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

parent 474885fa
...@@ -27,20 +27,14 @@ ...@@ -27,20 +27,14 @@
#include <QTime> #include <QTime>
ClipMetadataDisplayer::ClipMetadataDisplayer( Clip *clip, QWidget *parent /*= NULL*/ ) : ClipMetadataDisplayer::ClipMetadataDisplayer( const Clip *clip, QWidget *parent /*= NULL*/ ) :
QWidget( parent ), QWidget( parent ),
m_ui( new Ui::ClipMetadataDisplayer ), m_ui( new Ui::ClipMetadataDisplayer ),
m_watchedClip( clip ) m_watchedClip( clip )
{ {
m_ui->setupUi( this ); m_ui->setupUi( this );
m_watchedMedia = clip->getMedia(); if ( clip != NULL )
if ( m_watchedMedia->isMetadataComputed() == true ) setWatchedClip( clip );
metadataUpdated( m_watchedMedia );
else
{
connect( m_watchedMedia, SIGNAL( metaDataComputed(const Media*) ),
this, SLOT( metadataUpdated( const Media*) ) );
}
} }
void void
...@@ -62,3 +56,20 @@ ClipMetadataDisplayer::metadataUpdated( const Media *media ) ...@@ -62,3 +56,20 @@ ClipMetadataDisplayer::metadataUpdated( const Media *media )
m_ui->nbVideoTracksValueLabel->setText( QString::number( media->nbVideoTracks() ) ); m_ui->nbVideoTracksValueLabel->setText( QString::number( media->nbVideoTracks() ) );
m_ui->nbAudioTracksValueLabel->setText( QString::number( media->nbAudioTracks() ) ); 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 ...@@ -36,12 +36,14 @@ class ClipMetadataDisplayer : public QWidget
Q_DISABLE_COPY(ClipMetadataDisplayer); Q_DISABLE_COPY(ClipMetadataDisplayer);
public: public:
explicit ClipMetadataDisplayer( Clip* clip, QWidget *parent = 0 ); explicit ClipMetadataDisplayer( const Clip* clip, QWidget *parent = 0 );
void setWatchedClip( const Clip *clip );
private: private:
Ui::ClipMetadataDisplayer *m_ui; Ui::ClipMetadataDisplayer *m_ui;
Clip *m_watchedClip; const Clip *m_watchedClip;
Media *m_watchedMedia; const Media *m_watchedMedia;
private slots: private slots:
void metadataUpdated( const Media *media ); 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