Commit c507d337 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Timeline: set custom colors to rush

parent acce71d1
......@@ -21,6 +21,7 @@
*****************************************************************************/
#include <QMenu>
#include <QColorDialog>
#include "AbstractGraphicsMediaItem.h"
#include "TracksView.h"
#include "TracksScene.h"
......@@ -124,6 +125,10 @@ void AbstractGraphicsMediaItem::contextMenuEvent( QGraphicsSceneContextMenuEvent
linkAction->setEnabled( false );
}
menu.addSeparator();
QAction* changeColor = menu.addAction( "Set color" );
QAction* selectedAction = menu.exec( event->screenPos() );
if ( !selectedAction )
......@@ -159,6 +164,11 @@ void AbstractGraphicsMediaItem::contextMenuEvent( QGraphicsSceneContextMenuEvent
item->ungroup();
}
else if ( selectedAction == changeColor )
{
m_itemColor = QColorDialog::getColor( m_itemColor, tracksView() );
update();
}
}
......@@ -246,3 +256,8 @@ bool AbstractGraphicsMediaItem::resizeZone( const QPointF& position )
}
return false;
}
QColor AbstractGraphicsMediaItem::itemColor()
{
return m_itemColor;
}
......@@ -140,6 +140,8 @@ protected slots:
*/
bool resizeZone( const QPointF& position );
QColor itemColor();
private:
/// This pointer will be set when inserted in the tracksView.
TracksView* m_tracksView;
......@@ -149,6 +151,9 @@ private:
qint64 m_width;
qint64 m_height;
QColor m_itemColor;
//FIXME: this is a nasty forest boolean
bool m_resizeExpected;
};
......
......@@ -121,6 +121,13 @@ void GraphicsAudioItem::paintRect( QPainter* painter, const QStyleOptionGraphics
else
painter->drawRect( mapped );
if ( itemColor().isValid() )
{
QRectF mediaColorRect = mapped.adjusted( 3, 2, -3, -2 );
painter->setPen( QPen( itemColor(), 2 ) );
painter->drawLine( mediaColorRect.topLeft(), mediaColorRect.topRight() );
}
if ( isSelected() )
{
setZValue( Z_SELECTED );
......
......@@ -120,6 +120,13 @@ void GraphicsMovieItem::paintRect( QPainter* painter, const QStyleOptionGraphics
else
painter->drawRect( mapped );
if ( itemColor().isValid() )
{
QRectF mediaColorRect = mapped.adjusted( 3, 2, -3, -2 );
painter->setPen( QPen( itemColor(), 2 ) );
painter->drawLine( mediaColorRect.topLeft(), mediaColorRect.topRight() );
}
if ( isSelected() )
{
setZValue( Z_SELECTED );
......
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