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

ClipWorkflow: Removed Uuid, using ClipHelper instead.

parent 998a6fd1
......@@ -61,19 +61,19 @@ Commands::MainWorkflow::AddClip::~AddClip()
void Commands::MainWorkflow::AddClip::redo()
{
m_uuid = ::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType, m_undoRedoAction );
m_clipHelper = ::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType, m_undoRedoAction );
m_undoRedoAction = false;
}
void Commands::MainWorkflow::AddClip::undo()
{
::MainWorkflow::getInstance()->removeClip( m_clip->uuid(), m_trackNumber, m_trackType );
::MainWorkflow::getInstance()->removeClip( m_clipHelper->uuid(), m_trackNumber, m_trackType );
}
const QUuid&
Commands::MainWorkflow::AddClip::uuid() const
ClipHelper*
Commands::MainWorkflow::AddClip::clipHelper()
{
return m_uuid;
return m_clipHelper;
}
Commands::MainWorkflow::MoveClip::MoveClip( ::MainWorkflow* workflow, const QUuid& uuid,
......@@ -120,7 +120,7 @@ void Commands::MainWorkflow::RemoveClip::redo()
}
void Commands::MainWorkflow::RemoveClip::undo()
{
m_uuid = ::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType, true );
m_uuid = (::MainWorkflow::getInstance()->addClip( m_clip, m_trackNumber, m_pos, m_trackType, true ))->uuid();
}
Commands::MainWorkflow::ResizeClip::ResizeClip( const QUuid& uuid,
......
......@@ -33,6 +33,7 @@
#include "MainWorkflow.h"
class Clip;
class ClipHelper;
#define NEW_COMMAND(x) class x : public Generic
......@@ -66,13 +67,13 @@ namespace Commands
virtual ~AddClip();
virtual void redo();
virtual void undo();
const QUuid &uuid() const;
ClipHelper *clipHelper();
private:
Clip* m_clip;
unsigned int m_trackNumber;
qint64 m_pos;
::MainWorkflow::TrackType m_trackType;
QUuid m_uuid;
ClipHelper *m_clipHelper;
bool m_undoRedoAction;
};
......
......@@ -71,7 +71,7 @@ public:
/// Should return the unique uid of the contained media.
virtual const QUuid& uuid() const
{
return m_uuid;
return m_clipHelper->uuid();
}
/// Clip contained in the item
......@@ -182,7 +182,7 @@ private:
//FIXME: this is a nasty forest boolean
bool m_resizeExpected;
QUuid m_uuid;
ClipHelper* m_clipHelper;
};
#endif // ABSTRACTGRAPHICSMEDIAITEM_H
......@@ -678,7 +678,7 @@ TracksView::dropEvent( QDropEvent *event )
(qint64)mappedXPos,
MainWorkflow::AudioTrack );
Commands::trigger( clip );
m_dragAudioItem->m_uuid = clip->uuid();
m_dragAudioItem->m_clipHelper = clip->clipHelper();
m_dragAudioItem = NULL;
}
......@@ -698,7 +698,7 @@ TracksView::dropEvent( QDropEvent *event )
(qint64)mappedXPos,
MainWorkflow::VideoTrack );
Commands::trigger( clip );
m_dragVideoItem->m_uuid = clip->uuid();
m_dragVideoItem->m_clipHelper = clip->clipHelper();
m_dragVideoItem = NULL;
}
......
......@@ -33,6 +33,7 @@ ClipHelper::ClipHelper( Clip* clip, qint64 begin /*= -1*/, qint64 end /*= -1*/ )
m_begin = clip->begin();
if ( end == -1 )
m_end = clip->end();
m_uuid = QUuid::createUuid();
}
void
......
......@@ -26,6 +26,7 @@
class Clip;
#include <QtGlobal>
#include <QUuid>
class ClipHelper
{
......@@ -51,11 +52,16 @@ class ClipHelper
* \return The length in frames
*/
qint64 length() const;
const QUuid& uuid() const
{
return m_uuid;
}
private:
Clip* m_clip;
qint64 m_begin;
qint64 m_end;
QUuid m_uuid;
};
#endif // CLIPHELPER_H
......@@ -43,7 +43,6 @@ ClipWorkflow::ClipWorkflow( Clip::Clip* clip ) :
m_initWaitCond = new WaitCondition;
m_renderLock = new QMutex;
m_renderWaitCond = new QWaitCondition;
m_uuid = QUuid::createUuid();
m_clipHelper = new ClipHelper( clip );
}
......
......@@ -193,18 +193,6 @@ class ClipWorkflow : public QObject
*/
bool isResyncRequired();
/**
* \return The ClipWorkflow's UUID
*
* This is not to be confused with the clip's uuid. Many ClipWorkflow can base
* themselves on the same clip, and would have different uuid, though calling
* clip()->uuid() on them would return the same result.
*/
inline const QUuid &uuid() const
{
return m_uuid;
}
private:
void setState( State state );
void adjustBegin();
......@@ -262,7 +250,6 @@ class ClipWorkflow : public QObject
qint64 m_beginPausePts;
qint64 m_pauseDuration;
bool m_fullSpeedRender;
QUuid m_uuid;
private slots:
void loadingComplete();
......
......@@ -72,17 +72,17 @@ MainWorkflow::~MainWorkflow()
delete MainWorkflow::blackOutput;
}
const QUuid&
ClipHelper*
MainWorkflow::addClip( Clip *clip, unsigned int trackId,
qint64 start, MainWorkflow::TrackType trackType,
bool informGui )
{
const QUuid& uuid = m_tracks[trackType]->addClip( clip, trackId, start );
ClipHelper *ch = m_tracks[trackType]->addClip( clip, trackId, start );
computeLength();
//Inform the GUI
if ( informGui == true )
emit clipAdded( clip, trackId, start, trackType );
return uuid;
return ch;
}
void
......
......@@ -34,6 +34,7 @@ class QReadWriteLock;
class QXmlStreamWriter;
class Clip;
class ClipHelper;
class EffectsEngine;
class LightVideoFrame;
class TrackHandler;
......@@ -101,9 +102,9 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
* 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.
* \return A ClipHelper, based on the newly inserted Clip.
*/
const QUuid& addClip( Clip* clip, unsigned int trackId, qint64 start,
ClipHelper* addClip( Clip* clip, unsigned int trackId, qint64 start,
TrackType type, bool informGui );
/**
......
......@@ -58,13 +58,13 @@ TrackHandler::~TrackHandler()
delete[] m_tracks;
}
const QUuid&
ClipHelper*
TrackHandler::addClip( Clip* clip, unsigned int trackId, qint64 start )
{
Q_ASSERT_X( trackId < m_trackCount, "MainWorkflow::addClip",
"The specified trackId isn't valid, for it's higher than the number of tracks");
const QUuid& uuid = m_tracks[trackId]->addClip( clip, start );
ClipHelper* ch = m_tracks[trackId]->addClip( clip, start );
//Now check if this clip addition has changed something about the workflow's length
if ( m_tracks[trackId]->getLength() > m_length )
......@@ -73,7 +73,7 @@ TrackHandler::addClip( Clip* clip, unsigned int trackId, qint64 start )
//if the track is deactivated, we need to reactivate it.
if ( m_tracks[trackId].deactivated() == true )
activateTrack( trackId );
return uuid;
return ch;
}
void
......
......@@ -27,6 +27,7 @@
#include "Toggleable.hpp"
#include "MainWorkflow.h"
class ClipHelper;
class TrackWorkflow;
class QXmlStreamWriter;
......@@ -46,7 +47,7 @@ class TrackHandler : public QObject
* \param trackId The track identifier.
* \param start The new clip starting position.
*/
const QUuid &addClip( Clip* clip, unsigned int trackId, qint64 start );
ClipHelper *addClip( Clip* clip, unsigned int trackId, qint64 start );
/**
* Returns the number of tracks in this handler
*/
......
......@@ -65,7 +65,7 @@ TrackWorkflow::~TrackWorkflow()
delete m_renderOneFrameMutex;
}
const QUuid&
ClipHelper*
TrackWorkflow::addClip( Clip* clip, qint64 start )
{
ClipWorkflow* cw;
......@@ -79,7 +79,7 @@ TrackWorkflow::addClip( Clip* clip, qint64 start )
else
cw = new AudioClipWorkflow( clip );
addClip( cw, start );
return cw->uuid();
return cw->getClipHelper();
}
void
......@@ -115,7 +115,7 @@ qint64 TrackWorkflow::getClipPosition( const QUuid& uuid ) const
while ( it != end )
{
if ( it.value()->uuid() == uuid )
if ( it.value()->getClipHelper()->uuid() == uuid )
return it.key();
++it;
}
......@@ -129,7 +129,7 @@ Clip* TrackWorkflow::getClip( const QUuid& uuid )
while ( it != end )
{
if ( it.value()->uuid() == uuid )
if ( it.value()->getClipHelper()->uuid() == uuid )
return it.value()->clip();
++it;
}
......@@ -329,7 +329,7 @@ void TrackWorkflow::moveClip( const QUuid& id, qint64 startingFrame )
while ( it != end )
{
if ( it.value()->uuid() == id )
if ( it.value()->getClipHelper()->uuid() == id )
{
ClipWorkflow* cw = it.value();
m_clips.erase( it );
......@@ -353,7 +353,7 @@ Clip* TrackWorkflow::removeClip( const QUuid& id )
while ( it != end )
{
if ( it.value()->uuid() == id )
if ( it.value()->getClipHelper()->uuid() == id )
{
ClipWorkflow* cw = it.value();
Clip* clip = cw->clip();
......@@ -380,7 +380,7 @@ ClipWorkflow* TrackWorkflow::removeClipWorkflow( const QUuid& id )
while ( it != end )
{
if ( it.value()->uuid() == id )
if ( it.value()->getClipHelper()->uuid() == id )
{
ClipWorkflow* cw = it.value();
cw->disconnect();
......@@ -462,7 +462,7 @@ TrackWorkflow::muteClip( const QUuid &uuid )
while ( it != end )
{
if ( it.value()->uuid() == uuid )
if ( it.value()->getClipHelper()->uuid() == uuid )
{
it.value()->mute();
return ;
......@@ -483,7 +483,7 @@ TrackWorkflow::unmuteClip( const QUuid &uuid )
while ( it != end )
{
if ( it.value()->uuid() == uuid )
if ( it.value()->getClipHelper()->uuid() == uuid )
{
it.value()->unmute();
return ;
......
......@@ -60,7 +60,7 @@ class TrackWorkflow : public QObject
void moveClip( const QUuid& id, qint64 startingFrame );
Clip* removeClip( const QUuid& id );
ClipWorkflow* removeClipWorkflow( const QUuid& id );
const QUuid &addClip( Clip*, qint64 start );
ClipHelper *addClip( Clip*, qint64 start );
void addClip( ClipWorkflow*, qint64 start );
qint64 getClipPosition( const QUuid& uuid ) const;
Clip* getClip( const QUuid& uuid );
......
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