1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
24 #include <QStyleOptionGraphicsItem>
25 #include <QGraphicsScene>
26 #include <QGraphicsView>
30 #include <mlt++/Mlt.h>
34 #include "kdenlivesettings.h"
36 ClipItem::ClipItem(DocClipBase *clip, int track, int startpos, const QRectF & rect, int duration)
37 : 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)
40 kDebug()<<"******* CREATING NEW TML CLIP, DUR: "<<duration;
41 m_xml = clip->toXML();
42 m_clipName = clip->name();
43 m_producer = clip->getId();
44 m_clipType = clip->clipType();
46 m_maxDuration = duration;
47 if (duration != -1) m_cropDuration = duration;
48 else m_cropDuration = m_maxDuration;
51 m_cropStart = xml.attribute("in", 0).toInt();
52 m_maxDuration = xml.attribute("duration", 0).toInt();
53 if (m_maxDuration == 0) m_maxDuration = xml.attribute("out", 0).toInt() - m_cropStart;
55 if (duration != -1) m_cropDuration = duration;
56 else m_cropDuration = m_maxDuration;*/
59 setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemClipsChildrenToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
60 connect (this , SIGNAL (prepareAudioThumb(double,QPainterPath,int,int)) , this, SLOT (slotPrepareAudioThumb(double,QPainterPath,int,int)));
61 setBrush(QColor(100, 100, 150));
62 if (m_clipType == VIDEO || m_clipType == AV) {
64 connect(this, SIGNAL(getThumb(int, int)), clip->thumbProducer(), SLOT(extractImage(int, int)));
65 connect(clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));
66 connect(clip, SIGNAL (gotAudioData()), this, SLOT (slotGotAudioData()));
67 QTimer::singleShot(300, this, SLOT(slotFetchThumbs()));
69 startThumbTimer = new QTimer(this);
70 startThumbTimer->setSingleShot(true);
71 connect(startThumbTimer, SIGNAL(timeout()), this, SLOT(slotGetStartThumb()));
72 endThumbTimer = new QTimer(this);
73 endThumbTimer->setSingleShot(true);
74 connect(endThumbTimer, SIGNAL(timeout()), this, SLOT(slotGetEndThumb()));
77 else if (m_clipType == COLOR) {
78 QString colour = m_xml.attribute("colour");
79 colour = colour.replace(0, 2, "#");
80 setBrush(QColor(colour.left(7)));
82 else if (m_clipType == IMAGE) {
83 m_startPix = KThumb::getImage(KUrl(m_xml.attribute("resource")), 50 * KdenliveSettings::project_display_ratio(), 50);
90 if (startThumbTimer) delete startThumbTimer;
91 if (endThumbTimer) delete endThumbTimer;
94 void ClipItem::slotFetchThumbs()
96 emit getThumb(m_cropStart, m_cropStart + m_cropDuration);
99 void ClipItem::slotGetStartThumb()
101 emit getThumb(m_cropStart, -1);
104 void ClipItem::slotGetEndThumb()
106 emit getThumb(-1, m_cropStart + m_cropDuration);
109 void ClipItem::slotThumbReady(int frame, QPixmap pix)
111 if (frame == m_cropStart) m_startPix = pix;
116 void ClipItem::slotGotAudioData(){
117 audioThumbReady=true;
121 int ClipItem::type () const
126 DocClipBase *ClipItem::baseClip()
131 QDomElement ClipItem::xml() const
136 int ClipItem::clipType()
141 QString ClipItem::clipName()
146 int ClipItem::clipProducer()
151 int ClipItem::maxDuration()
153 return m_maxDuration;
156 int ClipItem::duration()
158 return m_cropDuration;
161 int ClipItem::startPos()
166 int ClipItem::cropStart()
171 int ClipItem::endPos()
173 return m_startPos + m_cropDuration;
177 void ClipItem::paint(QPainter *painter,
178 const QStyleOptionGraphicsItem *option,
182 QRect rectInView;//this is the rect that is visiable by the user
183 if (scene()->views().size()>0){
184 rectInView=scene()->views()[0]->viewport()->rect();
185 rectInView.moveTo(scene()->views()[0]->horizontalScrollBar()->value(),scene()->views()[0]->verticalScrollBar()->value());
186 rectInView.adjust(-10,-10,10,10);//make view rect 10 pixel greater on each site, or repaint after scroll event
187 //kDebug() << scene()->views()[0]->viewport()->rect() << " " << scene()->views()[0]->horizontalScrollBar()->value();
189 if (rectInView.isNull())
191 QPainterPath clippath;
192 clippath.addRect(rectInView);
193 int startpixel=rectInView.x()-rect().x();//start and endpixel that is viewable from rect()
196 int endpixel=rectInView.width()+rectInView.x();
200 painter->setRenderHints(QPainter::Antialiasing);
201 QPainterPath roundRectPathUpper,roundRectPathLower;
202 double roundingY = 20;
203 double roundingX = 20;
205 painter->setClipRect(option->exposedRect);
206 if (roundingX > br.width() / 2) roundingX = br.width() / 2;
207 //kDebug()<<"-----PAINTING, SCAL: "<<scale<<", height: "<<br.height();
208 roundRectPathUpper.moveTo(br.x() + br .width() - offset, br.y() + br.height()/2 - offset);
209 roundRectPathUpper.arcTo(br.x() + br .width() - roundingX - offset, br.y(), roundingX, roundingY, 0.0, 90.0);
210 roundRectPathUpper.lineTo(br.x() + roundingX, br.y());
211 roundRectPathUpper.arcTo(br.x() + offset, br.y(), roundingX, roundingY, 90.0, 90.0);
212 roundRectPathUpper.lineTo(br.x() + offset, br.y() + br.height()/2 - offset);
213 roundRectPathUpper.closeSubpath();
215 roundRectPathLower.moveTo(br.x() + offset, br.y() + br.height()/2 - offset);
216 roundRectPathLower.arcTo(br.x() + offset, br.y() + br.height() - roundingY - offset, roundingX, roundingY, 180.0, 90.0);
217 roundRectPathLower.lineTo(br.x() + br .width() - roundingX, br.y() + br.height() - offset);
218 roundRectPathLower.arcTo(br.x() + br .width() - roundingX - offset, br.y() + br.height() - roundingY - offset, roundingX, roundingY, 270.0, 90.0);
219 roundRectPathLower.lineTo(br.x() + br .width() - offset, br.y()+ br.height()/2 - offset);
220 roundRectPathLower.closeSubpath();
222 painter->setClipPath(roundRectPathUpper.united(roundRectPathLower).intersected(clippath), Qt::IntersectClip);
223 //painter->fillPath(roundRectPath, brush()); //, QBrush(QColor(Qt::red)));
224 painter->fillRect(br.intersected(rectInView), brush());
225 //painter->fillRect(QRectF(br.x() + br.width() - m_endPix.width(), br.y(), m_endPix.width(), br.height()), QBrush(QColor(Qt::black)));
228 if (!m_startPix.isNull()) {
229 if (m_clipType == IMAGE) {
230 painter->drawPixmap(QPointF(br.x() + br.width() - m_startPix.width(), br.y()), m_startPix);
231 QLineF l(br.x() + br.width() - m_startPix.width(), br.y(), br.x() + br.width() - m_startPix.width(), br.y() + br.height());
232 painter->drawLine(l);
234 painter->drawPixmap(QPointF(br.x() + br.width() - m_endPix.width(), br.y()), m_endPix);
235 QLineF l(br.x() + br.width() - m_endPix.width(), br.y(), br.x() + br.width() - m_endPix.width(), br.y() + br.height());
236 painter->drawLine(l);
239 painter->drawPixmap(QPointF(br.x(), br.y()), m_startPix);
240 QLineF l2(br.x() + m_startPix.width(), br.y(), br.x() + m_startPix.width(), br.y() + br.height());
241 painter->drawLine(l2);
243 if ( ( m_clipType == AV || m_clipType==AUDIO) && audioThumbReady ){
245 QPainterPath path= m_clipType==AV ? roundRectPathLower : roundRectPathUpper.united(roundRectPathLower);
246 painter->fillPath(path,QBrush(QColor(200,200,200,127)));
249 double pixelForOneFrame=(double)br.width()/duration();
251 emit prepareAudioThumb(pixelForOneFrame,path,startpixel,endpixel);
253 for (int startCache=startpixel-startpixel%100; startCache+100 < endpixel;startCache+=100){
254 if (audioThumbCachePic.contains(startCache) && !audioThumbCachePic[startCache].isNull() )
255 painter->drawPixmap(path.boundingRect().x()+startCache,path.boundingRect().y(),audioThumbCachePic[startCache]);
262 // draw start / end fades
263 double scale = br.width() / m_cropDuration;
266 fades = QBrush(QColor(200, 50, 50, 150));
268 else fades = QBrush(QColor(200, 200, 200, 200));
270 if (m_startFade != 0) {
271 QPainterPath fadeInPath;
272 fadeInPath.moveTo(br.x() - offset, br.y());
273 fadeInPath.lineTo(br.x() - offset, br.y() + br.height());
274 fadeInPath.lineTo(br.x() + m_startFade * scale, br.y());
275 fadeInPath.closeSubpath();
276 painter->fillPath(fadeInPath, fades);
278 QLineF l(br.x() + m_startFade * scale, br.y(), br.x(), br.y() + br.height());
279 painter->drawLine(l);
282 if (m_endFade != 0) {
283 QPainterPath fadeOutPath;
284 fadeOutPath.moveTo(br.x() + br.width(), br.y());
285 fadeOutPath.lineTo(br.x() + br.width(), br.y() + br.height());
286 fadeOutPath.lineTo(br.x() + br.width() - m_endFade * scale, br.y());
287 fadeOutPath.closeSubpath();
288 painter->fillPath(fadeOutPath, fades);
290 QLineF l(br.x() + br.width() - m_endFade * scale, br.y(), br.x() + br.width(), br.y() + br.height());
291 painter->drawLine(l);
295 QPen pen = painter->pen();
296 pen.setColor(Qt::white);
297 //pen.setStyle(Qt::DashDotDotLine); //Qt::DotLine);
299 QString effects = effectNames().join(" / ");
300 if (!effects.isEmpty()) {
301 painter->setPen(pen);
302 QFont font = painter->font();
303 QFont smallFont = font;
304 smallFont.setPointSize(8);
305 painter->setFont(smallFont);
306 QRectF txtBounding = painter->boundingRect(br, Qt::AlignLeft | Qt::AlignTop, " " + effects + " ");
307 painter->fillRect(txtBounding, QBrush(QColor(0,0,0,150)));
308 painter->drawText(txtBounding, Qt::AlignCenter, effects);
309 pen.setColor(Qt::black);
310 painter->setPen(pen);
311 painter->setFont(font);
314 QRectF txtBounding = painter->boundingRect(br, Qt::AlignCenter, " " + m_clipName + " ");
315 painter->fillRect(txtBounding, QBrush(QColor(255,255,255,150)));
316 painter->drawText(txtBounding, Qt::AlignCenter, m_clipName);
318 pen.setColor(Qt::red);
319 pen.setStyle(Qt::DashDotDotLine); //Qt::DotLine);
320 if (isSelected()) painter->setPen(pen);
321 painter->setClipRect(option->exposedRect);
322 painter->drawPath(roundRectPathUpper.united(roundRectPathLower).intersected(clippath));
323 //painter->fillRect(startpixel,0,startpixel+endpixel,(int)br.height(), QBrush(QColor(255,255,255,150)));
324 //painter->fillRect(QRect(br.x(), br.y(), roundingX, roundingY), QBrush(QColor(Qt::green)));
326 /*QRectF recta(rect().x(), rect().y(), scale,rect().height());
327 painter->drawRect(recta);
328 painter->drawLine(rect().x() + 1, rect().y(), rect().x() + 1, rect().y() + rect().height());
329 painter->drawLine(rect().x() + rect().width(), rect().y(), rect().x() + rect().width(), rect().y() + rect().height());
330 painter->setPen(QPen(Qt::black, 1.0));
331 painter->drawLine(rect().x(), rect().y(), rect().x() + rect().width(), rect().y());
332 painter->drawLine(rect().x(), rect().y() + rect().height(), rect().x() + rect().width(), rect().y() + rect().height());*/
334 //QGraphicsRectItem::paint(painter, option, widget);
335 //QPen pen(Qt::green, 1.0 / size.x() + 0.5);
336 //painter->setPen(pen);
337 //painter->drawLine(rect().x(), rect().y(), rect().x() + rect().width(), rect().y());
338 //kDebug()<<"ITEM REPAINT RECT: "<<boundingRect().width();
339 //painter->drawText(rect(), Qt::AlignCenter, m_name);
340 // painter->drawRect(boundingRect());
341 //painter->drawRoundRect(-10, -10, 20, 20);
345 OPERATIONTYPE ClipItem::operationMode(QPointF pos, double scale)
347 if (abs(pos.x() - (rect().x() + scale * m_startFade)) < 6 && abs(pos.y() - rect().y()) < 6) return FADEIN;
348 else if (abs(pos.x() - rect().x()) < 6) return RESIZESTART;
349 else if (abs(pos.x() - (rect().x() + rect().width() - scale * m_endFade)) < 6 && abs(pos.y() - rect().y()) < 6) return FADEOUT;
350 else if (abs(pos.x() - (rect().x() + rect().width())) < 6) return RESIZEEND;
354 void ClipItem::slotPrepareAudioThumb(double pixelForOneFrame,QPainterPath path,int startpixel, int endpixel){
357 QRectF re=path.boundingRect();
359 //if ( (!audioThumbWasDrawn || framePixelWidth!=pixelForOneFrame ) && !baseClip()->audioFrameChache.isEmpty()){
361 for (int startCache=startpixel-startpixel%100;startCache+100<endpixel ;startCache+=100){
362 //kDebug() << "creating " << startCache;
363 //if (framePixelWidth!=pixelForOneFrame ||
364 if (framePixelWidth==pixelForOneFrame && audioThumbCachePic.contains(startCache))
366 if (audioThumbCachePic[startCache].isNull() || framePixelWidth!=pixelForOneFrame){
367 audioThumbCachePic[startCache]=QPixmap(100,re.height());
368 audioThumbCachePic[startCache].fill(QColor(200,200,200,127));
371 QMap<int,QPainterPath > positiveChannelPaths;
372 QMap<int,QPainterPath > negativeChannelPaths;
373 QPainter pixpainter(&audioThumbCachePic[startCache]);
375 audiopen.setWidth(0);
376 pixpainter.setPen(audiopen);
377 pixpainter.setRenderHint(QPainter::Antialiasing,true);
378 //pixpainter.drawLine(0,0,100,re.height());
379 for (int i=0;i<channels;i++){
381 positiveChannelPaths[i].moveTo(0,0+audioThumbCachePic[startCache].height()*i/channels+ (audioThumbCachePic[startCache].height()/channels)/2);
382 negativeChannelPaths[i].moveTo(0,0+audioThumbCachePic[startCache].height()*i/channels+ (audioThumbCachePic[startCache].height()/channels)/2);
385 for (int samples=0;samples<=100;samples++){
386 double frame=(double)(samples+startCache-0)/pixelForOneFrame;
387 int sample=(frame-(int)(frame))*20 ;// AUDIO_FRAME_SIZE
388 if (frame<0 || sample< 0 || sample>19 )
390 QMap<int,QByteArray> frame_channel_data=baseClip()->audioFrameChache[(int)frame];
392 for (int channel=0;channel<channels && frame_channel_data[channel].size()> 0;channel++){
394 int y=audioThumbCachePic[startCache].height()*channel/channels+ (/*re.height()*/audioThumbCachePic[startCache].height()/channels)/2;
396 positiveChannelPaths[channel].lineTo(samples,0.1+y+( (int)frame_channel_data[channel][sample] -127/2 ) * (audioThumbCachePic[startCache].height()/channels) / 64 );
397 negativeChannelPaths[channel].lineTo(samples,0.1+y-( (int)frame_channel_data[channel][sample] -127/2 ) * (audioThumbCachePic[startCache].height()/channels) / 64 );
400 for (int i=0;i<channels;i++){
401 if (pixelForOneFrame<10){
402 pixpainter.fillPath(positiveChannelPaths[i].united(negativeChannelPaths[i]),QBrush(Qt::SolidPattern));//or singleif looks better
403 pixpainter.setBrush(QBrush(QColor(200,200,100,200)));
404 pixpainter.drawPath(positiveChannelPaths[i].united(negativeChannelPaths[i]));//or singleif looks better
406 pixpainter.drawPath(positiveChannelPaths[i]);
409 //audioThumbWasDrawn=true;
410 framePixelWidth=pixelForOneFrame;
415 int ClipItem::fadeIn() const
420 int ClipItem::fadeOut() const
425 void ClipItem::setFadeIn(int pos, double scale)
427 int oldIn = m_startFade;
428 if (pos < 0) pos = 0;
429 if (pos > m_cropDuration) pos = m_cropDuration / 2;
431 if (oldIn > pos) update(rect().x(), rect().y(), oldIn * scale, rect().height());
432 else update(rect().x(), rect().y(), pos * scale, rect().height());
435 void ClipItem::setFadeOut(int pos, double scale)
437 int oldOut = m_endFade;
438 if (pos < 0) pos = 0;
439 if (pos > m_cropDuration) pos = m_cropDuration / 2;
441 if (oldOut > pos) update(rect().x() + rect().width() - pos * scale, rect().y(), pos * scale, rect().height());
442 else update(rect().x() + rect().width() - oldOut * scale, rect().y(), oldOut * scale, rect().height());
448 void ClipItem::mousePressEvent ( QGraphicsSceneMouseEvent * event )
450 /*m_resizeMode = operationMode(event->pos());
451 if (m_resizeMode == MOVE) {
452 m_maxTrack = scene()->sceneRect().height();
453 m_grabPoint = (int) (event->pos().x() - rect().x());
455 QGraphicsRectItem::mousePressEvent(event);
459 void ClipItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
462 QGraphicsRectItem::mouseReleaseEvent(event);
465 void ClipItem::moveTo(int x, double scale, double offset, int newTrack)
467 double origX = rect().x();
468 double origY = rect().y();
471 setRect(x * scale, origY + offset, rect().width(), rect().height());
472 QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
473 if (collisionList.size() == 0) m_track = newTrack;
474 for (int i = 0; i < collisionList.size(); ++i) {
475 QGraphicsItem *item = collisionList.at(i);
476 if (item->type() == 70000)
480 QRectF other = ((QGraphicsRectItem *)item)->rect();
481 if (x < m_startPos) {
482 kDebug()<<"COLLISION, MOVING TO------";
483 m_startPos = ((ClipItem *)item)->endPos() + 1;
484 origX = m_startPos * scale;
487 kDebug()<<"COLLISION, MOVING TO+++";
488 m_startPos = ((ClipItem *)item)->startPos() - m_cropDuration;
489 origX = m_startPos * scale;
492 setRect(origX, origY, rect().width(), rect().height());
503 /* QList <QGraphicsItem *> childrenList = QGraphicsItem::children();
504 for (int i = 0; i < childrenList.size(); ++i) {
505 childrenList.at(i)->moveBy(rect().x() - origX , offset);
509 void ClipItem::resizeStart(int posx, double scale)
511 int durationDiff = posx - m_startPos;
512 if (durationDiff == 0) return;
513 kDebug()<<"-- RESCALE: CROP="<<m_cropStart<<", DIFF = "<<durationDiff;
514 if (m_cropStart + durationDiff < 0) {
515 durationDiff = -m_cropStart;
517 else if (durationDiff >= m_cropDuration) {
518 durationDiff = m_cropDuration - 3;
520 m_startPos += durationDiff;
521 m_cropStart += durationDiff;
522 m_cropDuration -= durationDiff;
523 setRect(m_startPos * scale, rect().y(), m_cropDuration * scale, rect().height());
524 QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
525 for (int i = 0; i < collisionList.size(); ++i) {
526 QGraphicsItem *item = collisionList.at(i);
527 if (item->type() == 70000)
529 int diff = ((ClipItem *)item)->endPos() + 1 - m_startPos;
530 setRect((m_startPos + diff) * scale, rect().y(), (m_cropDuration - diff) * scale, rect().height());
533 m_cropDuration -= diff;
537 if (m_hasThumbs) startThumbTimer->start(100);
540 void ClipItem::resizeEnd(int posx, double scale)
542 int durationDiff = posx - endPos();
543 if (durationDiff == 0) return;
544 kDebug()<<"-- RESCALE: CROP="<<m_cropStart<<", DIFF = "<<durationDiff;
545 if (m_cropDuration + durationDiff <= 0) {
546 durationDiff = - (m_cropDuration - 3);
548 else if (m_cropDuration + durationDiff >= m_maxDuration) {
549 durationDiff = m_maxDuration - m_cropDuration;
551 m_cropDuration += durationDiff;
552 setRect(m_startPos * scale, rect().y(), m_cropDuration * scale, rect().height());
553 QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
554 for (int i = 0; i < collisionList.size(); ++i) {
555 QGraphicsItem *item = collisionList.at(i);
556 if (item->type() == 70000)
558 int diff = ((ClipItem *)item)->startPos() - 1 - startPos();
559 m_cropDuration = diff;
560 setRect(m_startPos * scale, rect().y(), m_cropDuration * scale, rect().height());
564 if (m_hasThumbs) endThumbTimer->start(100);
568 void ClipItem::mouseMoveEvent ( QGraphicsSceneMouseEvent * event )
572 int ClipItem::track()
577 void ClipItem::setTrack(int track)
582 int ClipItem::effectsCounter()
584 return m_effectsCounter++;
587 int ClipItem::effectsCount()
589 return m_effectList.size();
592 QStringList ClipItem::effectNames()
594 return m_effectList.effectNames();
597 QDomElement ClipItem::effectAt(int ix)
599 return m_effectList.at(ix);
602 void ClipItem::setEffectAt(int ix, QDomElement effect)
604 kDebug()<<"CHange EFFECT AT: "<<ix<<", CURR: "<<m_effectList.at(ix).attribute("tag")<<", NEW: "<<effect.attribute("tag");
605 m_effectList.insert(ix, effect);
606 m_effectList.removeAt(ix + 1);
607 update(boundingRect());
610 QMap <QString, QString> ClipItem::addEffect(QDomElement effect)
612 QMap <QString, QString> effectParams;
613 m_effectList.append(effect);
614 effectParams["tag"] = effect.attribute("tag");
615 effectParams["kdenlive_ix"] = effect.attribute("kdenlive_ix");
616 QDomNodeList params = effect.elementsByTagName("parameter");
617 for (int i = 0; i < params.count(); i++) {
618 QDomElement e = params.item(i).toElement();
620 effectParams[e.attribute("name")] = e.attribute("value");
622 update(boundingRect());
626 QMap <QString, QString> ClipItem::getEffectArgs(QDomElement effect)
628 QMap <QString, QString> effectParams;
629 effectParams["tag"] = effect.attribute("tag");
630 effectParams["kdenlive_ix"] = effect.attribute("kdenlive_ix");
631 QDomNodeList params = effect.elementsByTagName("parameter");
632 for (int i = 0; i < params.count(); i++) {
633 QDomElement e = params.item(i).toElement();
635 effectParams[e.attribute("name")] = e.attribute("value");
640 void ClipItem::deleteEffect(QString index)
642 for (int i = 0; i < m_effectList.size(); ++i) {
643 if (m_effectList.at(i).attribute("kdenlive_ix") == index) {
644 m_effectList.removeAt(i);
648 update(boundingRect());
654 void CustomTrackView::mousePressEvent ( QMouseEvent * event )
656 int pos = event->x();
657 if (event->modifiers() == Qt::ControlModifier)
658 setDragMode(QGraphicsView::ScrollHandDrag);
659 else if (event->modifiers() == Qt::ShiftModifier)
660 setDragMode(QGraphicsView::RubberBandDrag);
662 QGraphicsItem * item = itemAt(event->pos());
665 else emit cursorMoved((int) mapToScene(event->x(), 0).x());
668 QGraphicsView::mousePressEvent(event);
671 void CustomTrackView::mouseReleaseEvent ( QMouseEvent * event )
673 QGraphicsView::mouseReleaseEvent(event);
674 setDragMode(QGraphicsView::NoDrag);
678 #include "clipitem.moc"