m_commandStack->push(command);
} else {
// move and resize clip
+ ClipItem *clip = static_cast<ClipItem *>(item);
QUndoCommand *moveCommand = new QUndoCommand();
moveCommand->setText(i18n("Edit clip"));
if (d.duration() < item->cropDuration() || d.cropStart() != clipInfo.cropStart) {
// duration was reduced, so process it first
clipInfo.endPos = clipInfo.startPos + d.duration();
clipInfo.cropStart = d.cropStart();
- new ResizeClipCommand(this, startInfo, clipInfo, true, false, moveCommand);
+
+ resizeClip(startInfo, clipInfo);
+ new ResizeClipCommand(this, startInfo, clipInfo, false, true, moveCommand);
+ adjustEffects(clip, startInfo, moveCommand);
+ new ResizeClipCommand(this, startInfo, clipInfo, false, true, moveCommand);
}
+
if (d.startPos() != clipInfo.startPos) {
startInfo = clipInfo;
clipInfo.startPos = d.startPos();
clipInfo.endPos = item->endPos() + (clipInfo.startPos - startInfo.startPos);
new MoveClipCommand(this, startInfo, clipInfo, true, moveCommand);
}
+
if (d.duration() > item->cropDuration()) {
// duration was increased, so process it after move
startInfo = clipInfo;
clipInfo.endPos = clipInfo.startPos + d.duration();
clipInfo.cropStart = d.cropStart();
- new ResizeClipCommand(this, startInfo, clipInfo, true, false, moveCommand);
+
+ resizeClip(startInfo, clipInfo);
+ new ResizeClipCommand(this, startInfo, clipInfo, false, true, moveCommand);
+ adjustEffects(clip, startInfo, moveCommand);
+ new ResizeClipCommand(this, startInfo, clipInfo, false, true, moveCommand);
}
updateTrackDuration(clipInfo.track, moveCommand);
m_commandStack->push(moveCommand);
continue;
}
item->initEffect(effect);
+
+ // Old LADSPA filter, deprecated
+ /*
if (effect.attribute("tag") == "ladspa") {
QString ladpsaFile = m_document->getLadspaFile();
initEffects::ladspaEffectFile(ladpsaFile, effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
effect.setAttribute("src", ladpsaFile);
- }
+ }*/
new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
count++;
}
} else {
item->initEffect(effect);
}
-
- if (effect.attribute("tag") == "ladspa") {
+ // Old LADSPA filter, deprecated
+ /* if (effect.attribute("tag") == "ladspa") {
QString ladpsaFile = m_document->getLadspaFile();
initEffects::ladspaEffectFile(ladpsaFile, effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
effect.setAttribute("src", ladpsaFile);
}
+ */
new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
}
}
if (pos < GenTime()) {
// editing a track effect
EffectsParameterList effectParams = getEffectArgs(effect);
- if (effect.attribute("tag") == "ladspa") {
+ // Old LADSPA filter, deprecated
+ /*if (effect.attribute("tag") == "ladspa") {
// Update the ladspa affect file
initEffects::ladspaEffectFile(effect.attribute("src"), effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
- }
+ }*/
// check if we are trying to reset a keyframe effect
/*if (effectParams.hasParam("keyframes") && effectParams.paramValue("keyframes").isEmpty()) {
clip->initEffect(effect);
}
EffectsParameterList effectParams = getEffectArgs(effect);
- if (effect.attribute("tag") == "ladspa") {
+ // Old LADSPA filter, deprecated
+ /*if (effect.attribute("tag") == "ladspa") {
// Update the ladspa affect file
initEffects::ladspaEffectFile(effect.attribute("src"), effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
- }
+ }*/
// check if we are trying to reset a keyframe effect
if (effectParams.hasParam("keyframes") && effectParams.paramValue("keyframes").isEmpty()) {
clip->initEffect(effect);
if (item->type() == AVWIDGET) {
ClipItem *clip = static_cast <ClipItem*>(item);
+ int trackProducer = info.track;
info.track = m_document->tracksCount() - info.track;
adjustTimelineClips(m_scene->editMode(), clip, ItemInfo(), moveGroup);
- m_document->renderer()->mltInsertClip(info, clip->xml(), clip->getProducer(info.track), m_scene->editMode() == OVERWRITEEDIT, m_scene->editMode() == INSERTEDIT);
+ m_document->renderer()->mltInsertClip(info, clip->xml(), clip->getProducer(trackProducer), m_scene->editMode() == OVERWRITEEDIT, m_scene->editMode() == INSERTEDIT);
for (int i = 0; i < clip->effectsCount(); i++) {
m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(clip->effectAt(i)), false);
}
else if (xml.hasAttribute("video_only")) item->setVideoOnly(true);
scene()->addItem(item);
+ int producerTrack = info.track;
int tracknumber = m_document->tracksCount() - info.track - 1;
bool isLocked = m_document->trackInfoAt(tracknumber).isLocked;
if (isLocked) item->setItemLocked(true);
baseclip->addReference();
m_document->updateClip(baseclip->getId());
info.track = m_document->tracksCount() - info.track;
- m_document->renderer()->mltInsertClip(info, xml, item->getProducer(info.track), overwrite, push);
+ m_document->renderer()->mltInsertClip(info, xml, item->getProducer(producerTrack), overwrite, push);
for (int i = 0; i < item->effectsCount(); i++) {
m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(item->effectAt(i)), false);
}
clip = static_cast <ClipItem *>(list.at(i));
if (clip->clipProducer() == clipId) {
ItemInfo info = clip->info();
- info.track = m_document->tracksCount() - clip->track();
if (reload && !m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer(info.track))) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", info.startPos.frames(m_document->fps()), info.track), ErrorMessage);
}
if (item->type() == AVWIDGET) {
ClipItem *clip = static_cast <ClipItem*>(item);
+ int trackProducer = info.track;
info.track = m_document->tracksCount() - info.track;
- m_document->renderer()->mltInsertClip(info, clip->xml(), clip->getProducer(info.track));
+ m_document->renderer()->mltInsertClip(info, clip->xml(), clip->getProducer(trackProducer));
for (int i = 0; i < clip->effectsCount(); i++) {
m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(clip->effectAt(i)), false);
}
ItemInfo clipinfo = item->info();
clipinfo.track = m_document->tracksCount() - clipinfo.track;
bool success = m_document->renderer()->mltResizeClipStart(clipinfo, end.startPos - clipinfo.startPos);
- if (success) {
- kDebug() << "RESIZE CLP STRAT TO:" << end.startPos.frames(m_document->fps()) << ", OLD ST: " << start.startPos.frames(25);
+ if (success)
item->resizeStart((int) end.startPos.frames(m_document->fps()));
-// updatePositionEffects(item, clipinfo);
- } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
+ else
+ emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
} else {
ItemInfo clipinfo = item->info();
clipinfo.track = m_document->tracksCount() - clipinfo.track;
bool success = m_document->renderer()->mltResizeClipEnd(clipinfo, end.endPos - clipinfo.startPos);
- if (success) {
+ if (success)
item->resizeEnd((int) end.endPos.frames(m_document->fps()));
-// updatePositionEffects(item, clipinfo);
- } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
+ else
+ emit displayMessage(i18n("Error when resizing clip"), ErrorMessage);
}
if (!resizeClipStart && end.cropStart != start.cropStart) {
kDebug() << "// RESIZE CROP, DIFF: " << (end.cropStart - start.cropStart).frames(25);
// put a resize command before & after checking keyframes so that
// we are sure the resize is performed before whenever we do or undo the action
new ResizeClipCommand(this, oldInfo, info, false, true, command);
- adjustEffects(clip, oldInfo, true, command);
+ adjustEffects(clip, oldInfo, command);
new ResizeClipCommand(this, oldInfo, info, false, true, command);
emit clipItemSelected(clip);
} else {
// put a resize command before & after checking keyframes so that
// we are sure the resize is performed before whenever we do or undo the action
new ResizeClipCommand(this, oldInfo, info, false, true, command);
- adjustEffects(clip, oldInfo, false, command);
+ adjustEffects(clip, oldInfo, command);
new ResizeClipCommand(this, oldInfo, info, false, true, command);
emit clipItemSelected(clip);
} else {
if (itemList.at(i)->type() == TRANSITIONWIDGET) {
transitionitem = static_cast <Transition*>(itemList.at(i));
transitionXml = transitionitem->toXML();
+ // luma files in transitions can be in "resource" or "luma" property
QString luma = EffectsList::parameter(transitionXml, "luma");
- if (!luma.isEmpty()) urls << luma;
+ if (luma.isEmpty()) luma = EffectsList::parameter(transitionXml, "resource");
+ if (!luma.isEmpty()) urls << KUrl(luma).path();
}
}
+#if QT_VERSION >= 0x040500
+ urls.removeDuplicates();
+#endif
return urls;
}
}
}
-void CustomTrackView::adjustEffects(ClipItem* item, ItemInfo oldInfo, bool fromStart, QUndoCommand* command)
+void CustomTrackView::adjustEffects(ClipItem* item, ItemInfo oldInfo, QUndoCommand* command)
{
- QMap<int, QDomElement> effects;
- if (fromStart)
- effects = item->adjustEffectsToDuration(m_document->width(), m_document->height(), oldInfo.cropStart.frames(m_document->fps()), item->cropStart().frames(m_document->fps()), true);
- else
- effects = item->adjustEffectsToDuration(m_document->width(), m_document->height(), (oldInfo.cropStart + oldInfo.cropDuration).frames(m_document->fps()) - 1,
- (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1, false);
+ QMap<int, QDomElement> effects = item->adjustEffectsToDuration(m_document->width(), m_document->height(), oldInfo);
if (effects.count()) {
QMap<int, QDomElement>::const_iterator i = effects.constBegin();
}
}
}
+
+
+void CustomTrackView::saveTimelinePreview(const QString path)
+{
+ QRect viewrect = viewport()->rect();
+ QImage img(viewrect.width(), viewrect.height(), QImage::Format_ARGB32_Premultiplied);
+ img.fill(palette().base().color().rgb());
+ QPainter painter(&img);
+ render(&painter);
+ painter.end();
+ img = img.scaledToWidth(600, Qt::SmoothTransformation);
+ img.save(path);
+}
+