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

Remove ClipHelper and use Clip instead

Signed-off-by: 's avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent a7dac860
......@@ -88,7 +88,6 @@ SET(VLMC_SRCS
Tools/VlmcDebug.h
Tools/VlmcLogger.cpp
Workflow/ClipWorkflow.cpp
Workflow/ClipHelper.cpp
Workflow/Helper.cpp
Workflow/MainWorkflow.cpp
Workflow/TrackWorkflow.cpp
......
......@@ -27,7 +27,6 @@
#include "Project/Project.h"
#include "Main/Core.h"
#include "Media/Clip.h"
#include "Workflow/ClipHelper.h"
#include "EffectsEngine/EffectHelper.h"
#include "EffectsEngine/EffectInstance.h"
#include "Workflow/TrackWorkflow.h"
......@@ -78,12 +77,12 @@ Commands::Generic::undo()
internalUndo();
}
Commands::Clip::Add::Add( ClipHelper* ch, TrackWorkflow* tw, qint64 pos ) :
m_clipHelper( ch ),
Commands::Clip::Add::Add( ::Clip* clip, TrackWorkflow* tw, qint64 pos ) :
m_clip( clip ),
m_trackWorkflow( tw ),
m_pos( pos )
{
connect( ch->clip(), &::Clip::destroyed, this, &Add::invalidate );
connect( clip, &::Clip::destroyed, this, &Add::invalidate );
retranslate();
}
......@@ -94,13 +93,13 @@ Commands::Clip::Add::~Add()
void
Commands::Clip::Add::internalRedo()
{
m_trackWorkflow->addClip( m_clipHelper, m_pos );
m_trackWorkflow->addClip( m_clip, m_pos );
}
void
Commands::Clip::Add::internalUndo()
{
m_trackWorkflow->removeClip( m_clipHelper->uuid() );
m_trackWorkflow->removeClip( m_clip->uuid() );
}
void
......@@ -110,15 +109,15 @@ Commands::Clip::Add::retranslate()
}
Commands::Clip::Move::Move( TrackWorkflow *oldTrack, TrackWorkflow *newTrack,
ClipHelper *clipHelper, qint64 newPos ) :
::Clip *clip, qint64 newPos ) :
m_oldTrack( oldTrack ),
m_newTrack( newTrack ),
m_clipHelper( clipHelper ),
m_clip( clip ),
m_newPos( newPos )
{
m_oldPos = oldTrack->getClipPosition( clipHelper->uuid() );
connect( clipHelper->clip(), SIGNAL( destroyed() ), this, SLOT( invalidate() ) );
m_oldPos = oldTrack->getClipPosition( clip->uuid() );
connect( clip, SIGNAL( destroyed() ), this, SLOT( invalidate() ) );
retranslate();
}
......@@ -137,11 +136,11 @@ Commands::Clip::Move::internalRedo()
{
if ( m_newTrack != m_oldTrack )
{
ClipWorkflow *cw = m_oldTrack->removeClipWorkflow( m_clipHelper->uuid() );
ClipWorkflow *cw = m_oldTrack->removeClipWorkflow( m_clip->uuid() );
m_newTrack->addClip( cw, m_newPos );
}
else
m_oldTrack->moveClip( m_clipHelper->uuid(), m_newPos );
m_oldTrack->moveClip( m_clip->uuid(), m_newPos );
}
void
......@@ -149,19 +148,19 @@ Commands::Clip::Move::internalUndo()
{
if ( m_newTrack != m_oldTrack )
{
ClipWorkflow *cw = m_newTrack->removeClipWorkflow( m_clipHelper->uuid() );
ClipWorkflow *cw = m_newTrack->removeClipWorkflow( m_clip->uuid() );
m_oldTrack->addClip( cw, m_oldPos );
}
else
m_newTrack->moveClip( m_clipHelper->uuid(), m_oldPos );
m_newTrack->moveClip( m_clip->uuid(), m_oldPos );
}
Commands::Clip::Remove::Remove( ClipHelper* ch, TrackWorkflow* tw ) :
m_clipHelper( ch ), m_trackWorkflow( tw )
Commands::Clip::Remove::Remove( ::Clip* clip, TrackWorkflow* tw ) :
m_clip( clip ), m_trackWorkflow( tw )
{
connect( ch->clip(), &::Clip::destroyed, this, &Remove::invalidate );
connect( clip, &::Clip::destroyed, this, &Remove::invalidate );
retranslate();
m_pos = tw->getClipPosition( ch->uuid() );
m_pos = tw->getClipPosition( clip->uuid() );
}
void
......@@ -173,27 +172,27 @@ Commands::Clip::Remove::retranslate()
void
Commands::Clip::Remove::internalRedo()
{
m_trackWorkflow->removeClip( m_clipHelper->uuid() );
m_trackWorkflow->removeClip( m_clip->uuid() );
}
void
Commands::Clip::Remove::internalUndo()
{
m_trackWorkflow->addClip( m_clipHelper, m_pos );
m_trackWorkflow->addClip( m_clip, m_pos );
}
Commands::Clip::Resize::Resize( TrackWorkflow* tw, ClipHelper* ch, qint64 newBegin,
Commands::Clip::Resize::Resize( TrackWorkflow* tw, ::Clip* clip, qint64 newBegin,
qint64 newEnd, qint64 newPos ) :
m_trackWorkflow( tw ),
m_clipHelper( ch ),
m_clip( clip ),
m_newBegin( newBegin ),
m_newEnd( newEnd ),
m_newPos( newPos )
{
connect( ch->clip(), &::Clip::destroyed, this, &Resize::invalidate );
m_oldBegin = ch->begin();
m_oldEnd = ch->end();
m_oldPos = tw->getClipPosition( ch->uuid() );
connect( clip, &::Clip::destroyed, this, &Resize::invalidate );
m_oldBegin = clip->begin();
m_oldEnd = clip->end();
m_oldPos = tw->getClipPosition( clip->uuid() );
retranslate();
}
......@@ -208,9 +207,9 @@ Commands::Clip::Resize::internalRedo()
{
if ( m_newBegin != m_newEnd )
{
m_trackWorkflow->moveClip( m_clipHelper->uuid(), m_newPos );
m_trackWorkflow->moveClip( m_clip->uuid(), m_newPos );
}
m_clipHelper->setBoundaries( m_newBegin, m_newEnd );
m_clip->setBoundaries( m_newBegin, m_newEnd );
}
void
......@@ -218,12 +217,12 @@ Commands::Clip::Resize::internalUndo()
{
if ( m_oldBegin != m_newBegin )
{
m_trackWorkflow->moveClip( m_clipHelper->uuid(), m_oldPos );
m_trackWorkflow->moveClip( m_clip->uuid(), m_oldPos );
}
m_clipHelper->setBoundaries( m_oldBegin, m_oldEnd );
m_clip->setBoundaries( m_oldBegin, m_oldEnd );
}
Commands::Clip::Split::Split( TrackWorkflow *tw, ClipHelper *toSplit,
Commands::Clip::Split::Split( TrackWorkflow *tw, ::Clip *toSplit,
qint64 newClipPos, qint64 newClipBegin ) :
m_trackWorkflow( tw ),
m_toSplit( toSplit ),
......@@ -231,8 +230,8 @@ Commands::Clip::Split::Split( TrackWorkflow *tw, ClipHelper *toSplit,
m_newClipPos( newClipPos ),
m_newClipBegin( newClipBegin )
{
connect( toSplit->clip(), &::Clip::destroyed, this, &Split::invalidate );
m_newClip = new ClipHelper( toSplit->clip(), newClipBegin, toSplit->end() );
connect( toSplit, &::Clip::destroyed, this, &Split::invalidate );
m_newClip = new ::Clip( toSplit, newClipBegin, toSplit->end() );
m_oldEnd = toSplit->end();
retranslate();
}
......
......@@ -34,7 +34,6 @@
#include "Workflow/MainWorkflow.h"
class Clip;
class ClipHelper;
class EffectUser;
namespace Commands
......@@ -79,13 +78,13 @@ namespace Commands
Q_OBJECT
public:
Add( ClipHelper* ch, TrackWorkflow* tw, qint64 pos );
Add( ::Clip* clip, TrackWorkflow* tw, qint64 pos );
virtual ~Add();
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
ClipHelper *m_clipHelper;
::Clip *m_clip;
TrackWorkflow *m_trackWorkflow;
qint64 m_pos;
};
......@@ -96,7 +95,7 @@ namespace Commands
public:
Move( TrackWorkflow *oldTrack, TrackWorkflow *newTrack,
ClipHelper *clipHelper, qint64 newPos );
::Clip *clip, qint64 newPos );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
......@@ -104,7 +103,7 @@ namespace Commands
private:
TrackWorkflow *m_oldTrack;
TrackWorkflow *m_newTrack;
ClipHelper *m_clipHelper;
::Clip *m_clip;
qint64 m_newPos;
qint64 m_oldPos;
};
......@@ -114,13 +113,13 @@ namespace Commands
Q_OBJECT
public:
Remove( ClipHelper* clip, TrackWorkflow* tw );
Remove( ::Clip* clip, TrackWorkflow* tw );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
ClipHelper *m_clipHelper;
::Clip *m_clip;
TrackWorkflow *m_trackWorkflow;
qint64 m_pos;
};
......@@ -137,7 +136,7 @@ namespace Commands
Q_OBJECT
public:
Resize( TrackWorkflow* tw, ClipHelper* clipHelper,
Resize( TrackWorkflow* tw, ::Clip* clip,
qint64 newBegin, qint64 newEnd, qint64 newPos );
virtual void internalRedo();
virtual void internalUndo();
......@@ -145,7 +144,7 @@ namespace Commands
private:
TrackWorkflow* m_trackWorkflow;
ClipHelper* m_clipHelper;
::Clip* m_clip;
qint64 m_newBegin;
qint64 m_newEnd;
qint64 m_oldBegin;
......@@ -159,7 +158,7 @@ namespace Commands
Q_OBJECT
public:
Split( TrackWorkflow *tw, ClipHelper* toSplit, qint64 newClipPos,
Split( TrackWorkflow *tw, ::Clip* toSplit, qint64 newClipPos,
qint64 newClipBegin );
~Split();
virtual void internalRedo();
......@@ -167,8 +166,8 @@ namespace Commands
virtual void retranslate();
private:
TrackWorkflow *m_trackWorkflow;
ClipHelper* m_toSplit;
ClipHelper* m_newClip;
::Clip* m_toSplit;
::Clip* m_newClip;
qint64 m_newClipPos;
qint64 m_newClipBegin;
qint64 m_oldEnd;
......
......@@ -27,7 +27,6 @@
#include "GraphicsTrack.h"
#include "Media/Clip.h"
#include "Workflow/ClipHelper.h"
#include "Commands/Commands.h"
#include "Media/Media.h"
......@@ -40,27 +39,15 @@
AbstractGraphicsMediaItem::AbstractGraphicsMediaItem( Clip* clip ) :
m_muted( false )
{
m_clipHelper = new ClipHelper( clip );
m_clip = new Clip( clip );
// Adjust the width
setWidth( clip->length() );
// Automatically adjust future changes
connect( m_clipHelper, SIGNAL( lengthUpdated() ), this, SLOT( adjustLength() ) );
connect( m_clip, SIGNAL( lengthUpdated() ), this, SLOT( adjustLength() ) );
connect( clip, SIGNAL( unloaded( Clip* ) ),
this, SLOT( clipDestroyed( Clip* ) ), Qt::DirectConnection );
}
AbstractGraphicsMediaItem::AbstractGraphicsMediaItem( ClipHelper* ch ) :
m_clipHelper( ch ),
m_muted( false )
{
// Adjust the width
setWidth( ch->length() );
// Automatically adjust future changes
connect( ch, SIGNAL( lengthUpdated() ), this, SLOT( adjustLength() ) );
connect( ch->clip(), SIGNAL( unloaded( Clip* ) ),
this, SLOT( clipDestroyed( Clip* ) ), Qt::DirectConnection );
}
AbstractGraphicsMediaItem::~AbstractGraphicsMediaItem()
{
ungroup();
......@@ -142,7 +129,7 @@ AbstractGraphicsMediaItem::contextMenuEvent( QGraphicsSceneContextMenuEvent* eve
Q_ASSERT( item1TrackId >= 0 );
item1->group( this );
tracksView()->moveItem( item1, item1TrackId , startPos() );
track()->trackWorkflow()->moveClip( item1->clipHelper()->uuid(), startPos() );
track()->trackWorkflow()->moveClip( item1->clip()->uuid(), startPos() );
}
}
else if ( selectedAction == unlinkAction )
......@@ -169,22 +156,22 @@ AbstractGraphicsMediaItem::clipDestroyed( Clip* clip )
m_tracksView->removeClip( clip->uuid() );
}
ClipHelper*
AbstractGraphicsMediaItem::clipHelper()
Clip*
AbstractGraphicsMediaItem::clip()
{
return m_clipHelper;
return m_clip;
}
const ClipHelper*
AbstractGraphicsMediaItem::clipHelper() const
const Clip*
AbstractGraphicsMediaItem::clip() const
{
return m_clipHelper;
return m_clip;
}
const QUuid&
AbstractGraphicsMediaItem::uuid() const
{
return m_clipHelper->uuid();
return m_clip->uuid();
}
void
......@@ -199,19 +186,21 @@ AbstractGraphicsMediaItem::setEmphasized( bool value )
bool
AbstractGraphicsMediaItem::hasResizeBoundaries() const
{
return ( clipHelper()->clip()->media()->fileType() != Media::Image );
return ( clip()->media()->fileType() != Media::Image );
}
qint64
AbstractGraphicsMediaItem::maxBegin() const
{
return ( m_clipHelper->clip()->begin() );
// Assume that the clip always has a parent.
return clip()->parent()->begin();
}
qint64
AbstractGraphicsMediaItem::maxEnd() const
{
return clipHelper()->clip()->end();
// Assume that the clip always has a parent.
return clip()->parent()->end();
}
void
......@@ -253,14 +242,14 @@ AbstractGraphicsMediaItem::mousePressEvent( QGraphicsSceneMouseEvent* event )
qint64
AbstractGraphicsMediaItem::begin() const
{
return m_clipHelper->begin();
return m_clip->begin();
}
qint64
AbstractGraphicsMediaItem::end() const
{
return m_clipHelper->end();
return m_clip->end();
}
void
......@@ -269,26 +258,26 @@ AbstractGraphicsMediaItem::triggerMove( EffectUser *target, qint64 startPos )
TrackWorkflow *tw = qobject_cast<TrackWorkflow*>( target );
if ( tw == nullptr )
return ;
Commands::trigger( new Commands::Clip::Move( m_oldTrack, tw, m_clipHelper, startPos ) );
Commands::trigger( new Commands::Clip::Move( m_oldTrack, tw, m_clip, startPos ) );
}
Workflow::Helper*
AbstractGraphicsMediaItem::helper()
{
return m_clipHelper;
return m_clip;
}
void
AbstractGraphicsMediaItem::triggerResize( EffectUser *target, Workflow::Helper *helper,
qint64 newBegin, qint64 newEnd, qint64 pos )
{
ClipHelper *clipHelper = qobject_cast<ClipHelper*>( helper );
if ( clipHelper == nullptr )
Clip *clip = qobject_cast<Clip*>( helper );
if ( clip == nullptr )
return ;
TrackWorkflow *tw = qobject_cast<TrackWorkflow*>( target );
if ( tw == nullptr )
return ;
Commands::trigger( new Commands::Clip::Resize( tw, clipHelper, newBegin,
Commands::trigger( new Commands::Clip::Resize( tw, clip, newBegin,
newEnd, pos ) );
}
......
......@@ -23,7 +23,6 @@
#ifndef ABSTRACTGRAPHICSMEDIAITEM_H
#define ABSTRACTGRAPHICSMEDIAITEM_H
class ClipHelper;
#include "AbstractGraphicsItem.h"
#include <QUuid>
......@@ -43,14 +42,13 @@ class AbstractGraphicsMediaItem : public AbstractGraphicsItem
public:
AbstractGraphicsMediaItem( Clip* clip );
AbstractGraphicsMediaItem( ClipHelper* ch );
virtual ~AbstractGraphicsMediaItem();
/// Should return the unique uid of the contained media.
virtual const QUuid& uuid() const;
ClipHelper *clipHelper();
const ClipHelper* clipHelper() const;
Clip *clip();
const Clip* clip() const;
virtual void setEmphasized( bool value );
virtual qint64 begin() const;
......@@ -74,7 +72,7 @@ protected:
virtual qint64 maxEnd() const;
protected:
ClipHelper* m_clipHelper;
Clip* m_clip;
private slots:
void clipDestroyed( Clip* clip );
......
......@@ -23,7 +23,6 @@
#include "GraphicsAudioItem.h"
#include "Workflow/ClipHelper.h"
#include "Backend/ISource.h"
#include "Media/Media.h"
#include "TracksView.h"
......@@ -46,20 +45,6 @@ GraphicsAudioItem::GraphicsAudioItem( Clip* clip ) :
setToolTip( tooltip );
}
GraphicsAudioItem::GraphicsAudioItem( ClipHelper* ch ) :
AbstractGraphicsMediaItem( ch )
{
setFlags( QGraphicsItem::ItemIsSelectable );
QTime length = QTime().addMSecs( ch->clip()->media()->source()->length() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" )
.arg( ch->clip()->media()->fileName() )
.arg( length.toString("hh:mm:ss.zzz") ) );
setToolTip( tooltip );
setAcceptHoverEvents( true );
}
GraphicsAudioItem::~GraphicsAudioItem()
{
}
......@@ -171,7 +156,7 @@ GraphicsAudioItem::paintTitle( QPainter* painter, const QStyleOptionGraphicsItem
// Initiate the font metrics calculation
QFontMetrics fm( painter->font() );
QString text = m_clipHelper->clip()->media()->fileName();
QString text = m_clip->media()->fileName();
// Get the transformations required to map the text on the viewport
QTransform viewPortTransform = Timeline::instance()->tracksView()->viewportTransform();
......
......@@ -40,7 +40,6 @@ public:
*/
enum { Type = UserType + 4 };
GraphicsAudioItem( Clip* clip );
GraphicsAudioItem( ClipHelper *ch );
virtual ~GraphicsAudioItem();
virtual int type() const { return Type; }
......
......@@ -21,7 +21,6 @@
*****************************************************************************/
#include "Media/Clip.h"
#include "Workflow/ClipHelper.h"
#include "GraphicsMovieItem.h"
#include "Backend/ISource.h"
#include "Media/Media.h"
......@@ -45,17 +44,6 @@ GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) :
setToolTip( tooltip );
}
GraphicsMovieItem::GraphicsMovieItem( ClipHelper* ch ) :
AbstractGraphicsMediaItem( ch )
{
QTime length = QTime().addMSecs( ch->clip()->media()->source()->length() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" )
.arg( ch->clip()->media()->fileName() )
.arg( length.toString("hh:mm:ss.zzz") ) );
setToolTip( tooltip );
}
GraphicsMovieItem::~GraphicsMovieItem()
{
}
......@@ -165,7 +153,7 @@ GraphicsMovieItem::paintTitle( QPainter* painter, const QStyleOptionGraphicsItem
// Initiate the font metrics calculation
QFontMetrics fm( painter->font() );
QString text = m_clipHelper->clip()->media()->fileName();
QString text = m_clip->media()->fileName();
// Get the transformations required to map the text on the viewport
QTransform viewPortTransform = Timeline::instance()->tracksView()->viewportTransform();
......
......@@ -39,9 +39,7 @@ public:
* \brief See http://doc.trolltech.com/4.5/qgraphicsitem.html#type
*/
enum { Type = UserType + 1 };
GraphicsMovieItem( Clip* clipHelper );
/// The same CTOR, but this one won't create a new ClipHelper.
GraphicsMovieItem( ClipHelper* clipHelper );
GraphicsMovieItem( Clip* clip );
virtual ~GraphicsMovieItem();
virtual int type() const { return Type; }
......
......@@ -25,7 +25,6 @@
#include "Project/Project.h"
#include "Main/Core.h"
#include "Media/Clip.h"
#include "Workflow/ClipHelper.h"
#include "TracksView.h"
#include "TracksScene.h"
#include "TracksControls.h"
......
......@@ -23,7 +23,7 @@
#ifndef TIMELINE_H
#define TIMELINE_H
#include "Workflow/ClipHelper.h"
#include "Media/Clip.h"
#include "vlmc.h"
#include "ui_Timeline.h"
#include "Workflow/Types.h"
......
......@@ -23,7 +23,6 @@
#include "TracksScene.h"
#include "Commands/Commands.h"
#include "Workflow/ClipHelper.h"
#include "EffectsEngine/EffectHelper.h"
#include "GraphicsAudioItem.h"
#include "GraphicsMovieItem.h"
......@@ -119,10 +118,10 @@ TracksScene::askRemoveSelectedItems()
if (linked_item != nullptr)
items.append(linked_item);
ClipHelper *ch = qobject_cast<ClipHelper*>( item->helper() );
if ( ch != nullptr )
Clip *clip = qobject_cast<Clip*>( item->helper() );
if ( clip != nullptr )
{
Commands::trigger( new Commands::Clip::Remove( ch, item->track()->trackWorkflow() ) );
Commands::trigger( new Commands::Clip::Remove( clip, item->track()->trackWorkflow() ) );
}
else
{
......
......@@ -24,7 +24,6 @@
#include "Main/Core.h"
#include "Project/Project.h"
#include "Workflow/ClipHelper.h"
#include "Workflow/ClipWorkflow.h"
#include "Commands/Commands.h"
#include "EffectsEngine/EffectHelper.h"
......@@ -250,13 +249,13 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
qint32 track = tw->trackId();
AbstractGraphicsItem *item = nullptr;
ClipHelper *clipHelper = qobject_cast<ClipHelper*>( helper );
if ( clipHelper != nullptr )
Clip *clip = qobject_cast<Clip*>( helper );
if ( clip != nullptr )
{
AbstractGraphicsMediaItem *mediaItem = nullptr;
bool hasVideo = clipHelper->formats() & ClipHelper::Video;
bool hasAudio = clipHelper->formats() & ClipHelper::Audio;
bool hasVideo = clip->formats() & Clip::Video;
bool hasAudio = clip->formats() & Clip::Audio;
// If there is not enough tracks to insert
// the clip do it now.
......@@ -268,7 +267,7 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
for ( int i = 0; i < nbTrackToAdd; ++i )
addTrack( Workflow::VideoTrack );
}
mediaItem = new GraphicsMovieItem( clipHelper );
mediaItem = new GraphicsMovieItem( clip );
connect( mediaItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
}
......@@ -280,7 +279,7 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
for ( int i = 0; i < nbTrackToAdd; ++i )
addTrack( Workflow::AudioTrack );
}
mediaItem = new GraphicsAudioItem( clipHelper );
mediaItem = new GraphicsAudioItem( clip );
connect( mediaItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
}
......@@ -297,7 +296,7 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
item->m_oldTrack = tw;
moveItem( item, track, start );
//If the item has some effects:
foreach ( EffectHelper *effectHelper, clipHelper->clipWorkflow()->effects( Effect::Filter ) )
for ( EffectHelper *effectHelper : clip->clipWorkflow()->effects( Effect::Filter ) )
{
addEffectItem( effectHelper, Workflow::VideoTrack, track, start );
}
......@@ -425,13 +424,13 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
if ( itemList.size() > 0 )
{
AbstractGraphicsMediaItem *item = itemList.first();
ClipHelper *clipHelper = qobject_cast<ClipHelper*>( item->helper() );
Q_ASSERT( clipHelper != nullptr );
Clip *clip = qobject_cast<Clip*>( item->helper() );
Q_ASSERT( clip != nullptr );
m_dragEffectItem->setWidth( item->clipHelper()->length() );
m_dragEffectItem->setWidth( item->clip()->length() );
m_dragEffectItem->setStartPos( item->startPos() );
m_dragEffectItem->setTrack( item->track() );
m_dragEffectItem->effectHelper()->setTarget( clipHelper->clipWorkflow() );
m_dragEffectItem->effectHelper()->setTarget( clip->clipWorkflow() );
}
else
{
......@@ -803,7 +802,7 @@ TracksView::dropEvent( QDropEvent *event )
if ( m_dragAudioItem )
{
m_itemsLoaded.insert( m_dragAudioItem->clipHelper()->uuid() );
m_itemsLoaded.insert( m_dragAudioItem->clip()->uuid() );
updateDuration();
if ( getTrack( Workflow::AudioTrack, m_numAudioTrack - 1 )->childItems().count() > 0 )
......@@ -811,9 +810,9 @@ TracksView::dropEvent( QDropEvent *event )
event->acceptProposedAction();
m_dragAudioItem->m_oldTrack = m_dragAudioItem->track()->trackWorkflow();
m_dragAudioItem->clipHelper()->setFormats( ClipHelper::Audio );
m_dragAudioItem->clip()->setFormats( Clip::Audio );
Commands::trigger( new Commands::Clip::Add( m_dragAudioItem->clipHelper(),
Commands::trigger( new Commands::Clip::Add( m_dragAudioItem->clip(),
m_dragAudioItem->track()->trackWorkflow(),
(qint64)mappedXPos ) );
m_dragAudioItem = nullptr;
......@@ -821,7 +820,7 @@ TracksView::dropEvent( QDropEvent *event )
if ( m_dragVideoItem )
{
m_itemsLoaded.insert( m_dragVideoItem->clipHelper()->uuid() );
m_itemsLoaded.insert( m_dragVideoItem->clip()->uuid() );
updateDuration();
if ( getTrack( Workflow::VideoTrack, m_numVideoTrack - 1 )->childItems().count() > 0 )
......@@ -829,9 +828,9 @@ TracksView::dropEvent( QDropEvent *event )
event->acceptProposedAction();
m_dragVideoItem->m_oldTrack = m_dragVideoItem->track()->trackWorkflow();
m_dragVideoItem->clipHelper()->setFormats( ClipHelper::Video );
m_dragVideoItem->clip()->setFormats( Clip::Video );
Commands::trigger( new Commands::Clip::Add( m_dragVideoItem->clipHelper(),
Commands::trigger( new Commands::Clip::Add( m_dragVideoItem->clip(),
m_dragVideoItem->track()->trackWorkflow(),
(qint64)mappedXPos ) );
m_dragVideoItem = nullptr;
......@@ -849,7 +848,7 @@ TracksView::dropEvent( QDropEvent *event )
m_itemsLoaded.insert( m_dragEffectItem->helper()->uuid() );
AbstractGraphicsMediaItem *item = clips.first();
Commands::trigger( new Commands::Effect::Add( m_dragEffectItem->effectHelper(),
item->clipHelper()->clipWorkflow() ) );
item->clip()->clipWorkflow() ) );
m_dragEffectItem->m_oldTrack = item->track()->trackWorkflow();
event->acceptProposedAction();
m_dragEffectItem->setContainer( item );
......@@ -974,10 +973,10 @@ TracksView::mouseMoveEvent( QMouseEvent *event )
AbstractGraphicsMediaItem *mediaItem = dynamic_cast<AbstractGraphicsMediaItem*>( collidingItem );
if ( mediaItem != nullptr )
{
ClipHelper *clipHelper = qobject_cast<ClipHelper*>( mediaItem->helper() );
Q_ASSERT( clipHelper != nullptr );
Clip *clip = qobject_cast<Clip*>( mediaItem->helper() );
Q_ASSERT( clip != nullptr );
m_effectTarget = mediaItem;
// effectItem->effectHelper()->setTarget( clipHelper->clipWorkflow() );
// effectItem->effectHelper()->setTarget( clip->clipWorkflow() );