Commit 02d13fc1 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Clip: Adding the root clip concept.

parent 298cbb4e
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <QTime> #include <QTime>
#include <QtDebug>
MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) : MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) :
QWidget( parent ), QWidget( parent ),
m_ui( new Ui::MediaCellView ), m_ui( new Ui::MediaCellView ),
...@@ -38,7 +40,7 @@ MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) : ...@@ -38,7 +40,7 @@ MediaCellView::MediaCellView( Clip* clip, QWidget *parent ) :
setAutoFillBackground( true ); setAutoFillBackground( true );
connect( m_ui->delLabel, SIGNAL( clicked( QWidget*, QMouseEvent* ) ), connect( m_ui->delLabel, SIGNAL( clicked( QWidget*, QMouseEvent* ) ),
this, SLOT( deleteButtonClicked( QWidget*, QMouseEvent* ) ) ); this, SLOT( deleteButtonClicked( QWidget*, QMouseEvent* ) ) );
if ( clip->isBaseClip() == true ) if ( clip->isRootClip() == true )
{ {
connect( m_ui->arrow, connect( m_ui->arrow,
SIGNAL( clicked( QWidget*, QMouseEvent* ) ), SIGNAL( clicked( QWidget*, QMouseEvent* ) ),
......
...@@ -101,7 +101,7 @@ void MediaListViewController::showClipList( const QUuid& uuid ) ...@@ -101,7 +101,7 @@ void MediaListViewController::showClipList( const QUuid& uuid )
m_mediaContainer->media( uuid )-> clipsCount() == 0 ) m_mediaContainer->media( uuid )-> clipsCount() == 0 )
return ; return ;
m_lastUuidClipListAsked = uuid; m_lastUuidClipListAsked = uuid;
m_clipsListView = new MediaListViewController( m_nav, Library::getInstance() ); m_clipsListView = new MediaListViewController( m_nav, m_mediaContainer );
m_clipsListView->newMediaLoaded( m_mediaContainer->media( uuid ) ); m_clipsListView->newMediaLoaded( m_mediaContainer->media( uuid ) );
connect( m_clipsListView, SIGNAL( clipSelected( const QUuid& ) ), connect( m_clipsListView, SIGNAL( clipSelected( const QUuid& ) ),
this, SLOT( clipSelection( const QUuid& ) ) ); this, SLOT( clipSelection( const QUuid& ) ) );
...@@ -110,10 +110,5 @@ void MediaListViewController::showClipList( const QUuid& uuid ) ...@@ -110,10 +110,5 @@ void MediaListViewController::showClipList( const QUuid& uuid )
void MediaListViewController::restoreContext() void MediaListViewController::restoreContext()
{ {
MediaCellView* cell = qobject_cast<MediaCellView*>( m_cells->value( m_lastUuidClipListAsked, 0 ) );
if ( cell != 0 )
{
qDebug() << "FIXME: Update clip count";
}
delete m_clipsListView; delete m_clipsListView;
} }
...@@ -100,7 +100,7 @@ void StackViewController::popViewController( bool animated ) ...@@ -100,7 +100,7 @@ void StackViewController::popViewController( bool animated )
else else
{ {
m_nav->previousButton()->setText( "< " + m_nav->previousButton()->setText( "< " +
m_controllerStack->value( m_controllerStack->size() - 1 )->title() ); m_controllerStack->value( m_controllerStack->size() - 1 )->title() );
} }
} }
......
...@@ -36,8 +36,10 @@ Clip::Clip( Media *parent, const QString& uuid ) : ...@@ -36,8 +36,10 @@ Clip::Clip( Media *parent, const QString& uuid ) :
m_begin( 0 ), m_begin( 0 ),
m_end( parent->nbFrames() ), m_end( parent->nbFrames() ),
m_maxBegin( 0 ), m_maxBegin( 0 ),
m_maxEnd( parent->nbFrames() ) m_maxEnd( parent->nbFrames() ),
m_rootClip( NULL )
{ {
Q_ASSERT( parent->baseClip() == NULL );
if ( uuid.isEmpty() == true ) if ( uuid.isEmpty() == true )
m_uuid = QUuid::createUuid(); m_uuid = QUuid::createUuid();
else else
...@@ -52,7 +54,8 @@ Clip::Clip( Clip *clip, qint64 begin /*= 0*/, qint64 end /*= -1*/ ) : ...@@ -52,7 +54,8 @@ Clip::Clip( Clip *clip, qint64 begin /*= 0*/, qint64 end /*= -1*/ ) :
m_metaTags( clip->m_metaTags ), m_metaTags( clip->m_metaTags ),
m_notes( clip->m_notes ), m_notes( clip->m_notes ),
m_maxBegin( clip->m_begin ), m_maxBegin( clip->m_begin ),
m_maxEnd( clip->m_end ) m_maxEnd( clip->m_end ),
m_rootClip( clip->getParent()->baseClip() )
{ {
if ( begin == -1 ) if ( begin == -1 )
m_begin = clip->begin(); m_begin = clip->begin();
...@@ -68,7 +71,8 @@ Clip::Clip( Media *parent, qint64 begin, qint64 end /*= -1*/, ...@@ -68,7 +71,8 @@ Clip::Clip( Media *parent, qint64 begin, qint64 end /*= -1*/,
m_begin( begin ), m_begin( begin ),
m_end( end ), m_end( end ),
m_maxBegin( begin ), m_maxBegin( begin ),
m_maxEnd( end ) m_maxEnd( end ),
m_rootClip( parent->baseClip() )
{ {
if ( end < 0 ) if ( end < 0 )
{ {
...@@ -237,8 +241,14 @@ Clip::maxEnd() const ...@@ -237,8 +241,14 @@ Clip::maxEnd() const
return m_maxEnd; return m_maxEnd;
} }
Clip*
Clip::rootClip()
{
return m_rootClip;
}
bool bool
Clip::isBaseClip() const Clip::isRootClip() const
{ {
return ( m_parent->baseClip() == this ); return ( m_rootClip == NULL );
} }
...@@ -115,7 +115,8 @@ class Clip : public QObject ...@@ -115,7 +115,8 @@ class Clip : public QObject
void computeLength(); void computeLength();
bool isBaseClip() const; bool isRootClip() const;
Clip* rootClip();
private: private:
Media *m_parent; Media *m_parent;
...@@ -159,6 +160,13 @@ class Clip : public QObject ...@@ -159,6 +160,13 @@ class Clip : public QObject
*/ */
qint64 m_maxEnd; qint64 m_maxEnd;
/**
* \brief Return the root clip.
*
* The root clip is the base clip for the parent media.
*/
Clip* m_rootClip;
signals: signals:
void lengthUpdated(); void lengthUpdated();
}; };
......
...@@ -48,6 +48,7 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ ) ...@@ -48,6 +48,7 @@ Media::Media( const QString& filePath, const QString& uuid /*= QString()*/ )
m_width( 0 ), m_width( 0 ),
m_height( 0 ), m_height( 0 ),
m_fps( .0f ), m_fps( .0f ),
m_baseClip( NULL ),
m_nbAudioTracks( 0 ), m_nbAudioTracks( 0 ),
m_nbVideoTracks( 0 ), m_nbVideoTracks( 0 ),
m_metadataComputed( false ) m_metadataComputed( 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