Commit b4a452f1 authored by Clement CHAVANCE's avatar Clement CHAVANCE
Browse files

Clip List works with the import / library refactor

parent 549bd642
......@@ -153,12 +153,15 @@ ImportController::clipSelection( const QUuid& uuid )
p.setColor( QPalette::Window, QColor( Qt::darkBlue ) );
m_clipListController->cell( uuid )->setPalette( p );
Clip* clip;
foreach(QUuid id, Library::getInstance()->medias()->keys() )
foreach(QUuid id, Library::getInstance()->temporaryMedias()->keys() )
{
Media* media = Library::getInstance()->medias()->value( id );
Media* media = Library::getInstance()->temporaryMedias()->value( id );
if ( ( clip = media->clip( uuid ) ) != 0 )
break;
}
if ( clip == 0 )
return ;
qDebug() << "ImportController::clipSelection clip" << clip;
setUIMetaData( clip );
if ( uuid != m_currentUuid )
m_preview->stop();
......
......@@ -33,6 +33,8 @@ ClipListViewController::ClipListViewController( StackViewController* nav, const
m_currentUuid(),
m_deletion( 0 )
{
connect( this, SIGNAL( clipDeleted( const QUuid&, const QUuid& ) ),
Library::getInstance(), SLOT( removeClip( const QUuid&, const QUuid& ) ) );
}
ClipListViewController::~ClipListViewController()
......@@ -101,7 +103,7 @@ void ClipListViewController::clipDeletion( const QUuid& uuid )
removeCell( cell );
m_cells.remove( uuid );
m_currentUuid = QUuid();
Library::getInstance()->media( m_mediaId )->removeClip( uuid );
m_cells.remove( uuid );
emit clipDeleted( m_mediaId, uuid );
}
}
......@@ -52,7 +52,7 @@ class ClipListViewController : public ListViewController
signals:
void clipSelected( const QUuid& uuid );
void clipDeleted( const QUuid& uuid );
void clipDeleted( const QUuid& mediaId, const QUuid& clipId );
};
#endif
......@@ -39,7 +39,6 @@ MediaLibraryWidget::MediaLibraryWidget( QWidget* parent ) : QWidget( parent )
connect( m_nav, SIGNAL( importRequired() ), this, SIGNAL( importRequired() ) );
//Clip
//connect( list, SIGNAL( clipSelected( Clip* clip ) ), this, SIGNAL( clipSelected( Clip* ) ) );
//connect( list, SIGNAL( clipRemoved( const QUuid&, const QUuid& ) ), library, SLOT( removeClip( const QUuid&, const QUuid& ) ) );
connect( this, SIGNAL( addClipToViewController( Clip* ) ), list, SLOT( newClipAdded( Clip* ) ) );
m_nav->pushViewController( list );
}
......
......@@ -49,6 +49,8 @@ void MediaListViewController::newMediaLoaded( const QUuid& uuid )
this, SLOT ( cellSelection( QUuid ) ) );
connect( cell, SIGNAL ( cellDeleted( QUuid ) ),
this, SLOT( mediaDeletion( QUuid ) ) );
connect( cell, SIGNAL( arrowClicked( const QUuid& ) ),
this, SLOT( showClipList( const QUuid& ) ) );
if ( media->getMetadata() != Media::ParsedWithSnapshot )
connect( media, SIGNAL( snapshotComputed( Media* ) ),
......@@ -102,12 +104,14 @@ void MediaListViewController::updateCell( Media* media )
void MediaListViewController::showClipList( const QUuid& uuid )
{
qDebug() << "nb clips :" << Library::getInstance()->media( uuid )->clips()->size();
if ( Library::getInstance()->media( uuid ) == NULL ||
Library::getInstance()->media( uuid )->clips()->size() == 0 )
return ;
qDebug() << "uuid" << uuid << "lastUuid" << m_lastUuidClipListAsked;
if ( m_lastUuidClipListAsked != uuid )
{
m_lastUuidClipListAsked = m_currentUuid;
m_lastUuidClipListAsked = uuid;
if ( m_clipsListView != 0 )
delete m_clipsListView;
m_clipsListView = new ClipListViewController( m_nav, uuid );
......
Supports Markdown
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