Commit 51a0e59a authored by luyikei's avatar luyikei

Clip: Add a getter for checking whether a clip is on the timeline

parent 6f9be2ef
......@@ -42,7 +42,8 @@
Clip::Clip( QSharedPointer<Media> media, qint64 begin /*= 0*/, qint64 end /*= Backend::IInput::EndOfMedia */, const QUuid& uuid /*= QString()*/ ) :
Workflow::Helper( uuid ),
m_media( media ),
m_input( media->input()->cut( begin, end ) )
m_input( media->input()->cut( begin, end ) ),
m_onTimeline( false )
{
}
......@@ -107,6 +108,20 @@ Clip::setNotes( const QString &notes )
m_notes = notes;
}
bool
Clip::onTimeline() const
{
return m_onTimeline;
}
void
Clip::setOnTimeline( bool onTimeline )
{
if ( m_onTimeline != onTimeline )
emit onTimelineChanged( onTimeline );
m_onTimeline = onTimeline;
}
const QUuid&
Clip::uuid() const
{
......
......@@ -94,6 +94,9 @@ class Clip : public Workflow::Helper
const QString &notes() const;
void setNotes( const QString &notes );
bool onTimeline() const;
void setOnTimeline( bool onTimeline );
QVariant toVariant() const;
Backend::IInput* input();
......@@ -105,11 +108,14 @@ class Clip : public Workflow::Helper
QStringList m_metaTags;
QString m_notes;
bool m_onTimeline;
signals:
/**
* \brief Act just like QObject::destroyed(), but before the clip deletion.
*/
void unloaded( Clip* );
bool onTimelineChanged( bool );
};
#endif //CLIP_H__
......@@ -76,6 +76,7 @@ SequenceWorkflow::addClip( QSharedPointer<::Clip> clip, quint32 trackId, qint32
trackId, pos, isAudioClip );
vlmcDebug() << "adding" << (isAudioClip ? "audio" : "video") << "clip instance:" << c->uuid;
m_clips.insert( c->uuid, c ) ;
clip->setOnTimeline( true );
emit clipAdded( c->uuid.toString() );
return c->uuid;
}
......@@ -166,6 +167,11 @@ SequenceWorkflow::removeClip( const QUuid& uuid )
t->remove( t->clipIndexAt( position ) );
m_clips.erase( it );
clip->disconnect( this );
bool onTimeline = false;
for ( const auto& clipInstance : m_clips )
if ( clipInstance->clip->uuid() == clip->uuid() )
onTimeline = true;
clip->setOnTimeline( onTimeline );
emit clipRemoved( uuid.toString() );
return c;
......
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