Commit acf53111 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Don't add a Clip twice.

The forest boolean is back !
parent 0287faa4
......@@ -44,11 +44,13 @@ void Commands::trigger( Commands::Generic* command )
Commands::MainWorkflow::AddClip::AddClip( Clip* clip,
unsigned int trackNumber, qint64 pos,
::MainWorkflow::TrackType trackType ) :
::MainWorkflow::TrackType trackType,
bool undoRedoAction /*= false*/ ) :
m_clip( clip ),
m_trackNumber( trackNumber ),
m_pos( pos ),
m_trackType( trackType )
m_trackType( trackType ),
m_undoRedoAction( undoRedoAction )
{
setText( QObject::tr( "Adding clip to track %1" ).arg( QString::number( trackNumber ) ) );
}
......@@ -59,7 +61,8 @@ Commands::MainWorkflow::AddClip::~AddClip()
void Commands::MainWorkflow::AddClip::redo()
{
m_uuid = ::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType );
m_uuid = ::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType, m_undoRedoAction );
m_undoRedoAction = false;
}
void Commands::MainWorkflow::AddClip::undo()
......@@ -116,7 +119,7 @@ void Commands::MainWorkflow::RemoveClip::redo()
}
void Commands::MainWorkflow::RemoveClip::undo()
{
::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType );
::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType, true );
}
Commands::MainWorkflow::ResizeClip::ResizeClip( const QUuid& uuid,
......
......@@ -62,7 +62,7 @@ namespace Commands
{
public:
AddClip( Clip* clip, unsigned int trackNumber, qint64 pos,
::MainWorkflow::TrackType trackType );
::MainWorkflow::TrackType trackType, bool undoRedoAction = false );
virtual ~AddClip();
virtual void redo();
virtual void undo();
......@@ -73,6 +73,7 @@ namespace Commands
qint64 m_pos;
::MainWorkflow::TrackType m_trackType;
QUuid m_uuid;
bool m_undoRedoAction;
};
NEW_COMMAND( MoveClip )
......
......@@ -74,12 +74,14 @@ MainWorkflow::~MainWorkflow()
const QUuid&
MainWorkflow::addClip( Clip *clip, unsigned int trackId,
qint64 start, MainWorkflow::TrackType trackType )
qint64 start, MainWorkflow::TrackType trackType,
bool informGui )
{
const QUuid& uuid = m_tracks[trackType]->addClip( clip, trackId, start );
computeLength();
//Inform the GUI
emit clipAdded( clip, trackId, start, trackType );
if ( informGui == true )
emit clipAdded( clip, trackId, start, trackType );
return uuid;
}
......@@ -325,7 +327,7 @@ MainWorkflow::loadProject( const QDomElement &root )
if ( c != NULL )
{
addClip( new Clip( c, begin.toLongLong(), end.toLongLong() ),
trackId, startFrame.toLongLong(), type );
trackId, startFrame.toLongLong(), type, true );
}
clip = clip.nextSibling().toElement();
}
......@@ -416,7 +418,7 @@ MainWorkflow::split( Clip* toSplit, Clip* newClip, quint32 trackId, qint64 newCl
newClip = new Clip( toSplit, newClipBegin, toSplit->end() );
toSplit->setEnd( newClipBegin, true );
addClip( newClip, trackId, newClipPos, trackType );
addClip( newClip, trackId, newClipPos, trackType, true );
return newClip;
}
......
......@@ -97,12 +97,14 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
* \param trackId The number of the track (starting at 0)
* \param start The clip's starting position
* \param type The track type (audio or video)
* \param informGui Will be false if the action is queried by the GUI.
* true otherwise.
* \sa removeClip( const QUuid&, unsigned int, MainWorkflow::TrackType )
* \sa clipAdded( Clip*, unsigned int, qint64, MainWorkflow::TrackType )
* \return The newly inserted ClipWorkflow's UUID.
*/
const QUuid& addClip( Clip* clip, unsigned int trackId, qint64 start,
TrackType type );
TrackType type, bool informGui );
/**
* \brief Initialize the workflow for the render.
......
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