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

Fixing signal/slot stuff when moving clip.

parent f15a16cc
......@@ -84,10 +84,6 @@ Timeline::Timeline( WorkflowRenderer* renderer, QWidget *parent ) :
// Project duration change
connect( m_tracksView, SIGNAL( durationChanged(int) ), this, SLOT( setDuration(int) ) );
// Clip actions
connect( m_mainWorkflow, SIGNAL( clipMoved( QUuid, uint, qint64, Workflow::TrackType ) ),
this, SLOT( actionMoveClip(QUuid, uint, qint64, Workflow::TrackType ) ) );
// Clear / reset
connect( m_mainWorkflow, SIGNAL( cleared() ), m_tracksControls, SLOT( clear() ) );
connect( m_mainWorkflow, SIGNAL( cleared() ), tracksView(), SLOT( clear() ) );
......
......@@ -30,6 +30,10 @@
#include "GraphicsCursorItem.h"
#include "GraphicsTrack.h"
#include "Media.h"
//Ugly part {
#include "Timeline.h"
#include "TracksRuler.h"
//} this should be fixed, it brokes the design
#include "TrackWorkflow.h"
#include "UndoStack.h"
#include "WorkflowRenderer.h"
......@@ -125,7 +129,11 @@ TracksView::addVideoTrack()
this, SLOT( addMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
connect( track->trackWorkflow(), SIGNAL( clipRemoved( TrackWorkflow*, ClipHelper* ) ),
this, SLOT( removeMediaItem( TrackWorkflow*, ClipHelper* ) ) );
connect( track->trackWorkflow(), SIGNAL( clipMoved( TrackWorkflow*, ClipHelper*, qint64 ) ),
this, SLOT( moveMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
emit videoTrackAdded( track );
}
void
......@@ -142,6 +150,8 @@ TracksView::addAudioTrack()
this, SLOT( addMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
connect( track->trackWorkflow(), SIGNAL( clipRemoved( TrackWorkflow*, ClipHelper* ) ),
this, SLOT( removeMediaItem( TrackWorkflow*, ClipHelper* ) ) );
connect( track->trackWorkflow(), SIGNAL( clipMoved( TrackWorkflow*, ClipHelper*, qint64 ) ),
this, SLOT( moveMediaItem( TrackWorkflow*, ClipHelper*, qint64 ) ) );
emit audioTrackAdded( track );
}
......@@ -340,7 +350,7 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
}
void
TracksView::moveMediaItem( const QUuid &uuid, unsigned int track, qint64 time )
TracksView::moveMediaItem( TrackWorkflow *tw, ClipHelper *ch, qint64 time )
{
QList<QGraphicsItem*> sceneItems = m_scene->items();
......@@ -348,9 +358,11 @@ TracksView::moveMediaItem( const QUuid &uuid, unsigned int track, qint64 time )
{
AbstractGraphicsMediaItem* item =
dynamic_cast<AbstractGraphicsMediaItem*>( sceneItems.at( i ) );
if ( !item || item->uuid() != uuid ) continue;
moveMediaItem( item, track, time );
if ( !item || item->uuid() != ch->uuid() ) continue;
moveMediaItem( item, tw->trackId(), time );
}
updateDuration();
Timeline::getInstance()->tracksRuler()->update();
}
void
......
......@@ -202,11 +202,11 @@ public slots:
void addMediaItem( TrackWorkflow* tw, ClipHelper *clipHelper, qint64 start );
/**
* \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.
* \param tw The TrackWorkflow in which the track was moved
* \param ch The clip that was moved.
* \param time The new position (in frames) of the item.
*/
void moveMediaItem( const QUuid &uuid, unsigned int track, qint64 time );
void moveMediaItem( TrackWorkflow *tw, ClipHelper *ch, qint64 time );
/**
* \brief Remove an item from the timeline.
* \param uuid The Universally Unique Identifier of the item.
......
......@@ -129,6 +129,7 @@ class TrackWorkflow : public QObject
void lengthChanged( qint64 newLength );
void clipAdded( TrackWorkflow*, ClipHelper*, qint64 );
void clipRemoved( TrackWorkflow*, ClipHelper* );
void clipMoved( TrackWorkflow*, ClipHelper*, qint64 );
};
#endif // TRACKWORKFLOW_H
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