m_commandStack = doc->commandStack();
else
m_commandStack = NULL;
-
+ m_ct = 0;
setMouseTracking(true);
setAcceptDrops(true);
setFrameShape(QFrame::NoFrame);
m_blockRefresh = true;
m_dragGuide = NULL;
- bool collision = false;
if (m_tool != RAZORTOOL) activateMonitor();
else if (m_document->renderer()->playSpeed() != 0.0) {
m_dragGuide = (Guide *) collisionList.at(i);
if (event->button() == Qt::LeftButton) { // move it
m_dragGuide->setFlag(QGraphicsItem::ItemIsMovable, true);
- collision = true;
m_operationMode = MOVEGUIDE;
// deselect all clips so that only the guide will move
m_scene->clearSelection();
void CustomTrackView::deleteClip(ItemInfo info, bool refresh)
{
ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()), info.track);
-
+ m_ct++;
+ if (!item) kDebug()<<"// PROBLEM FINDING CLIP ITEM TO REMOVVE!!!!!!!!!";
+ else kDebug()<<"// deleting CLIP: "<<info.startPos.frames(m_document->fps())<<", "<<item->baseClip()->fileURL();
+ //m_document->renderer()->saveSceneList(QString("/tmp/error%1.mlt").arg(m_ct), QDomElement());
if (!item || m_document->renderer()->mltRemoveClip(m_document->tracksCount() - info.track, info.startPos) == false) {
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);
scene()->clearSelection();
QUndoCommand *deleteSelected = new QUndoCommand();
- bool resetGroup = false;
int groupCount = 0;
int clipCount = 0;
int transitionCount = 0;
QList<QGraphicsItem *> children = itemList.at(i)->childItems();
QList <ItemInfo> clipInfos;
QList <ItemInfo> transitionInfos;
- GenTime currentPos = GenTime(m_cursorPos, m_document->fps());
for (int j = 0; j < children.count(); j++) {
if (children.at(j)->type() == AVWIDGET) {
AbstractClipItem *clip = static_cast <AbstractClipItem *>(children.at(j));
if (itemList.at(i)->type() == AVWIDGET) {
clipCount++;
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
- if (item->parentItem()) resetGroup = true;
//kDebug()<<"// DELETE CLP AT: "<<item->info().startPos.frames(25);
new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), false, false, true, true, deleteSelected);
emit clipItemSelected(NULL);
transitionCount++;
Transition *item = static_cast <Transition *>(itemList.at(i));
//kDebug()<<"// DELETE TRANS AT: "<<item->info().startPos.frames(25);
- if (item->parentItem()) resetGroup = true;
new AddTransitionCommand(this, item->info(), item->transitionEndTrack(), item->toXML(), true, true, deleteSelected);
emit transitionItemSelected(NULL);
}
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
- ItemInfo info = item->info();
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;
QList<QGraphicsItem *> itemList = scene()->selectedItems();
QList <ItemInfo> clipInfos;
QList <ItemInfo> transitionInfos;
- GenTime currentPos = GenTime(m_cursorPos, m_document->fps());
// Expand groups
int max = itemList.count();
// parse parameters to check if we need to adjust to the new crop start
int diff = (newstart - oldstart).frames(m_document->fps());
int max = (newstart + duration).frames(m_document->fps());
+ QLocale locale;
QDomNodeList params = xml.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
double val = str.section(':', 1, 1).toDouble();
pos += diff;
if (pos > max) {
- newKeyFrames.append(QString::number(max) + ':' + QString::number(val));
+ newKeyFrames.append(QString::number(max) + ':' + locale.toString(val));
break;
- } else newKeyFrames.append(QString::number(pos) + ':' + QString::number(val));
+ } else newKeyFrames.append(QString::number(pos) + ':' + locale.toString(val));
}
//kDebug()<<"ORIGIN: "<<keys<<", FIXED: "<<newKeyFrames;
e.setAttribute("keyframes", newKeyFrames.join(";"));
} else {
QString startThumb = thumbBase + item->baseClip()->getClipHash() + '_';
QString endThumb = startThumb;
- startThumb.append(QString::number(item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
- endThumb.append(QString::number((item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
+ startThumb.append(QString::number((int) item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
+ endThumb.append(QString::number((int) (item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
if (QFile::exists(startThumb)) {
QPixmap pix(startThumb);
if (pix.isNull()) KIO::NetAccess::del(KUrl(startThumb), this);
} else {
QString startThumb = thumbBase + item->baseClip()->getClipHash() + '_';
QString endThumb = startThumb;
- startThumb.append(QString::number(item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
- endThumb.append(QString::number((item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
+ startThumb.append(QString::number((int) item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
+ endThumb.append(QString::number((int) (item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
if (!QFile::exists(startThumb)) {
QPixmap pix(item->startThumb());
pix.save(startThumb);
QStringList CustomTrackView::getLadspaParams(QDomElement effect) const
{
QStringList result;
+ QLocale locale;
QDomNodeList params = effect.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
double factor = e.attribute("factor").toDouble();
double value = e.attribute("value").toDouble();
value = value / factor;
- result.append(QString::number(value));
+ result.append(locale.toString(value));
} else result.append(e.attribute("value"));
}
}
if (clip->parentItem()) {
emit displayMessage(i18n("Cannot split audio of grouped clips"), ErrorMessage);
} else {
- new SplitAudioCommand(this, clip->track(), clip->startPos(), splitCommand);
+ EffectsList effects;
+ effects.clone(clip->effectList());
+ new SplitAudioCommand(this, clip->track(), clip->startPos(), effects, splitCommand);
}
}
}
}
}
-void CustomTrackView::doSplitAudio(const GenTime &pos, int track, bool split)
+void CustomTrackView::doSplitAudio(const GenTime &pos, int track, EffectsList effects, bool split)
{
ClipItem *clip = getClipItemAt(pos, track);
if (clip == NULL) {
}
audioClip->setSelected(true);
audioClip->setAudioOnly(true);
+
+ // keep video effects, move audio effects to audio clip
+ int videoIx = 0;
+ int audioIx = 0;
+ for (int i = 0; i < effects.count(); ++i) {
+ if (effects.at(i).attribute("type") == "audio") {
+ deleteEffect(m_document->tracksCount() - track, pos, clip->effectAt(videoIx));
+ audioIx++;
+ } else {
+ deleteEffect(freetrack, pos, audioClip->effectAt(audioIx));
+ videoIx++;
+ }
+ }
+
groupSelectedItems(false, 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))) {
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", info.startPos.frames(m_document->fps()), info.track), ErrorMessage);
}
+
+ // re-add audio effects
+ for (int i = 0; i < effects.count(); ++i) {
+ if (effects.at(i).attribute("type") == "audio") {
+ addEffect(m_document->tracksCount() - track, pos, effects.at(i));
+ }
+ }
+
break;
}
}
EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement effect)
{
EffectsParameterList parameters;
+ QLocale locale;
parameters.addParam("tag", effect.attribute("tag"));
if (effect.hasAttribute("region")) parameters.addParam("region", effect.attribute("region"));
parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
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;
- values[j] = pos + "=" + QString::number(val);
+ values[j] = pos + "=" + locale.toString(val);
}
// kDebug() << "/ / / /SENDING KEYFR:" << values;
parameters.addParam(e.attribute("name"), values.join(";"));
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"), QString::number(e.attribute("value").toDouble() / fact));
+ parameters.addParam(e.attribute("name"), locale.toString(e.attribute("value").toDouble() / fact));
} else {
parameters.addParam(e.attribute("name"), e.attribute("value"));
}