Commit b2fb746a authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Clip addition is now stacked too

parent 2ed1e54b
......@@ -32,10 +32,10 @@ void Commands::trigger( QUndoCommand* command )
UndoStack::getInstance()->push( command );
}
Commands::MainWorkflow::AddClip::AddClip( ::MainWorkflow* workflow, Clip* clip,
Commands::MainWorkflow::AddClip::AddClip( WorkflowRenderer* renderer, Clip* clip,
unsigned int trackNumber, qint64 pos,
::MainWorkflow::TrackType trackType ) :
m_workflow( workflow ),
m_renderer( renderer ),
m_clip( clip ),
m_trackNumber( trackNumber ),
m_pos( pos ),
......@@ -46,12 +46,12 @@ Commands::MainWorkflow::AddClip::AddClip( ::MainWorkflow* workflow, Clip* clip,
void Commands::MainWorkflow::AddClip::redo()
{
m_workflow->addClip( m_clip, m_trackNumber, m_pos, m_trackType );
m_renderer->addClip( m_clip, m_trackNumber, m_pos, m_trackType );
}
void Commands::MainWorkflow::AddClip::undo()
{
m_workflow->removeClip( m_clip->getUuid(), m_trackNumber, m_trackType );
m_renderer->removeClip( m_clip->getUuid(), m_trackNumber, m_trackType );
}
Commands::MainWorkflow::MoveClip::MoveClip( ::MainWorkflow* workflow, const QUuid& uuid,
......
......@@ -51,11 +51,11 @@ namespace Commands
NEW_COMMAND( AddClip )
{
public:
AddClip( ::MainWorkflow* workflow, Clip* clip, unsigned int trackNumber, qint64 pos, ::MainWorkflow::TrackType trackType );
AddClip( WorkflowRenderer* renderer, Clip* clip, unsigned int trackNumber, qint64 pos, ::MainWorkflow::TrackType trackType );
virtual void redo();
virtual void undo();
private:
::MainWorkflow* m_workflow;
WorkflowRenderer* m_renderer;
Clip* m_clip;
unsigned int m_trackNumber;
qint64 m_pos;
......
......@@ -422,7 +422,7 @@ void TracksView::dropEvent( QDropEvent* event )
m_dragItem->oldTrackNumber = m_dragItem->trackNumber();
m_dragItem->oldPosition = (qint64)mappedXPos;
Commands::trigger( new Commands::MainWorkflow::AddClip( m_mainWorkflow,
Commands::trigger( new Commands::MainWorkflow::AddClip( m_renderer,
m_dragItem->clip(),
m_dragItem->trackNumber(),
(qint64)mappedXPos,
......@@ -720,7 +720,7 @@ void TracksView::split( GraphicsMovieItem* item, qint64 frame )
Q_ASSERT( newclip );
addMediaItem( newclip, item->trackNumber(), item->pos().x() + frame );
Commands::trigger( new Commands::MainWorkflow::AddClip( m_mainWorkflow,
Commands::trigger( new Commands::MainWorkflow::AddClip( m_renderer,
newclip,
item->trackNumber(),
item->pos().x() + frame,
......
......@@ -129,7 +129,6 @@ void WorkflowRenderer::checkActions()
//This will also pause the MainWorkflow via a signal/slot
break ;
case AddClip:
qDebug() << "Unstacked action";
m_mainWorkflow->addClip( act->clip, act->trackId, act->startingPos, act->trackType );
break ;
case RemoveClip:
......@@ -284,7 +283,6 @@ void WorkflowRenderer::removeClip( const QUuid& uuid, uint32_t trackId, M
act->trackType = trackType;
QMutexLocker lock( m_actionsMutex );
m_actions.push( act );
qDebug() << "<<<<<<<<";
}
void WorkflowRenderer::addClip( Clip* clip, uint32_t trackNumber, qint64 startingPos, MainWorkflow::TrackType trackType )
......@@ -296,6 +294,8 @@ void WorkflowRenderer::addClip( Clip* clip, uint32_t trackNumber, qint64
act->trackId = trackNumber;
act->startingPos = startingPos;
act->trackType = trackType;
QMutexLocker lock( m_actionsMutex );
m_actions.push( act );
}
else
m_mainWorkflow->addClip( clip, trackNumber, startingPos, trackType );
......
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