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

Relocating TrackType to Types.h, in the Workflow namespace.

parent ac5e3396
......@@ -45,7 +45,7 @@ void Commands::trigger( Commands::Generic* command )
Commands::MainWorkflow::AddClip::AddClip( ClipHelper* ch,
unsigned int trackNumber, qint64 pos,
::MainWorkflow::TrackType trackType,
Workflow::TrackType trackType,
bool undoRedoAction /*= false*/ ) :
m_trackNumber( trackNumber ),
m_pos( pos ),
......@@ -73,7 +73,7 @@ void Commands::MainWorkflow::AddClip::undo()
Commands::MainWorkflow::MoveClip::MoveClip( ::MainWorkflow* workflow, const QUuid& uuid,
unsigned int oldTrack, unsigned int newTrack, qint64 newPos,
::MainWorkflow::TrackType trackType ) :
Workflow::TrackType trackType ) :
m_workflow( workflow ), m_uuid( uuid ), m_oldTrack( oldTrack ),
m_newTrack( newTrack ), m_pos( newPos ), m_trackType( trackType )
{
......@@ -101,7 +101,7 @@ void Commands::MainWorkflow::MoveClip::undo()
}
Commands::MainWorkflow::RemoveClip::RemoveClip( ClipHelper* ch, quint32 trackNumber,
qint64 pos, ::MainWorkflow::TrackType trackType ) :
qint64 pos, Workflow::TrackType trackType ) :
m_clipHelper( ch ), m_trackNumber( trackNumber ),
m_pos( pos ), m_trackType( trackType )
{
......@@ -122,7 +122,7 @@ Commands::MainWorkflow::ResizeClip::ResizeClip( ClipHelper* clipHelper,
qint64 oldBegin, qint64 oldEnd,
qint64 newPos, qint64 oldPos,
quint32 trackId,
::MainWorkflow::TrackType trackType ) :
Workflow::TrackType trackType ) :
m_newBegin( newBegin ),
m_newEnd( newEnd ),
m_oldBegin( oldBegin ),
......@@ -160,7 +160,7 @@ void Commands::MainWorkflow::ResizeClip::undo()
}
Commands::MainWorkflow::SplitClip::SplitClip( ClipHelper* toSplit, quint32 trackId,
qint64 newClipPos, qint64 newClipBegin, ::MainWorkflow::TrackType trackType ) :
qint64 newClipPos, qint64 newClipBegin, Workflow::TrackType trackType ) :
m_toSplit( toSplit ),
m_newClip( NULL ),
m_trackId( trackId ),
......
......@@ -31,6 +31,7 @@
#include <QObject>
#include <QVector>
#include "MainWorkflow.h"
#include "Types.h"
class Clip;
class ClipHelper;
......@@ -63,14 +64,14 @@ namespace Commands
{
public:
AddClip( ClipHelper* ch, unsigned int trackNumber, qint64 pos,
::MainWorkflow::TrackType trackType, bool undoRedoAction = false );
Workflow::TrackType trackType, bool undoRedoAction = false );
virtual ~AddClip();
virtual void redo();
virtual void undo();
private:
unsigned int m_trackNumber;
qint64 m_pos;
::MainWorkflow::TrackType m_trackType;
Workflow::TrackType m_trackType;
ClipHelper *m_clipHelper;
bool m_undoRedoAction;
};
......@@ -80,7 +81,7 @@ namespace Commands
public:
MoveClip( ::MainWorkflow* workflow, const QUuid& uuid,
unsigned int oldTrack, unsigned int newTrack,
qint64 newPos, ::MainWorkflow::TrackType trackType );
qint64 newPos, Workflow::TrackType trackType );
virtual void redo();
virtual void undo();
......@@ -92,14 +93,14 @@ namespace Commands
qint64 m_pos;
qint64 m_oldPos;
bool m_undoRedoAction;
::MainWorkflow::TrackType m_trackType;
Workflow::TrackType m_trackType;
};
NEW_COMMAND( RemoveClip )
{
public:
RemoveClip( ClipHelper* clip, unsigned int trackNumber,
qint64 pos, ::MainWorkflow::TrackType trackType );
qint64 pos, Workflow::TrackType trackType );
virtual void redo();
virtual void undo();
......@@ -107,7 +108,7 @@ namespace Commands
ClipHelper* m_clipHelper;
unsigned int m_trackNumber;
qint64 m_pos;
::MainWorkflow::TrackType m_trackType;
Workflow::TrackType m_trackType;
};
/**
......@@ -127,7 +128,7 @@ namespace Commands
ResizeClip( ClipHelper* clipHelper,
qint64 newBegin, qint64 newEnd, qint64 oldBegin,
qint64 oldEnd, qint64 newPos, qint64 oldPos,
quint32 trackId, ::MainWorkflow::TrackType trackType );
quint32 trackId, Workflow::TrackType trackType );
virtual void redo();
virtual void undo();
private:
......@@ -139,7 +140,7 @@ namespace Commands
qint64 m_oldPos;
quint32 m_trackId;
ClipHelper* m_clipHelper;
::MainWorkflow::TrackType m_trackType;
Workflow::TrackType m_trackType;
bool m_undoRedoAction;
};
......@@ -147,7 +148,7 @@ namespace Commands
{
public:
SplitClip( ClipHelper* toSplit, quint32 trackId, qint64 newClipPos,
qint64 newClipBegin, ::MainWorkflow::TrackType trackType );
qint64 newClipBegin, Workflow::TrackType trackType );
~SplitClip();
virtual void redo();
virtual void undo();
......@@ -157,7 +158,7 @@ namespace Commands
quint32 m_trackId;
qint64 m_newClipPos;
qint64 m_newClipBegin;
::MainWorkflow::TrackType m_trackType;
Workflow::TrackType m_trackType;
};
}
}
......
......@@ -72,7 +72,7 @@ MainWindow::MainWindow( QWidget *parent ) :
{
m_ui.setupUi( this );
qRegisterMetaType<MainWorkflow::TrackType>( "MainWorkflow::TrackType" );
qRegisterMetaType<Workflow::TrackType>( "Workflow::TrackType" );
qRegisterMetaType<MainWorkflow::FrameChangedReason>( "MainWorkflow::FrameChangedReason" );
qRegisterMetaType<QVariant>( "QVariant" );
......
......@@ -76,7 +76,7 @@ public:
TracksScene* scene();
/// Return the type of the media
virtual MainWorkflow::TrackType mediaType() const = 0;
virtual Workflow::TrackType mediaType() const = 0;
/// Group two items together
void group( AbstractGraphicsMediaItem* item );
......
......@@ -66,9 +66,9 @@ GraphicsAudioItem::~GraphicsAudioItem()
{
}
MainWorkflow::TrackType GraphicsAudioItem::mediaType() const
Workflow::TrackType GraphicsAudioItem::mediaType() const
{
return MainWorkflow::AudioTrack;
return Workflow::AudioTrack;
}
void GraphicsAudioItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* )
......
......@@ -51,7 +51,7 @@ public:
virtual int type() const { return Type; }
virtual bool expandable() const { return false; }
virtual bool moveable() const { return true; }
virtual MainWorkflow::TrackType mediaType() const;
virtual Workflow::TrackType mediaType() const;
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 );
protected:
......
......@@ -66,9 +66,9 @@ GraphicsMovieItem::~GraphicsMovieItem()
{
}
MainWorkflow::TrackType GraphicsMovieItem::mediaType() const
Workflow::TrackType GraphicsMovieItem::mediaType() const
{
return MainWorkflow::VideoTrack;
return Workflow::VideoTrack;
}
void GraphicsMovieItem::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* )
......
......@@ -52,7 +52,7 @@ public:
virtual int type() const { return Type; }
virtual bool expandable() const { return false; }
virtual bool moveable() const { return true; }
virtual MainWorkflow::TrackType mediaType() const;
virtual Workflow::TrackType mediaType() const;
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 );
protected:
......
......@@ -24,7 +24,7 @@
#include "TracksView.h"
#include "GraphicsTrack.h"
GraphicsTrack::GraphicsTrack( MainWorkflow::TrackType type, quint32 trackNumber,
GraphicsTrack::GraphicsTrack( Workflow::TrackType type, quint32 trackNumber,
QGraphicsItem *parent ) : QGraphicsWidget( parent )
{
m_type = type;
......@@ -75,7 +75,7 @@ GraphicsTrack::trackNumber()
return m_trackNumber;
}
MainWorkflow::TrackType
Workflow::TrackType
GraphicsTrack::mediaType()
{
return m_type;
......
......@@ -36,7 +36,7 @@ class GraphicsTrack : public QGraphicsWidget
public:
enum { Type = UserType + 2 };
GraphicsTrack( MainWorkflow::TrackType type, quint32 trackNumber,
GraphicsTrack( Workflow::TrackType type, quint32 trackNumber,
QGraphicsItem *parent = 0 );
void setHeight( int height );
......@@ -44,13 +44,13 @@ public:
void setTrackEnabled( bool enabled );
bool isEnabled();
quint32 trackNumber();
MainWorkflow::TrackType mediaType();
Workflow::TrackType mediaType();
virtual int type() const { return Type; }
QList<AbstractGraphicsMediaItem*> childs();
private:
MainWorkflow::TrackType m_type;
Workflow::TrackType m_type;
quint32 m_trackNumber;
bool m_enabled;
};
......
......@@ -85,12 +85,12 @@ Timeline::Timeline( WorkflowRenderer* renderer, QWidget *parent ) :
connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) );
// Clip actions
connect( m_mainWorkflow, SIGNAL( clipAdded(ClipHelper*,uint,qint64,MainWorkflow::TrackType ) ),
this, SLOT( actionAddClip(ClipHelper*,uint,qint64,MainWorkflow::TrackType ) ) );
connect( m_mainWorkflow, SIGNAL( clipMoved(QUuid, uint, qint64,MainWorkflow::TrackType ) ),
this, SLOT( actionMoveClip(QUuid,uint,qint64,MainWorkflow::TrackType ) ) );
connect( m_mainWorkflow, SIGNAL( clipRemoved(const QUuid&,uint,MainWorkflow::TrackType ) ),
this, SLOT( actionRemoveClip(const QUuid&,uint,MainWorkflow::TrackType )) );
connect( m_mainWorkflow, SIGNAL( clipAdded( ClipHelper*, uint, qint64, Workflow::TrackType ) ),
this, SLOT( actionAddClip(ClipHelper*, uint, qint64, Workflow::TrackType ) ) );
connect( m_mainWorkflow, SIGNAL( clipMoved( QUuid, uint, qint64, Workflow::TrackType ) ),
this, SLOT( actionMoveClip(QUuid, uint, qint64, Workflow::TrackType ) ) );
connect( m_mainWorkflow, SIGNAL( clipRemoved( const QUuid&, uint, Workflow::TrackType ) ),
this, SLOT( actionRemoveClip( const QUuid&, uint, Workflow::TrackType )) );
// Clear / reset
connect( m_mainWorkflow, SIGNAL( cleared() ), m_tracksControls, SLOT( clear() ) );
......@@ -163,12 +163,12 @@ void Timeline::setTool( ToolButtons button )
tracksView()->setTool( button );
}
void Timeline::actionAddClip( ClipHelper* clipHelper, unsigned int track, qint64 start, MainWorkflow::TrackType trackType )
void Timeline::actionAddClip( ClipHelper* clipHelper, unsigned int track, qint64 start, Workflow::TrackType trackType )
{
tracksView()->addMediaItem( clipHelper, track, trackType, start );
}
void Timeline::actionMoveClip( const QUuid& uuid, unsigned int track, qint64 time, MainWorkflow::TrackType )
void Timeline::actionMoveClip( const QUuid& uuid, unsigned int track, qint64 time, Workflow::TrackType )
{
tracksView()->moveMediaItem( uuid, track, time );
Q_ASSERT( tracksView()->setItemOldTrack( uuid, track ) == true );
......@@ -176,7 +176,7 @@ void Timeline::actionMoveClip( const QUuid& uuid, unsigned int track, qint64 tim
tracksRuler()->update();
}
void Timeline::actionRemoveClip( const QUuid &uuid, unsigned int track, MainWorkflow::TrackType trackType )
void Timeline::actionRemoveClip( const QUuid &uuid, unsigned int track, Workflow::TrackType trackType )
{
tracksView()->removeMediaItem( uuid, track, trackType );
}
......
......@@ -85,20 +85,20 @@ public slots:
* \param start The position in frames.
* \param
*/
void actionAddClip( ClipHelper* clip, unsigned int track, qint64 start, MainWorkflow::TrackType trackType );
void actionAddClip( ClipHelper* clip, unsigned int track, qint64 start, Workflow::TrackType trackType );
/**
* \brief Move an item in the timeline.
* \param uuid The Universally Unique Identifier of the item.
* \param track The new track of the item.
* \param time The new position (in frames) of the item.
*/
void actionMoveClip( const QUuid& uuid, unsigned int track, qint64 time, MainWorkflow::TrackType );
void actionMoveClip( const QUuid& uuid, unsigned int track, qint64 time, Workflow::TrackType );
/**
* \brief Remove an item from the timeline.
* \param uuid The Universally Unique Identifier of the item.
* \param track The current track of the item.
*/
void actionRemoveClip( const QUuid& uuid, unsigned int track, MainWorkflow::TrackType trackType );
void actionRemoveClip( const QUuid& uuid, unsigned int track, Workflow::TrackType trackType );
void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event );
......
This diff is collapsed.
......@@ -201,7 +201,7 @@ public slots:
* \param start The position in frames.
*/
void addMediaItem( ClipHelper *clipHelper, unsigned int track,
MainWorkflow::TrackType trackType, qint64 start );
Workflow::TrackType trackType, qint64 start );
/**
* \brief Move an item in the timeline.
* \param uuid The Universally Unique Identifier of the item.
......@@ -215,7 +215,7 @@ public slots:
* \param track The current track of the item.
* \param trackType The type of the track (Audio or Video)
*/
void removeMediaItem( const QUuid &uuid, unsigned int track, MainWorkflow::TrackType trackType );
void removeMediaItem( const QUuid &uuid, unsigned int track, Workflow::TrackType trackType );
/**
* \brief This is an overloaded method provided for convenience.
* \param item A pointer to AbstractGraphicsMediaItem.
......@@ -289,7 +289,7 @@ private:
/**
* \brief DOCUMENT ME
*/
void cleanTracks( MainWorkflow::TrackType type );
void cleanTracks( Workflow::TrackType type );
/**
* \brief This is an overloaded method provided for convenience.
......@@ -315,7 +315,7 @@ private:
* \param number The track number.
* \return A pointer to the GraphicsTrack.
*/
GraphicsTrack *getTrack( MainWorkflow::TrackType type, unsigned int number );
GraphicsTrack *getTrack( Workflow::TrackType type, unsigned int number );
QGraphicsScene *m_scene;
int m_tracksHeight;
int m_projectDuration;
......
......@@ -42,9 +42,9 @@ TrackControls::~TrackControls()
void TrackControls::updateTextLabels()
{
if ( m_track->mediaType() == MainWorkflow::VideoTrack )
if ( m_track->mediaType() == Workflow::VideoTrack )
m_ui->trackLabel->setText( tr( "Video #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
else if ( m_track->mediaType() == MainWorkflow::AudioTrack )
else if ( m_track->mediaType() == Workflow::AudioTrack )
m_ui->trackLabel->setText( tr( "Audio #%1" ).arg( QString::number( m_track->trackNumber() + 1 ) ) );
}
......@@ -66,16 +66,16 @@ void TrackControls::setTrackDisabled( bool disable )
m_track->setTrackEnabled( !disable );
if ( !disable )
{
if ( m_track->mediaType() == MainWorkflow::VideoTrack )
if ( m_track->mediaType() == Workflow::VideoTrack )
m_ui->disableButton->setIcon( QIcon( ":/images/trackon" ) );
else if ( m_track->mediaType() == MainWorkflow::AudioTrack )
else if ( m_track->mediaType() == Workflow::AudioTrack )
m_ui->disableButton->setIcon( QIcon( ":/images/hpon" ) );
}
else
{
if ( m_track->mediaType() == MainWorkflow::VideoTrack )
if ( m_track->mediaType() == Workflow::VideoTrack )
m_ui->disableButton->setIcon( QIcon( ":/images/trackoff" ) );
else if ( m_track->mediaType() == MainWorkflow::AudioTrack )
else if ( m_track->mediaType() == Workflow::AudioTrack )
m_ui->disableButton->setIcon( QIcon( ":/images/hpoff" ) );
}
}
......@@ -142,13 +142,13 @@ WorkflowRenderer::lock( void *datas, const char* cookie, qint64 *dts, qint64 *pt
{
ret = handler->self->lockVideo( handler, pts, bufferSize, buffer );
if ( paused == false )
handler->self->m_mainWorkflow->nextFrame( MainWorkflow::VideoTrack );
handler->self->m_mainWorkflow->nextFrame( Workflow::VideoTrack );
}
else if ( cookie[0] == WorkflowRenderer::AudioCookie )
{
ret = handler->self->lockAudio( handler, pts, bufferSize, buffer );
if ( paused == false )
handler->self->m_mainWorkflow->nextFrame( MainWorkflow::AudioTrack );
handler->self->m_mainWorkflow->nextFrame( Workflow::AudioTrack );
}
else
qCritical() << "Invalid imem cookie";
......@@ -164,7 +164,7 @@ WorkflowRenderer::lockVideo( EsHandler *handler, qint64 *pts, size_t *bufferSize
if ( m_stopping == true )
return 1;
ret = m_mainWorkflow->getOutput( MainWorkflow::VideoTrack, m_paused );
ret = m_mainWorkflow->getOutput( Workflow::VideoTrack, m_paused );
ptsDiff = ret->video->ptsDiff;
if ( ptsDiff == 0 )
{
......@@ -194,7 +194,7 @@ WorkflowRenderer::lockAudio( EsHandler *handler, qint64 *pts, size_t *bufferSize
if ( m_stopping == false && m_paused == false )
{
MainWorkflow::OutputBuffers* ret = m_mainWorkflow->getOutput( MainWorkflow::AudioTrack,
MainWorkflow::OutputBuffers* ret = m_mainWorkflow->getOutput( Workflow::AudioTrack,
m_paused );
renderAudioSample = ret->audio;
}
......@@ -264,7 +264,7 @@ void WorkflowRenderer::nextFrame()
void WorkflowRenderer::previousFrame()
{
if ( m_paused == true )
m_mainWorkflow->previousFrame( MainWorkflow::VideoTrack );
m_mainWorkflow->previousFrame( Workflow::VideoTrack );
}
void WorkflowRenderer::togglePlayPause( bool forcePause )
......
This diff is collapsed.
This diff is collapsed.
......@@ -27,7 +27,7 @@
#include <QDomDocument>
#include <QDomElement>
TrackHandler::TrackHandler( unsigned int nbTracks, MainWorkflow::TrackType trackType ) :
TrackHandler::TrackHandler( unsigned int nbTracks, Workflow::TrackType trackType ) :
m_trackCount( nbTracks ),
m_trackType( trackType ),
m_length( 0 )
......
......@@ -35,7 +35,7 @@ class TrackHandler : public QObject
{
Q_OBJECT
public:
TrackHandler( unsigned int nbTracks, MainWorkflow::TrackType trackType );
TrackHandler( unsigned int nbTracks, Workflow::TrackType trackType );
~TrackHandler();
/**
......@@ -110,7 +110,7 @@ class TrackHandler : public QObject
private:
Toggleable<TrackWorkflow*>* m_tracks;
unsigned int m_trackCount;
MainWorkflow::TrackType m_trackType;
Workflow::TrackType m_trackType;
qint64 m_length;
unsigned int m_highestTrackNumber;
bool m_endReached;
......
......@@ -40,7 +40,7 @@
#include <QtDebug>
TrackWorkflow::TrackWorkflow( MainWorkflow::TrackType type ) :
TrackWorkflow::TrackWorkflow( Workflow::TrackType type ) :
m_length( 0 ),
m_trackType( type ),
m_lastFrame( 0 )
......@@ -69,7 +69,7 @@ void
TrackWorkflow::addClip( ClipHelper* ch, qint64 start )
{
ClipWorkflow* cw;
if ( m_trackType == MainWorkflow::VideoTrack )
if ( m_trackType == Workflow::VideoTrack )
{
if ( ch->clip()->getMedia()->fileType() == Media::Video )
cw = new VideoClipWorkflow( ch );
......@@ -310,7 +310,7 @@ TrackWorkflow::getOutput( qint64 currentFrame, qint64 subFrame, bool paused )
{
ret = renderClip( cw, currentFrame, start, needRepositioning,
renderOneFrame, paused );
if ( m_trackType == MainWorkflow::VideoTrack )
if ( m_trackType == Workflow::VideoTrack )
{
frames[frameId] = reinterpret_cast<Workflow::Frame*>( ret );
++frameId;
......@@ -326,7 +326,7 @@ TrackWorkflow::getOutput( qint64 currentFrame, qint64 subFrame, bool paused )
++it;
}
//Handle mixers:
if ( m_trackType == MainWorkflow::VideoTrack )
if ( m_trackType == Workflow::VideoTrack )
{
EffectsEngine::MixerHelper* mixer = EffectsEngine::getMixer( m_mixers, currentFrame );
if ( mixer != NULL && frames[0] != NULL ) //There's no point using the mixer if there's no frame rendered.
......@@ -346,7 +346,7 @@ TrackWorkflow::getOutput( qint64 currentFrame, qint64 subFrame, bool paused )
m_lastFrame = subFrame;
if ( ret == NULL )
return NULL;
if ( m_trackType == MainWorkflow::VideoTrack )
if ( m_trackType == Workflow::VideoTrack )
return reinterpret_cast<Workflow::Frame*>( ret );
return reinterpret_cast<Workflow::AudioSample*>( ret );
}
......
......@@ -25,6 +25,7 @@
#include "EffectsEngine.h"
#include "MainWorkflow.h"
#include "Types.h"
#include <QObject>
#include <QMap>
......@@ -45,7 +46,7 @@ class TrackWorkflow : public QObject
Q_OBJECT
public:
TrackWorkflow( MainWorkflow::TrackType type );
TrackWorkflow( Workflow::TrackType type );
~TrackWorkflow();
void* getOutput( qint64 currentFrame,
......@@ -115,7 +116,7 @@ class TrackWorkflow : public QObject
QReadWriteLock* m_clipsLock;
MainWorkflow::TrackType m_trackType;
Workflow::TrackType m_trackType;
qint64 m_lastFrame;
Workflow::Frame *m_mixerBuffer;
double m_fps;
......
......@@ -29,6 +29,16 @@ namespace Workflow
{
const quint32 Depth = 4;
/**
* \enum Represents the potential Track types.
*/
enum TrackType
{
VideoTrack, ///< Represents a video track
AudioTrack, ///< Represents an audio track
NbTrackType, ///< Used to know how many types we have
};
class Frame
{
public:
......
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