Commit 6523f102 authored by luyikei's avatar luyikei

Introduce SequenceWorkflow for simplification of implementation

parent c042f2f3
......@@ -36,7 +36,7 @@ vlmc_SOURCES = \
src/Tools/VlmcLogger.cpp \
src/Workflow/Helper.cpp \
src/Workflow/MainWorkflow.cpp \
src/Workflow/TrackWorkflow.cpp \
src/Workflow/SequenceWorkflow.cpp \
$(NULL)
vlmc_SOURCES += \
......@@ -92,7 +92,6 @@ vlmc_SOURCES += \
src/Main/Core.h \
src/Library/Library.h \
src/Library/MediaContainer.h \
src/Workflow/TrackWorkflow.h \
src/Workflow/Helper.h \
src/Workflow/Types.h \
src/Workflow/MainWorkflow.h \
......@@ -100,7 +99,7 @@ vlmc_SOURCES += \
nodist_vlmc_SOURCES = \
src/Media/Clip.moc.cpp \
src/Workflow/TrackWorkflow.moc.cpp \
src/Workflow/SequenceWorkflow.moc.cpp \
src/Services/YouTube/YouTubeService.moc.cpp \
src/EffectsEngine/EffectHelper.moc.cpp \
src/Workflow/Helper.moc.cpp \
......
......@@ -31,6 +31,8 @@
#include "Media/Clip.h"
#include "EffectsEngine/EffectHelper.h"
#include "Workflow/TrackWorkflow.h"
#include "Workflow/SequenceWorkflow.h"
#include "Workflow/MainWorkflow.h"
#include "AbstractUndoStack.h"
#include "Backend/IFilter.h"
......@@ -88,42 +90,74 @@ Commands::Generic::undo()
internalUndo();
}
Commands::Clip::Add::Add( std::shared_ptr<::Clip> const& clip, TrackWorkflow* tw, qint64 pos ) :
m_clip( clip ),
m_trackWorkflow( tw ),
m_pos( pos )
Commands::Clip::Add::Add( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& uuid, quint32 trackId, qint32 pos, bool isAudioClip ) :
m_workflow( workflow ),
m_uuid( uuid ),
m_trackId( trackId ),
m_pos( pos ),
m_isAudioClip( isAudioClip )
{
connect( clip.get(), &::Clip::destroyed, this, &Add::invalidate );
retranslate();
}
void
Commands::Clip::Add::internalRedo()
{
m_trackWorkflow->addClip( m_clip, m_pos );
if ( m_clip )
{
auto ret = m_workflow->addClip( m_clip, m_trackId, m_pos );
if ( ret == true )
emit Core::instance()->workflow()->clipAdded( m_clip->uuid().toString() );
else
invalidate();
}
else
{
auto ret = m_workflow->addClip( m_uuid, m_trackId, m_pos, m_isAudioClip );
if ( QUuid( ret ).isNull() == false )
{
m_clip = m_workflow->clip( ret );
connect( m_clip.get(), &::Clip::destroyed, this, &Add::invalidate );
emit Core::instance()->workflow()->clipAdded( ret );
}
else
invalidate();
}
}
void
Commands::Clip::Add::internalUndo()
{
m_trackWorkflow->removeClip( m_clip->uuid() );
m_clip = m_workflow->removeClip( m_uuid );
if ( m_clip )
emit Core::instance()->workflow()->clipRemoved( m_uuid.toString() );
else
invalidate();
}
void
Commands::Clip::Add::retranslate()
{
setText( tr( "Adding clip to track %1" ).arg( m_trackWorkflow->trackId() ) );
setText( tr( "Adding clip to track %1" ).arg( m_trackId ) );
}
Commands::Clip::Move::Move( TrackWorkflow *oldTrack, TrackWorkflow *newTrack,
std::shared_ptr<::Clip> const& clip, qint64 newPos ) :
m_oldTrack( oldTrack ),
m_newTrack( newTrack ),
m_clip( clip ),
m_newPos( newPos )
std::shared_ptr<Clip>
Commands::Clip::Add::newClip()
{
return m_clip;
}
Commands::Clip::Move::Move( std::shared_ptr<SequenceWorkflow> const& workflow,
const QString& uuid, quint32 trackId, qint64 pos ) :
m_workflow( workflow ),
//We have to find an actual clip to ensure that it exists
m_clip( workflow->clip( uuid ) ),
m_newTrackId( trackId ),
m_oldTrackId( workflow->trackId( uuid ) ),
m_newPos( pos ),
m_oldPos( workflow->position( uuid ) )
{
m_oldPos = oldTrack->getClipPosition( m_clip->uuid() );
connect( m_clip.get(), SIGNAL( destroyed() ), this, SLOT( invalidate() ) );
retranslate();
}
......@@ -131,9 +165,9 @@ Commands::Clip::Move::Move( TrackWorkflow *oldTrack, TrackWorkflow *newTrack,
void
Commands::Clip::Move::retranslate()
{
if ( m_oldTrack != m_newTrack )
if ( m_oldTrackId != m_newTrackId )
setText( tr( "Moving clip from track %1 to %2" ).arg(
QString::number( m_oldTrack->trackId() ), QString::number( m_newTrack->trackId() ) ) );
QString::number( m_oldTrackId ), QString::number( m_newTrackId ) ) );
else
setText( QObject::tr( "Moving clip" ) );
}
......@@ -141,33 +175,42 @@ Commands::Clip::Move::retranslate()
void
Commands::Clip::Move::internalRedo()
{
if ( m_newTrack != m_oldTrack )
if ( !m_clip )
{
m_clip = m_oldTrack->removeClip( m_clip->uuid() );
m_newTrack->addClip( m_clip, m_newPos );
invalidate();
return;
}
auto ret = m_workflow->moveClip( m_clip->uuid(), m_newTrackId, m_newPos );
if ( ret == true )
emit Core::instance()->workflow()->clipMoved( m_clip->uuid().toString() );
else
m_oldTrack->moveClip( m_clip->uuid(), m_newPos );
invalidate();
}
void
Commands::Clip::Move::internalUndo()
{
if ( m_newTrack != m_oldTrack )
if ( !m_clip )
{
m_clip = m_newTrack->removeClip( m_clip->uuid() );
m_oldTrack->addClip( m_clip, m_oldPos );
invalidate();
return;
}
auto ret = m_workflow->moveClip( m_clip->uuid(), m_oldTrackId, m_oldPos );
if ( ret == true )
emit Core::instance()->workflow()->clipMoved( m_clip->uuid().toString() );
else
m_newTrack->moveClip( m_clip->uuid(), m_oldPos );
invalidate();
}
Commands::Clip::Remove::Remove( std::shared_ptr<::Clip> const& clip, TrackWorkflow* tw ) :
m_clip( clip ), m_trackWorkflow( tw )
Commands::Clip::Remove::Remove( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& uuid ) :
m_workflow( workflow ),
m_clip( workflow->clip( uuid ) ),
m_trackId( workflow->trackId( uuid ) ),
m_pos( workflow->position( uuid ) )
{
connect( clip.get(), &::Clip::destroyed, this, &Remove::invalidate );
connect( m_clip.get(), &::Clip::destroyed, this, &Remove::invalidate );
retranslate();
m_pos = tw->getClipPosition( clip->uuid() );
}
void
......@@ -179,27 +222,51 @@ Commands::Clip::Remove::retranslate()
void
Commands::Clip::Remove::internalRedo()
{
m_trackWorkflow->removeClip( m_clip->uuid() );
if ( !m_clip )
{
invalidate();
return;
}
m_clip = m_workflow->removeClip( m_clip->uuid() );
if ( m_clip )
emit Core::instance()->workflow()->clipRemoved( m_clip->uuid().toString() );
else
invalidate();
}
void
Commands::Clip::Remove::internalUndo()
{
m_trackWorkflow->addClip( m_clip, m_pos );
if ( !m_clip )
{
invalidate();
return;
}
auto ret = m_workflow->addClip( m_clip, m_trackId, m_pos );
if ( ret == true )
emit Core::instance()->workflow()->clipAdded( m_clip->uuid().toString() );
else
invalidate();
}
Commands::Clip::Resize::Resize( TrackWorkflow* tw, std::shared_ptr<::Clip> const& clip, qint64 newBegin,
qint64 newEnd, qint64 newPos ) :
m_trackWorkflow( tw ),
m_clip( clip ),
Commands::Clip::Resize::Resize( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& uuid, qint64 newBegin, qint64 newEnd, qint64 newPos ) :
m_workflow( workflow ),
m_clip( workflow->clip( uuid ) ),
m_newBegin( newBegin ),
m_newEnd( newEnd ),
m_newPos( newPos )
{
connect( clip.get(), &::Clip::destroyed, this, &Resize::invalidate );
m_oldBegin = clip->begin();
m_oldEnd = clip->end();
m_oldPos = tw->getClipPosition( clip->uuid() );
connect( m_clip.get(), &::Clip::destroyed, this, &Resize::invalidate );
if ( !m_clip )
{
invalidate();
retranslate();
return;
}
m_oldBegin = m_clip->begin();
m_oldEnd = m_clip->end();
m_oldPos = workflow->trackId( uuid );
retranslate();
}
......@@ -212,26 +279,41 @@ Commands::Clip::Resize::retranslate()
void
Commands::Clip::Resize::internalRedo()
{
m_trackWorkflow->resizeClip( m_clip->uuid(), m_newBegin, m_newEnd, m_newPos );
bool ret = m_workflow->resizeClip( m_clip->uuid(), m_newBegin, m_newEnd, m_newPos );
if ( ret == true )
emit Core::instance()->workflow()->clipResized( m_clip->uuid().toString() );
else
invalidate();
}
void
Commands::Clip::Resize::internalUndo()
{
m_trackWorkflow->resizeClip( m_clip->uuid(), m_oldBegin, m_oldEnd, m_oldPos );
bool ret = m_workflow->resizeClip( m_clip->uuid(), m_oldBegin, m_oldEnd, m_oldPos );
if ( ret == true )
emit Core::instance()->workflow()->clipResized( m_clip->uuid().toString() );
else
invalidate();
}
Commands::Clip::Split::Split( TrackWorkflow *tw, std::shared_ptr<::Clip> const& toSplit,
qint64 newClipPos, qint64 newClipBegin ) :
m_trackWorkflow( tw ),
m_toSplit( toSplit ),
Commands::Clip::Split::Split( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& uuid, qint64 newClipPos, qint64 newClipBegin ) :
m_workflow( workflow ),
m_toSplit( workflow->clip( uuid ) ),
m_trackId( workflow->trackId( uuid ) ),
m_newClip( nullptr ),
m_newClipPos( newClipPos ),
m_newClipBegin( newClipBegin )
{
connect( toSplit.get(), &::Clip::destroyed, this, &Split::invalidate );
m_newClip = std::make_shared<::Clip>( toSplit.get(), newClipBegin, toSplit->end() );
m_oldEnd = toSplit->end();
connect( m_toSplit.get(), &::Clip::destroyed, this, &Split::invalidate );
if ( !m_toSplit )
{
invalidate();
retranslate();
return;
}
m_newClip = std::make_shared<::Clip>( m_toSplit.get(), newClipBegin, m_toSplit->end() );
m_oldEnd = m_toSplit->end();
retranslate();
}
......@@ -246,23 +328,38 @@ Commands::Clip::Split::internalRedo()
{
//If we don't remove 1, the clip will end exactly at the starting frame (ie. they will
//be rendering at the same time)
if ( !m_toSplit )
{
invalidate();
return;
}
m_toSplit->setEnd( m_newClipBegin );
m_trackWorkflow->addClip( m_newClip, m_newClipPos );
bool ret = m_workflow->addClip( m_newClip, m_trackId, m_newClipPos );
if ( ret == true )
emit Core::instance()->workflow()->clipAdded( m_newClip->uuid().toString() );
else
invalidate();
emit Core::instance()->workflow()->clipResized( m_toSplit->uuid().toString() );
}
void
Commands::Clip::Split::internalUndo()
{
m_trackWorkflow->removeClip( m_newClip->uuid() );
m_newClip = m_workflow->removeClip( m_newClip->uuid() );
if ( !m_newClip )
{
invalidate();
return;
}
m_toSplit->setEnd( m_oldEnd );
}
Commands::Clip::Link::Link( std::shared_ptr<::Clip> const& clipA, std::shared_ptr<::Clip> const& clipB )
: m_clipA( clipA )
Commands::Clip::Link::Link( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& clipA, const QUuid& clipB )
: m_workflow( workflow )
, m_clipA( clipA )
, m_clipB( clipB )
{
connect( m_clipA.get(), &::Clip::destroyed, this, &Link::invalidate );
connect( m_clipB.get(), &::Clip::destroyed, this, &Link::invalidate );
retranslate();
}
......@@ -275,17 +372,21 @@ Commands::Clip::Link::retranslate()
void
Commands::Clip::Link::internalRedo()
{
m_clipA->setLinkedClipUuid( m_clipB->uuid() );
m_clipB->setLinkedClipUuid( m_clipA->uuid() );
m_clipA->setLinked( true );
m_clipB->setLinked( true );
auto ret = m_workflow->linkClips( m_clipA, m_clipB );
if ( ret == true )
emit Core::instance()->workflow()->clipLinked( m_clipA.toString(), m_clipB.toString() );
else
invalidate();
}
void
Commands::Clip::Link::internalUndo()
{
m_clipA->setLinked( false );
m_clipB->setLinked( false );
auto ret = m_workflow->unlinkClips( m_clipA, m_clipB );
if ( ret == true )
emit Core::instance()->workflow()->clipUnlinked( m_clipA.toString(), m_clipB.toString() );
else
invalidate();
}
Commands::Effect::Add::Add( std::shared_ptr<EffectHelper> const& helper, Backend::IInput* target )
......
......@@ -30,12 +30,11 @@
# include <QUndoCommand>
#endif
#include <QObject>
#include "Workflow/MainWorkflow.h"
#include <QUuid>
#include <memory>
class Clip;
class SequenceWorkflow;
namespace Backend
{
......@@ -79,29 +78,35 @@ namespace Commands
class Add : public Generic
{
public:
Add( std::shared_ptr<::Clip> const& clip, TrackWorkflow* tw, qint64 pos );
Add( std::shared_ptr<SequenceWorkflow> const& workflow, const QUuid& uuid, quint32 trackId, qint32 pos, bool isAudioClip );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
std::shared_ptr<::Clip> newClip();
private:
std::shared_ptr<SequenceWorkflow> m_workflow;
QUuid m_uuid;
std::shared_ptr<::Clip> m_clip;
TrackWorkflow *m_trackWorkflow;
quint32 m_trackId;
qint64 m_pos;
bool m_isAudioClip;
};
class Move : public Generic
{
public:
Move( TrackWorkflow *oldTrack, TrackWorkflow *newTrack,
std::shared_ptr<::Clip> const& clip, qint64 newPos );
Move( std::shared_ptr<SequenceWorkflow> const& workflow, const QString& uuid, quint32 trackId, qint64 pos );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
TrackWorkflow *m_oldTrack;
TrackWorkflow *m_newTrack;
std::shared_ptr<SequenceWorkflow> m_workflow;
std::shared_ptr<::Clip> m_clip;
quint32 m_newTrackId;
quint32 m_oldTrackId;
qint64 m_newPos;
qint64 m_oldPos;
};
......@@ -109,15 +114,16 @@ namespace Commands
class Remove : public Generic
{
public:
Remove( std::shared_ptr<::Clip> const& clip, TrackWorkflow* tw );
Remove( std::shared_ptr<SequenceWorkflow> const& workflow, const QUuid& uuid );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
std::shared_ptr<::Clip> m_clip;
TrackWorkflow *m_trackWorkflow;
qint64 m_pos;
std::shared_ptr<SequenceWorkflow> m_workflow;
std::shared_ptr<::Clip> m_clip;
quint32 m_trackId;
qint64 m_pos;
};
/**
......@@ -130,18 +136,18 @@ namespace Commands
class Resize : public Generic
{
public:
Resize( TrackWorkflow* tw, std::shared_ptr<::Clip> const& clip,
qint64 newBegin, qint64 newEnd, qint64 newPos );
Resize( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& uuid, qint64 newBegin, qint64 newEnd, qint64 newPos );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
TrackWorkflow* m_trackWorkflow;
std::shared_ptr<SequenceWorkflow> m_workflow;
std::shared_ptr<::Clip> m_clip;
qint64 m_newBegin;
qint64 m_newEnd;
qint64 m_oldBegin;
qint64 m_newEnd;
qint64 m_oldEnd;
qint64 m_newPos;
qint64 m_oldPos;
......@@ -150,15 +156,16 @@ namespace Commands
class Split : public Generic
{
public:
Split( TrackWorkflow *tw, std::shared_ptr<::Clip> const& toSplit, qint64 newClipPos,
qint64 newClipBegin );
Split( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& uuid, qint64 newClipPos, qint64 newClipBegin );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
TrackWorkflow *m_trackWorkflow;
std::shared_ptr<::Clip> m_toSplit;
std::shared_ptr<::Clip> m_newClip;
std::shared_ptr<SequenceWorkflow> m_workflow;
std::shared_ptr<::Clip> m_toSplit;
quint32 m_trackId;
std::shared_ptr<::Clip> m_newClip;
qint64 m_newClipPos;
qint64 m_newClipBegin;
qint64 m_oldEnd;
......@@ -167,13 +174,15 @@ namespace Commands
class Link : public Generic
{
public:
Link( std::shared_ptr<::Clip> const& clipA, std::shared_ptr<::Clip> const& clipB );
Link( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& clipA, const QUuid& clipB );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
std::shared_ptr<::Clip> m_clipA;
std::shared_ptr<::Clip> m_clipB;
std::shared_ptr<SequenceWorkflow> m_workflow;
QUuid m_clipA;
QUuid m_clipB;
};
}
namespace Effect
......
......@@ -62,14 +62,14 @@ Timeline::container()
void
Timeline::showEffectStack( quint32 trackId )
{
auto w = new EffectStack( Core::instance()->workflow()->track( trackId )->input() );
auto w = new EffectStack( Core::instance()->workflow()->trackInput( trackId ) );
w->show();
}
void
Timeline::showEffectStack( const QString& uuid )
{
auto w = new EffectStack( Core::instance()->workflow()->clip( uuid )->input() );
auto w = new EffectStack( Core::instance()->workflow()->clipInput( uuid ) );
connect( w, &EffectStack::finished, Core::instance()->workflow(), [uuid]{ emit Core::instance()->workflow()->effectsUpdated( uuid ); } );
w->show();
}
......@@ -44,6 +44,7 @@
#include "MainWorkflow.h"
#include "Project/Project.h"
#include "TrackWorkflow.h"
#include "SequenceWorkflow.h"
#include "Settings/Settings.h"
#include "Tools/VlmcDebug.h"
#include "Tools/RendererEventWatcher.h"
......@@ -56,10 +57,10 @@ MainWorkflow::MainWorkflow( Settings* projectSettings, int trackCount ) :
m_trackCount( trackCount ),
m_settings( new Settings ),
m_renderer( new AbstractRenderer ),
m_multitrack( new Backend::MLT::MLTMultiTrack ),
m_undoStack( new Commands::AbstractUndoStack )
m_undoStack( new Commands::AbstractUndoStack ),
m_sequenceWorkflow( new SequenceWorkflow( trackCount ) )
{
m_renderer->setInput( m_multitrack );
m_renderer->setInput( m_sequenceWorkflow->input() );
connect( m_renderer->eventWatcher(), &RendererEventWatcher::lengthChanged, this, &MainWorkflow::lengthChanged );
connect( m_renderer->eventWatcher(), &RendererEventWatcher::endReached, this, &MainWorkflow::mainWorkflowEndReached );
......@@ -68,9 +69,6 @@ MainWorkflow::MainWorkflow( Settings* projectSettings, int trackCount ) :
emit frameChanged( pos, Vlmc::Renderer );
} );
for ( int i = 0; i < trackCount; ++i )
m_tracks << new TrackWorkflow( i, m_multitrack );
m_settings->createVar( SettingValue::List, "tracks", QVariantList(), "", "", SettingValue::Nothing );
connect( m_settings, &Settings::postLoad, this, &MainWorkflow::postLoad, Qt::DirectConnection );
connect( m_settings, &Settings::preSave, this, &MainWorkflow::preSave, Qt::DirectConnection );
......@@ -81,48 +79,33 @@ MainWorkflow::MainWorkflow( Settings* projectSettings, int trackCount ) :
MainWorkflow::~MainWorkflow()
{
m_clips.clear();
for ( auto track : m_tracks )
delete track;
delete m_multitrack;
m_renderer->stop();
delete m_renderer;
delete m_settings;
}
qint64
MainWorkflow::getClipPosition( const QUuid& uuid, unsigned int trackId ) const
{
return track( trackId )->getClipPosition( uuid );
}
void
MainWorkflow::muteTrack( unsigned int trackId, Workflow::TrackType trackType )
{
track( trackId )->mute( true, trackType );
}
void
MainWorkflow::unmuteTrack( unsigned int trackId, Workflow::TrackType trackType )
{
track( trackId )->mute( false, trackType );
// TODO
}
void
MainWorkflow::muteClip( const QUuid& uuid, unsigned int trackId )
{
track( trackId )->muteClip( uuid );
// TODO
}
void
MainWorkflow::unmuteClip( const QUuid& uuid, unsigned int trackId )
{
track( trackId )->unmuteClip( uuid );
// TODO
}
std::shared_ptr<Clip>
MainWorkflow::clip( const QUuid &uuid, unsigned int trackId )
{
return track( trackId )->clip( uuid );
// TODO
}
void
......@@ -134,8 +117,7 @@ MainWorkflow::trigger( Commands::Generic* command )
void
MainWorkflow::clear()
{
for ( auto track : m_tracks )
track->clear();
m_sequenceWorkflow->clear();
emit cleared();
}
......@@ -164,6 +146,21 @@ MainWorkflow::renderer()
return m_renderer;
}
Backend::IInput*
MainWorkflow::clipInput( const QString& uuid )
{
auto clip = m_sequenceWorkflow->clip( uuid );
if ( clip )
return clip->input();
return nullptr;
}
Backend::IInput*
MainWorkflow::trackInput( quint32 trackId )
{
return m_sequenceWorkflow->trackInput( trackId );
}
Commands::AbstractUndoStack*
MainWorkflow::undoStack()
{
......@@ -179,10 +176,8 @@ MainWorkflow::getTrackCount() const
bool
MainWorkflow::contains( const QUuid &uuid ) const
{
for ( auto track : m_tracks )
if ( track->contains( uuid ) == true )
return true;
return false;
auto clip = m_sequenceWorkflow->clip( uuid );
return !clip == false;
}
quint32
......@@ -191,43 +186,15 @@ MainWorkflow::trackCount() const
return m_trackCount;
}
std::shared_ptr<Clip>
MainWorkflow::clip( const QUuid& uuid )
{
for ( auto it = m_clips.begin(); it != m_clips.end(); ++it )
if ( it.value()->uuid() == uuid )
return it.value();
return std::shared_ptr<Clip>( nullptr );
}
std::shared_ptr<Clip>
MainWorkflow::createClip( const QUuid& uuid, quint32 trackId )
{
Clip* clip = Core::instance()->library()->clip( uuid );
if ( clip == nullptr )
{
vlmcCritical() << "Couldn't find an acceptable parent to be added.";
return nullptr;
}
auto newClip = std::make_shared<Clip>( clip );
m_clips.insertMulti( trackId, newClip );
return newClip;
}
QString
MainWorkflow::addClip( const QString& uuid, quint32 trackId, qint32 pos, bool isAudioClip )
{
auto newClip = createClip( uuid, trackId );
if ( isAudioClip == true )
newClip->setFormats( Clip::Audio );
else
newClip->setFormats( Clip::Video );
trigger( new Commands::Clip::Add( newClip, track( trackId ), pos ) );
emit clipAdded( newClip->uuid().toString() );
return newClip->uuid().toString();
auto command = new Commands::Clip::Add( m_sequenceWorkflow, uuid, trackId, pos, isAudioClip );
trigger( command );
auto newClip = command->newClip();
if ( newClip )
return newClip->uuid().toString();
return QUuid().toString();
}
QJsonObject
......@@ -249,95 +216,42 @@ MainWorkflow::clipInfo( const QString& uuid )
return QJsonObject::fromVariantHash( h );
}
for ( auto it = m_clips.begin(); it != m_clips.end(); ++it )
{
if ( it.value()->uuid().toString() == uuid )
{
auto clip = it.value();
auto h = clip->toVariant().toHash();