#include <KIcon>
#include <KCursor>
#include <KColorScheme>
+#include <KMessageBox>
+#include <KIO/NetAccess>
#include <QMouseEvent>
#include <QStylePainter>
#include <QScrollBar>
#include <QApplication>
#include <QInputDialog>
-#include <KMessageBox>
+
#if QT_VERSION >= 0x040600
#include <QGraphicsDropShadowEffect>
m_document->setModified(true);
}
-void CustomTrackView::setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup)
+void CustomTrackView::setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup, QMenu *markermenu)
{
m_timelineContextMenu = timeline;
m_timelineContextClipMenu = clip;
m_clipTypeGroup = clipTypeGroup;
+
+ m_markerMenu = new QMenu(i18n("Go to marker..."), this);
+ m_markerMenu->setEnabled(false);
+ markermenu->addMenu(m_markerMenu);
+ connect(m_markerMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotGoToMarker(QAction *)));
QList <QAction *> list = m_timelineContextClipMenu->actions();
for (int i = 0; i < list.count(); i++) {
if (list.at(i)->data().toString() == "paste_effects") m_pasteEffectsAction = list.at(i);
// spacer tool
snappedPos = getSnapPointForPos(mappedXPos + m_spacerOffset);
if (snappedPos < 0) snappedPos = 0;
+
// Make sure there is no collision
QList<QGraphicsItem *> children = m_selectionGroup->childItems();
QPainterPath shape = m_selectionGroup->clipGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
QList<QGraphicsItem*> collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
collidingItems.removeAll(m_selectionGroup);
for (int i = 0; i < children.count(); i++) {
+ if (children.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+ for (int j = 0; j < subchildren.count(); j++) {
+ collidingItems.removeAll(subchildren.at(j));
+ }
+ }
collidingItems.removeAll(children.at(i));
}
bool collision = false;
+ int offset = 0;
+ for (int i = 0; i < collidingItems.count(); i++) {
+ if (!collidingItems.at(i)->isEnabled()) continue;
+ if (collidingItems.at(i)->type() == AVWIDGET && snappedPos < m_selectionGroup->sceneBoundingRect().left()) {
+ AbstractClipItem *item = static_cast <AbstractClipItem *>(collidingItems.at(i));
+ // Moving backward, determine best pos
+ QPainterPath clipPath;
+ clipPath.addRect(item->sceneBoundingRect());
+ QPainterPath res = shape.intersected(clipPath);
+ offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
+ }
+ }
+ snappedPos += offset;
+ // make sure we have no collision
+ shape = m_selectionGroup->clipGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
+ collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
+ collidingItems.removeAll(m_selectionGroup);
+ for (int i = 0; i < children.count(); i++) {
+ if (children.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+ for (int j = 0; j < subchildren.count(); j++) {
+ collidingItems.removeAll(subchildren.at(j));
+ }
+ }
+ collidingItems.removeAll(children.at(i));
+ }
+
for (int i = 0; i < collidingItems.count(); i++) {
if (!collidingItems.at(i)->isEnabled()) continue;
if (collidingItems.at(i)->type() == AVWIDGET) {
break;
}
}
+
+
if (!collision) {
// Check transitions
shape = m_selectionGroup->transitionGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
collidingItems.removeAll(m_selectionGroup);
for (int i = 0; i < children.count(); i++) {
+ if (children.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+ for (int j = 0; j < subchildren.count(); j++) {
+ collidingItems.removeAll(subchildren.at(j));
+ }
+ }
+ collidingItems.removeAll(children.at(i));
+ }
+ offset = 0;
+
+ for (int i = 0; i < collidingItems.count(); i++) {
+ if (collidingItems.at(i)->type() == TRANSITIONWIDGET && snappedPos < m_selectionGroup->sceneBoundingRect().left()) {
+ AbstractClipItem *item = static_cast <AbstractClipItem *>(collidingItems.at(i));
+ // Moving backward, determine best pos
+ QPainterPath clipPath;
+ clipPath.addRect(item->sceneBoundingRect());
+ QPainterPath res = shape.intersected(clipPath);
+ offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
+ }
+ }
+
+ snappedPos += offset;
+ // make sure we have no collision
+ shape = m_selectionGroup->transitionGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
+ collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
+ collidingItems.removeAll(m_selectionGroup);
+ for (int i = 0; i < children.count(); i++) {
+ if (children.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+ for (int j = 0; j < subchildren.count(); j++) {
+ collidingItems.removeAll(subchildren.at(j));
+ }
+ }
collidingItems.removeAll(children.at(i));
}
for (int i = 0; i < collidingItems.count(); i++) {
kDebug() << "SELELCTING ELEMENTS WITHIN =" << event->pos().x() << "/" << 1 << ", " << mapFromScene(sceneRect().width(), 0).x() - event->pos().x() << "/" << sceneRect().height();
}
+ QList <GenTime> offsetList;
// create group to hold selected items
m_selectionGroup = new AbstractGroupItem(m_document->fps());
scene()->addItem(m_selectionGroup);
- QList <GenTime> offsetList;
+
for (int i = 0; i < selection.count(); i++) {
if (selection.at(i)->parentItem() == 0 && (selection.at(i)->type() == AVWIDGET || selection.at(i)->type() == TRANSITIONWIDGET)) {
AbstractClipItem *item = static_cast<AbstractClipItem *>(selection.at(i));
offsetList.append(item->endPos());
m_selectionGroup->addToGroup(selection.at(i));
selection.at(i)->setFlag(QGraphicsItem::ItemIsMovable, false);
- } else if (selection.at(i)->parentItem() == 0 && selection.at(i)->type() == GROUPWIDGET) {
+ } else if (/*selection.at(i)->parentItem() == 0 && */selection.at(i)->type() == GROUPWIDGET) {
if (static_cast<AbstractGroupItem *>(selection.at(i))->isItemLocked()) continue;
QList<QGraphicsItem *> children = selection.at(i)->childItems();
for (int j = 0; j < children.count(); j++) {
}
m_selectionGroup->addToGroup(selection.at(i));
selection.at(i)->setFlag(QGraphicsItem::ItemIsMovable, false);
- } else if (selection.at(i)->parentItem()) {
+ } else if (selection.at(i)->parentItem() && !selection.contains(selection.at(i)->parentItem())) {
if (static_cast<AbstractGroupItem *>(selection.at(i)->parentItem())->isItemLocked()) continue;
+ //AbstractGroupItem *grp = static_cast<AbstractGroupItem *>(selection.at(i)->parentItem());
m_selectionGroup->addToGroup(selection.at(i)->parentItem());
selection.at(i)->parentItem()->setFlag(QGraphicsItem::ItemIsMovable, false);
}
void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
{
if (m_dragItem && m_dragItem->hasKeyFrames()) {
- if (m_moveOpMode == KEYFRAME) {
+ /*if (m_moveOpMode == KEYFRAME) {
// user double clicked on a keyframe, open edit dialog
+ //TODO: update for effects with several values per keyframe
QDialog d(parentWidget());
Ui::KeyFrameDialog_UI view;
view.setupUi(&d);
emit clipItemSelected(item, item->selectedEffectIndex());
}
- } else {
+ } else*/ {
// add keyframe
GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x()), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
- m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
+ int val = m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
ClipItem * item = static_cast <ClipItem *>(m_dragItem);
- QString previous = item->keyframes(item->selectedEffectIndex());
- item->updateKeyframeEffect();
- QString next = item->keyframes(item->selectedEffectIndex());
- EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
+ //QString previous = item->keyframes(item->selectedEffectIndex());
+ QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
+ item->insertKeyframe(item->getEffectAt(item->selectedEffectIndex()), keyFramePos.frames(m_document->fps()), val);
+ //item->updateKeyframeEffect();
+ //QString next = item->keyframes(item->selectedEffectIndex());
+ QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false);
+ //EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
m_commandStack->push(command);
updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
emit clipItemSelected(item, item->selectedEffectIndex());
}
} else if (m_dragItem && !m_dragItem->isItemLocked()) {
- ClipDurationDialog d(m_dragItem, m_document->timecode(), this);
GenTime minimum;
GenTime maximum;
if (m_dragItem->type() == TRANSITIONWIDGET) {
getClipAvailableSpace(m_dragItem, minimum, maximum);
}
//kDebug()<<"// GOT MOVE POS: "<<minimum.frames(25)<<" - "<<maximum.frames(25);
- d.setMargins(minimum, maximum);
+ ClipDurationDialog d(m_dragItem, m_document->timecode(), minimum, maximum, this);
if (d.exec() == QDialog::Accepted) {
if (m_dragItem->type() == TRANSITIONWIDGET) {
// move & resize transition
{
m_deleteGuide->setEnabled(m_dragGuide != NULL);
m_editGuide->setEnabled(m_dragGuide != NULL);
- if (clip == NULL) m_timelineContextMenu->popup(pos);
- else if (group != NULL) {
+ m_markerMenu->clear();
+ m_markerMenu->setEnabled(false);
+ if (clip == NULL) {
+ m_timelineContextMenu->popup(pos);
+ } else if (group != NULL) {
m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
m_ungroupAction->setEnabled(true);
updateClipTypeActions(NULL);
m_ungroupAction->setEnabled(false);
if (clip->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem*>(clip);
+ //build go to marker menu
+ if (item->baseClip()) {
+ QList <CommentedTime> markers = item->baseClip()->commentedSnapMarkers();
+ int offset = item->startPos().frames(m_document->fps());
+ if (!markers.isEmpty()) {
+ for (int i = 0; i < markers.count(); i++) {
+ int pos = (int) markers.at(i).time().frames(m_document->timecode().fps());
+ QString position = m_document->timecode().getTimecode(markers.at(i).time()) + ' ' + markers.at(i).comment();
+ QAction *go = m_markerMenu->addAction(position);
+ go->setData(pos + offset);
+ }
+ }
+ m_markerMenu->setEnabled(!m_markerMenu->isEmpty());
+ }
updateClipTypeActions(item);
m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
m_timelineContextClipMenu->popup(pos);
- } else if (clip->type() == TRANSITIONWIDGET) m_timelineContextTransitionMenu->popup(pos);
+ } else if (clip->type() == TRANSITIONWIDGET) {
+ m_timelineContextTransitionMenu->popup(pos);
+ }
}
}
{
if (data->hasFormat("kdenlive/clip")) {
m_clipDrag = true;
- resetSelectionGroup();
+ m_scene->clearSelection();
+ resetSelectionGroup(false);
QStringList list = QString(data->data("kdenlive/clip")).split(';');
DocClipBase *clip = m_document->getBaseClip(list.at(0));
if (clip == NULL) {
updateSnapPoints(NULL, offsetList);
m_selectionGroup->setPos(framePos);
scene()->addItem(m_selectionGroup);
- //m_selectionGroup->setZValue(10);
+ m_selectionGroup->setSelected(true);
return true;
} else if (data->hasFormat("kdenlive/producerslist")) {
m_clipDrag = true;
start += info.cropDuration;
offsetList.append(start);
ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, 1, false);
- //item->setZValue(10);
item->setFlag(QGraphicsItem::ItemIsMovable, false);
m_selectionGroup->addToGroup(item);
if (!clip->isPlaceHolder()) m_waitingThumbs.append(item);
return;
}
EffectsParameterList params = clip->addEffect(effect);
- if (effect.attribute("disabled") == "1") {
- // Effect is disabled, don't add it to MLT playlist
- if (clip->isSelected()) emit clipItemSelected(clip);
- return;
- }
if (!m_document->renderer()->mltAddEffect(track, pos, params))
emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
if (clip->isSelected()) emit clipItemSelected(clip);
return;
}
}
- if (!m_document->renderer()->mltRemoveEffect(track, pos, index, true) && effect.attribute("disabled") != "1") {
- kDebug() << "// ERROR REMOV EFFECT: " << index << ", DISABLE: " << effect.attribute("disabled");
+ if (!m_document->renderer()->mltRemoveEffect(track, pos, index, true)) {
+ kDebug() << "// ERROR REMOV EFFECT: " << index << ", DISABLE: " << effect.attribute("disable");
emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
return;
}
if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
else effectName = i18n("effect");
effectCommand->setText(i18n("Add %1", effectName));
- int count = 0;
+
if (track == -1) itemList = scene()->selectedItems();
if (itemList.isEmpty()) {
ClipItem *clip = getClipItemAt((int) pos.frames(m_document->fps()), track);
if (clip) itemList.append(clip);
else emit displayMessage(i18n("Select a clip if you want to apply an effect"), ErrorMessage);
}
- kDebug() << "// REQUESTING EFFECT ON CLIP: " << pos.frames(25) << ", TRK: " << track << "SELECTED ITEMS: " << itemList.count();
+
+ //expand groups
+ for (int i = 0; i < itemList.count(); i++) {
+ if (itemList.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> subitems = itemList.at(i)->childItems();
+ for (int j = 0; j < subitems.count(); j++) {
+ if (!itemList.contains(subitems.at(j))) itemList.append(subitems.at(j));
+ }
+ }
+ }
+
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
effect.setAttribute("src", ladpsaFile);
}
new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
- count++;
}
}
- if (count > 0) {
+ if (effectCommand->childCount() > 0) {
m_commandStack->push(effectCommand);
setDocumentModified();
} else delete effectCommand;
}
-void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect)
+void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect, bool affectGroup)
{
+ if (affectGroup && clip->parentItem() && clip->parentItem() == m_selectionGroup) {
+ //clip is in a group, also remove the effect in other clips of the group
+ 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());
+ else effectName = i18n("effect");
+ delCommand->setText(i18n("Delete %1", effectName));
+
+ //expand groups
+ for (int i = 0; i < items.count(); i++) {
+ if (items.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> subitems = items.at(i)->childItems();
+ for (int j = 0; j < subitems.count(); j++) {
+ if (!items.contains(subitems.at(j))) items.append(subitems.at(j));
+ }
+ }
+ }
+
+ for (int i = 0; i < items.count(); i++) {
+ if (items.at(i)->type() == AVWIDGET) {
+ ClipItem *item = static_cast <ClipItem *>(items.at(i));
+ int ix = item->hasEffect(effect.attribute("tag"), effect.attribute("id"));
+ if (ix != -1) {
+ QDomElement eff = item->effectAt(ix);
+ new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), eff, false, delCommand);
+ }
+ }
+ }
+ if (delCommand->childCount() > 0) m_commandStack->push(delCommand);
+ else delete delCommand;
+ return;
+ }
AddEffectCommand *command = new AddEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effect, false);
m_commandStack->push(command);
setDocumentModified();
if (clip) {
// Special case: speed effect
if (effect.attribute("id") == "speed") {
- if (effect.attribute("disabled") == "1") doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), 1.0, clip->speed(), 1, clip->baseClip()->getId());
+ if (effect.attribute("disable") == "1") doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), 1.0, clip->speed(), 1, clip->baseClip()->getId());
else {
double speed = EffectsList::parameter(effect, "speed").toDouble() / 100.0;
int strobe = EffectsList::parameter(effect, "strobe").toInt();
clip->initEffect(effect);
effectParams = clip->getEffectArgs(effect);
}
- if (effectParams.paramValue("disabled") == "1") {
- if (m_document->renderer()->mltRemoveEffect(track, pos, effectParams.paramValue("kdenlive_ix"), false)) {
- kDebug() << "////// DISABLING EFFECT: " << ix << ", CURRENTLA: " << clip->selectedEffectIndex();
- } else emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
- } else if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - clip->track(), clip->startPos(), effectParams))
+ if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - clip->track(), clip->startPos(), effectParams))
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
clip->setEffectAt(ix, effect);
QDomElement effect = clip->effectAt(effectPos);
QDomElement oldEffect = effect.cloneNode().toElement();
- effect.setAttribute("disabled", (int) disable);
+ effect.setAttribute("disable", (int) disable);
EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
m_commandStack->push(command);
setDocumentModified();;
dupInfo.cropStart += diff;
dupInfo.cropDuration = clipInfo.endPos - info.startPos;
new RazorClipCommand(this, clipInfo, info.startPos, false, command);
- ClipItem *dup = cutClip(clipInfo, info.startPos, true, false);
+ // Commented out; variable dup unused. --granjow
+ //ClipItem *dup = cutClip(clipInfo, info.startPos, true, false);
+ cutClip(clipInfo, info.startPos, true, false);
}
}
// TODO: add insertspacecommand
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
- slotDeleteEffect(item, oldeffect);
+ slotDeleteEffect(item, oldeffect, false);
} else {
end += start;
QDomElement effect = oldeffect.cloneNode().toElement();
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
- slotDeleteEffect(item, oldeffect);
+ slotDeleteEffect(item, oldeffect, false);
} else {
end += start;
QDomElement effect = oldeffect.cloneNode().toElement();
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
- slotDeleteEffect(item, oldeffect);
+ slotDeleteEffect(item, oldeffect, false);
} else {
start = end - start;
QDomElement effect = oldeffect.cloneNode().toElement();
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
- slotDeleteEffect(item, oldeffect);
+ slotDeleteEffect(item, oldeffect, false);
} else {
start = end - start;
QDomElement effect = oldeffect.cloneNode().toElement();
} else if (m_operationMode == KEYFRAME) {
// update the MLT effect
ClipItem * item = static_cast <ClipItem *>(m_dragItem);
- QString previous = item->keyframes(item->selectedEffectIndex());
- item->updateKeyframeEffect();
- QString next = item->keyframes(item->selectedEffectIndex());
- EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
+ QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
+
+ // check if we want to remove keyframe
+ double val = mapToScene(event->pos()).toPoint().y();
+ QRectF br = item->sceneBoundingRect();
+ double maxh = 100.0 / br.height();
+ val = (br.bottom() - val) * maxh;
+ int start = item->cropStart().frames(m_document->fps());
+ int end = (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1;
+ if ((val < -50 || val > 150) && item->editedKeyFramePos() != start && item->editedKeyFramePos() != end) {
+ //delete keyframe
+ kDebug() << "// DELETE KFR: " << item->editedKeyFramePos();
+ item->movedKeyframe(item->getEffectAt(item->selectedEffectIndex()), item->selectedKeyFramePos(), -1, 0);
+ } else item->movedKeyframe(item->getEffectAt(item->selectedEffectIndex()), item->selectedKeyFramePos(), item->editedKeyFramePos(), item->editedKeyFrameValue());
+ QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
+ //item->updateKeyframeEffect();
+ //QString next = item->keyframes(item->selectedEffectIndex());
+ //EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false);
+
m_commandStack->push(command);
updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
emit clipItemSelected(item, item->selectedEffectIndex());
paste->setText("Paste effects");
QList<QGraphicsItem *> clips = scene()->selectedItems();
+
+ // expand groups
+ for (int i = 0; i < clips.count(); ++i) {
+ if (clips.at(i)->type() == GROUPWIDGET) {
+ QList<QGraphicsItem *> children = clips.at(i)->childItems();
+ for (int j = 0; j < children.count(); j++) {
+ if (children.at(j)->type() == AVWIDGET && !clips.contains(children.at(j))) {
+ clips.append(children.at(j));
+ }
+ }
+ }
+ }
+
+
for (int i = 0; i < clips.count(); ++i) {
if (clips.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast < ClipItem *>(clips.at(i));
}
}
}
- m_commandStack->push(paste);
+ if (paste->childCount() > 0) m_commandStack->push(paste);
+ else delete paste;
- // adjust effects (fades, ...)
+ //adjust effects (fades, ...)
for (int i = 0; i < clips.count(); ++i) {
- ClipItem *item = static_cast < ClipItem *>(clips.at(i));
- updatePositionEffects(item, item->info());
+ if (clips.at(i)->type() == AVWIDGET) {
+ ClipItem *item = static_cast < ClipItem *>(clips.at(i));
+ updatePositionEffects(item, item->info());
+ }
}
}
QString thumb = thumbBase + item->baseClip()->getClipHash() + "_0.png";
if (QFile::exists(thumb)) {
QPixmap pix(thumb);
+ if (pix.isNull()) KIO::NetAccess::del(KUrl(thumb), this);
item->slotSetStartThumb(pix);
}
} else {
endThumb.append(QString::number((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);
item->slotSetStartThumb(pix);
}
if (QFile::exists(endThumb)) {
QPixmap pix(endThumb);
+ if (pix.isNull()) KIO::NetAccess::del(KUrl(endThumb), this);
item->slotSetEndThumb(pix);
}
}
}
item->refreshClip(false);
- qApp->processEvents();
+ //qApp->processEvents();
}
}
viewport()->update();
}
}
+void CustomTrackView::slotGoToMarker(QAction *action)
+{
+ int pos = action->data().toInt();
+ setCursorPos(pos, true);
+}
+
void CustomTrackView::reloadTransitionLumas()
{
QString lumaNames;
if (m_selectedTrack > m_document->tracksCount() - 2) m_selectedTrack = 0;
else m_selectedTrack++;
emit updateTrackHeaders();
- QRectF rect(mapToScene(QPoint()).x(), m_selectedTrack * m_tracksHeight, 10, m_tracksHeight);
- ensureVisible(rect);
+ QRectF rect(mapToScene(QPoint(10, 0)).x(), m_selectedTrack * m_tracksHeight, 10, m_tracksHeight);
+ ensureVisible(rect, 0, 0);
viewport()->update();
}
if (m_selectedTrack > 0) m_selectedTrack--;
else m_selectedTrack = m_document->tracksCount() - 1;
emit updateTrackHeaders();
- QRectF rect(mapToScene(QPoint()).x(), m_selectedTrack * m_tracksHeight, 10, m_tracksHeight);
- ensureVisible(rect);
+ QRectF rect(mapToScene(QPoint(10, 0)).x(), m_selectedTrack * m_tracksHeight, 10, m_tracksHeight);
+ ensureVisible(rect, 0, 0);
viewport()->update();
}
m_selectedTrack = qMax(0, ix);
m_selectedTrack = qMin(ix, m_document->tracksCount() - 1);
emit updateTrackHeaders();
- QRectF rect(mapToScene(QPoint()).x(), m_selectedTrack * m_tracksHeight, 10, m_tracksHeight);
- ensureVisible(rect);
+ QRectF rect(mapToScene(QPoint(10, 0)).x(), m_selectedTrack * m_tracksHeight, 10, m_tracksHeight);
+ ensureVisible(rect, 0, 0);
viewport()->update();
}
new AddTimelineClipCommand(this, clip->toXML(), clip->getId(), info, EffectsList(), true, false, true, false, addCommand);
m_commandStack->push(addCommand);
}
+
+void CustomTrackView::clearSelection()
+{
+ resetSelectionGroup();
+ scene()->clearSelection();
+ m_dragItem = NULL;
+ emit clipItemSelected(NULL);
+}
+