[vlmc-devel] commit: timeline: items now use setTrack instead of setParentItem ( Ludovic Fauvet )
git at videolan.org
git at videolan.org
Tue Mar 30 02:36:24 CEST 2010
vlmc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Tue Mar 30 02:18:34 2010 +0200| [cb73cf5d56abf708899549886ba85d4d75f8e8c8] | committer: Ludovic Fauvet
timeline: items now use setTrack instead of setParentItem
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=cb73cf5d56abf708899549886ba85d4d75f8e8c8
---
src/Gui/timeline/AbstractGraphicsMediaItem.cpp | 10 ++++++++++
src/Gui/timeline/AbstractGraphicsMediaItem.h | 6 ++++++
src/Gui/timeline/TracksView.cpp | 12 ++++++------
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
index e36b578..a9ae3e1 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
@@ -83,6 +83,16 @@ quint32 AbstractGraphicsMediaItem::trackNumber()
return -1;
}
+void AbstractGraphicsMediaItem::setTrack( GraphicsTrack* track )
+{
+ setParentItem( track );
+}
+
+GraphicsTrack* AbstractGraphicsMediaItem::track()
+{
+ return qgraphicsitem_cast<GraphicsTrack*>( parentItem() );
+}
+
void AbstractGraphicsMediaItem::group( AbstractGraphicsMediaItem* item )
{
Q_ASSERT( item );
diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.h b/src/Gui/timeline/AbstractGraphicsMediaItem.h
index ffda4f2..ee7500c 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.h
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.h
@@ -89,6 +89,12 @@ public:
/// Return the current track of the item
quint32 trackNumber();
+ /// Set the item's parent track
+ void setTrack( GraphicsTrack* track );
+
+ /// Return the item's parent track
+ GraphicsTrack* track();
+
/// Set the position of the item (in frames) for the x-axis.
void setStartPos( qint64 position );
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 8825e4b..da386be 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -277,7 +277,7 @@ TracksView::addMediaItem( Clip *clip, unsigned int track, MainWorkflow::TrackTyp
item->m_tracksView = this;
item->setHeight( tracksHeight() );
- item->setParentItem( getTrack( trackType, track ) );
+ item->setTrack( getTrack( trackType, track ) );
item->setStartPos( start );
item->oldTrackNumber = track;
item->oldPosition = start;
@@ -310,7 +310,7 @@ TracksView::dragEnterEvent( QDragEnterEvent *event )
m_dragAudioItem = new GraphicsAudioItem( audioClip );
m_dragAudioItem->m_tracksView = this;
m_dragAudioItem->setHeight( tracksHeight() );
- m_dragAudioItem->setParentItem( getTrack( m_dragAudioItem->mediaType(), 0 ) );
+ m_dragAudioItem->setTrack( getTrack( m_dragAudioItem->mediaType(), 0 ) );
connect( m_dragAudioItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
}
@@ -322,7 +322,7 @@ TracksView::dragEnterEvent( QDragEnterEvent *event )
m_dragVideoItem = new GraphicsMovieItem( videoClip );
m_dragVideoItem->m_tracksView = this;
m_dragVideoItem->setHeight( tracksHeight() );
- m_dragVideoItem->setParentItem( getTrack( m_dragVideoItem->mediaType(), 0 ) );
+ m_dragVideoItem->setTrack( getTrack( m_dragVideoItem->mediaType(), 0 ) );
connect( m_dragVideoItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
}
@@ -469,11 +469,11 @@ TracksView::moveMediaItem( AbstractGraphicsMediaItem *item, quint32 track, qint6
// We've found a valid position that fit for the two items.
// Move the primary item to the target destination.
item->setStartPos( p.time() );
- item->setParentItem( getTrack( item->mediaType(), p.track() ) );
+ item->setTrack( getTrack( item->mediaType(), p.track() ) );
// Move the linked item to the target destination.
item->groupItem()->setStartPos( p2.time() );
- item->groupItem()->setParentItem( getTrack( item->groupItem()->mediaType(), p2.track() ) );
+ item->groupItem()->setTrack( getTrack( item->groupItem()->mediaType(), p2.track() ) );
}
}
else
@@ -481,7 +481,7 @@ TracksView::moveMediaItem( AbstractGraphicsMediaItem *item, quint32 track, qint6
if ( p.isValid() )
{
item->setStartPos( p.time() );
- item->setParentItem( getTrack( item->mediaType(), p.track() ) );
+ item->setTrack( getTrack( item->mediaType(), p.track() ) );
}
}
}
More information about the Vlmc-devel
mailing list