#include "kdenlivesettings.h"
ClipItem::ClipItem(DocClipBase *clip, int track, int startpos, const QRectF & rect, int duration)
-: QGraphicsRectItem(rect), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_track(track), m_startPos(startpos), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), m_startFade(0), m_endFade(0), m_effectsCounter(0),audioThumbWasDrawn(false),audioThumbReady(false)
+: QGraphicsRectItem(rect), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_track(track), m_startPos(startpos), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), m_startFade(0), m_endFade(0), m_effectsCounter(0),audioThumbWasDrawn(false),audioThumbReady(false), m_opacity(1.0), m_timeLine(0)
{
//setToolTip(name);
kDebug()<<"******* CREATING NEW TML CLIP, DUR: "<<duration;
m_maxDuration = duration;
if (duration != -1) m_cropDuration = duration;
else m_cropDuration = m_maxDuration;
+ setAcceptDrops (true);
/*
m_cropStart = xml.attribute("in", 0).toInt();
return m_startPos + m_cropDuration;
}
+void ClipItem::flashClip()
+{
+ if (m_timeLine == 0) {
+ m_timeLine = new QTimeLine(750, this);
+ connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animate(qreal)));
+ }
+ m_timeLine->start();
+}
+
+void ClipItem::animate(qreal value)
+{
+ m_opacity = value;
+ update();
+}
+
// virtual
void ClipItem::paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
+ painter->setOpacity(m_opacity);
QRectF br = rect();
- QRect rectInView;//this is the rect that is visiable by the user
+ QRect rectInView;//this is the rect that is visible by the user
if (scene()->views().size()>0){
rectInView=scene()->views()[0]->viewport()->rect();
rectInView.moveTo(scene()->views()[0]->horizontalScrollBar()->value(),scene()->views()[0]->verticalScrollBar()->value());
painter->setFont(font);
}
+ if (isSelected()) painter->fillRect(br.intersected(rectInView), QBrush(QColor(200,20,0,80)));
pen.setColor(Qt::red);
//pen.setStyle(Qt::DashDotDotLine); //Qt::DotLine);
if (isSelected()) painter->setPen(pen);
- painter->setClipRect(option->exposedRect);
- painter->drawPath(roundRectPathUpper.united(roundRectPathLower).intersected(clippath));
+ painter->setClipRect(option->exposedRect);
+ painter->drawPath(roundRectPathUpper.united(roundRectPathLower).intersected(clippath));
QRectF txtBounding = painter->boundingRect(br, Qt::AlignCenter, " " + m_clipName + " ");
painter->fillRect(txtBounding, QBrush(QColor(255,255,255,150)));
if (!e.isNull())
effectParams[e.attribute("name")] = e.attribute("value");
}
+ flashClip();
update(boundingRect());
return effectParams;
}
break;
}
}
+ flashClip();
update(boundingRect());
}
#include <QGraphicsRectItem>
#include <QDomElement>
#include <QGraphicsSceneMouseEvent>
+#include <QTimeLine>
#include "definitions.h"
#include "gentime.h"
QDomElement effectAt(int ix);
/** Replace effect at pos ix with given value */
void setEffectAt(int ix, QDomElement effect);
+ void flashClip();
protected:
virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
uint m_endFade;
/** counter used to provide a unique id to each effect */
int m_effectsCounter;
+ double m_opacity;
+ QTimeLine *m_timeLine;
EffectsList m_effectList;
QMap<int,QPixmap> audioThumbCachePic;
bool audioThumbWasDrawn,audioThumbReady;
double framePixelWidth;
QMap<int,QPainterPath > channelPaths;
+
private slots:
void slotThumbReady(int frame, QPixmap pix);
void slotFetchThumbs();
void slotGetEndThumb();
void slotGotAudioData();
void slotPrepareAudioThumb(double,QPainterPath,int,int);
+ void animate(qreal value);
+
signals:
void getThumb(int, int);
void prepareAudioThumb(double,QPainterPath,int,int);