Commit 24f87514 authored by luyikei's avatar luyikei Committed by Hugo Beauzée-Luyssen

Remove TrackWorkflow::type()

Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent 43143768
......@@ -117,8 +117,6 @@ Commands::Clip::Move::Move( TrackWorkflow *oldTrack, TrackWorkflow *newTrack,
m_newPos( newPos )
{
Q_ASSERT( oldTrack->type() == newTrack->type() );
m_oldPos = oldTrack->getClipPosition( clipHelper->uuid() );
connect( clipHelper->clip(), SIGNAL( destroyed() ), this, SLOT( invalidate() ) );
retranslate();
......
......@@ -248,64 +248,64 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
if ( m_itemsLoaded.contains( helper->uuid() ) )
return ;
qint32 track = tw->trackId();
Workflow::TrackType trackType = tw->type();
// If there is not enough tracks to insert
// the clip do it now.
if ( trackType == Workflow::VideoTrack )
{
if ( track + 1 >= m_numVideoTrack )
{
int nbTrackToAdd = ( track + 2 ) - m_numVideoTrack;
for ( int i = 0; i < nbTrackToAdd; ++i )
addTrack( Workflow::VideoTrack );
}
}
else if ( trackType == Workflow::AudioTrack )
{
if ( track + 1 >= m_numAudioTrack )
{
int nbTrackToAdd = ( track + 2 ) - m_numAudioTrack;
for ( int i = 0; i < nbTrackToAdd; ++i )
addTrack( Workflow::AudioTrack );
}
}
AbstractGraphicsItem *item = nullptr;
ClipHelper *clipHelper = qobject_cast<ClipHelper*>( helper );
if ( clipHelper != nullptr )
{
AbstractGraphicsMediaItem *mediaItem = nullptr;
if ( trackType == Workflow::VideoTrack )
bool hasVideo = clipHelper->formats() & ClipHelper::Video;
bool hasAudio = clipHelper->formats() & ClipHelper::Audio;
// If there is not enough tracks to insert
// the clip do it now.
if ( hasVideo )
{
if ( track + 1 >= m_numVideoTrack )
{
int nbTrackToAdd = ( track + 2 ) - m_numVideoTrack;
for ( int i = 0; i < nbTrackToAdd; ++i )
addTrack( Workflow::VideoTrack );
}
mediaItem = new GraphicsMovieItem( clipHelper );
connect( mediaItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
}
else if ( trackType == Workflow::AudioTrack )
else if ( hasAudio )
{
if ( track + 1 >= m_numAudioTrack )
{
int nbTrackToAdd = ( track + 2 ) - m_numAudioTrack;
for ( int i = 0; i < nbTrackToAdd; ++i )
addTrack( Workflow::AudioTrack );
}
mediaItem = new GraphicsAudioItem( clipHelper );
connect( mediaItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
}
item = mediaItem;
m_itemsLoaded.insert( helper->uuid() );
item->m_tracksView = this;
item->setHeight( item->itemHeight() );
item->setTrack( getTrack( trackType, track ) );
if ( hasVideo )
item->setTrack( getTrack( Workflow::VideoTrack, track ) );
else if ( hasAudio )
item->setTrack( getTrack( Workflow::AudioTrack, track ) );
item->setStartPos( start );
item->m_oldTrack = tw;
moveItem( item, track, start );
//If the item has some effects:
foreach ( EffectHelper *effectHelper, clipHelper->clipWorkflow()->effects( Effect::Filter ) )
{
addEffectItem( effectHelper, trackType, track, start );
addEffectItem( effectHelper, Workflow::VideoTrack, track, start );
}
}
else
{
EffectHelper *effectHelper = qobject_cast<EffectHelper*>( helper );
addEffectItem( effectHelper, trackType, track, start );
addEffectItem( effectHelper, Workflow::VideoTrack, track, start );
}
updateDuration();
}
......@@ -743,18 +743,21 @@ TracksView::findPosition( AbstractGraphicsItem *item, qint32 track, qint64 time
void
TracksView::removeItem( TrackWorkflow *tw, const QUuid &uuid )
{
GraphicsTrack *track = getTrack( tw->type(), tw->trackId() );
for ( int i = 0; i < Workflow::NbTrackType; ++i )
{
GraphicsTrack *track = getTrack( (Workflow::TrackType)i, tw->trackId() );
if ( track == nullptr )
return ;
QList<QGraphicsItem*> trackItems = track->childItems();;
if ( track == nullptr )
return ;
QList<QGraphicsItem*> trackItems = track->childItems();;
for ( int i = 0; i < trackItems.size(); ++i )
{
AbstractGraphicsItem *item = dynamic_cast<AbstractGraphicsItem*>( trackItems.at( i ) );
if ( !item || item->uuid() != uuid )
continue;
removeItem( item );
for ( int i = 0; i < trackItems.size(); ++i )
{
AbstractGraphicsItem *item = dynamic_cast<AbstractGraphicsItem*>( trackItems.at( i ) );
if ( !item || item->uuid() != uuid )
continue;
removeItem( item );
}
}
}
......
......@@ -46,7 +46,6 @@
TrackWorkflow::TrackWorkflow( quint32 trackId ) :
m_length( 0 ),
m_trackType( Workflow::NbTrackType ),
m_trackId( trackId )
{
m_clipsLock = new QReadWriteLock;
......@@ -675,12 +674,6 @@ TrackWorkflow::trackId() const
return m_trackId;
}
Workflow::TrackType
TrackWorkflow::type() const
{
return m_trackType;
}
EffectsEngine::EffectList*
TrackWorkflow::filters()
{
......
......@@ -94,7 +94,6 @@ class TrackWorkflow : public EffectUser
void stopFrameComputing();
bool hasNoMoreFrameToRender( qint64 currentFrame ) const;
quint32 trackId() const;
Workflow::TrackType type() const;
//FIXME: this is not thread safe if the list gets modified (but it can't be const, as it is intended to be modified...)
EffectsEngine::EffectList *filters();
EffectsEngine::EffectList *mixers();
......@@ -123,7 +122,6 @@ class TrackWorkflow : public EffectUser
QReadWriteLock* m_clipsLock;
const Workflow::TrackType m_trackType;
qint64 m_lastFrame[Workflow::NbTrackType];
Workflow::Frame *m_mixerBuffer;
const quint32 m_trackId;
......
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