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

ClipRenderer: Unload previous clip when selecting a new one.

Consistancy: when a clip is removed, use a QUuid. When another action
occured on a clip, use its pointer.
parent d1c5be68
......@@ -97,8 +97,8 @@ ImportController::ImportController(QWidget *parent) :
m_clipRenderer, SLOT( setClip( Clip* ) ) );
connect( m_mediaListView, SIGNAL( clipSelected( Clip* ) ),
this, SLOT( clipSelection( Clip* ) ) );
connect( m_mediaListView, SIGNAL( clipRemoved( const Clip* ) ),
m_clipRenderer, SLOT( clipUnloaded( const Clip* ) ) );
connect( m_mediaListView, SIGNAL( clipRemoved( const QUuid& ) ),
m_clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
connect( MetaDataManager::getInstance(), SIGNAL( failedToCompute( Media* ) ),
this, SLOT( failedToLoad( Media* ) ) );
......@@ -132,7 +132,6 @@ ImportController::clipSelection( Clip* clip )
const QUuid& uuid = clip->uuid();
if ( m_currentUuid == uuid )
return ;
Media* media = clip->rootClip()->getMedia();
setUIMetaData( clip->rootClip() );
m_preview->stop();
m_currentUuid = uuid;
......@@ -323,7 +322,7 @@ ImportController::failedToLoad( Media *media )
m_ui->errorLabelImg->show();
m_ui->errorLabel->show();
QTimer::singleShot( 3000, this, SLOT( hideErrors() ) );
delete m_temporaryMedias->removeClip( media->baseClip() );
delete m_temporaryMedias->removeClip( media->baseClip()->uuid() );
delete media;
}
......
......@@ -34,8 +34,8 @@ MediaListView::MediaListView( StackViewController* nav, MediaContainer* mc ) :
{
connect( mc, SIGNAL( newClipLoaded(Clip*) ),
this, SLOT( newClipLoaded( Clip* ) ) );
connect( this, SIGNAL( clipRemoved( const Clip* ) ),
mc, SLOT( removeClip( const Clip* ) ) );
connect( this, SIGNAL( clipRemoved( const QUuid& ) ),
mc, SLOT( removeClip( const QUuid& ) ) );
connect( mc, SIGNAL( clipRemoved( const QUuid& ) ),
this, SLOT( __clipRemoved( const QUuid& ) ) );
foreach ( Clip* clip, mc->clips() )
......@@ -87,7 +87,7 @@ void MediaListView::cellSelection( const QUuid& uuid )
void MediaListView::removeClip( const Clip* clip )
{
__clipRemoved( clip->uuid() );
emit clipRemoved( clip );
emit clipRemoved( clip->uuid() );
}
void
......
......@@ -69,6 +69,6 @@ private slots:
signals:
void clipSelected( Clip* );
void clipRemoved( const Clip* );
void clipRemoved( const QUuid& );
};
#endif // MEDIALISTVIEW_H
......@@ -163,12 +163,6 @@ MediaContainer::removeClip( const QUuid &uuid )
return NULL;
}
Clip*
MediaContainer::removeClip( const Clip* clip )
{
return removeClip( clip->uuid() );
}
const QHash<QUuid, Clip*>&
MediaContainer::clips() const
{
......
......@@ -132,9 +132,8 @@ protected:
public slots:
/**
* \brief Delete a Clip from the container
* \param clip The clip to remove.
* \param uuid The clip to remove's uuid.
*/
Clip *removeClip( const Clip* clip );
Clip *removeClip( const QUuid& uuid );
/**
* \brief Clear the library (remove all the loaded Clip, delete their subclips, and
......
......@@ -59,6 +59,10 @@ ClipRenderer::~ClipRenderer()
void
ClipRenderer::setClip( Clip* clip )
{
if ( m_selectedClip != NULL && clip != NULL &&
clip->uuid() != m_selectedClip->uuid() )
clipUnloaded( m_selectedClip->uuid() );
if ( clip == NULL )
{
m_selectedClip = NULL;
......@@ -191,12 +195,6 @@ ClipRenderer::clipUnloaded( const QUuid& uuid )
}
}
void
ClipRenderer::clipUnloaded( const Clip *clip )
{
clipUnloaded( clip->uuid() );
}
qint64
ClipRenderer::getCurrentFrame() const
{
......
......@@ -77,7 +77,6 @@ public slots:
*/
void setClip( Clip* clip );
void clipUnloaded( const QUuid& uuid );
void clipUnloaded( const Clip* clip );
virtual void previewWidgetCursorChanged( qint64 newFrame );
void updateInfos( Clip* clip );
......
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