[vlmc-devel] commit: GrpahicsTracks: Implementing the setEmphasized method. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sun Sep 5 19:45:15 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Sep  5 19:42:22 2010 +0200| [b4fcb67030b0d42adbe4d1b54b2c586bae81e794] | committer: Hugo Beauzée-Luyssen 

GrpahicsTracks: Implementing the setEmphasized method.

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

 src/Gui/timeline/GraphicsTrack.cpp |   34 +++++++++++++++++++++++++++++++---
 src/Gui/timeline/GraphicsTrack.h   |   12 ++++++++++++
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/src/Gui/timeline/GraphicsTrack.cpp b/src/Gui/timeline/GraphicsTrack.cpp
index 581bcd6..24e193a 100644
--- a/src/Gui/timeline/GraphicsTrack.cpp
+++ b/src/Gui/timeline/GraphicsTrack.cpp
@@ -29,7 +29,8 @@
 
 GraphicsTrack::GraphicsTrack( Workflow::TrackType type, quint32 trackNumber,
                               QGraphicsItem *parent ) :
-    QGraphicsWidget( parent )
+    QGraphicsWidget( parent ),
+    m_emphasizer( NULL )
 {
     m_type = type;
     m_trackNumber = trackNumber;
@@ -110,7 +111,34 @@ GraphicsTrack::trackWorkflow()
 }
 
 void
-GraphicsTrack::setEmphasized( bool )
+GraphicsTrack::setEmphasized( bool value )
 {
-    //TODO
+    if ( m_emphasizer == NULL )
+        m_emphasizer = new EmphasizedTrackItem( this, maximumWidth(), preferredHeight() );
+    if ( value == true )
+        m_emphasizer->show();
+    else
+        m_emphasizer->hide();
+}
+
+
+EmphasizedTrackItem::EmphasizedTrackItem( GraphicsTrack *parent, qreal width, qreal height ) :
+    QGraphicsItem( parent ),
+    m_width( width ),
+    m_height( height )
+{
+}
+
+    QRectF
+EmphasizedTrackItem::boundingRect() const
+{
+    return QRectF( 0, 0, m_width, m_height );
+}
+
+void
+EmphasizedTrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+                     QWidget *widget)
+{
+    painter->setBrush( QBrush( Qt::darkBlue ));
+    painter->drawRect( boundingRect() );
 }
diff --git a/src/Gui/timeline/GraphicsTrack.h b/src/Gui/timeline/GraphicsTrack.h
index fe69cc2..61e0cb7 100644
--- a/src/Gui/timeline/GraphicsTrack.h
+++ b/src/Gui/timeline/GraphicsTrack.h
@@ -57,6 +57,18 @@ private:
     quint32             m_trackNumber;
     bool                m_enabled;
     TrackWorkflow       *m_trackWorkflow;
+    QGraphicsItem       *m_emphasizer;
+};
+
+class   EmphasizedTrackItem : public QGraphicsItem
+{
+    public:
+        EmphasizedTrackItem( GraphicsTrack *parent, qreal width, qreal height );
+        QRectF  boundingRect() const;
+        void    paint( QPainter*, const QStyleOptionGraphicsItem*, QWidget* );
+    private:
+        qreal   m_width;
+        qreal   m_height;
 };
 
 #endif // GRAPHICSTRACK_H



More information about the Vlmc-devel mailing list