void ClipItem::slotThumbReady(int frame, QPixmap pix) {
if (m_thumbsRequested == 0) return;
if (frame == m_cropStart.frames(m_fps)) {
- m_startPix = pix;
- QRectF r = boundingRect();
- r.setRight(pix.width() + 2);
- update(r);
- }
- else {
- m_endPix = pix;
- QRectF r = boundingRect();
- r.setLeft(r.right() - pix.width() - 2);
- update(r);
- }
+ m_startPix = pix;
+ QRectF r = boundingRect();
+ r.setRight(pix.width() + 2);
+ update(r);
+ } else {
+ m_endPix = pix;
+ QRectF r = boundingRect();
+ r.setLeft(r.right() - pix.width() - 2);
+ update(r);
+ }
m_thumbsRequested--;
}
void ClipItem::slotGotAudioData() {
audioThumbReady = true;
- if (m_clipType == AV) {
- QRectF r = boundingRect();
- r.setTop(r.top() + r.height() / 2 - 1);
- update(r);
- }
- else update();
+ if (m_clipType == AV) {
+ QRectF r = boundingRect();
+ r.setTop(r.top() + r.height() / 2 - 1);
+ update(r);
+ } else update();
}
int ClipItem::type() const {
void ClipItem::flashClip() {
if (m_timeLine == 0) {
- m_timeLine = new QTimeLine(750, this);
- m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve);
- connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animate(qreal)));
- }
+ m_timeLine = new QTimeLine(750, this);
+ m_timeLine->setCurveShape(QTimeLine::EaseInOutCurve);
+ connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(animate(qreal)));
+ }
m_timeLine->start();
}
void ClipItem::animate(qreal value) {
- QRectF r = boundingRect();
- r.setHeight(20);
- update(r);
+ QRectF r = boundingRect();
+ r.setHeight(20);
+ update(r);
}
// virtual
QRectF br = rect();
double scale = br.width() / m_cropDuration.frames(m_fps);
- // kDebug()<<"/// EXPOSED RECT: "<<option->exposedRect.x()<<" X "<<option->exposedRect.right();
- painter->setClipRect(option->exposedRect);
+ // kDebug()<<"/// EXPOSED RECT: "<<option->exposedRect.x()<<" X "<<option->exposedRect.right();
+ painter->setClipRect(option->exposedRect);
int startpixel = (int)option->exposedRect.x() - rect().x();
if (startpixel < 0)
//painter->setRenderHints(QPainter::Antialiasing);
QPainterPath roundRectPathUpper = upperRectPart(br), roundRectPathLower = lowerRectPart(br);
-
+
// build path around clip
QPainterPath resultClipPath = roundRectPathUpper.united(roundRectPathLower);
//virtual
void ClipItem::hoverEnterEvent(QGraphicsSceneHoverEvent *) {
m_hover = true;
- QRectF r = boundingRect();
- qreal width = qMin(25.0, r.width());
+ QRectF r = boundingRect();
+ qreal width = qMin(25.0, r.width());
update(r.x(), r.y(), width, r.height());
update(r.right() - width, r.y(), width, r.height());
}
//virtual
void ClipItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
m_hover = false;
- QRectF r = boundingRect();
- qreal width = qMin(25.0, r.width());
+ QRectF r = boundingRect();
+ qreal width = qMin(25.0, r.width());
update(r.x(), r.y(), width, r.height());
update(r.right() - width, r.y(), width, r.height());
}
m_effectList.insert(ix, effect);
m_effectList.removeAt(ix + 1);
m_effectNames = m_effectList.effectNames().join(" / ");
- if (effect.attribute("id") == "fadein" || effect.attribute("id") == "fadeout") update(boundingRect());
- else {
- QRectF r = boundingRect();
- r.setHeight(20);
- update(r);
- }
+ if (effect.attribute("id") == "fadein" || effect.attribute("id") == "fadeout") update(boundingRect());
+ else {
+ QRectF r = boundingRect();
+ r.setHeight(20);
+ update(r);
+ }
}
QMap <QString, QString> ClipItem::addEffect(QDomElement effect, bool animate) {
QMap <QString, QString> effectParams;
- bool needRepaint = false;
+ bool needRepaint = false;
/*QDomDocument doc;
doc.appendChild(doc.importNode(effect, true));
kDebug() << "/////// CLIP ADD EFFECT: "<< doc.toString();*/
effectParams[e.attribute("name")] = e.attribute("value");
// check if it is a fade effect
if (effectId == "fadein") {
- needRepaint = true;
+ needRepaint = true;
if (e.attribute("name") == "out") fade += e.attribute("value").toInt();
else if (e.attribute("name") == "in") fade -= e.attribute("value").toInt();
} else if (effectId == "fadeout") {
- needRepaint = true;
+ needRepaint = true;
if (e.attribute("name") == "out") fade -= e.attribute("value").toInt();
else if (e.attribute("name") == "in") fade += e.attribute("value").toInt();
}
m_effectNames = m_effectList.effectNames().join(" / ");
if (fade > 0) m_startFade = fade;
else if (fade < 0) m_endFade = -fade;
- if (needRepaint) update(boundingRect());
+ if (needRepaint) update(boundingRect());
if (animate) {
flashClip();
} else if (!needRepaint) {
- QRectF r = boundingRect();
- r.setHeight(20);
- update(r);
- }
+ QRectF r = boundingRect();
+ r.setHeight(20);
+ update(r);
+ }
return effectParams;
}
}
void ClipItem::deleteEffect(QString index) {
- bool needRepaint = false;
+ bool needRepaint = false;
for (int i = 0; i < m_effectList.size(); ++i) {
if (m_effectList.at(i).attribute("kdenlive_ix") == index) {
if (m_effectList.at(i).attribute("id") == "fadein") {
- m_startFade = 0;
- needRepaint = true;
- }
- else if (m_effectList.at(i).attribute("id") == "fadeout") {
- m_endFade = 0;
- needRepaint = true;
- }
+ m_startFade = 0;
+ needRepaint = true;
+ } else if (m_effectList.at(i).attribute("id") == "fadeout") {
+ m_endFade = 0;
+ needRepaint = true;
+ }
m_effectList.removeAt(i);
break;
}
}
m_effectNames = m_effectList.effectNames().join(" / ");
- if (needRepaint) update(boundingRect());
+ if (needRepaint) update(boundingRect());
flashClip();
}