From a646f250a5cf8f2027d8a2924d12925444e613bc Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sat, 29 Aug 2009 00:09:52 +0000 Subject: [PATCH] Several fixes for keyframes, fix bug in clip resize start undo and cleanup svn path=/trunk/kdenlive/; revision=3851 --- src/abstractclipitem.cpp | 6 +- src/abstractclipitem.h | 2 +- src/clipitem.cpp | 48 ++++++++------- src/clipitem.h | 7 ++- src/customtrackview.cpp | 111 ++++++++++++++++++++++++++-------- src/customtrackview.h | 8 +-- src/editeffectcommand.cpp | 6 +- src/editeffectcommand.h | 2 +- src/editkeyframecommand.cpp | 1 + src/effectslist.cpp | 11 +++- src/effectslist.h | 1 + src/effectstackedit.cpp | 30 ++++----- src/effectstackedit.h | 3 +- src/effectstackview.cpp | 6 ++ src/keyframeedit.cpp | 92 +++++++++++++++------------- src/keyframeedit.h | 5 +- src/moveclipcommand.cpp | 8 ++- src/moveclipcommand.h | 1 + src/movetransitioncommand.cpp | 8 ++- src/movetransitioncommand.h | 1 + src/projectlist.cpp | 7 ++- src/projectlist.h | 1 + src/renderwidget.cpp | 16 ++++- src/renderwidget.h | 3 + src/resizeclipcommand.cpp | 9 +-- src/resizeclipcommand.h | 3 +- src/transition.cpp | 1 - src/transitionsettings.cpp | 5 ++ 28 files changed, 261 insertions(+), 141 deletions(-) diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index 32c2d3c9..fd6828bc 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -142,7 +142,7 @@ void AbstractClipItem::resizeStart(int posx, double speed) }*/ } -void AbstractClipItem::resizeEnd(int posx, double speed, bool /*updateKeyFrames*/) +void AbstractClipItem::resizeEnd(int posx, double speed) { GenTime durationDiff = GenTime(posx, m_fps) - endPos(); if (durationDiff == GenTime()) return; @@ -294,7 +294,7 @@ void AbstractClipItem::updateKeyFramePos(const GenTime pos, const double value) if (!m_keyframes.contains(m_selectedKeyframe)) return; int newpos = (int) pos.frames(m_fps); int start = cropStart().frames(m_fps); - int end = (cropStart() + cropDuration()).frames(m_fps); + int end = (cropStart() + cropDuration()).frames(m_fps) - 1; newpos = qMax(newpos, start); newpos = qMin(newpos, end); if (value < -50 && m_selectedKeyframe != start && m_selectedKeyframe != end) { @@ -330,7 +330,7 @@ void AbstractClipItem::addKeyFrame(const GenTime pos, const double value) QRectF br = sceneBoundingRect(); double maxh = 100.0 / br.height() / m_keyframeFactor; int newval = (br.bottom() - value) * maxh; - kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval; + //kDebug() << "Rect: " << br << "/ SCENE: " << sceneBoundingRect() << ", VALUE: " << value << ", MAX: " << maxh << ", NEWVAL: " << newval; int newpos = (int) pos.frames(m_fps) ; m_keyframes[newpos] = newval; m_selectedKeyframe = newpos; diff --git a/src/abstractclipitem.h b/src/abstractclipitem.h index 231cf946..f2b3afdb 100644 --- a/src/abstractclipitem.h +++ b/src/abstractclipitem.h @@ -55,7 +55,7 @@ public: virtual GenTime cropStart() const ; virtual GenTime cropDuration() const ; virtual void resizeStart(int posx, double speed = 1.0); - virtual void resizeEnd(int posx, double speed = 1.0, bool updateKeyFrames = true); + virtual void resizeEnd(int posx, double speed = 1.0); virtual double fps() const; virtual GenTime maxDuration() const; virtual void setCropStart(GenTime pos); diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 0b143996..0902037f 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -305,7 +305,7 @@ bool ClipItem::checkKeyFrames() void ClipItem::setKeyframes(const int ix, const QString keyframes) { - QDomElement effect = effectAt(ix); + QDomElement effect = getEffectAt(ix); if (effect.attribute("disabled") == "1") return; QDomNodeList params = effect.elementsByTagName("parameter"); for (int i = 0; i < params.count(); i++) { @@ -1074,7 +1074,6 @@ void ClipItem::resizeStart(int posx, double /*speed*/) const int previous = cropStart().frames(m_fps); AbstractClipItem::resizeStart(posx, m_speed); if ((int) cropStart().frames(m_fps) != previous) { - checkEffectsKeyframesPos(previous, cropStart().frames(m_fps), true); if (m_hasThumbs && KdenliveSettings::videothumbnails()) { /*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/ m_startThumbTimer.start(150); @@ -1082,16 +1081,16 @@ void ClipItem::resizeStart(int posx, double /*speed*/) } } -void ClipItem::resizeEnd(int posx, double /*speed*/, bool updateKeyFrames) +void ClipItem::resizeEnd(int posx, double /*speed*/) { const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps); if (posx > max && maxDuration() != GenTime()) posx = max; if (posx == endPos().frames(m_fps)) return; //kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps); - const int previous = (cropStart() + cropDuration()).frames(m_fps); + const int previous = (int)(cropStart() + cropDuration()).frames(m_fps) - 1; AbstractClipItem::resizeEnd(posx, m_speed); - if ((int)(cropStart() + cropDuration()).frames(m_fps) != previous) { - if (updateKeyFrames) checkEffectsKeyframesPos(previous, (cropStart() + cropDuration()).frames(m_fps), false); + const int current = (int)(cropStart() + cropDuration()).frames(m_fps) - 1; + if (current != previous) { if (m_hasThumbs && KdenliveSettings::videothumbnails()) { /*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/ m_endThumbTimer.start(150); @@ -1100,8 +1099,9 @@ void ClipItem::resizeEnd(int posx, double /*speed*/, bool updateKeyFrames) } -void ClipItem::checkEffectsKeyframesPos(const int previous, const int current, bool fromStart) +bool ClipItem::checkEffectsKeyframesPos(const int previous, const int current, bool fromStart) { + bool modified = false; for (int i = 0; i < m_effectList.count(); i++) { QDomElement effect = m_effectList.at(i); QDomNodeList params = effect.elementsByTagName("parameter"); @@ -1116,24 +1116,31 @@ void ClipItem::checkEffectsKeyframesPos(const int previous, const int current, b foreach(const QString &str, keyframes) { pos = str.section(':', 0, 0).toInt(); val = str.section(':', 1, 1).toDouble(); - if (pos == previous) kfr[current] = val; - else { - if (fromStart && pos >= current) kfr[pos] = val; - else if (!fromStart && pos <= current) kfr[pos] = val; + if (pos == previous) { + kfr[current] = val; + modified = true; + } else { + if ((fromStart && pos >= current) || (!fromStart && pos <= current)) { + kfr[pos] = val; + modified = true; + } } } - QString newkfr; - QMap::const_iterator k = kfr.constBegin(); - while (k != kfr.constEnd()) { - newkfr.append(QString::number(k.key()) + ':' + QString::number(k.value()) + ';'); - ++k; + if (modified) { + QString newkfr; + QMap::const_iterator k = kfr.constBegin(); + while (k != kfr.constEnd()) { + newkfr.append(QString::number(k.key()) + ':' + QString::number(k.value()) + ';'); + ++k; + } + e.setAttribute("keyframes", newkfr); + break; } - e.setAttribute("keyframes", newkfr); - break; } } } - if (m_selectedEffect >= 0) setSelectedEffect(m_selectedEffect); + if (modified && m_selectedEffect >= 0) setSelectedEffect(m_selectedEffect); + return modified; } //virtual @@ -1248,8 +1255,7 @@ void ClipItem::setEffectAt(int ix, QDomElement effect) } //kDebug() << "CHange EFFECT AT: " << ix << ", CURR: " << m_effectList.at(ix).attribute("tag") << ", NEW: " << effect.attribute("tag"); effect.setAttribute("kdenlive_ix", ix + 1); - m_effectList.insert(ix, effect); - m_effectList.removeAt(ix + 1); + m_effectList.replace(ix, effect); m_effectNames = m_effectList.effectNames().join(" / "); QString id = effect.attribute("id"); if (id == "fadein" || id == "fadeout" || id == "fade_from_black" || id == "fade_to_black") diff --git a/src/clipitem.h b/src/clipitem.h index f66586ab..0522c4bb 100644 --- a/src/clipitem.h +++ b/src/clipitem.h @@ -48,7 +48,7 @@ public: QWidget *); virtual int type() const; void resizeStart(int posx, double speed = 1.0); - void resizeEnd(int posx, double speed = 1.0, bool updateKeyFrames = true); + void resizeEnd(int posx, double speed = 1.0); OPERATIONTYPE operationMode(QPointF pos); const QString clipProducer() const; int clipType() const; @@ -112,6 +112,8 @@ public: void setAudioOnly(bool force); bool isVideoOnly() const; bool isAudioOnly() const; + /** Called when clip start is resized, adjust keyframes values */ + bool checkEffectsKeyframesPos(const int previous, const int current, bool fromStart); protected: //virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event); @@ -153,8 +155,7 @@ private: QMap m_audioThumbCachePic; bool m_audioThumbReady; double m_framePixelWidth; - /** Called when clip start is resized, adjust keyframes values */ - void checkEffectsKeyframesPos(const int previous, const int current, bool fromStart); + QPixmap m_videoPix; QPixmap m_audioPix; diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 162967c7..b3e6d58c 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -1134,7 +1134,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event) ItemInfo startInfo = clipInfo; clipInfo.endPos = clipInfo.startPos + d.duration(); clipInfo.cropStart = d.cropStart(); - new ResizeClipCommand(this, startInfo, clipInfo, true, moveCommand); + new ResizeClipCommand(this, startInfo, clipInfo, true, false, moveCommand); } if (d.startPos() != clipInfo.startPos) { ItemInfo startInfo = clipInfo; @@ -1147,7 +1147,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event) ItemInfo startInfo = clipInfo; clipInfo.endPos = clipInfo.startPos + d.duration(); clipInfo.cropStart = d.cropStart(); - new ResizeClipCommand(this, startInfo, clipInfo, true, moveCommand); + new ResizeClipCommand(this, startInfo, clipInfo, true, false, moveCommand); } m_commandStack->push(moveCommand); } @@ -1167,7 +1167,7 @@ void CustomTrackView::editKeyFrame(const GenTime pos, const int track, const int ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), track); if (clip) { clip->setKeyframes(index, keyframes); - updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(index), index); + updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(index), index, false); } else emit displayMessage(i18n("Cannot find clip with keyframe"), ErrorMessage); } @@ -1496,11 +1496,11 @@ void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect) setDocumentModified(); } -void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect, int ix, bool triggeredByUser) +void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool triggeredByUser) { ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_document->tracksCount() - track); + QDomElement effect = insertedEffect.cloneNode().toElement(); if (clip) { - // Special case: speed effect if (effect.attribute("id") == "speed") { ItemInfo info = clip->info(); @@ -2709,8 +2709,40 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) new MoveTransitionCommand(this, trInfo, newTrInfo, true, resizeCommand); } } - updateClipFade(static_cast (m_dragItem)); - new ResizeClipCommand(this, m_dragItemInfo, info, false, resizeCommand); + + ClipItem *clip = static_cast < ClipItem * >(m_dragItem); + updateClipFade(clip); + + // check keyframes + QDomDocument doc; + QDomElement root = doc.createElement("list"); + doc.appendChild(root); + QList indexes; + for (int i = 0; i < clip->effectsCount(); i++) { + QDomElement effect = clip->effectAt(i); + if (EffectsList::hasKeyFrames(effect)) { + doc.appendChild(doc.importNode(effect, true)); + indexes.append(i); + } + } + + if (clip->checkEffectsKeyframesPos(m_dragItemInfo.cropStart.frames(m_document->fps()), clip->cropStart().frames(m_document->fps()), true)) { + // Keyframes were modified, updateClip + QDomNodeList effs = doc.elementsByTagName("effect"); + // Hack: + // Since we must always resize clip before updating the keyframes, we + // 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, m_dragItemInfo, info, false, true, resizeCommand); + for (int i = 0; i < indexes.count(); i++) { + new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effs.at(i).cloneNode().toElement(), clip->effectAt(indexes.at(i)), indexes.at(i), false, resizeCommand); + updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(indexes.at(i)), indexes.at(i)); + } + new ResizeClipCommand(this, m_dragItemInfo, info, false, true, resizeCommand); + emit clipItemSelected(clip); + } else new ResizeClipCommand(this, m_dragItemInfo, info, false, false, resizeCommand); + m_commandStack->push(resizeCommand); } else { m_dragItem->resizeStart((int) m_dragItemInfo.startPos.frames(m_document->fps())); @@ -2771,9 +2803,39 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) } } - new ResizeClipCommand(this, m_dragItemInfo, info, false, resizeCommand); + // check keyframes + ClipItem *clip = static_cast < ClipItem * >(m_dragItem); + QDomDocument doc; + QDomElement root = doc.createElement("list"); + doc.appendChild(root); + QList indexes; + for (int i = 0; i < clip->effectsCount(); i++) { + QDomElement effect = clip->effectAt(i); + if (EffectsList::hasKeyFrames(effect)) { + doc.appendChild(doc.importNode(effect, true)); + indexes.append(i); + } + } + + if (clip->checkEffectsKeyframesPos((m_dragItemInfo.cropStart + m_dragItemInfo.endPos - m_dragItemInfo.startPos).frames(m_document->fps()) - 1, (clip->cropStart() + clip->cropDuration()).frames(m_document->fps()) - 1, false)) { + // Keyframes were modified, updateClip + QDomNodeList effs = doc.elementsByTagName("effect"); + // Hack: + // Since we must always resize clip before updating the keyframes, we + // 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, m_dragItemInfo, info, false, true, resizeCommand); + for (int i = 0; i < indexes.count(); i++) { + new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effs.at(i).cloneNode().toElement(), clip->effectAt(indexes.at(i)), indexes.at(i), false, resizeCommand); + updateEffect(m_document->tracksCount() - clip->track(), clip->startPos(), clip->effectAt(indexes.at(i)), indexes.at(i)); + } + new ResizeClipCommand(this, m_dragItemInfo, info, false, true, resizeCommand); + emit clipItemSelected(clip); + } else new ResizeClipCommand(this, m_dragItemInfo, info, false, false, resizeCommand); + m_commandStack->push(resizeCommand); - updateClipFade(static_cast (m_dragItem)); + updateClipFade(clip); } else { m_dragItem->resizeEnd((int) m_dragItemInfo.endPos.frames(m_document->fps())); emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); @@ -3287,7 +3349,7 @@ Transition *CustomTrackView::getTransitionItemAtStart(GenTime pos, int track) return clip; } -void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end) +void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end, bool refresh) { if (m_selectionGroup) resetSelectionGroup(false); ClipItem *item = getClipItemAt((int) start.startPos.frames(m_document->fps()), start.track); @@ -3330,7 +3392,7 @@ void CustomTrackView::moveClip(const ItemInfo start, const ItemInfo end) // undo last move and emit error message emit displayMessage(i18n("Cannot move clip to position %1", m_document->timecode().getTimecodeFromFrames(end.startPos.frames(m_document->fps()))), ErrorMessage); } - m_document->renderer()->doRefresh(); + if (refresh) m_document->renderer()->doRefresh(); //kDebug() << " // MOVED CLIP TO: " << end.startPos.frames(25) << ", ITEM START: " << item->startPos().frames(25); } @@ -3424,7 +3486,7 @@ void CustomTrackView::moveGroup(QList startClip, QList sta } else kDebug() << "///////// WARNING; NO GROUP TO MOVE"; } -void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end) +void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end, bool m_refresh) { Transition *item = getTransitionItemAt(start.startPos, start.track); if (!item) { @@ -3466,17 +3528,15 @@ void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end) } emit transitionItemSelected(item, getPreviousVideoTrack(item->track()), p); } - m_document->renderer()->doRefresh(); + if (m_refresh) m_document->renderer()->doRefresh(); } -void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end) +void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end, bool dontWorry) { - bool resizeClipStart = true; - if (start.startPos == end.startPos) resizeClipStart = false; - /*if (resizeClipStart) offset = 1; - else offset = -1;*/ - ClipItem *item = getClipItemAt((int)(start.startPos.frames(m_document->fps())), start.track); + bool resizeClipStart = (start.startPos != end.startPos); + ClipItem *item = getClipItemAtStart(start.startPos, start.track); if (!item) { + if (dontWorry) return; emit displayMessage(i18n("Cannot move clip at time: %1 on track %2", m_document->timecode().getTimecodeFromFrames(start.startPos.frames(m_document->fps())), start.track), ErrorMessage); kDebug() << "---------------- ERROR, CANNOT find clip to resize at... "; // << startPos; return; @@ -3485,18 +3545,19 @@ void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end) // Item is part of a group, reset group resetSelectionGroup(); } + bool snap = KdenliveSettings::snaptopoints(); KdenliveSettings::setSnaptopoints(false); - if (resizeClipStart && start.startPos != end.startPos) { + if (resizeClipStart) { ItemInfo clipinfo = item->info(); clipinfo.track = m_document->tracksCount() - clipinfo.track; - bool success = m_document->renderer()->mltResizeClipStart(clipinfo, end.startPos - item->startPos()); + 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); item->resizeStart((int) end.startPos.frames(m_document->fps())); updateClipFade(item); } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); - } else if (!resizeClipStart) { + } else { ItemInfo clipinfo = item->info(); clipinfo.track = m_document->tracksCount() - clipinfo.track; bool success = m_document->renderer()->mltResizeClipEnd(clipinfo, end.endPos - clipinfo.startPos); @@ -3505,7 +3566,7 @@ void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end) updateClipFade(item); } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); } - if (end.cropStart != start.cropStart) { + if (!resizeClipStart && end.cropStart != start.cropStart) { kDebug() << "// RESIZE CROP, DIFF: " << (end.cropStart - start.cropStart).frames(25); ItemInfo clipinfo = end; clipinfo.track = m_document->tracksCount() - end.track; @@ -4267,7 +4328,7 @@ void CustomTrackView::setInPoint() } if (clip->type() == TRANSITIONWIDGET) { m_commandStack->push(new MoveTransitionCommand(this, startInfo, endInfo, true)); - } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true)); + } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true, false)); } void CustomTrackView::setOutPoint() @@ -4299,7 +4360,7 @@ void CustomTrackView::setOutPoint() if (clip->type() == TRANSITIONWIDGET) { m_commandStack->push(new MoveTransitionCommand(this, startInfo, endInfo, true)); - } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true)); + } else m_commandStack->push(new ResizeClipCommand(this, startInfo, endInfo, true, false)); } void CustomTrackView::slotUpdateAllThumbs() diff --git a/src/customtrackview.h b/src/customtrackview.h index dece5d42..6119efa1 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -54,11 +54,11 @@ public: void changeTrack(int ix, TrackInfo type); int cursorPos(); void checkAutoScroll(); - void moveClip(const ItemInfo start, const ItemInfo end); + void moveClip(const ItemInfo start, const ItemInfo end, bool refresh); void moveGroup(QList startClip, QList startTransition, const GenTime offset, const int trackOffset, bool reverseMove = false); /** move transition, startPos = (old start, old end), endPos = (new start, new end) */ - void moveTransition(const ItemInfo start, const ItemInfo end); - void resizeClip(const ItemInfo start, const ItemInfo end); + void moveTransition(const ItemInfo start, const ItemInfo end, bool m_refresh); + void resizeClip(const ItemInfo start, const ItemInfo end, bool dontWorry = false); void addClip(QDomElement xml, const QString &clipId, ItemInfo info, EffectsList list = EffectsList(), bool refresh = true); void deleteClip(ItemInfo info, bool refresh = true); void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position); @@ -70,7 +70,7 @@ public: void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group); void addEffect(int track, GenTime pos, QDomElement effect); void deleteEffect(int track, GenTime pos, QDomElement effect); - void updateEffect(int track, GenTime pos, QDomElement effect, int ix, bool triggeredByUser = true); + void updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool triggeredByUser = true); void moveEffect(int track, GenTime pos, int oldPos, int newPos); void addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh); void deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh); diff --git a/src/editeffectcommand.cpp b/src/editeffectcommand.cpp index a6e76c14..9bbebc74 100644 --- a/src/editeffectcommand.cpp +++ b/src/editeffectcommand.cpp @@ -23,8 +23,8 @@ #include -EditEffectCommand::EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt) : - QUndoCommand(), +EditEffectCommand::EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt, QUndoCommand *parent) : + QUndoCommand(parent), m_view(view), m_track(track), m_oldeffect(oldeffect), @@ -59,13 +59,11 @@ bool EditEffectCommand::mergeWith(const QUndoCommand * other) // virtual void EditEffectCommand::undo() { - //kDebug() << "---- undoing action"; m_view->updateEffect(m_track, m_pos, m_oldeffect, m_stackPos, false); } // virtual void EditEffectCommand::redo() { - //kDebug() << "---- redoing action"; m_view->updateEffect(m_track, m_pos, m_effect, m_stackPos, m_doIt); m_doIt = false; } diff --git a/src/editeffectcommand.h b/src/editeffectcommand.h index 1b01ede7..c793fd4f 100644 --- a/src/editeffectcommand.h +++ b/src/editeffectcommand.h @@ -31,7 +31,7 @@ class CustomTrackView; class EditEffectCommand : public QUndoCommand { public: - EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt); + EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, int stackPos, bool doIt, QUndoCommand *parent = 0); virtual int id() const; virtual bool mergeWith(const QUndoCommand * command); diff --git a/src/editkeyframecommand.cpp b/src/editkeyframecommand.cpp index d946cc45..29c341ca 100644 --- a/src/editkeyframecommand.cpp +++ b/src/editkeyframecommand.cpp @@ -44,6 +44,7 @@ EditKeyFrameCommand::EditKeyFrameCommand(CustomTrackView *view, const int track, void EditKeyFrameCommand::undo() { m_view->editKeyFrame(m_pos, m_track, m_index, m_oldkfr); + m_doIt = true; } // virtual void EditKeyFrameCommand::redo() diff --git a/src/effectslist.cpp b/src/effectslist.cpp index c3f1e0c2..6d29b403 100644 --- a/src/effectslist.cpp +++ b/src/effectslist.cpp @@ -221,7 +221,14 @@ QDomElement EffectsList::item(int ix) void EffectsList::insert(int ix, QDomElement effect) { QDomNodeList effects = m_baseElement.childNodes(); - if (ix >= effects.count()) m_baseElement.appendChild(effect); - else m_baseElement.insertBefore(effect, effects.at(ix)); + if (ix >= effects.count()) m_baseElement.appendChild(importNode(effect, true)); + else m_baseElement.insertBefore(importNode(effect, true), effects.at(ix)); } +void EffectsList::replace(int ix, QDomElement effect) +{ + QDomNodeList effects = m_baseElement.childNodes(); + if (ix < effects.count()) m_baseElement.removeChild(effects.at(ix)); + if (ix == effects.count()) m_baseElement.appendChild(importNode(effect, true)); + else m_baseElement.insertBefore(importNode(effect, true), effects.at(ix)); +} diff --git a/src/effectslist.h b/src/effectslist.h index 2877738a..d019159a 100644 --- a/src/effectslist.h +++ b/src/effectslist.h @@ -49,6 +49,7 @@ public: void removeAt(int ix); QDomElement item(int ix); void insert(int ix, QDomElement effect); + void replace(int ix, QDomElement effect); static bool hasKeyFrames(QDomElement effect); static void setParameter(QDomElement effect, const QString &name, const QString &value); static QString parameter(QDomElement effect, const QString &name); diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 8e2ab3f2..b10ed93e 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -65,26 +65,19 @@ class Wipeval: public QWidget, public Ui::Wipeval_UI QMap EffectStackEdit::iconCache; EffectStackEdit::EffectStackEdit(QWidget *parent) : - QObject(parent), + QScrollArea(parent), m_in(0), m_out(0), m_frameSize(QPoint()) { - QVBoxLayout *vbox1 = new QVBoxLayout(parent); - vbox1->setContentsMargins(0, 0, 0, 0); - vbox1->setSpacing(0); - - QScrollArea *area = new QScrollArea; - m_baseWidget = new QWidget(parent); - area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - area->setFrameStyle(QFrame::NoFrame); - parent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); - area->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding)); - - vbox1->addWidget(area); - area->setWidget(m_baseWidget); - area->setWidgetResizable(true); + m_baseWidget = new QWidget(this); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + setFrameStyle(QFrame::NoFrame); + setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding)); + + setWidget(m_baseWidget); + setWidgetResizable(true); m_vbox = new QVBoxLayout(m_baseWidget); m_vbox->setContentsMargins(0, 0, 0, 0); m_vbox->setSpacing(0); @@ -241,7 +234,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int in, int out) } else if (type == "keyframe") { // keyframe editor widget kDebug() << "min: " << m_in << ", MAX: " << m_out; - KeyframeEdit *geo = new KeyframeEdit(pa, m_out - m_in, pa.attribute("min").toInt(), pa.attribute("max").toInt(), m_timecode); + KeyframeEdit *geo = new KeyframeEdit(pa, m_out - m_in - 1, pa.attribute("min").toInt(), pa.attribute("max").toInt(), m_timecode); //geo->setupParam(100, pa.attribute("min").toInt(), pa.attribute("max").toInt(), pa.attribute("keyframes")); //connect(geo, SIGNAL(seekToPos(int)), this, SLOT(slotSeekToPos(int))); //geo->setupParam(pa, minFrame, maxFrame); @@ -538,8 +531,9 @@ void EffectStackEdit::clearAllItems() //qDeleteAll(m_uiItems); QLayoutItem *child; while ((child = m_vbox->takeAt(0)) != 0) { - if (child->widget()) delete child->widget(); + QWidget *wid = child->widget(); delete child; + if (wid) delete wid; } blockSignals(false); } diff --git a/src/effectstackedit.h b/src/effectstackedit.h index f16ea1ae..5045bc3d 100644 --- a/src/effectstackedit.h +++ b/src/effectstackedit.h @@ -27,6 +27,7 @@ #include #include #include +#include enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 }; @@ -39,7 +40,7 @@ struct wipeInfo { class QFrame; -class EffectStackEdit : public QObject +class EffectStackEdit : public QScrollArea { Q_OBJECT public: diff --git a/src/effectstackview.cpp b/src/effectstackview.cpp index da0c6855..7f852e76 100644 --- a/src/effectstackview.cpp +++ b/src/effectstackview.cpp @@ -38,7 +38,12 @@ EffectStackView::EffectStackView(QWidget *parent) : QWidget(parent) { m_ui.setupUi(this); + QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame); m_effectedit = new EffectStackEdit(m_ui.frame); + vbox1->setContentsMargins(0, 0, 0, 0); + vbox1->setSpacing(0); + vbox1->addWidget(m_effectedit); + m_ui.frame->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); //m_ui.effectlist->horizontalHeader()->setVisible(false); //m_ui.effectlist->verticalHeader()->setVisible(false); m_clipref = NULL; @@ -145,6 +150,7 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix) double factor = c->baseClip()->getProperty("aspect_ratio").toDouble(); QPoint p((int)(size.section('x', 0, 0).toInt() * factor + 0.5), size.section('x', 1, 1).toInt()); m_effectedit->setFrameSize(p); + m_effectedit->setFrameSize(p); } else ix = 0; } if (m_clipref == NULL) { diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index 9931381c..847caaab 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -33,62 +33,70 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int maxFrame, int minVal, int maxVal, m_timecode(tc), m_previousPos(0) { - m_ui.setupUi(this); - m_ui.keyframe_list->setFont(KGlobalSettings::generalFont()); - m_ui.keyframe_list->setHeaderLabels(QStringList() << i18n("Position") << i18n("Value")); + setupUi(this); + keyframe_list->setFont(KGlobalSettings::generalFont()); + keyframe_list->setHeaderLabels(QStringList() << i18n("Position") << i18n("Value")); //setResizeMode(1, QHeaderView::Interactive); - m_ui.button_add->setIcon(KIcon("document-new")); - m_ui.button_delete->setIcon(KIcon("edit-delete")); - connect(m_ui.keyframe_list, SIGNAL(itemSelectionChanged()/*itemClicked(QTreeWidgetItem *, int)*/), this, SLOT(slotAdjustKeyframeInfo())); + button_add->setIcon(KIcon("document-new")); + button_delete->setIcon(KIcon("edit-delete")); + connect(keyframe_list, SIGNAL(itemSelectionChanged()/*itemClicked(QTreeWidgetItem *, int)*/), this, SLOT(slotAdjustKeyframeInfo())); setupParam(); - m_ui.keyframe_list->header()->resizeSections(QHeaderView::ResizeToContents); - connect(m_ui.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteKeyframe())); - connect(m_ui.button_add, SIGNAL(clicked()), this, SLOT(slotAddKeyframe())); - connect(m_ui.keyframe_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotGenerateParams(QTreeWidgetItem *, int))); - connect(m_ui.keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem *, int))); - connect(m_ui.keyframe_pos, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int))); - m_ui.keyframe_pos->setPageStep(1); - m_ui.keyframe_list->setItemDelegate(new KeyItemDelegate(minVal, maxVal)); + keyframe_list->header()->resizeSections(QHeaderView::ResizeToContents); + connect(button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteKeyframe())); + connect(button_add, SIGNAL(clicked()), this, SLOT(slotAddKeyframe())); + connect(keyframe_list, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotGenerateParams(QTreeWidgetItem *, int))); + connect(keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem *, int))); + connect(keyframe_pos, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int))); + keyframe_pos->setPageStep(1); + m_delegate = new KeyItemDelegate(minVal, maxVal); + keyframe_list->setItemDelegate(m_delegate); +} + +KeyframeEdit::~KeyframeEdit() +{ + keyframe_list->blockSignals(true); + keyframe_list->clear(); + delete m_delegate; } void KeyframeEdit::setupParam(QDomElement e) { if (!e.isNull()) m_param = e; - m_ui.keyframe_list->clear(); + keyframe_list->clear(); QStringList frames = m_param.attribute("keyframes").split(";", QString::SkipEmptyParts); for (int i = 0; i < frames.count(); i++) { QString framePos = m_timecode.getTimecodeFromFrames(frames.at(i).section(':', 0, 0).toInt()); QTreeWidgetItem *item = new QTreeWidgetItem(QStringList() << framePos << frames.at(i).section(':', 1, 1)); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); - m_ui.keyframe_list->addTopLevelItem(item); + keyframe_list->addTopLevelItem(item); } - QTreeWidgetItem *first = m_ui.keyframe_list->topLevelItem(0); - if (first) m_ui.keyframe_list->setCurrentItem(first); + QTreeWidgetItem *first = keyframe_list->topLevelItem(0); + if (first) keyframe_list->setCurrentItem(first); slotAdjustKeyframeInfo(); - m_ui.button_delete->setEnabled(m_ui.keyframe_list->topLevelItemCount() > 2); + button_delete->setEnabled(keyframe_list->topLevelItemCount() > 2); } void KeyframeEdit::slotDeleteKeyframe() { - if (m_ui.keyframe_list->topLevelItemCount() < 3) return; - QTreeWidgetItem *item = m_ui.keyframe_list->currentItem(); + if (keyframe_list->topLevelItemCount() < 3) return; + QTreeWidgetItem *item = keyframe_list->currentItem(); if (item) { delete item; slotGenerateParams(); } - m_ui.button_delete->setEnabled(m_ui.keyframe_list->topLevelItemCount() > 2); + button_delete->setEnabled(keyframe_list->topLevelItemCount() > 2); } void KeyframeEdit::slotAddKeyframe() { - m_ui.keyframe_list->blockSignals(true); + keyframe_list->blockSignals(true); int pos2; - QTreeWidgetItem *item = m_ui.keyframe_list->currentItem(); + QTreeWidgetItem *item = keyframe_list->currentItem(); if (item == NULL) return; - int ix = m_ui.keyframe_list->indexOfTopLevelItem(item); + int ix = keyframe_list->indexOfTopLevelItem(item); int pos1 = m_timecode.getFrameCount(item->text(0)); - QTreeWidgetItem *below = m_ui.keyframe_list->topLevelItem(ix + 1); - if (below == NULL) below = m_ui.keyframe_list->topLevelItem(ix - 1); + QTreeWidgetItem *below = keyframe_list->topLevelItem(ix + 1); + if (below == NULL) below = keyframe_list->topLevelItem(ix - 1); if (below == NULL) { if (pos1 == 0) pos2 = m_max; else pos2 = 0; @@ -100,11 +108,11 @@ void KeyframeEdit::slotAddKeyframe() if (result > pos1) ix++; QTreeWidgetItem *newItem = new QTreeWidgetItem(QStringList() << m_timecode.getTimecodeFromFrames(result) << item->text(1)); newItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); - m_ui.keyframe_list->insertTopLevelItem(ix, newItem); - m_ui.keyframe_list->setCurrentItem(newItem); + keyframe_list->insertTopLevelItem(ix, newItem); + keyframe_list->setCurrentItem(newItem); slotAdjustKeyframeInfo(); - m_ui.keyframe_list->blockSignals(false); - m_ui.button_delete->setEnabled(m_ui.keyframe_list->topLevelItemCount() > 2); + keyframe_list->blockSignals(false); + button_delete->setEnabled(keyframe_list->topLevelItemCount() > 2); slotGenerateParams(); } @@ -122,7 +130,7 @@ void KeyframeEdit::slotGenerateParams(QTreeWidgetItem *item, int column) pos = m_max; val = m_timecode.getTimecodeFromFrames(pos); } - QList duplicates = m_ui.keyframe_list->findItems(val, Qt::MatchExactly, 0); + QList duplicates = keyframe_list->findItems(val, Qt::MatchExactly, 0); duplicates.removeAll(item); if (!duplicates.isEmpty()) { // Trying to insert a keyframe at existing value, revert it @@ -136,8 +144,8 @@ void KeyframeEdit::slotGenerateParams(QTreeWidgetItem *item, int column) } } QString keyframes; - for (int i = 0; i < m_ui.keyframe_list->topLevelItemCount(); i++) { - QTreeWidgetItem *item = m_ui.keyframe_list->topLevelItem(i); + for (int i = 0; i < keyframe_list->topLevelItemCount(); i++) { + QTreeWidgetItem *item = keyframe_list->topLevelItem(i); keyframes.append(QString::number(m_timecode.getFrameCount(item->text(0))) + ':' + item->text(1) + ';'); } m_param.setAttribute("keyframes", keyframes); @@ -146,23 +154,23 @@ void KeyframeEdit::slotGenerateParams(QTreeWidgetItem *item, int column) void KeyframeEdit::slotAdjustKeyframeInfo() { - QTreeWidgetItem *item = m_ui.keyframe_list->currentItem(); + QTreeWidgetItem *item = keyframe_list->currentItem(); if (!item) return; int min = 0; int max = m_max; - QTreeWidgetItem *above = m_ui.keyframe_list->itemAbove(item); - QTreeWidgetItem *below = m_ui.keyframe_list->itemBelow(item); + QTreeWidgetItem *above = keyframe_list->itemAbove(item); + QTreeWidgetItem *below = keyframe_list->itemBelow(item); if (above) min = m_timecode.getFrameCount(above->text(0)) + 1; if (below) max = m_timecode.getFrameCount(below->text(0)) - 1; - m_ui.keyframe_pos->blockSignals(true); - m_ui.keyframe_pos->setRange(min, max); - m_ui.keyframe_pos->setValue(m_timecode.getFrameCount(item->text(0))); - m_ui.keyframe_pos->blockSignals(false); + keyframe_pos->blockSignals(true); + keyframe_pos->setRange(min, max); + keyframe_pos->setValue(m_timecode.getFrameCount(item->text(0))); + keyframe_pos->blockSignals(false); } void KeyframeEdit::slotAdjustKeyframeValue(int value) { - QTreeWidgetItem *item = m_ui.keyframe_list->currentItem(); + QTreeWidgetItem *item = keyframe_list->currentItem(); item->setText(0, m_timecode.getTimecodeFromFrames(value)); } diff --git a/src/keyframeedit.h b/src/keyframeedit.h index 82621c80..8de47f02 100644 --- a/src/keyframeedit.h +++ b/src/keyframeedit.h @@ -71,21 +71,22 @@ private: int m_max; }; -class KeyframeEdit : public QWidget +class KeyframeEdit : public QWidget, public Ui::KeyframeEditor_UI { Q_OBJECT public: explicit KeyframeEdit(QDomElement e, int maxFrame, int minVal, int maxVal, Timecode tc, QWidget* parent = 0); + virtual ~KeyframeEdit(); void setupParam(QDomElement e = QDomElement()); private: - Ui::KeyframeEditor_UI m_ui; QDomElement m_param; int m_max; int m_minVal; int m_maxVal; Timecode m_timecode; int m_previousPos; + KeyItemDelegate *m_delegate; public slots: diff --git a/src/moveclipcommand.cpp b/src/moveclipcommand.cpp index 74d159d8..659c09fa 100644 --- a/src/moveclipcommand.cpp +++ b/src/moveclipcommand.cpp @@ -31,6 +31,10 @@ MoveClipCommand::MoveClipCommand(CustomTrackView *view, const ItemInfo start, co m_doIt(doIt) { setText(i18n("Move clip")); + if (parent) { + // command has a parent, so there are several operations ongoing, do not refresh monitor + m_refresh = false; + } else m_refresh = true; } @@ -39,14 +43,14 @@ void MoveClipCommand::undo() { // kDebug()<<"---- undoing action"; m_doIt = true; - m_view->moveClip(m_endPos, m_startPos); + m_view->moveClip(m_endPos, m_startPos, m_refresh); } // virtual void MoveClipCommand::redo() { //kDebug() << "---- redoing action"; if (m_doIt) - m_view->moveClip(m_startPos, m_endPos); + m_view->moveClip(m_startPos, m_endPos, m_refresh); m_doIt = true; } diff --git a/src/moveclipcommand.h b/src/moveclipcommand.h index 41ab4a8c..5b7d99ff 100644 --- a/src/moveclipcommand.h +++ b/src/moveclipcommand.h @@ -39,6 +39,7 @@ private: const ItemInfo m_startPos; const ItemInfo m_endPos; bool m_doIt; + bool m_refresh; }; #endif diff --git a/src/movetransitioncommand.cpp b/src/movetransitioncommand.cpp index 71c29444..f825ed77 100644 --- a/src/movetransitioncommand.cpp +++ b/src/movetransitioncommand.cpp @@ -28,6 +28,10 @@ MoveTransitionCommand::MoveTransitionCommand(CustomTrackView *view, const ItemIn m_doIt(doIt) { setText(i18n("Move transition")); + if (parent) { + // command has a parent, so there are several operations ongoing, do not refresh monitor + m_refresh = false; + } else m_refresh = true; } @@ -36,13 +40,13 @@ void MoveTransitionCommand::undo() { // kDebug()<<"---- undoing action"; m_doIt = true; - m_view->moveTransition(m_endPos, m_startPos); + m_view->moveTransition(m_endPos, m_startPos, m_refresh); } // virtual void MoveTransitionCommand::redo() { //kDebug() << "---- redoing action"; - if (m_doIt) m_view->moveTransition(m_startPos, m_endPos); + if (m_doIt) m_view->moveTransition(m_startPos, m_endPos, m_refresh); m_doIt = true; } diff --git a/src/movetransitioncommand.h b/src/movetransitioncommand.h index aecd47a8..6c9dd00c 100644 --- a/src/movetransitioncommand.h +++ b/src/movetransitioncommand.h @@ -36,6 +36,7 @@ private: ItemInfo m_startPos; ItemInfo m_endPos; bool m_doIt; + bool m_refresh; }; #endif diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 574fc94d..50f2ad79 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -103,8 +103,8 @@ ProjectList::ProjectList(QWidget *parent) : connect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int))); connect(m_listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *))); - ItemDelegate *listViewDelegate = new ItemDelegate(m_listView); - m_listView->setItemDelegate(listViewDelegate); + m_listViewDelegate = new ItemDelegate(m_listView); + m_listView->setItemDelegate(m_listViewDelegate); if (KdenliveSettings::activate_nepomuk()) { Nepomuk::ResourceManager::instance()->init(); @@ -119,6 +119,9 @@ ProjectList::~ProjectList() { delete m_menu; delete m_toolbar; + m_listView->blockSignals(true); + m_listView->clear(); + delete m_listViewDelegate; } void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction) diff --git a/src/projectlist.h b/src/projectlist.h index ebaeb00a..9618d352 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -172,6 +172,7 @@ private: QMenu *m_transcodeAction; KdenliveDoc *m_doc; ProjectItem *m_selectedItem; + ItemDelegate *m_listViewDelegate; bool m_refreshed; QToolButton *m_addButton; QMap m_infoQueue; diff --git a/src/renderwidget.cpp b/src/renderwidget.cpp index e352450c..dc3db831 100644 --- a/src/renderwidget.cpp +++ b/src/renderwidget.cpp @@ -156,7 +156,8 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) : m_view.out_file->setMode(KFile::File); m_view.running_jobs->setHeaderLabels(QStringList() << QString() << i18n("File") << i18n("Progress")); - m_view.running_jobs->setItemDelegate(new RenderViewDelegate(this)); + m_jobsDelegate = new RenderViewDelegate(this); + m_view.running_jobs->setItemDelegate(m_jobsDelegate); QHeaderView *header = m_view.running_jobs->header(); QFontMetrics fm = fontMetrics(); @@ -170,7 +171,8 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) : m_view.scripts_list->setHeaderLabels(QStringList() << QString() << i18n("Script Files")); - m_view.scripts_list->setItemDelegate(new RenderViewDelegate(this)); + m_scriptsDelegate = new RenderViewDelegate(this); + m_view.scripts_list->setItemDelegate(m_scriptsDelegate); header = m_view.scripts_list->header(); header->setResizeMode(0, QHeaderView::Fixed); header->resizeSection(0, 30); @@ -186,6 +188,16 @@ RenderWidget::RenderWidget(const QString &projectfolder, QWidget * parent) : focusFirstVisibleItem(); } +RenderWidget::~RenderWidget() +{ + m_view.running_jobs->blockSignals(true); + m_view.scripts_list->blockSignals(true); + m_view.running_jobs->clear(); + m_view.scripts_list->clear(); + delete m_jobsDelegate; + delete m_scriptsDelegate; +} + void RenderWidget::slotEditItem(QListWidgetItem *item) { QString edit = item->data(EditableRole).toString(); diff --git a/src/renderwidget.h b/src/renderwidget.h index c2d9ef58..90064792 100644 --- a/src/renderwidget.h +++ b/src/renderwidget.h @@ -100,6 +100,7 @@ class RenderWidget : public QDialog public: explicit RenderWidget(const QString &projectfolder, QWidget * parent = 0); + virtual ~RenderWidget(); void setGuides(QDomElement guidesxml, double duration); void focusFirstVisibleItem(); void setProfile(MltVideoProfile profile); @@ -144,6 +145,8 @@ private: Ui::RenderWidget_UI m_view; MltVideoProfile m_profile; QString m_projectFolder; + RenderViewDelegate *m_scriptsDelegate; + RenderViewDelegate *m_jobsDelegate; bool m_blockProcessing; QString m_renderer; void parseProfiles(QString meta = QString(), QString group = QString(), QString profile = QString()); diff --git a/src/resizeclipcommand.cpp b/src/resizeclipcommand.cpp index 9ad85065..4d8cfdf1 100644 --- a/src/resizeclipcommand.cpp +++ b/src/resizeclipcommand.cpp @@ -23,12 +23,13 @@ #include -ResizeClipCommand::ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, QUndoCommand * parent) : +ResizeClipCommand::ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, bool dontWorry, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_startPos(start), m_endPos(end), - m_doIt(doIt) + m_doIt(doIt), + m_dontWorry(dontWorry) { setText(i18n("Resize clip")); } @@ -38,13 +39,13 @@ void ResizeClipCommand::undo() { // kDebug()<<"---- undoing action"; m_doIt = true; - if (m_doIt) m_view->resizeClip(m_endPos, m_startPos); + if (m_doIt) m_view->resizeClip(m_endPos, m_startPos, m_dontWorry); } // virtual void ResizeClipCommand::redo() { kDebug() << "---- redoing action"; - if (m_doIt) m_view->resizeClip(m_startPos, m_endPos); + if (m_doIt) m_view->resizeClip(m_startPos, m_endPos, m_dontWorry); m_doIt = true; } diff --git a/src/resizeclipcommand.h b/src/resizeclipcommand.h index 8493c95d..9b5a4ae6 100644 --- a/src/resizeclipcommand.h +++ b/src/resizeclipcommand.h @@ -34,7 +34,7 @@ class CustomTrackView; class ResizeClipCommand : public QUndoCommand { public: - ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, QUndoCommand * parent = 0); + ResizeClipCommand(CustomTrackView *view, const ItemInfo start, const ItemInfo end, bool doIt, bool dontWorry, QUndoCommand * parent = 0); virtual void undo(); virtual void redo(); @@ -43,6 +43,7 @@ private: ItemInfo m_startPos; ItemInfo m_endPos; bool m_doIt; + bool m_dontWorry; }; #endif diff --git a/src/transition.cpp b/src/transition.cpp index 47cdf737..0568c50c 100644 --- a/src/transition.cpp +++ b/src/transition.cpp @@ -147,7 +147,6 @@ void Transition::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget */*widget*/) { - const double scale = option->matrix.m11(); const QRectF exposed = option->exposedRect; painter->setClipRect(exposed); const QRectF br = rect(); diff --git a/src/transitionsettings.cpp b/src/transitionsettings.cpp index 2b2aecf3..cdab1d25 100644 --- a/src/transitionsettings.cpp +++ b/src/transitionsettings.cpp @@ -33,7 +33,12 @@ TransitionSettings::TransitionSettings(QWidget* parent) : m_autoTrackTransition(0) { m_ui.setupUi(this); + QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame); m_effectEdit = new EffectStackEdit(m_ui.frame); + vbox1->setContentsMargins(0, 0, 0, 0); + vbox1->setSpacing(0); + vbox1->addWidget(m_effectEdit); + m_ui.frame->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); connect(m_effectEdit, SIGNAL(seekTimeline(int)), this, SIGNAL(seekTimeline(int))); setEnabled(false); -- 2.39.2