QDomNodeList params = effect.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
- kDebug() << "// init eff: " << e.attribute("name");
+
+ if (e.isNull())
+ continue;
// Check if this effect has a variable parameter
if (e.attribute("default").startsWith('%')) {
}
}
- if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe")) {
- QString def = e.attribute("default");
+ if ((e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") && e.attribute("keyframes").isEmpty()) {
// Effect has a keyframe type parameter, we need to set the values
- if (e.attribute("keyframes").isEmpty()) {
- e.setAttribute("keyframes", QString::number(cropStart().frames(m_fps)) + ':' + def);
- kDebug() << "///// EFFECT KEYFRAMES INITED: " << e.attribute("keyframes");
- //break;
- }
+ e.setAttribute("keyframes", QString::number(cropStart().frames(m_fps)) + ':' + e.attribute("default"));
}
}
if (effect.attribute("tag") == "volume" || effect.attribute("tag") == "brightness") {
{
m_selectedEffect = ix;
QDomElement effect = effectAt(m_selectedEffect);
- if (effect.isNull() == false) {
+ if (!effect.isNull() && effect.attribute("disable") != "1") {
QDomNodeList params = effect.elementsByTagName("parameter");
- if (effect.attribute("disable") != "1")
- for (int i = 0; i < params.count(); i++) {
- QDomElement e = params.item(i).toElement();
- if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") && e.attribute("intimeline") == "1") {
- m_keyframes.clear();
- m_visibleParam = i;
- double max = e.attribute("max").toDouble();
- double min = e.attribute("min").toDouble();
- m_keyframeFactor = 100.0 / (max - min);
- m_keyframeOffset = min;
- m_keyframeDefault = e.attribute("default").toDouble();
- m_selectedKeyframe = 0;
-
- // parse keyframes
- const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
- foreach(const QString &str, keyframes) {
- int pos = str.section(':', 0, 0).toInt();
- double val = str.section(':', 1, 1).toDouble();
- m_keyframes[pos] = val;
- }
- if (m_keyframes.find(m_editedKeyframe) == m_keyframes.end()) m_editedKeyframe = -1;
- update();
- return;
+ for (int i = 0; i < params.count(); i++) {
+ QDomElement e = params.item(i).toElement();
+ if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") && e.attribute("intimeline") == "1") {
+ m_keyframes.clear();
+ m_visibleParam = i;
+ double max = e.attribute("max").toDouble();
+ double min = e.attribute("min").toDouble();
+ m_keyframeFactor = 100.0 / (max - min);
+ m_keyframeOffset = min;
+ m_keyframeDefault = e.attribute("default").toDouble();
+ m_selectedKeyframe = 0;
+
+ // parse keyframes
+ const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
+ foreach(const QString &str, keyframes) {
+ int pos = str.section(':', 0, 0).toInt();
+ double val = str.section(':', 1, 1).toDouble();
+ m_keyframes[pos] = val;
}
+ if (m_keyframes.find(m_editedKeyframe) == m_keyframes.end())
+ m_editedKeyframe = -1;
+ update();
+ return;
}
+ }
}
+
if (!m_keyframes.isEmpty()) {
m_keyframes.clear();
update();
if (rect.height() < 30) addtransitionOffset = 0;
if (qAbs((int)(pos.x() - (rect.x() + m_startFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) {
- if (m_startFade == 0) setToolTip(i18n("Add audio fade"));
- // xgettext:no-c-format
- else setToolTip(i18n("Audio fade duration: %1s", GenTime(m_startFade, m_fps).seconds()));
return FADEIN;
} else if (pos.x() - rect.x() < maximumOffset && (rect.bottom() - pos.y() > addtransitionOffset)) {
- // xgettext:no-c-format
- setToolTip(i18n("Crop from start: %1s", cropStart().seconds()));
return RESIZESTART;
} else if (qAbs((int)(pos.x() - (rect.x() + rect.width() - m_endFade))) < maximumOffset && qAbs((int)(pos.y() - rect.y())) < 6) {
- if (m_endFade == 0) setToolTip(i18n("Add audio fade"));
- // xgettext:no-c-format
- else setToolTip(i18n("Audio fade duration: %1s", GenTime(m_endFade, m_fps).seconds()));
return FADEOUT;
} else if ((rect.right() - pos.x() < maximumOffset) && (rect.bottom() - pos.y() > addtransitionOffset)) {
- // xgettext:no-c-format
- setToolTip(i18n("Clip duration: %1s", cropDuration().seconds()));
return RESIZEEND;
} else if ((pos.x() - rect.x() < 16 / scale) && (rect.bottom() - pos.y() <= addtransitionOffset)) {
- setToolTip(i18n("Add transition"));
return TRANSITIONSTART;
} else if ((rect.right() - pos.x() < 16 / scale) && (rect.bottom() - pos.y() <= addtransitionOffset)) {
- setToolTip(i18n("Add transition"));
return TRANSITIONEND;
}
- QString tooltip = "<b>" + m_clipName + "</b>";
- if (!baseClip()->fileURL().isEmpty())
- tooltip.append("<br />" + baseClip()->fileURL().path());
- if (!baseClip()->description().isEmpty())
- tooltip.append("<br />" + baseClip()->description());
- setToolTip(tooltip);
+
return MOVE;
}
{
if (pos == m_startFade) return;
int oldIn = m_startFade;
- if (pos < 0) pos = 0;
- if (pos > cropDuration().frames(m_fps)) pos = (int)(cropDuration().frames(m_fps));
- m_startFade = pos;
+ m_startFade = qBound(0, pos, (int)cropDuration().frames(m_fps));
QRectF rect = boundingRect();
- update(rect.x(), rect.y(), qMax(oldIn, pos), rect.height());
+ update(rect.x(), rect.y(), qMax(oldIn, m_startFade), rect.height());
}
void ClipItem::setFadeOut(int pos)
{
if (pos == m_endFade) return;
int oldOut = m_endFade;
- if (pos < 0) pos = 0;
- if (pos > cropDuration().frames(m_fps)) pos = (int)(cropDuration().frames(m_fps));
- m_endFade = pos;
+ m_endFade = qBound(0, pos, (int)cropDuration().frames(m_fps));
QRectF rect = boundingRect();
- update(rect.x() + rect.width() - qMax(oldOut, pos), rect.y(), qMax(oldOut, pos), rect.height());
+ update(rect.x() + rect.width() - qMax(oldOut, m_endFade), rect.y(), qMax(oldOut, m_endFade), rect.height());
}
if (effectId.isEmpty()) effectId = effect.attribute("tag");
parameters.addParam("id", effectId);
- // special case: the affine effect needs in / out points
+ // special case: the affine effect needs in / out points
if (effectId == "pan_zoom") {
parameters.addParam("in", QString::number(cropStart().frames(m_fps)));
parameters.addParam("out", QString::number((cropStart() + cropDuration()).frames(m_fps)));
//virtual
void ClipItem::dropEvent(QGraphicsSceneDragDropEvent * event)
{
- const QString effects = QString(event->mimeData()->data("kdenlive/effectslist"));
+ const QString effects = QString::fromUtf8(event->mimeData()->data("kdenlive/effectslist"));
QDomDocument doc;
doc.setContent(effects, true);
const QDomElement e = doc.documentElement();
void ClipItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{
- Q_UNUSED(event);
+ Q_UNUSED(event)
}
void ClipItem::addTransition(Transition* t)
}
QPixmap p;
for (int i = start; i <= end; i++) {
- if (!view->pixmapCache->find(m_clip->fileURL().path() + "%" + QString::number(i), p)) {
+ if (!view->m_pixmapCache->find(m_clip->fileURL().path() + "%" + QString::number(i), p)) {
p = m_clip->thumbProducer()->extractImage(i, twidth, theight);
- view->pixmapCache->insert(m_clip->fileURL().path() + "%" + QString::number(i), p);
+ view->m_pixmapCache->insert(m_clip->fileURL().path() + "%" + QString::number(i), p);
}
painter->drawPixmap(startPos + QPointF(twidth *(i - offset), 0), p);
}