connect(&m_thumbsTimer, SIGNAL(timeout()), this, SLOT(slotFetchNextThumbs()));
m_thumbsTimer.setInterval(500);
m_thumbsTimer.setSingleShot(true);
+
+ connect(&m_audioMonitorTimer, SIGNAL(timeout()), this, SIGNAL(documentModified()));
+ m_audioMonitorTimer.setInterval(2000);
+ m_audioMonitorTimer.setSingleShot(true);
}
CustomTrackView::~CustomTrackView()
void CustomTrackView::setDocumentModified()
{
m_document->setModified(true);
+ m_audioMonitorTimer.start();
}
void CustomTrackView::setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup, QMenu *markermenu)
emit mousePosition(mappedXPos);
if (event->buttons() & Qt::MidButton) return;
- if (dragMode() == QGraphicsView::RubberBandDrag || (event->modifiers() == Qt::ControlModifier && m_tool != SPACERTOOL)) {
+ if (dragMode() == QGraphicsView::RubberBandDrag || (event->modifiers() == Qt::ControlModifier && m_tool != SPACERTOOL && m_operationMode != RESIZESTART && m_operationMode != RESIZEEND)) {
event->setAccepted(true);
m_moveOpMode = NONE;
QGraphicsView::mouseMoveEvent(event);
}
} else if (m_operationMode == RESIZESTART && move) {
m_document->renderer()->pause();
- if (m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
+ if (event->modifiers() != Qt::ControlModifier && m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
if (parent)
parent->resizeStart((int)(snappedPos) - m_dragItemInfo.startPos.frames(m_document->fps()));
}
} else if (m_operationMode == RESIZEEND && move) {
m_document->renderer()->pause();
- if (m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
+ if (event->modifiers() != Qt::ControlModifier && m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
if (parent)
parent->resizeEnd((int)(snappedPos) - m_dragItemInfo.endPos.frames(m_document->fps()));
}
} else if (opMode == RESIZESTART) {
setCursor(KCursor("left_side", Qt::SizeHorCursor));
+ if (item->type() == AVWIDGET && item->parentItem() && item->parentItem() != m_selectionGroup)
+ emit displayMessage(i18n("Use Ctrl to resize only current item, otherwise all items in this group will be resized at once."), InformationMessage);
} else if (opMode == RESIZEEND) {
setCursor(KCursor("right_side", Qt::SizeHorCursor));
+ if (item->type() == AVWIDGET && item->parentItem() && item->parentItem() != m_selectionGroup)
+ emit displayMessage(i18n("Use Ctrl to resize only current item, otherwise all items in this group will be resized at once."), InformationMessage);
} else if (opMode == FADEIN || opMode == FADEOUT) {
setCursor(Qt::PointingHandCursor);
emit displayMessage(i18n("Drag to add or resize a fade effect."), InformationMessage);
bool selected = !m_dragItem->isSelected();
if (dragGroup)
dragGroup->setSelected(selected);
- else
+ else
m_dragItem->setSelected(selected);
groupSelectedItems();
trackTransitionStartList[m_document->tracksCount() - info.track] = info.startPos.frames(m_document->fps());
}
}
-
- InsertSpaceCommand *command = new InsertSpaceCommand(this, clipsToMove, transitionsToMove, track, timeOffset, false);
- m_commandStack->push(command);
- if (track != -1) track = m_document->tracksCount() - track;
- kDebug() << "SPACER TRACK:" << track;
- m_document->renderer()->mltInsertSpace(trackClipStartList, trackTransitionStartList, track, timeOffset, GenTime());
+ if (!clipsToMove.isEmpty() || !transitionsToMove.isEmpty()) {
+ InsertSpaceCommand *command = new InsertSpaceCommand(this, clipsToMove, transitionsToMove, track, timeOffset, false);
+ m_commandStack->push(command);
+ if (track != -1) track = m_document->tracksCount() - track;
+ kDebug() << "SPACER TRACK:" << track;
+ m_document->renderer()->mltInsertSpace(trackClipStartList, trackTransitionStartList, track, timeOffset, GenTime());
+ setDocumentModified();
+ }
}
resetSelectionGroup(false);
m_operationMode = NONE;
adjustTimelineTransitions(m_scene->editMode(), transition, moveCommand);
new MoveTransitionCommand(this, m_dragItemInfo, info, false, moveCommand);
m_commandStack->push(moveCommand);
+ setDocumentModified();
}
}
} else {
m_document->renderer()->mltAddTransition(tr->transitionTag(), newTrack, m_document->tracksCount() - info.track, info.startPos, info.endPos, tr->toXML());
}
}
- rebuildGroup((AbstractGroupItem *)group);
new MoveGroupCommand(this, clipsToMove, transitionsToMove, timeOffset, trackOffset, false, moveGroup);
m_commandStack->push(moveGroup);
if (m_selectionGroup) {
m_selectionGroupInfo.startPos = GenTime(m_selectionGroup->scenePos().x(), m_document->fps());
m_selectionGroupInfo.track = m_selectionGroup->track();
+ } else {
+ rebuildGroup((AbstractGroupItem *)group);
}
setDocumentModified();
}
m_document->renderer()->doRefresh();
} else if (m_operationMode == RESIZESTART && m_dragItem->startPos() != m_dragItemInfo.startPos) {
// resize start
- if (m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
+ if (event->modifiers() != Qt::ControlModifier && m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
if (parent) {
QUndoCommand *resizeCommand = new QUndoCommand();
}
} else if (m_operationMode == RESIZEEND && m_dragItem->endPos() != m_dragItemInfo.endPos) {
// resize end
- if (m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
+ if (event->modifiers() != Qt::ControlModifier && m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
if (parent) {
QUndoCommand *resizeCommand = new QUndoCommand();
break;
}
}
- for(int i = 0; i < clipsCut.count(); ++i)
+ for (int i = 0; i < clipsCut.count(); ++i)
cutClip(clipsCut.at(i), cutPos, false);
// TODO: uncut transitonsCut
doGroupClips(QList <ItemInfo>() << clips1 << clipsCut << clips2, QList <ItemInfo>() << transitions1 << transitionsCut << transitions2, true);
KdenliveSettings::setSnaptopoints(snap);
}
+ bool hasParentCommand = false;
+ if (command) {
+ hasParentCommand = true;
+ } else {
+ command = new QUndoCommand();
+ command->setText(i18n("Resize clip start"));
+ }
+
// do this here, too, because otherwise undo won't update the group
if (item->parentItem() && item->parentItem() != m_selectionGroup)
new RebuildGroupCommand(this, item->info().track, item->endPos() - GenTime(1, m_document->fps()), command);
resizeinfo.track = m_document->tracksCount() - resizeinfo.track;
bool success = m_document->renderer()->mltResizeClipStart(resizeinfo, item->startPos() - oldInfo.startPos);
if (success) {
- bool hasParentCommand = false;
- if (command) {
- hasParentCommand = true;
- } else {
- command = new QUndoCommand();
- command->setText(i18n("Resize clip start"));
- }
-
// Check if there is an automatic transition on that clip (lower track)
Transition *transition = getTransitionItemAtStart(oldInfo.startPos, oldInfo.track);
if (transition && transition->isAutomatic()) {
} else {
new ResizeClipCommand(this, oldInfo, info, false, false, command);
}
-
- if (!hasParentCommand)
- m_commandStack->push(command);
} else {
KdenliveSettings::setSnaptopoints(false);
item->resizeStart((int) oldInfo.startPos.frames(m_document->fps()));
}
if (item->parentItem() && item->parentItem() != m_selectionGroup)
new RebuildGroupCommand(this, item->info().track, item->endPos() - GenTime(1, m_document->fps()), command);
+
+ if (!hasParentCommand)
+ m_commandStack->push(command);
}
void CustomTrackView::prepareResizeClipEnd(AbstractClipItem* item, ItemInfo oldInfo, int pos, bool check, QUndoCommand *command)
KdenliveSettings::setSnaptopoints(snap);
}
+ bool hasParentCommand = false;
+ if (command) {
+ hasParentCommand = true;
+ } else {
+ command = new QUndoCommand();
+ command->setText(i18n("Resize clip end"));
+ }
+
// do this here, too, because otherwise undo won't update the group
if (item->parentItem() && item->parentItem() != m_selectionGroup)
new RebuildGroupCommand(this, item->info().track, item->startPos(), command);
resizeinfo.track = m_document->tracksCount() - resizeinfo.track;
bool success = m_document->renderer()->mltResizeClipEnd(resizeinfo, resizeinfo.endPos - resizeinfo.startPos);
if (success) {
- bool hasParentCommand = false;
- if (command) {
- hasParentCommand = true;
- } else {
- command = new QUndoCommand();
- command->setText(i18n("Resize clip end"));
- }
-
// Check if there is an automatic transition on that clip (lower track)
Transition *tr = getTransitionItemAtEnd(oldInfo.endPos, oldInfo.track);
if (tr && tr->isAutomatic()) {
new ResizeClipCommand(this, oldInfo, info, false, false, command);
}
- if (!hasParentCommand)
- m_commandStack->push(command);
updatePositionEffects(clip, oldInfo);
} else {
KdenliveSettings::setSnaptopoints(false);
}
if (item->parentItem() && item->parentItem() != m_selectionGroup)
new RebuildGroupCommand(this, item->info().track, item->startPos(), command);
+
+ if (!hasParentCommand)
+ m_commandStack->push(command);
}
void CustomTrackView::updatePositionEffects(ClipItem * item, ItemInfo info)
m_animationTimer->start();
}
}
+
+bool CustomTrackView::hasAudio(int track) const
+{
+ QRectF rect(0, (double)(track * m_tracksHeight + 1), (double) sceneRect().width(), (double)(m_tracksHeight - 1));
+ QList<QGraphicsItem *> collisions = scene()->items(rect, Qt::IntersectsItemBoundingRect);
+ QGraphicsItem *item;
+ for (int i = 0; i < collisions.count(); i++) {
+ item = collisions.at(i);
+ if (!item->isEnabled()) continue;
+ if (item->type() == AVWIDGET) {
+ ClipItem *clip = static_cast <ClipItem *>(item);
+ if (!clip->isVideoOnly() && (clip->clipType() == AUDIO || clip->clipType() == AV || clip->clipType() == PLAYLIST)) return true;
+ }
+ }
+ return false;
+}