Commit e461e760 authored by Ludovic Fauvet's avatar Ludovic Fauvet

UndoRedo: support grouped actions for AddClip and MoveClip

parent 8eca7c4f
......@@ -53,6 +53,16 @@ void UndoStack::push( QUndoCommand* command )
m_undoStack->push( command );
}
void UndoStack::beginMacro( const QString& text )
{
m_undoStack->beginMacro( text );
}
void UndoStack::endMacro()
{
m_undoStack->endMacro();
}
void UndoStack::clear()
{
m_undoStack->clear();
......
......@@ -38,6 +38,8 @@ class UndoStack : public QUndoView, public QSingleton<UndoStack>
public:
void push( QUndoCommand* command );
void beginMacro( const QString& text );
void endMacro();
private:
UndoStack( QWidget* parent );
......
......@@ -482,6 +482,8 @@ void TracksView::dropEvent( QDropEvent* event )
{
qreal mappedXPos = ( mapToScene( event->pos() ).x() + 0.5 );;
UndoStack::getInstance()->beginMacro( "Add clip" );
if ( m_dragAudioItem )
{
updateDuration();
......@@ -518,6 +520,8 @@ void TracksView::dropEvent( QDropEvent* event )
MainWorkflow::VideoTrack ) );
m_dragVideoItem = NULL;
}
UndoStack::getInstance()->endMacro();
}
void TracksView::setDuration( int duration )
......@@ -722,6 +726,8 @@ void TracksView::mouseReleaseEvent( QMouseEvent* event )
if ( getTrack( MainWorkflow::AudioTrack, m_numAudioTrack - 1 )->childItems().count() > 0 )
addAudioTrack();
UndoStack::getInstance()->beginMacro( "Move clip" );
Commands::trigger( new Commands::MainWorkflow::MoveClip( m_mainWorkflow,
m_actionItem->clip()->getUuid(),
m_actionItem->oldTrackNumber,
......@@ -743,6 +749,8 @@ void TracksView::mouseReleaseEvent( QMouseEvent* event )
m_actionItem->groupItem()->oldPosition = m_actionItem->groupItem()->startPos();
}
UndoStack::getInstance()->endMacro();
m_actionItem->oldTrackNumber = m_actionItem->trackNumber();
m_actionItem->oldPosition = m_actionItem->startPos();
m_actionRelativeX = -1;
......
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