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

TracksView: Fix auto track addition.

Replacing some AbstractGraphicsMediaItem with AbstractGraphicsItem when
appropriate.
parent ef81c0e3
......@@ -87,16 +87,16 @@ GraphicsTrack::mediaType()
return m_type;
}
QList<AbstractGraphicsMediaItem*>
QList<AbstractGraphicsItem*>
GraphicsTrack::childs()
{
QList<AbstractGraphicsMediaItem*> list;
QList<AbstractGraphicsItem*> list;
QList<QGraphicsItem*> items = childItems();
AbstractGraphicsMediaItem* item;
AbstractGraphicsItem* item;
for ( int i = 0; i < items.count(); ++i )
{
item = dynamic_cast<AbstractGraphicsMediaItem*>( items.at( i ) );
item = dynamic_cast<AbstractGraphicsItem*>( items.at( i ) );
if ( !item )
continue;
list.append( item );
......
......@@ -27,6 +27,7 @@
#include <QList>
#include "Types.h"
class AbstractGraphicsItem;
class AbstractGraphicsMediaItem;
class TrackWorkflow;
......@@ -50,7 +51,7 @@ public:
TrackWorkflow *trackWorkflow();
void setEmphasized( bool value );
QList<AbstractGraphicsMediaItem*> childs();
QList<AbstractGraphicsItem*> childs();
private:
Workflow::TrackType m_type;
......
......@@ -779,12 +779,14 @@ TracksView::dropEvent( QDropEvent *event )
if ( track != NULL )
{
m_itemsLoaded.insert( m_dragEffectItem->helper()->uuid() );
updateDuration();
if ( getTrack( Workflow::VideoTrack, m_numVideoTrack - 1 )->childItems().count() > 0 )
addTrack( Workflow::VideoTrack );
m_dragEffectItem->m_oldTrack = track->trackWorkflow();
Commands::trigger( new Commands::Effect::Add( m_dragEffectItem->effectHelper(),
track->trackWorkflow() ) );
m_dragEffectItem->m_oldTrack = track->trackWorkflow();
event->acceptProposedAction();
if ( getTrack( Workflow::VideoTrack, m_numVideoTrack - 1 )->childItems().count() > 0 )
addTrack( Workflow::VideoTrack );
break ;
}
}
......@@ -953,9 +955,9 @@ TracksView::mousePressEvent( QMouseEvent *event )
if ( clickPos.x() < RESIZE_ZONE || clickPos.x() > ( itemSize.x() - RESIZE_ZONE ) )
{
if ( clickPos.x() < RESIZE_ZONE )
m_actionResizeType = AbstractGraphicsMediaItem::END;
m_actionResizeType = AbstractGraphicsItem::END;
else
m_actionResizeType = AbstractGraphicsMediaItem::BEGINNING;
m_actionResizeType = AbstractGraphicsItem::BEGINNING;
m_action = TracksView::Resize;
m_actionItem = item;
}
......@@ -1047,7 +1049,7 @@ TracksView::mouseReleaseEvent( QMouseEvent *event )
{
qint64 newBegin;
qint64 newEnd;
if ( m_actionResizeType == AbstractGraphicsMediaItem::END )
if ( m_actionResizeType == AbstractGraphicsItem::END )
{
newEnd = m_actionItem->helper()->end();
newBegin = newEnd - m_actionItem->width();
......@@ -1207,7 +1209,7 @@ TracksView::cleanTracks( Workflow::TrackType type )
if ( !track )
continue;
QList<AbstractGraphicsMediaItem*> items = track->childs();
QList<AbstractGraphicsItem*> items = track->childs();
if ( items.count() == 0 )
tracksToRemove++;
......
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