Commit d8eace07 authored by Clement CHAVANCE's avatar Clement CHAVANCE

The previewWidget is now notified that a clip have been selected

parent 5016b1fa
......@@ -168,6 +168,9 @@ void MainWindow::setupLibrary()
connect( mediaLibraryWidget, SIGNAL( importRequired() ), this, SLOT( on_actionImport_triggered() ) );
connect( m_clipPreview, SIGNAL( addClip( Clip* ) ), mediaLibraryWidget, SLOT( clipAdded( Clip* ) ) );
connect( mediaLibraryWidget, SIGNAL( previewClipSetted( Clip* ) ),
m_clipPreview->getGenericRenderer(), SLOT( setClip( Clip* ) ) );
}
void MainWindow::on_actionSave_triggered()
......
......@@ -38,7 +38,7 @@ MediaLibraryWidget::MediaLibraryWidget( QWidget* parent ) : QWidget( parent )
connect( library, SIGNAL( mediaRemoved( QUuid ) ), list, SLOT( mediaRemoved( const QUuid& ) ) );
connect( m_nav, SIGNAL( importRequired() ), this, SIGNAL( importRequired() ) );
//Clip
//connect( list, SIGNAL( clipSelected( Clip* clip ) ), this, SIGNAL( clipSelected( Clip* ) ) );
connect( list, SIGNAL( clipSelected( Clip* ) ), this, SIGNAL( previewClipSetted( Clip* ) ) );
connect( this, SIGNAL( addClipToViewController( Clip* ) ), list, SLOT( newClipAdded( Clip* ) ) );
m_nav->pushViewController( list );
}
......@@ -66,5 +66,4 @@ void MediaLibraryWidget::mediaSelection( Media* media )
void MediaLibraryWidget::clipSelection( Clip* clip )
{
emit clipSelected( clip );
}
......@@ -51,7 +51,7 @@ private slots:
signals:
void mediaSelected( Media* media );
void clipSelected( Clip* clip );
void previewClipSetted( Clip* clip );
void importRequired();
void addClipToViewController( Clip* clip );
};
......
......@@ -106,11 +106,9 @@ void MediaListViewController::showClipList( const QUuid& uuid )
{
if ( !m_cells->contains( uuid ) )
return ;
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 = uuid;
......@@ -119,7 +117,7 @@ void MediaListViewController::showClipList( const QUuid& uuid )
m_clipsListView = new ClipListViewController( m_nav, uuid );
m_clipsListView->addClipsFromMedia( Library::getInstance()->media( uuid ) );
connect( m_clipsListView, SIGNAL( clipSelected( const QUuid& ) ),
this, SIGNAL( clipSelected( const QUuid& ) ) );
this, SLOT( clipSelection( const QUuid& ) ) );
}
m_nav->pushViewController( m_clipsListView );
}
......@@ -140,10 +138,8 @@ void MediaListViewController::newClipAdded( Clip* clip )
void MediaListViewController::restoreContext()
{
qDebug() << "current uuid" << m_currentUuid;
if ( m_clipsListView->getNbDeletion() != 0 )
{
qDebug() << "cells :" << m_cells;
if ( m_cells->contains( m_currentUuid ) )
{
MediaCellView* cell = dynamic_cast<MediaCellView*>( m_cells->value( m_currentUuid, 0 ) );
......@@ -152,3 +148,12 @@ void MediaListViewController::restoreContext()
}
}
}
void
MediaListViewController::clipSelection( const QUuid& uuid )
{
Clip* clip;
if ( ( clip = Library::getInstance()->clip( m_currentUuid, uuid ) ) != 0 )
emit clipSelected( clip );
}
......@@ -33,12 +33,14 @@ public slots:
void updateCell( Media* media );
void showClipList( const QUuid& uuid );
void newClipAdded( Clip* clip );
void clipSelection( const QUuid& uuid );
private slots:
void restoreContext();
signals:
void mediaSelected( Media* media );
void mediaDeleted( const QUuid& uuid );
void clipSelected( Clip* clip );
};
#endif // MEDIALISTVIEWCONTROLLER_H
......@@ -73,6 +73,7 @@ void ClipRenderer::setMedia( Media* media )
void ClipRenderer::setClip( Clip* clip )
{
qDebug() << "Setting clip";
if ( clip == NULL )
{
m_selectedMedia = NULL;
......@@ -107,7 +108,7 @@ void ClipRenderer::startPreview()
m_mediaPlayer->setMedia( m_vlcMedia );
m_mediaPlayer->play();
m_mediaPlayer->setPosition( m_begin / m_end );
m_mediaPlayer->setPosition( m_begin / m_selectedMedia->getNbFrames() );
m_clipLoaded = true;
m_isRendering = true;
m_paused = false;
......
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