Commit a973c4ad authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Commands: Fix move command

ANd don't invalidate it when the clip gets deleted, this would mean
there's no way of undoing deleting a clip
parent b40fbf3c
...@@ -156,8 +156,7 @@ Commands::Clip::Add::retranslate() ...@@ -156,8 +156,7 @@ Commands::Clip::Add::retranslate()
Commands::Clip::Move::Move( std::shared_ptr<SequenceWorkflow> const& workflow, Commands::Clip::Move::Move( std::shared_ptr<SequenceWorkflow> const& workflow,
const QString& uuid, quint32 trackId, qint64 pos ) : const QString& uuid, quint32 trackId, qint64 pos ) :
m_workflow( workflow ), m_workflow( workflow ),
//We have to find an actual clip to ensure that it exists m_uuid( uuid ),
m_clip( workflow->clip( uuid )->clip ),
m_newTrackId( trackId ), m_newTrackId( trackId ),
m_oldTrackId( workflow->trackId( uuid ) ), m_oldTrackId( workflow->trackId( uuid ) ),
m_newPos( pos ), m_newPos( pos ),
...@@ -179,14 +178,9 @@ Commands::Clip::Move::retranslate() ...@@ -179,14 +178,9 @@ Commands::Clip::Move::retranslate()
void void
Commands::Clip::Move::internalRedo() Commands::Clip::Move::internalRedo()
{ {
if ( !m_clip ) auto ret = m_workflow->moveClip( m_uuid, m_newTrackId, m_newPos );
{
invalidate();
return;
}
auto ret = m_workflow->moveClip( m_clip->uuid(), m_newTrackId, m_newPos );
if ( ret == true ) if ( ret == true )
emit Core::instance()->workflow()->clipMoved( m_clip->uuid().toString() ); emit Core::instance()->workflow()->clipMoved( m_uuid.toString() );
else else
invalidate(); invalidate();
} }
...@@ -194,14 +188,9 @@ Commands::Clip::Move::internalRedo() ...@@ -194,14 +188,9 @@ Commands::Clip::Move::internalRedo()
void void
Commands::Clip::Move::internalUndo() Commands::Clip::Move::internalUndo()
{ {
if ( !m_clip ) auto ret = m_workflow->moveClip( m_uuid, m_oldTrackId, m_oldPos );
{
invalidate();
return;
}
auto ret = m_workflow->moveClip( m_clip->uuid(), m_oldTrackId, m_oldPos );
if ( ret == true ) if ( ret == true )
emit Core::instance()->workflow()->clipMoved( m_clip->uuid().toString() ); emit Core::instance()->workflow()->clipMoved( m_uuid.toString() );
else else
invalidate(); invalidate();
} }
......
...@@ -104,7 +104,7 @@ namespace Commands ...@@ -104,7 +104,7 @@ namespace Commands
private: private:
std::shared_ptr<SequenceWorkflow> m_workflow; std::shared_ptr<SequenceWorkflow> m_workflow;
QSharedPointer<::Clip> m_clip; QUuid m_uuid;
quint32 m_newTrackId; quint32 m_newTrackId;
quint32 m_oldTrackId; quint32 m_oldTrackId;
qint64 m_newPos; qint64 m_newPos;
......
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