Commit b93f3d4f authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Let the MediaCellView handle view related stuff.

parent a10daf9d
...@@ -86,16 +86,7 @@ ImportMediaListController::addClip( Clip* clip ) ...@@ -86,16 +86,7 @@ ImportMediaListController::addClip( Clip* clip )
connect( cell, SIGNAL( cellDeleted( const QUuid& ) ), connect( cell, SIGNAL( cellDeleted( const QUuid& ) ),
this, SLOT( clipDeletion( 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 ); addCell( cell );
m_mediaCellList->insert( clip->uuid(), cell ); m_mediaCellList->insert( clip->uuid(), cell );
} }
......
...@@ -66,14 +66,8 @@ void ClipListViewController::addClip( Clip* clip ) ...@@ -66,14 +66,8 @@ void ClipListViewController::addClip( Clip* clip )
connect( cell, SIGNAL( cellSelected( QUuid ) ), this, SLOT( cellSelection( const QUuid& ) ) ); connect( cell, SIGNAL( cellSelected( QUuid ) ), this, SLOT( cellSelection( const QUuid& ) ) );
connect( cell, SIGNAL( cellDeleted( const QUuid& ) ), this, SLOT( clipDeletion( 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 ); addCell( cell );
m_cells.insert( clip->uuid(), cell ); m_cells.insert( clip->uuid(), cell );
cell->setEnabled( true );
} }
void ClipListViewController::clean() void ClipListViewController::clean()
......
...@@ -41,11 +41,15 @@ MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) : ...@@ -41,11 +41,15 @@ MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) :
connect( m_ui->arrow, connect( m_ui->arrow,
SIGNAL( clicked( QWidget*, QMouseEvent* ) ), SIGNAL( clicked( QWidget*, QMouseEvent* ) ),
SLOT( arrowButtonClicked( QWidget*, QMouseEvent* ) ) ); SLOT( arrowButtonClicked( QWidget*, QMouseEvent* ) ) );
setEnabled( false ); if ( clip->getParent()->isMetadataComputed() == false )
setEnabled( false );
connect( clip->getParent(), SIGNAL( metaDataComputed(const Media*) ), connect( clip->getParent(), SIGNAL( metaDataComputed(const Media*) ),
this, SLOT( metadataUpdated( const Media*) ) ); this, SLOT( metadataUpdated( const Media*) ) );
connect( clip->getParent(), SIGNAL( snapshotComputed(const Media*) ), connect( clip->getParent(), SIGNAL( snapshotComputed(const Media*) ),
this, SLOT( snapshotUpdated(const Media*) ) ); this, SLOT( snapshotUpdated(const Media*) ) );
setThumbnail( clip->getParent()->snapshot() );
setTitle( clip->getParent()->fileName() );
setLength( clip->lengthSecond() * 1000 );
} }
void void
......
...@@ -51,11 +51,6 @@ void MediaListViewController::newMediaLoaded( Media* media ) ...@@ -51,11 +51,6 @@ void MediaListViewController::newMediaLoaded( Media* media )
connect( media, SIGNAL( clipAdded( Clip* ) ), connect( media, SIGNAL( clipAdded( Clip* ) ),
this, SLOT( newClipAdded(Clip*) ) ); this, SLOT( newClipAdded(Clip*) ) );
cell->setNbClips( media->clipsCount() ); 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); addCell(cell);
m_cells->insert( media->baseClip()->uuid(), cell ); m_cells->insert( media->baseClip()->uuid(), cell );
} }
......
...@@ -49,7 +49,8 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ ) ...@@ -49,7 +49,8 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
m_height( 0 ), m_height( 0 ),
m_fps( .0f ), m_fps( .0f ),
m_nbAudioTracks( 0 ), m_nbAudioTracks( 0 ),
m_nbVideoTracks( 0 ) m_nbVideoTracks( 0 ),
m_metadataComputed( false )
{ {
if ( filePath.startsWith( Media::streamPrefix ) == false ) if ( filePath.startsWith( Media::streamPrefix ) == false )
{ {
...@@ -193,6 +194,7 @@ void Media::emitMetaDataComputed() ...@@ -193,6 +194,7 @@ void Media::emitMetaDataComputed()
m_baseClip->setBegin( 0 ); m_baseClip->setBegin( 0 );
m_baseClip->setEnd( m_nbFrames ); m_baseClip->setEnd( m_nbFrames );
m_baseClip->computeLength(); m_baseClip->computeLength();
m_metadataComputed = true;
emit metaDataComputed( this ); emit metaDataComputed( this );
} }
...@@ -329,3 +331,9 @@ Media::nbVideoTracks() const ...@@ -329,3 +331,9 @@ Media::nbVideoTracks() const
{ {
return m_nbVideoTracks; return m_nbVideoTracks;
} }
bool
Media::isMetadataComputed() const
{
return m_metadataComputed;
}
...@@ -148,6 +148,8 @@ public: ...@@ -148,6 +148,8 @@ public:
Clip* baseClip() { return m_baseClip; } Clip* baseClip() { return m_baseClip; }
const Clip* baseClip() const { return m_baseClip; } const Clip* baseClip() const { return m_baseClip; }
bool isMetadataComputed() const;
private: private:
void setFileType(); void setFileType();
...@@ -172,6 +174,7 @@ protected: ...@@ -172,6 +174,7 @@ protected:
QList<int>* m_audioValueList; QList<int>* m_audioValueList;
int m_nbAudioTracks; int m_nbAudioTracks;
int m_nbVideoTracks; int m_nbVideoTracks;
bool m_metadataComputed;
signals: signals:
void metaDataComputed( const Media* ); void metaDataComputed( const 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