Commit c992aa53 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Fix the track counting issue

parent ad3bec58
......@@ -36,7 +36,7 @@ Timeline::Timeline( QWidget *parent ) :
m_instance = this;
m_ui.setupUi( this );
m_mainWorkflow = new MainWorkflow( this, 5 );
m_mainWorkflow = new MainWorkflow( this, MAX_TRACKS );
m_tracksScene = new TracksScene( this );
m_tracksView = new TracksView( m_tracksScene, m_mainWorkflow, m_ui.tracksFrame );
......
......@@ -28,6 +28,7 @@
#include "TracksScene.h"
#include "TracksRuler.h"
#include "Workflow/MainWorkflow.h"
#include "Workflow/TrackWorkflow.h"
class Timeline : public QWidget
{
......
......@@ -45,6 +45,7 @@ TracksView::TracksView( QGraphicsScene* scene, MainWorkflow* mainWorkflow, QWidg
m_numAudioTrack = 0;
m_numVideoTrack = 0;
m_videoTracksCounter = MAX_TRACKS;
m_dragItem = NULL;
setMouseTracking( true );
......@@ -104,6 +105,7 @@ void TracksView::addVideoTrack()
track->setContentsMargins( 0, 0, 0, 0 );
m_layout->insertItem( 0, track );
m_numVideoTrack++;
m_videoTracksCounter--;
m_scene->invalidate();
//FIXME this should maybe go elsewhere
setSceneRect( m_layout->contentsRect().adjusted( 0, 0, 100, 100 ) );
......@@ -242,7 +244,8 @@ void TracksView::dropEvent( QDropEvent* event )
qreal mappedXPos = ( mapToScene( event->pos() ).x() + 0.5 );
//FIXME this leaks, but it will be corrected once we really use Clip instead
// of Media
m_mainWorkflow->addClip( new Clip( m_dragItem->media() ), track, (qint64)mappedXPos );
m_mainWorkflow->addClip( new Clip( m_dragItem->media() ),
m_videoTracksCounter + track, (qint64)mappedXPos );
m_dragItem = NULL; // Temporary action
}
......
......@@ -33,6 +33,7 @@
#include "Media.h"
#include "GraphicsCursorItem.h"
#include "Workflow/MainWorkflow.h"
#include "Workflow/TrackWorkflow.h"
class GraphicsMovieItem;
class AbstractGraphicsMediaItem;
......@@ -112,6 +113,7 @@ private:
QGraphicsLinearLayout* m_layout;
int m_numVideoTrack;
int m_numAudioTrack;
int m_videoTracksCounter;
MainWorkflow* m_mainWorkflow;
GraphicsMovieItem* m_dragItem;
QGraphicsWidget* m_separator;
......
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