#include "docclipbase.h"
#include "clipitem.h"
#include "definitions.h"
-#include "moveclipcommand.h"
-#include "movetransitioncommand.h"
-#include "resizeclipcommand.h"
-#include "editguidecommand.h"
-#include "addtimelineclipcommand.h"
-#include "addeffectcommand.h"
-#include "editeffectcommand.h"
-#include "moveeffectcommand.h"
-#include "addtransitioncommand.h"
-#include "edittransitioncommand.h"
-#include "editkeyframecommand.h"
-#include "changespeedcommand.h"
-#include "addmarkercommand.h"
-#include "razorclipcommand.h"
+#include "commands/moveclipcommand.h"
+#include "commands/movetransitioncommand.h"
+#include "commands/resizeclipcommand.h"
+#include "commands/editguidecommand.h"
+#include "commands/addtimelineclipcommand.h"
+#include "commands/addeffectcommand.h"
+#include "commands/editeffectcommand.h"
+#include "commands/moveeffectcommand.h"
+#include "commands/addtransitioncommand.h"
+#include "commands/edittransitioncommand.h"
+#include "commands/editkeyframecommand.h"
+#include "commands/changespeedcommand.h"
+#include "commands/addmarkercommand.h"
+#include "commands/razorclipcommand.h"
#include "kdenlivesettings.h"
#include "transition.h"
#include "clipmanager.h"
#include "ui_keyframedialog_ui.h"
#include "clipdurationdialog.h"
#include "abstractgroupitem.h"
-#include "insertspacecommand.h"
+#include "commands/insertspacecommand.h"
#include "spacerdialog.h"
-#include "addtrackcommand.h"
-#include "movegroupcommand.h"
+#include "commands/addtrackcommand.h"
+#include "commands/movegroupcommand.h"
#include "ui_addtrack_ui.h"
#include "initeffects.h"
-#include "locktrackcommand.h"
-#include "groupclipscommand.h"
-#include "splitaudiocommand.h"
-#include "changecliptypecommand.h"
+#include "commands/locktrackcommand.h"
+#include "commands/groupclipscommand.h"
+#include "commands/splitaudiocommand.h"
+#include "commands/changecliptypecommand.h"
#include "trackdialog.h"
#include "tracksconfigdialog.h"
-#include "configtrackscommand.h"
-#include "rebuildgroupcommand.h"
-#include "razorgroupcommand.h"
+#include "commands/configtrackscommand.h"
+#include "commands/rebuildgroupcommand.h"
+#include "commands/razorgroupcommand.h"
#include "profilesdialog.h"
#include <KDebug>
return m_scene->m_tracksList;
}*/
-void CustomTrackView::checkTrackHeight()
+
+int CustomTrackView::getFrameWidth()
+{
+ return (int) (m_tracksHeight * m_document->mltProfile().display_aspect_num / m_document->mltProfile().display_aspect_den + 0.5);
+}
+
+void CustomTrackView::updateSceneFrameWidth()
{
- if (m_tracksHeight == KdenliveSettings::trackheight()) return;
+ int frameWidth = getFrameWidth();
+ QList<QGraphicsItem *> itemList = items();
+ ClipItem *item;
+ for (int i = 0; i < itemList.count(); i++) {
+ if (itemList.at(i)->type() == AVWIDGET) {
+ item = (ClipItem*) itemList.at(i);
+ item->resetFrameWidth(frameWidth);
+ item->resetThumbs(true);
+ }
+ }
+}
+
+bool CustomTrackView::checkTrackHeight()
+{
+ if (m_tracksHeight == KdenliveSettings::trackheight()) return false;
m_tracksHeight = KdenliveSettings::trackheight();
emit trackHeightChanged();
QList<QGraphicsItem *> itemList = items();
ClipItem *item;
Transition *transitionitem;
+ int frameWidth = getFrameWidth();
bool snap = KdenliveSettings::snaptopoints();
KdenliveSettings::setSnaptopoints(false);
for (int i = 0; i < itemList.count(); i++) {
item = (ClipItem*) itemList.at(i);
item->setRect(0, 0, item->rect().width(), m_tracksHeight - 1);
item->setPos((qreal) item->startPos().frames(m_document->fps()), (qreal) item->track() * m_tracksHeight + 1);
+ item->resetFrameWidth(frameWidth);
item->resetThumbs(true);
} else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
transitionitem = (Transition*) itemList.at(i);
// verticalScrollBar()->setMaximum(m_tracksHeight * m_document->tracksCount());
KdenliveSettings::setSnaptopoints(snap);
viewport()->update();
+ return true;
}
/** Zoom or move viewport on mousewheel
// razor tool over a clip, display current frame in monitor
if (false && !m_blockRefresh && item->type() == AVWIDGET) {
//TODO: solve crash when showing frame when moving razor over clip
- emit showClipFrame(((ClipItem *) item)->baseClip(), QPoint(), mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
+ emit showClipFrame(((ClipItem *) item)->baseClip(), QPoint(), false, mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
}
event->accept();
return;
// check item under mouse
QList<QGraphicsItem *> collisionList = items(m_clickEvent);
-
if (event->modifiers() == Qt::ControlModifier && m_tool != SPACERTOOL && collisionList.count() == 0) {
// Pressing Ctrl + left mouse button in an empty area scrolls the timeline
setDragMode(QGraphicsView::ScrollHandDrag);
} else {
setCursorPos((int)(mapToScene(event->x(), 0).x()));
}
- QGraphicsView::mousePressEvent(event);
+ //QGraphicsView::mousePressEvent(event);
+ event->ignore();
return;
}
kDebug() << " WARNING))))))))) CLIP NOT FOUND : " << list.at(0);
return false;
}
- if (clip->producer() == NULL) {
+ if (clip->getProducer() == NULL) {
emit displayMessage(i18n("Clip not ready"), ErrorMessage);
return false;
}
return true;
}
m_selectionGroup = new AbstractGroupItem(m_document->fps());
- ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, 1);
+ ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, 1, getFrameWidth());
m_selectionGroup->addToGroup(item);
item->setFlag(QGraphicsItem::ItemIsMovable, false);
kDebug() << " WARNING))))))))) CLIP NOT FOUND : " << ids.at(i);
return false;
}
- if (clip->producer() == NULL) {
+ if (clip->getProducer() == NULL) {
emit displayMessage(i18n("Clip not ready"), ErrorMessage);
return false;
}
info.track = 0;
start += info.cropDuration;
offsetList.append(start);
- ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, 1, false);
+ ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, 1, getFrameWidth(), false);
item->setFlag(QGraphicsItem::ItemIsMovable, false);
m_selectionGroup->addToGroup(item);
if (!clip->isPlaceHolder()) m_waitingThumbs.append(item);
{
if (pos < GenTime()) {
// Add track effect
+ if (effect.attribute("id") == "speed") {
+ emit displayMessage(i18n("Cannot add speed effect to track"), ErrorMessage);
+ return;
+ }
clearSelection();
m_document->addTrackEffect(track - 1, effect);
m_document->renderer()->mltAddTrackEffect(track, getEffectArgs(effect));
QList<QGraphicsItem *> itemList = group->childItems();
QUndoCommand *effectCommand = new QUndoCommand();
QString effectName;
- QDomNode namenode = effect.elementsByTagName("name").item(0);
- if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
+ QDomElement namenode = effect.firstChildElement("name");
+ if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
else effectName = i18n("effect");
effectCommand->setText(i18n("Add %1", effectName));
int count = 0;
QList<QGraphicsItem *> itemList;
QUndoCommand *effectCommand = new QUndoCommand();
QString effectName;
- QDomNode namenode = effect.elementsByTagName("name").item(0);
- if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
+ QDomElement namenode = effect.firstChildElement("name");
+ if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
else effectName = i18n("effect");
effectCommand->setText(i18n("Add %1", effectName));
QList<QGraphicsItem *> items = m_selectionGroup->childItems();
QUndoCommand *delCommand = new QUndoCommand();
QString effectName;
- QDomNode namenode = effect.elementsByTagName("name").item(0);
- if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
+ QDomElement namenode = effect.firstChildElement("name");
+ if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
else effectName = i18n("effect");
delCommand->setText(i18n("Delete %1", effectName));
return;
}
QDomElement effect = insertedEffect.cloneNode().toElement();
- //kDebug() << "// update effect ix: " << effect.attribute("kdenlive_ix")<<", TRACK: "<<track;
+ //kDebug() << "// update effect ix: " << effect.attribute("kdenlive_ix")<<", GAIN: "<<EffectsList::parameter(effect, "gain");
if (pos < GenTime()) {
// editing a track effect
EffectsParameterList effectParams = getEffectArgs(effect);
emit clipItemSelected(clip, ix);
}
}
+ else emit displayMessage(i18n("Cannot find clip to update effect"), ErrorMessage);
setDocumentModified();
}
ItemInfo clipInfo = info;
clipInfo.track = m_document->tracksCount() - item->track();
- int worked = m_document->renderer()->mltInsertClip(clipInfo, item->xml(), item->baseClip()->producer(item->track()), m_scene->editMode() == OVERWRITEEDIT, m_scene->editMode() == INSERTEDIT);
+ int worked = m_document->renderer()->mltInsertClip(clipInfo, item->xml(), item->baseClip()->getProducer(item->track()), m_scene->editMode() == OVERWRITEEDIT, m_scene->editMode() == INSERTEDIT);
if (worked == -1) {
emit displayMessage(i18n("Cannot insert clip in timeline"), ErrorMessage);
brokenClips.append(item);
m_selectionGroup->translate(0, m_tracksHeight);
// adjust track number
+ Mlt::Tractor *tractor = m_document->renderer()->lockService();
QList<QGraphicsItem *> children = m_selectionGroup->childItems();
for (int i = 0; i < children.count(); i++) {
if (children.at(i)->type() == GROUPWIDGET) {
// We add a move clip command so that we get the correct producer for new track number
if (clip->clipType() == AV || clip->clipType() == AUDIO) {
Mlt::Producer *prod = clip->getProducer(clipinfo.track);
- if (m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod) == false) {
+ if (m_document->renderer()->mltUpdateClipProducer(tractor, (int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod) == false) {
// problem updating clip
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", clipinfo.startPos.frames(m_document->fps()), clipinfo.track), ErrorMessage);
}
}
}
resetSelectionGroup(false);
+ m_document->renderer()->unlockService(tractor);
}
int maxHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
// Move graphic items
qreal ydiff = 0 - (int) m_tracksHeight;
m_selectionGroup->translate(0, ydiff);
+ Mlt::Tractor *tractor = m_document->renderer()->lockService();
// adjust track number
QList<QGraphicsItem *> children = m_selectionGroup->childItems();
// We add a move clip command so that we get the correct producer for new track number
if (clip->clipType() == AV || clip->clipType() == AUDIO || clip->clipType() == PLAYLIST) {
Mlt::Producer *prod = clip->getProducer(clipinfo.track);
- if (prod == NULL || !m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod)) {
+ if (prod == NULL || !m_document->renderer()->mltUpdateClipProducer(tractor, (int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod)) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", clipinfo.startPos.frames(m_document->fps()), clipinfo.track), ErrorMessage);
}
}
}
}
resetSelectionGroup(false);
+ m_document->renderer()->unlockService(tractor);
int maxHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
for (int i = 0; i < m_guides.count(); i++) {
emit displayMessage(i18n("Error removing clip at %1 on track %2", m_document->timecode().getTimecodeFromFrames(info.startPos.frames(m_document->fps())), info.track), ErrorMessage);
kDebug()<<"CANNOT REMOVE: "<<info.startPos.frames(m_document->fps())<<", TK: "<<info.track;
//m_document->renderer()->saveSceneList(QString("/tmp/error%1.mlt").arg(m_ct), QDomElement());
- exit(1);
return;
}
m_waitingThumbs.removeAll(item);
+ item->stopThumbs();
if (item->isSelected()) emit clipItemSelected(NULL);
item->baseClip()->removeReference();
m_document->updateClip(item->baseClip()->getId());
m_commandStack->push(deleteSelected);
}
-void CustomTrackView::changeClipSpeed()
-{
- // TODO: remove after string freeze
- QList<QGraphicsItem *> itemList = scene()->selectedItems();
- if (itemList.count() == 0) {
- emit displayMessage(i18n("Select clip to change speed"), ErrorMessage);
- return;
- }
- QUndoCommand *changeSelected = new QUndoCommand();
- changeSelected->setText("Edit clip speed");
- int count = 0;
- int percent = -1;
- bool ok;
- for (int i = 0; i < itemList.count(); i++) {
- if (itemList.at(i)->type() == AVWIDGET) {
- ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
- if (percent == -1) percent = QInputDialog::getInteger(this, i18n("Edit Clip Speed"), i18n("New speed (percents)"), item->speed() * 100, 1, 10000, 1, &ok);
- if (!ok) break;
- double speed = (double) percent / 100.0;
- if (item->speed() != speed && (item->clipType() == VIDEO || item->clipType() == AV)) {
- count++;
- //new ChangeSpeedCommand(this, info, item->speed(), speed, item->clipProducer(), changeSelected);
- }
- }
- }
- if (count > 0) m_commandStack->push(changeSelected);
- else delete changeSelected;
-}
void CustomTrackView::doChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, const double speed, const double oldspeed, int strobe, const QString &id)
{
return;
}
- if (baseclip->producer() == NULL) {
+ if (baseclip->getProducer() == NULL) {
// If the clip has no producer, we must wait until it is created...
m_mutex.lock();
emit displayMessage(i18n("Waiting for clip..."), InformationMessage);
emit forceClipProcessing(clipId);
qApp->processEvents();
- for (int i = 0; i < 3; i++) {
- if (baseclip->producer() == NULL) {
- m_producerNotReady.wait(&m_mutex, 500 + 500 * i);
+ for (int i = 0; i < 10; i++) {
+ if (baseclip->getProducer() == NULL) {
+ qApp->processEvents();
+ m_producerNotReady.wait(&m_mutex, 200);
} else break;
}
- if (baseclip->producer() == NULL) {
+ if (baseclip->getProducer() == NULL) {
emit displayMessage(i18n("Cannot insert clip..."), ErrorMessage);
m_mutex.unlock();
return;
m_mutex.unlock();
}
- ClipItem *item = new ClipItem(baseclip, info, m_document->fps(), xml.attribute("speed", "1").toDouble(), xml.attribute("strobe", "1").toInt());
+ ClipItem *item = new ClipItem(baseclip, info, m_document->fps(), xml.attribute("speed", "1").toDouble(), xml.attribute("strobe", "1").toInt(), getFrameWidth());
item->setEffectList(effects);
if (xml.hasAttribute("audio_only")) item->setAudioOnly(true);
else if (xml.hasAttribute("video_only")) item->setVideoOnly(true);
void CustomTrackView::slotUpdateClip(const QString &clipId, bool reload)
{
+ QMutexLocker locker(&m_mutex);
QList<QGraphicsItem *> list = scene()->items();
QList <ClipItem *>clipList;
ClipItem *clip = NULL;
+ DocClipBase *baseClip = NULL;
+ Mlt::Tractor *tractor = m_document->renderer()->lockService();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i)->type() == AVWIDGET) {
clip = static_cast <ClipItem *>(list.at(i));
if (clip->clipProducer() == clipId) {
+ if (baseClip == NULL) {
+ baseClip = clip->baseClip();
+ }
ItemInfo info = clip->info();
Mlt::Producer *prod = NULL;
- if (clip->isAudioOnly()) prod = clip->baseClip()->audioProducer(info.track);
- else if (clip->isVideoOnly()) prod = clip->baseClip()->videoProducer();
- else prod = clip->baseClip()->producer(info.track);
- if (reload && !m_document->renderer()->mltUpdateClip(info, clip->xml(), prod)) {
+ if (clip->isAudioOnly()) prod = baseClip->audioProducer(info.track);
+ else if (clip->isVideoOnly()) prod = baseClip->videoProducer();
+ else prod = baseClip->getProducer(info.track);
+ if (reload && !m_document->renderer()->mltUpdateClip(tractor, info, clip->xml(), prod)) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", info.startPos.frames(m_document->fps()), info.track), ErrorMessage);
}
else clipList.append(clip);
}
for (int i = 0; i < clipList.count(); i++)
clipList.at(i)->refreshClip(true, true);
+ m_document->renderer()->unlockService(tractor);
}
ClipItem *CustomTrackView::getClipItemAtEnd(GenTime pos, int track)
Transition *CustomTrackView::getTransitionItemAt(int pos, int track)
{
- const QPointF p(pos, (track + 1) * m_tracksHeight);
+ const QPointF p(pos, track * m_tracksHeight + Transition::itemOffset() + 1);
QList<QGraphicsItem *> list = scene()->items(p);
Transition *clip = NULL;
for (int i = 0; i < list.size(); i++) {
Transition *CustomTrackView::getTransitionItemAtEnd(GenTime pos, int track)
{
int framepos = (int)(pos.frames(m_document->fps()));
- const QPointF p(framepos - 1, (track + 1) * m_tracksHeight);
+ const QPointF p(framepos - 1, track * m_tracksHeight + Transition::itemOffset() + 1);
QList<QGraphicsItem *> list = scene()->items(p);
Transition *clip = NULL;
for (int i = 0; i < list.size(); i++) {
Transition *CustomTrackView::getTransitionItemAtStart(GenTime pos, int track)
{
- const QPointF p(pos.frames(m_document->fps()), (track + 1) * m_tracksHeight);
+ const QPointF p(pos.frames(m_document->fps()), track * m_tracksHeight + Transition::itemOffset() + 1);
QList<QGraphicsItem *> list = scene()->items(p);
Transition *clip = NULL;
for (int i = 0; i < list.size(); ++i) {
} else kDebug() << "///////// WARNING; NO GROUP TO MOVE";
}
-void CustomTrackView::moveTransition(const ItemInfo &start, const ItemInfo &end, bool m_refresh)
+void CustomTrackView::moveTransition(const ItemInfo &start, const ItemInfo &end, bool refresh)
{
Transition *item = getTransitionItemAt(start.startPos, start.track);
if (!item) {
}
emit transitionItemSelected(item, getPreviousVideoTrack(item->track()), p);
}
- if (m_refresh) m_document->renderer()->doRefresh();
+ if (refresh) m_document->renderer()->doRefresh();
setDocumentModified();
}
clip->setSelected(true);
ClipItem *audioClip = getClipItemAt(start, info.track);
if (audioClip) {
+ Mlt::Tractor *tractor = m_document->renderer()->lockService();
clip->setVideoOnly(true);
- if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->videoProducer()) == false) {
+ if (m_document->renderer()->mltUpdateClipProducer(tractor, m_document->tracksCount() - track, start, clip->baseClip()->videoProducer()) == false) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
}
- if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - info.track, start, clip->baseClip()->audioProducer(info.track)) == false) {
+ if (m_document->renderer()->mltUpdateClipProducer(tractor, m_document->tracksCount() - info.track, start, clip->baseClip()->audioProducer(info.track)) == false) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, info.track), ErrorMessage);
}
+ m_document->renderer()->unlockService(tractor);
audioClip->setSelected(true);
audioClip->setAudioOnly(true);
ItemInfo info = clip->info();
deleteClip(clp->info());
clip->setVideoOnly(false);
-
- if (!m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - info.track, info.startPos.frames(m_document->fps()), clip->baseClip()->producer(info.track))) {
+ Mlt::Tractor *tractor = m_document->renderer()->lockService();
+ if (!m_document->renderer()->mltUpdateClipProducer(tractor, m_document->tracksCount() - info.track, info.startPos.frames(m_document->fps()), clip->baseClip()->getProducer(info.track))) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", info.startPos.frames(m_document->fps()), info.track), ErrorMessage);
}
+ m_document->renderer()->unlockService(tractor);
// re-add audio effects
for (int i = 0; i < effects.count(); ++i) {
kDebug() << "// Cannot find clip to split!!!";
return;
}
+ Mlt::Tractor *tractor = m_document->renderer()->lockService();
if (videoOnly) {
int start = pos.frames(m_document->fps());
clip->setVideoOnly(true);
clip->setAudioOnly(false);
- if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->videoProducer()) == false) {
+ if (m_document->renderer()->mltUpdateClipProducer(tractor, m_document->tracksCount() - track, start, clip->baseClip()->videoProducer()) == false) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
}
} else if (audioOnly) {
int start = pos.frames(m_document->fps());
clip->setAudioOnly(true);
clip->setVideoOnly(false);
- if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->audioProducer(track)) == false) {
+ if (m_document->renderer()->mltUpdateClipProducer(tractor, m_document->tracksCount() - track, start, clip->baseClip()->audioProducer(track)) == false) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
}
} else {
int start = pos.frames(m_document->fps());
clip->setAudioOnly(false);
clip->setVideoOnly(false);
- if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->producer(track)) == false) {
+ if (m_document->renderer()->mltUpdateClipProducer(tractor, m_document->tracksCount() - track, start, clip->baseClip()->getProducer(track)) == false) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
}
}
+ m_document->renderer()->unlockService(tractor);
clip->update();
setDocumentModified();
}
if (!luma.isEmpty()) urls << KUrl(luma).path();
}
}
-#if QT_VERSION >= 0x040500
urls.removeDuplicates();
-#endif
return urls;
}
QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
double factor = e.attribute("factor", "1").toDouble();
+ double offset = e.attribute("offset", "0").toDouble();
for (int j = 0; j < values.count(); j++) {
QString pos = values.at(j).section(':', 0, 0);
- double val = values.at(j).section(':', 1, 1).toDouble() / factor;
+ double val = (values.at(j).section(':', 1, 1).toDouble() - offset) / factor;
values[j] = pos + "=" + locale.toString(val);
}
// kDebug() << "/ / / /SENDING KEYFR:" << values;
parameters.addParam("max", e.attribute("max"));
parameters.addParam("min", e.attribute("min"));
parameters.addParam("factor", e.attribute("factor", "1"));
+ parameters.addParam("offset", e.attribute("offset", "0"));
parameters.addParam("starttag", e.attribute("starttag", "start"));
parameters.addParam("endtag", e.attribute("endtag", "end"));
} else if (e.attribute("namedesc").contains(';')) {
}
parameters.addParam("start", neu);
} else {
- if (e.attribute("factor", "1") != "1") {
+ if (e.attribute("factor", "1") != "1" || e.attribute("offset", "0") != "0") {
double fact;
if (e.attribute("factor").contains('%')) {
fact = ProfilesDialog::getStringEval(m_document->mltProfile(), e.attribute("factor"));
- } else fact = e.attribute("factor", "1").toDouble();
- parameters.addParam(e.attribute("name"), locale.toString(e.attribute("value").toDouble() / fact));
+ } else {
+ fact = e.attribute("factor", "1").toDouble();
+ }
+ double offset = e.attribute("offset", "0").toDouble();
+ parameters.addParam(e.attribute("name"), locale.toString((e.attribute("value").toDouble() - offset) / fact));
} else {
parameters.addParam(e.attribute("name"), e.attribute("value"));
}
}
+void CustomTrackView::slotGotFilterJobResults(const QString &id, int startPos, int track, const QString &filter, stringMap filterParams)
+{
+ ClipItem *clip = getClipItemAt(GenTime(startPos, m_document->fps()), track);
+ if (clip == NULL) {
+ emit displayMessage(i18n("Cannot find clip for effect update %1.", filter), ErrorMessage);
+ return;
+ }
+ QDomElement newEffect;
+ QDomElement effect = clip->getEffectAt(clip->selectedEffectIndex());
+ if (effect.attribute("id") == filter) {
+ newEffect = effect.cloneNode().toElement();
+ QMap<QString, QString>::const_iterator i = filterParams.constBegin();
+ while (i != filterParams.constEnd()) {
+ EffectsList::setParameter(newEffect, i.key(), i.value());
+ kDebug()<<"// RESULT FILTER: "<<i.key()<<"="<< i.value();
+ ++i;
+ }
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effect, newEffect, clip->selectedEffectIndex(), true);
+ m_commandStack->push(command);
+ emit clipItemSelected(clip, clip->selectedEffectIndex());
+ }
+
+}
+
+