Commit 1c0b8236 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Library: Unbroke clip adding conception.

The previewwidget isn't meant to emit a signal about a clip beeing
added.
Let this to the media, as it holds the clips.
parent 2846e21d
......@@ -243,8 +243,6 @@ 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* ) ) );
}
......
......@@ -206,7 +206,7 @@ void PreviewWidget::createNewClipFromMarkers()
Clip* part = new Clip( selectedMedia, beg, end );
//Adding the newly created clip to the media
selectedMedia->addClip( part );
emit addClip( part );
if ( selectedMedia->addClip( part ) == false )
delete part;
return ;
}
......@@ -70,9 +70,6 @@ private slots:
void markerStartClicked();
void markerStopClicked();
void createNewClipFromMarkers();
signals:
void addClip( Clip* clip );
};
#endif // PREVIEWWIDGET_H
......@@ -97,8 +97,6 @@ ImportController::ImportController(QWidget *parent) :
connect( m_mediaListController, SIGNAL( showClipListAsked( const QUuid& ) ),
this, SLOT( showClipList( const QUuid& ) ) );
connect( m_preview, SIGNAL( addClip( Clip* ) ),
m_mediaListController, SLOT( clipAdded( Clip* ) ) ); //StackViewController
connect( m_stackNav, SIGNAL( previousButtonPushed() ),
this, SLOT( restoreContext() ) );
......
......@@ -46,6 +46,8 @@ ImportMediaListController::addMedia( Media* media )
this, SIGNAL( mediaDeleted( const QUuid& ) ) );
connect( cell, SIGNAL( arrowClicked( const QUuid& ) ),
this, SIGNAL( showClipListAsked( const QUuid& ) ) );
connect( media, SIGNAL( clipAdded(Clip*) ),
this, SLOT( clipAdded( Clip* ) ) );
cell->setTitle( media->fileName() );
cell->setThumbnail( media->snapshot() );
......
......@@ -50,6 +50,8 @@ void MediaListViewController::newMediaLoaded( Media* media )
this, SLOT( showClipList( const QUuid& ) ) );
connect( media, SIGNAL( snapshotComputed( const Media* ) ),
this, SLOT( updateCell( const Media* ) ) );
connect( media, SIGNAL( clipAdded( Clip* ) ),
this, SLOT( newClipAdded(Clip*) ) );
cell->setNbClips( media->clips()->size() );
cell->setThumbnail( media->snapshot() );
cell->setTitle( media->fileName() );
......
......@@ -268,16 +268,18 @@ bool Media::matchMetaTag( const QString& tag ) const
return false;
}
void Media::addClip( Clip* clip )
bool Media::addClip( Clip* clip )
{
if ( clip->getParent() != this )
return ;
return false;
foreach ( Clip *c, m_clips.values() )
{
if ( clip->begin() == c->begin() && clip->end() == clip->end() )
return ;
return false;
}
m_clips.insert( clip->uuid(), clip );
emit clipAdded( clip );
return true;
}
void Media::removeClip( const QUuid& uuid )
......@@ -294,7 +296,7 @@ Media::hasAudioTrack() const
bool
Media::hasVideoTrack() const
{
return ( m_nbVideoTracks > 0);
return ( m_nbVideoTracks > 0 );
}
void
......
......@@ -140,7 +140,7 @@ public:
// bool hasMetadata() const;
void addClip( Clip* clip );
bool addClip( Clip* clip );
void removeClip( const QUuid& uuid );
Clip* clip( const QUuid& uuid ) const { return m_clips[uuid]; }
const QHash<QUuid, Clip*>* clips() const { return &m_clips; }
......@@ -179,6 +179,7 @@ signals:
void metaDataComputed( const Media* );
void snapshotComputed( const Media* );
void audioSpectrumComputed( const QUuid& );
void clipAdded( Clip* );
};
#endif // CLIP_H__
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