painter->setPen(Qt::black);
}
- /*
- // For testing puspose only: draw transitions count
- {
- painter->setPen(pen);
- QFont font = painter->font();
- QFont smallFont = font;
- smallFont.setPointSize(8);
- painter->setFont(smallFont);
- QString txt = " Transitions: " + QString::number(m_transitionsList.count()) + " ";
- QRectF txtBoundin = painter->boundingRect(br, Qt::AlignRight | Qt::AlignTop, txt);
- painter->fillRect(txtBoundin, QBrush(QColor(0, 0, 0, 150)));
- painter->drawText(txtBoundin, Qt::AlignCenter, txt);
- pen.setColor(Qt::black);
- painter->setPen(pen);
- painter->setFont(font);
- }
- */
-
// Draw clip name
QRectF txtBounding = painter->boundingRect(br, Qt::AlignHCenter | Qt::AlignTop, " " + m_clipName + " ");
//painter->fillRect(txtBounding, QBrush(QColor(255, 255, 255, 150)));
// painter->drawRect(boundingRect());
//painter->drawRoundRect(-10, -10, 20, 20);
if (m_hover) {
- int pointy = (int)(br.y() + br.height() / 2 - 5);
+ painter->setBrush(QColor(180, 180, 50, 180)); //gradient);
+
+ // draw transitions handles
+ QPainterPath transitionHandle;
+ const int handle_size = 4;
+ transitionHandle.moveTo(0, 0);
+ transitionHandle.lineTo(handle_size, handle_size);
+ transitionHandle.lineTo(handle_size * 2, 0);
+ transitionHandle.lineTo(handle_size * 3, handle_size);
+ transitionHandle.lineTo(handle_size * 2, handle_size * 2);
+ transitionHandle.lineTo(handle_size * 3, handle_size * 3);
+ transitionHandle.lineTo(0, handle_size * 3);
+ transitionHandle.closeSubpath();
+ int pointy = (int)(br.y() + br.height() / 2);
int pointx1 = (int)(br.x() + 10);
- int pointx2 = (int)(br.x() + br.width() - 20);
+ int pointx2 = (int)(br.x() + br.width() - (10 + handle_size * 3));
#if 0
painter->setPen(QPen(Qt::black));
painter->setBrush(QBrush(QColor(50, 50, 0)));
#else
- QRadialGradient gradient(pointx1 + 5, pointy + 5 , 5, 2, 2);
+ /*QRadialGradient gradient(pointx1 + 5, pointy + 5 , 5, 2, 2);
gradient.setColorAt(0.2, Qt::white);
gradient.setColorAt(0.8, Qt::yellow);
- gradient.setColorAt(1, Qt::black);
- painter->setBrush(gradient);
-#endif
- painter->drawEllipse(pointx1, pointy , 10, 10);
-
- QRadialGradient gradient1(pointx2 + 5, pointy + 5 , 5, 2, 2);
- gradient1.setColorAt(0.2, Qt::white);
- gradient1.setColorAt(0.8, Qt::yellow);
- gradient1.setColorAt(1, Qt::black);
- painter->setBrush(gradient1);
- painter->drawEllipse(pointx2, pointy, 10, 10);
+ gradient.setColorAt(1, Qt::black);*/
+#endif
+ painter->translate(pointx1, pointy);
+ painter->drawPath(transitionHandle); //Ellipse(0, 0 , 10, 10);
+ painter->translate(-pointx1, -pointy);
+
+ /* QRadialGradient gradient1(pointx2 + 5, pointy + 5 , 5, 2, 2);
+ gradient1.setColorAt(0.2, Qt::white);
+ gradient1.setColorAt(0.8, Qt::yellow);
+ gradient1.setColorAt(1, Qt::black);
+ painter->setBrush(gradient1);*/
+ QMatrix m;
+ m.scale(-1.0, 1.0);
+ painter->setMatrix(m);
+ painter->translate(-pointx2 - handle_size * 3, pointy);
+ painter->drawPath(transitionHandle); // Ellipse(0, 0, 10, 10);
+ painter->translate(pointx2, -pointy);
}
}
else if (qAbs((int)(pos.x() - rect().x())) < 6) return RESIZESTART;
else if (qAbs((int)(pos.x() - (rect().x() + rect().width() - scale * m_endFade))) < 6 && qAbs((int)(pos.y() - rect().y())) < 6) return FADEOUT;
else if (qAbs((int)(pos.x() - (rect().x() + rect().width()))) < 6) return RESIZEEND;
- else if (qAbs((int)(pos.x() - (rect().x() + 10))) < 6 && qAbs((int)(pos.y() - (rect().y() + rect().height() / 2 - 5))) < 6) return TRANSITIONSTART;
- else if (qAbs((int)(pos.x() - (rect().x() + rect().width() - 20))) < 6 && qAbs((int)(pos.y() - (rect().y() + rect().height() / 2 - 5))) < 6) return TRANSITIONEND;
+ else if (qAbs((int)(pos.x() - (rect().x() + 16))) < 10 && qAbs((int)(pos.y() - (rect().y() + rect().height() / 2 + 5))) < 8) return TRANSITIONSTART;
+ else if (qAbs((int)(pos.x() - (rect().x() + rect().width() - 21))) < 10 && qAbs((int)(pos.y() - (rect().y() + rect().height() / 2 + 5))) < 8) return TRANSITIONEND;
return MOVE;
}
m_effectList.append(effect);
effectParams["tag"] = effect.attribute("tag");
QString effectId = effect.attribute("id");
+ if (effectId.isEmpty()) effectId = effect.attribute("tag");
+ effectParams["id"] = effectId;
effectParams["kdenlive_ix"] = effect.attribute("kdenlive_ix");
QString state = effect.attribute("disabled");
if (!state.isEmpty()) effectParams["disabled"] = state;
QMap <QString, QString> effectParams;
effectParams["tag"] = effect.attribute("tag");
effectParams["kdenlive_ix"] = effect.attribute("kdenlive_ix");
+ effectParams["id"] = effect.attribute("id");
QString state = effect.attribute("disabled");
if (!state.isEmpty()) effectParams["disabled"] = state;
QDomNodeList params = effect.elementsByTagName("parameter");
txtNeu << (int)(values[i+1].toDouble());
}
effectParams["start"] = neu;
- } else
- if (!e.isNull()) {
- effectParams[e.attribute("name")] = e.attribute("value");
- }
- if (!e.attribute("factor").isEmpty()) {
- effectParams[e.attribute("name")] = QString::number(effectParams[e.attribute("name")].toDouble() / e.attribute("factor").toDouble());
+ } else if (!e.isNull()) {
+ if (!e.attribute("factor").isEmpty())
+ effectParams[e.attribute("name")] = QString::number(effectParams[e.attribute("name")].toDouble() / e.attribute("factor").toDouble());
+ else effectParams[e.attribute("name")] = e.attribute("value");
}
}
return effectParams;
m_animation = new QGraphicsItemAnimation;
m_animation->setItem(m_visualTip);
m_animation->setTimeLine(m_animationTimer);
- m_visualTip->setPos(clip->rect().x() + 15, clip->rect().y() + clip->rect().height() / 2);
+ m_visualTip->setPos(clip->rect().x() + 10, clip->rect().y() + clip->rect().height() / 2 + 12);
double scale = 2.0;
m_animation->setScaleAt(.5, scale, scale);
scale = 1.0;
m_animation = new QGraphicsItemAnimation;
m_animation->setItem(m_visualTip);
m_animation->setTimeLine(m_animationTimer);
- m_visualTip->setPos(clip->rect().x() + clip->rect().width() - 15 , clip->rect().y() + clip->rect().height() / 2);
+ m_visualTip->setPos(clip->rect().x() + clip->rect().width() - 10 , clip->rect().y() + clip->rect().height() / 2 + 12);
double scale = 2.0;
m_animation->setScaleAt(.5, scale, scale);
scale = 1.0;
void CustomTrackView::mousePressEvent(QMouseEvent * event) {
activateMonitor();
m_clickEvent = event->pos();
+ if (event->button() == Qt::MidButton) {
+ m_document->renderer()->switchPlay();
+ return;
+ }
if (event->modifiers() == Qt::ControlModifier) {
setDragMode(QGraphicsView::ScrollHandDrag);
QGraphicsView::mousePressEvent(event);
}
void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) {
+ if (event->button() == Qt::MidButton) {
+ return;
+ }
QGraphicsView::mouseReleaseEvent(event);
setDragMode(QGraphicsView::NoDrag);
if (m_dragItem == NULL) {
EffectsList::setParameter(effect, "out", QString::number(end));
slotUpdateClipEffect(item, oldeffect, effect);
}
- } else {
+ } else if (item->fadeIn() != 0) {
QDomElement effect = MainWindow::audioEffects.getEffectByName("Fade in");
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn() + start;
EffectsList::setParameter(effect, "out", QString::number(end));
slotUpdateClipEffect(item, oldeffect, effect);
}
- } else {
+ } else if (item->fadeOut() != 0) {
QDomElement effect = MainWindow::audioEffects.getEffectByName("Fade out");
int end = (item->duration() + item->cropStart()).frames(m_document->fps());
int start = end - item->fadeOut();
return QDomElement();
}
-QDomElement EffectsList::getEffectByTag(const QString & tag) const {
- QString effectName;
+QDomElement EffectsList::getEffectByTag(const QString & tag, const QString & id) const {
+
+ if (!id.isEmpty()) for (int i = 0; i < this->size(); ++i) {
+ QDomElement effect = this->at(i);
+ if (effect.attribute("id") == id) {
+ QDomNodeList params = effect.elementsByTagName("parameter");
+ for (int i = 0; i < params.count(); i++) {
+ QDomElement e = params.item(i).toElement();
+ e.setAttribute("value", e.attribute("default"));
+ }
+ return effect;
+ }
+ }
+
for (int i = 0; i < this->size(); ++i) {
QDomElement effect = this->at(i);
if (effect.attribute("tag") == tag) {
~EffectsList();
/** Returns an XML version of this Effect.*/
QDomElement getEffectByName(const QString & name) const;
- QDomElement getEffectByTag(const QString & tag) const;
+ QDomElement getEffectByTag(const QString & tag, const QString & id) const;
QStringList effectNames();
QString getInfo(QString effectName);
QMap <QString, QString> effect(const QString & name);
QDomElement westley = doc.createElement("westley");
doc.appendChild(westley);
westley.appendChild(doc.importNode(xml, true));
- //kDebug() << "////////////\n" << doc.toString() << "////////////////\n";
char *tmp = decodedString(doc.toString());
Mlt::Producer producer(*m_mltProfile, "westley-xml", tmp);
else
filePropertyMap["type"] = "video";
-
QPixmap pix(width, height);
mlt_image_format format = mlt_image_rgb24a;
- const uint8_t *thumb = frame->get_image(format, width, height);
- QImage image(thumb, width, height, QImage::Format_ARGB32);
+ uint8_t* data = frame->get_image(format, width, height);
+ QImage image(data, width, height, QImage::Format_ARGB32);
if (!image.isNull()) {
pix = pix.fromImage(image);
} else pix.fill(Qt::black);
+ QPixmap copy = pix;
+ copy.detach();
+ pix = copy;
+
emit replyGetImage(clipId, 0, pix, width, height);
} else if (frame->get_int("test_audio") == 0) {
QString tag = args.value("tag");
//kDebug()<<" / / INSERTING EFFECT: "<<id;
if (tag.startsWith("ladspa")) tag = "ladspa";
- char *filterId = decodedString(tag);
- Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, filterId);
+ char *filterTag = decodedString(tag);
+ char *filterId = decodedString(args.value("id"));
+ Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, filterTag);
if (filter && filter->is_valid())
filter->set("kdenlive_id", filterId);
else {
if (currentKeyFrameNumber != keyFrameNumber) {
// attach filter to the clip
clipService.attach(*filter);
- filter = new Mlt::Filter(*m_mltProfile, filterId);
+ filter = new Mlt::Filter(*m_mltProfile, filterTag);
filter->set("kdenlive_id", filterId);
keyFrameNumber = currentKeyFrameNumber;
}
// attach filter to the clip
clipService.attach(*filter);
delete[] filterId;
+ delete[] filterTag;
m_isBlocked = false;
if (doRefresh) refresh();
}
if (transitionAdd) {
// Transition should be added to the scene
ItemInfo transitionInfo;
- QDomElement base = MainWindow::transitions.getEffectByTag(mlt_service);
+ QDomElement base = MainWindow::transitions.getEffectByTag(mlt_service, QString());
for (int k = 0; k < transitionparams.count(); k++) {
p = transitionparams.item(k).toElement();
if (effect.tagName() == "filter") {
// add effect to clip
QString effecttag;
+ QString effectid;
QString effectindex;
// Get effect tag & index
for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
if (effectparam.attribute("name") == "tag") {
effecttag = effectparam.text();
}
+ if (effectparam.attribute("name") == "kdenlive_id") {
+ effectid = effectparam.text();
+ }
if (effectparam.attribute("name") == "kdenlive_ix") {
effectindex = effectparam.text();
}
}
// get effect standard tags
- QDomElement clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag);
+ QDomElement clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid);
+ if (clipeffect.isNull()) clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid);
+ if (clipeffect.isNull()) clipeffect = MainWindow::customEffects.getEffectByTag(effecttag, effectid);
clipeffect.setAttribute("kdenlive_ix", effectindex);
QDomNodeList clipeffectparams = clipeffect.childNodes();