[vlmc-devel] commit: TracksView: Don't use tracksHeight to set items height. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Thu Sep 9 01:18:11 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Sep  9 00:44:28 2010 +0200| [7a0b775b41bcc0111565ad96b68abce71185c5dc] | committer: Hugo Beauzée-Luyssen 

TracksView: Don't use tracksHeight to set items height.

Instead, ask the item for the height it wants

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=7a0b775b41bcc0111565ad96b68abce71185c5dc
---

 src/Gui/timeline/AbstractGraphicsItem.h        |    2 ++
 src/Gui/timeline/AbstractGraphicsMediaItem.cpp |    6 ++++++
 src/Gui/timeline/AbstractGraphicsMediaItem.h   |    1 +
 src/Gui/timeline/GraphicsEffectItem.cpp        |    6 ++++++
 src/Gui/timeline/GraphicsEffectItem.h          |    1 +
 src/Gui/timeline/TracksView.cpp                |   10 +++++-----
 6 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/Gui/timeline/AbstractGraphicsItem.h b/src/Gui/timeline/AbstractGraphicsItem.h
index 71efa74..6bc6bb4 100644
--- a/src/Gui/timeline/AbstractGraphicsItem.h
+++ b/src/Gui/timeline/AbstractGraphicsItem.h
@@ -72,6 +72,8 @@ class AbstractGraphicsItem : public QObject, public QGraphicsItem
         /// The item can be moved by the user.
         virtual bool moveable() const = 0;
 
+        virtual qint64      itemHeight() const = 0;
+
         /// Return a pointer to the TracksScene
         TracksScene* scene();
 
diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
index 8ad8774..9901b5e 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.cpp
@@ -300,3 +300,9 @@ AbstractGraphicsMediaItem::triggerResize( TrackWorkflow *tw, Workflow::Helper *h
     Commands::trigger( new Commands::Clip::Resize( tw, clipHelper, newBegin,
                                                                newEnd, pos ) );
 }
+
+qint64
+AbstractGraphicsMediaItem::itemHeight() const
+{
+    return 35;
+}
diff --git a/src/Gui/timeline/AbstractGraphicsMediaItem.h b/src/Gui/timeline/AbstractGraphicsMediaItem.h
index 0b216bb..240063a 100644
--- a/src/Gui/timeline/AbstractGraphicsMediaItem.h
+++ b/src/Gui/timeline/AbstractGraphicsMediaItem.h
@@ -61,6 +61,7 @@ public:
                                      Workflow::Helper *helper, qint64 pos );
     virtual void        triggerResize( TrackWorkflow *tw, Workflow::Helper *helper,
                                        qint64 newBegin, qint64 newEnd, qint64 pos );
+    virtual qint64              itemHeight() const;
 
 protected:
     virtual void        contextMenuEvent( QGraphicsSceneContextMenuEvent* event );
diff --git a/src/Gui/timeline/GraphicsEffectItem.cpp b/src/Gui/timeline/GraphicsEffectItem.cpp
index 9cc9b85..b398e27 100644
--- a/src/Gui/timeline/GraphicsEffectItem.cpp
+++ b/src/Gui/timeline/GraphicsEffectItem.cpp
@@ -86,6 +86,12 @@ GraphicsEffectItem::trackType() const
     return Workflow::VideoTrack;
 }
 
+qint64
+GraphicsEffectItem::itemHeight() const
+{
+    return 15;
+}
+
 void
 GraphicsEffectItem::paintRect( QPainter* painter, const QStyleOptionGraphicsItem* option )
 {
diff --git a/src/Gui/timeline/GraphicsEffectItem.h b/src/Gui/timeline/GraphicsEffectItem.h
index 0de244c..4c10e13 100644
--- a/src/Gui/timeline/GraphicsEffectItem.h
+++ b/src/Gui/timeline/GraphicsEffectItem.h
@@ -50,6 +50,7 @@ class GraphicsEffectItem : public AbstractGraphicsItem
                                                 Workflow::Helper *helper, qint64 pos);
         virtual void                triggerResize( TrackWorkflow *tw, Workflow::Helper *helper,
                                            qint64 newBegin, qint64 newEnd, qint64 pos );
+        virtual qint64              itemHeight() const;
     protected:
         virtual bool                hasResizeBoundaries() const;
         /**
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index 7b823c4..c6e2340 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -289,7 +289,7 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
     }
     m_itemsLoaded.insert( helper->uuid() );
     item->m_tracksView = this;
-    item->setHeight( tracksHeight() );
+    item->setHeight( item->itemHeight() );
     item->setTrack( getTrack( trackType, track ) );
     item->setStartPos( start );
     item->m_oldTrack = tw;
@@ -341,7 +341,7 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
         if ( m_dragAudioItem ) delete m_dragAudioItem;
         m_dragAudioItem = new GraphicsAudioItem( clip );
         m_dragAudioItem->m_tracksView = this;
-        m_dragAudioItem->setHeight( tracksHeight() );
+        m_dragAudioItem->setHeight( m_dragAudioItem->itemHeight() );
         m_dragAudioItem->setTrack( getTrack( m_dragAudioItem->trackType(), 0 ) );
         connect( m_dragAudioItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
                  this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
@@ -351,7 +351,7 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
         if ( m_dragVideoItem ) delete m_dragVideoItem;
         m_dragVideoItem = new GraphicsMovieItem( clip );
         m_dragVideoItem->m_tracksView = this;
-        m_dragVideoItem->setHeight( tracksHeight() );
+        m_dragVideoItem->setHeight( m_dragVideoItem->itemHeight() );
         m_dragVideoItem->setTrack( getTrack( m_dragVideoItem->trackType(), 0 ) );
         connect( m_dragVideoItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
                  this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
@@ -382,7 +382,7 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
             AbstractGraphicsMediaItem   *item = itemList.first();
             m_dragEffectItem->setWidth( item->clipHelper()->length() );
             m_dragEffectItem->setStartPos( item->startPos() );
-            m_dragEffectItem->setHeight( tracksHeight() / 2 );
+            m_dragEffectItem->setHeight( m_dragEffectItem->itemHeight() );
             m_dragEffectItem->setTrack( getTrack( m_dragEffectItem->trackType(), 0 ) );
             m_dragEffectItem->setZValue( 100 );
         }
@@ -396,7 +396,7 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
                 {
                     m_dragEffectItem->setWidth( track->maximumWidth() );
                     m_dragEffectItem->setStartPos( 0 );
-                    m_dragEffectItem->setHeight( tracksHeight() / 2 );
+                    m_dragEffectItem->setHeight( m_dragEffectItem->itemHeight() );
                     m_dragEffectItem->setTrack( track );
                     break ;
                 }



More information about the Vlmc-devel mailing list