Commit fa04538a authored by Ludovic Fauvet's avatar Ludovic Fauvet

Change the look of clips and tracks

parent 4deb5be2
......@@ -20,10 +20,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "GraphicsMovieItem.h"
#include "TracksView.h"
#include <QPainter>
#include <QLinearGradient>
#include <QDebug>
#include "GraphicsMovieItem.h"
#include "TracksView.h"
GraphicsMovieItem::GraphicsMovieItem( Media* media ) : m_media ( media ), m_width( 0 ), m_height( 0 )
{
......@@ -41,7 +42,11 @@ QRectF GraphicsMovieItem::boundingRect() const
void GraphicsMovieItem::paint( QPainter* painter, const QStyleOptionGraphicsItem*, QWidget* )
{
painter->setBrush( Qt::red );
QLinearGradient gradient( 0, 0, m_width, m_height );
gradient.setColorAt( 0, QColor::fromRgb( 32, 52, 142 ) );
gradient.setColorAt( 1, QColor::fromRgb( 43, 69, 181 ) );
painter->setBrush( QBrush( gradient ) );
painter->drawRect( boundingRect() );
paintAudioSpectrum( painter );
......
......@@ -89,7 +89,7 @@ void TracksView::createLayout()
void TracksView::addVideoTrack()
{
GraphicsTrack* track = new GraphicsTrack();
GraphicsTrack* track = new GraphicsTrack( GraphicsTrack::Video );
track->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
track->setPreferredHeight( m_tracksHeight );
track->setContentsMargins( 0, 0, 0, 0 );
......@@ -99,7 +99,7 @@ void TracksView::addVideoTrack()
void TracksView::addAudioTrack()
{
GraphicsTrack* track = new GraphicsTrack();
GraphicsTrack* track = new GraphicsTrack( GraphicsTrack::Audio );
track->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
track->setPreferredHeight( m_tracksHeight );
track->setContentsMargins( 0, 0, 0, 0 );
......
......@@ -41,15 +41,29 @@ class GraphicsTrack : public QGraphicsWidget
Q_OBJECT
public:
GraphicsTrack( QGraphicsItem* parent = 0 ) : QGraphicsWidget( parent ) {}
enum Type
{
Video,
Audio
};
GraphicsTrack( Type type, QGraphicsItem* parent = 0 ) : QGraphicsWidget( parent )
{
m_type = type;
}
protected:
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem*, QWidget* = 0 )
{
if ( m_type == Video )
painter->setBrush( Qt::green );
else
painter->setBrush( Qt::blue );
painter->setPen( Qt::transparent );
painter->setBrush( Qt::cyan );
painter->drawRect( rect() );
}
private:
Type m_type;
};
class TracksView : public QGraphicsView
......
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