Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
b6cdb35d
Commit
b6cdb35d
authored
Dec 03, 2017
by
Jean-Baptiste Mardelle
Browse files
Timeline preview fixes: Don't invalidate on expand/collapse effect, invalidate on master clip edit
parent
a568c015
Changes
23
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
b6cdb35d
...
...
@@ -2617,7 +2617,7 @@ void Bin::slotEffectDropped(QString id, QDomElement effect)
m_doc
->
commandStack
()
->
push
(
command
);
}
void
Bin
::
slotUpdateEffect
(
QString
id
,
QDomElement
oldEffect
,
QDomElement
newEffect
,
int
ix
,
bool
refreshStack
)
void
Bin
::
slotUpdateEffect
(
QString
id
,
QDomElement
oldEffect
,
QDomElement
newEffect
,
int
ix
,
bool
refreshStack
,
bool
updateClip
)
{
if
(
id
.
isEmpty
())
{
id
=
m_monitor
->
activeClipId
();
...
...
@@ -2625,7 +2625,7 @@ void Bin::slotUpdateEffect(QString id, QDomElement oldEffect, QDomElement newEff
if
(
id
.
isEmpty
())
{
return
;
}
UpdateBinEffectCommand
*
command
=
new
UpdateBinEffectCommand
(
this
,
id
,
oldEffect
,
newEffect
,
ix
,
refreshStack
);
UpdateBinEffectCommand
*
command
=
new
UpdateBinEffectCommand
(
this
,
id
,
oldEffect
,
newEffect
,
ix
,
refreshStack
,
updateClip
);
m_doc
->
commandStack
()
->
push
(
command
);
}
...
...
@@ -2728,14 +2728,16 @@ void Bin::addEffect(const QString &id, QDomElement &effect)
m_monitor
->
refreshMonitorIfActive
();
}
void
Bin
::
updateEffect
(
const
QString
&
id
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStackWidget
)
void
Bin
::
updateEffect
(
const
QString
&
id
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStackWidget
,
bool
updateClip
)
{
ProjectClip
*
currentItem
=
m_rootFolder
->
clip
(
id
);
if
(
!
currentItem
)
{
return
;
}
currentItem
->
updateEffect
(
m_monitor
->
profileInfo
(),
effect
,
ix
,
refreshStackWidget
);
m_monitor
->
refreshMonitorIfActive
();
currentItem
->
updateEffect
(
m_monitor
->
profileInfo
(),
effect
,
ix
,
refreshStackWidget
,
updateClip
);
if
(
updateClip
)
{
m_monitor
->
refreshMonitorIfActive
();
}
}
void
Bin
::
changeEffectState
(
const
QString
&
id
,
const
QList
<
int
>
&
indexes
,
bool
disable
,
bool
refreshStack
)
...
...
@@ -3260,7 +3262,7 @@ void Bin::slotGotFilterJobResults(const QString &id, int startPos, int track, co
EffectsList
::
setParameter
(
newEffect
,
i
.
key
(),
i
.
value
());
++
i
;
}
ctl
->
updateEffect
(
pCore
->
monitorManager
()
->
projectMonitor
()
->
profileInfo
(),
newEffect
,
effect
.
attribute
(
QStringLiteral
(
"kdenlive_ix"
)).
toInt
());
ctl
->
updateEffect
(
pCore
->
monitorManager
()
->
projectMonitor
()
->
profileInfo
(),
newEffect
,
effect
.
attribute
(
QStringLiteral
(
"kdenlive_ix"
)).
toInt
()
,
true
);
emit
masterClipUpdated
(
ctl
,
m_monitor
);
// TODO use undo / redo for bin clip edit effect
/*EditEffectCommand *command = new EditEffectCommand(this, clip->track(), clip->startPos(), effect, newEffect, clip->selectedEffectIndex(), true, true);
...
...
src/bin/bin.h
View file @
b6cdb35d
...
...
@@ -301,7 +301,7 @@ public:
/** @brief Add an effect to a bin clip. */
void
addEffect
(
const
QString
&
id
,
QDomElement
&
effect
);
/** @brief Update a bin clip effect. */
void
updateEffect
(
const
QString
&
id
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStackWidget
);
void
updateEffect
(
const
QString
&
id
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStackWidget
,
bool
updateClip
);
void
changeEffectState
(
const
QString
&
id
,
const
QList
<
int
>
&
indexes
,
bool
disable
,
bool
refreshStack
);
/** @brief Edit an effect settings to a bin clip. */
void
editMasterEffect
(
ClipController
*
ctl
);
...
...
@@ -370,7 +370,7 @@ private slots:
void
slotItemDropped
(
const
QStringList
&
ids
,
const
QModelIndex
&
parent
);
void
slotItemDropped
(
const
QList
<
QUrl
>
&
urls
,
const
QModelIndex
&
parent
);
void
slotEffectDropped
(
const
QString
&
effect
,
const
QModelIndex
&
parent
);
void
slotUpdateEffect
(
QString
id
,
QDomElement
oldEffect
,
QDomElement
newEffect
,
int
ix
,
bool
refreshStack
=
false
);
void
slotUpdateEffect
(
QString
id
,
QDomElement
oldEffect
,
QDomElement
newEffect
,
int
ix
,
bool
refreshStack
=
false
,
bool
updateClip
=
true
);
void
slotChangeEffectState
(
QString
id
,
const
QList
<
int
>
&
indexes
,
bool
disable
);
void
slotItemEdited
(
const
QModelIndex
&
,
const
QModelIndex
&
,
const
QVector
<
int
>
&
);
void
slotAddUrl
(
const
QString
&
url
,
int
folderId
,
const
QMap
<
QString
,
QString
>
&
data
=
QMap
<
QString
,
QString
>
());
...
...
src/bin/bincommands.cpp
View file @
b6cdb35d
...
...
@@ -154,26 +154,27 @@ void RemoveBinEffectCommand::redo()
m_bin
->
removeEffect
(
m_clipId
,
m_effect
);
}
UpdateBinEffectCommand
::
UpdateBinEffectCommand
(
Bin
*
bin
,
const
QString
&
clipId
,
QDomElement
&
oldEffect
,
QDomElement
&
newEffect
,
int
ix
,
bool
refreshStack
,
QUndoCommand
*
parent
)
:
UpdateBinEffectCommand
::
UpdateBinEffectCommand
(
Bin
*
bin
,
const
QString
&
clipId
,
QDomElement
&
oldEffect
,
QDomElement
&
newEffect
,
int
ix
,
bool
refreshStack
,
bool
updateClip
,
QUndoCommand
*
parent
)
:
QUndoCommand
(
parent
),
m_bin
(
bin
),
m_clipId
(
clipId
),
m_oldEffect
(
oldEffect
),
m_newEffect
(
newEffect
),
m_ix
(
ix
),
m_refreshStack
(
refreshStack
)
m_refreshStack
(
refreshStack
),
m_updateClip
(
updateClip
)
{
setText
(
i18n
(
"Edit Bin Effect"
));
}
// virtual
void
UpdateBinEffectCommand
::
undo
()
{
m_bin
->
updateEffect
(
m_clipId
,
m_oldEffect
,
m_ix
,
m_refreshStack
);
m_bin
->
updateEffect
(
m_clipId
,
m_oldEffect
,
m_ix
,
m_refreshStack
,
m_updateClip
);
}
// virtual
void
UpdateBinEffectCommand
::
redo
()
{
m_bin
->
updateEffect
(
m_clipId
,
m_newEffect
,
m_ix
,
m_refreshStack
);
m_bin
->
updateEffect
(
m_clipId
,
m_newEffect
,
m_ix
,
m_refreshStack
,
m_updateClip
);
m_refreshStack
=
true
;
}
...
...
src/bin/bincommands.h
View file @
b6cdb35d
...
...
@@ -106,7 +106,7 @@ private:
class
UpdateBinEffectCommand
:
public
QUndoCommand
{
public:
explicit
UpdateBinEffectCommand
(
Bin
*
bin
,
const
QString
&
clipId
,
QDomElement
&
oldEffect
,
QDomElement
&
newEffect
,
int
ix
,
bool
refreshStack
,
QUndoCommand
*
parent
=
nullptr
);
explicit
UpdateBinEffectCommand
(
Bin
*
bin
,
const
QString
&
clipId
,
QDomElement
&
oldEffect
,
QDomElement
&
newEffect
,
int
ix
,
bool
refreshStack
,
bool
updateClip
,
QUndoCommand
*
parent
=
nullptr
);
void
undo
()
Q_DECL_OVERRIDE
;
void
redo
()
Q_DECL_OVERRIDE
;
private:
...
...
@@ -116,6 +116,7 @@ private:
QDomElement
m_newEffect
;
int
m_ix
;
bool
m_refreshStack
;
bool
m_updateClip
;
};
class
ChangeMasterEffectStateCommand
:
public
QUndoCommand
...
...
src/bin/projectclip.cpp
View file @
b6cdb35d
...
...
@@ -845,9 +845,9 @@ void ProjectClip::addEffect(const ProfileInfo &pInfo, QDomElement &effect)
bin
()
->
emitItemUpdated
(
this
);
}
void
ProjectClip
::
updateEffect
(
const
ProfileInfo
&
pInfo
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStack
)
void
ProjectClip
::
updateEffect
(
const
ProfileInfo
&
pInfo
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStack
,
bool
updateClip
)
{
m_controller
->
updateEffect
(
pInfo
,
effect
,
ix
);
m_controller
->
updateEffect
(
pInfo
,
effect
,
ix
,
updateClip
);
if
(
refreshStack
)
{
bin
()
->
updateMasterEffect
(
m_controller
);
}
...
...
src/bin/projectclip.h
View file @
b6cdb35d
...
...
@@ -193,7 +193,7 @@ public:
void
addMarkers
(
QList
<
CommentedTime
>
&
markers
);
/** @brief Add an effect to bin clip. */
void
addEffect
(
const
ProfileInfo
&
pInfo
,
QDomElement
&
effect
);
void
updateEffect
(
const
ProfileInfo
&
pInfo
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStack
);
void
updateEffect
(
const
ProfileInfo
&
pInfo
,
QDomElement
&
effect
,
int
ix
,
bool
refreshStack
,
bool
updateClip
);
void
removeEffect
(
int
ix
);
/** @brief Create audio thumbnail for this clip. */
void
createAudioThumbs
();
...
...
src/effectstack/collapsibleeffect.cpp
View file @
b6cdb35d
...
...
@@ -450,7 +450,7 @@ void CollapsibleEffect::updateCollapsedState()
QString
info
=
m_info
.
toString
();
if
(
info
!=
m_effect
.
attribute
(
QStringLiteral
(
"kdenlive_info"
)))
{
m_effect
.
setAttribute
(
QStringLiteral
(
"kdenlive_info"
),
info
);
emit
parameterChanged
(
m_original_effect
,
m_effect
,
effectIndex
());
emit
parameterChanged
(
m_original_effect
,
m_effect
,
effectIndex
()
,
false
);
}
}
...
...
src/effectstack/collapsibleeffect.h
View file @
b6cdb35d
...
...
@@ -141,7 +141,7 @@ protected:
void
dropEvent
(
QDropEvent
*
event
)
Q_DECL_OVERRIDE
;
signals:
void
parameterChanged
(
const
QDomElement
&
,
const
QDomElement
&
,
int
);
void
parameterChanged
(
const
QDomElement
&
,
const
QDomElement
&
,
int
,
bool
update
=
true
);
void
syncEffectsPos
(
int
);
void
effectStateChanged
(
bool
,
int
ix
,
MonitorSceneType
effectNeedsMonitorScene
);
void
deleteEffect
(
const
QDomElement
&
);
...
...
src/effectstack/effectstackview2.cpp
View file @
b6cdb35d
...
...
@@ -776,16 +776,16 @@ CollapsibleEffect *EffectStackView2::getEffectByIndex(int ix)
return
nullptr
;
}
void
EffectStackView2
::
slotUpdateEffectParams
(
const
QDomElement
&
old
,
const
QDomElement
&
e
,
int
ix
)
void
EffectStackView2
::
slotUpdateEffectParams
(
const
QDomElement
&
old
,
const
QDomElement
&
e
,
int
ix
,
bool
update
)
{
if
(
m_status
==
TIMELINE_TRACK
)
{
emit
updateEffect
(
nullptr
,
m_trackindex
,
old
,
e
,
ix
,
false
);
emit
updateEffect
(
nullptr
,
m_trackindex
,
old
,
e
,
ix
,
false
,
update
);
}
else
if
(
m_status
==
TIMELINE_CLIP
&&
m_clipref
)
{
emit
updateEffect
(
m_clipref
,
-
1
,
old
,
e
,
ix
,
false
);
emit
updateEffect
(
m_clipref
,
-
1
,
old
,
e
,
ix
,
false
,
update
);
// Make sure the changed effect is currently displayed
slotSetCurrentEffect
(
ix
);
}
else
if
(
m_status
==
MASTER_CLIP
)
{
emit
updateMasterEffect
(
m_masterclipref
->
clipId
(),
old
,
e
,
ix
);
emit
updateMasterEffect
(
m_masterclipref
->
clipId
(),
old
,
e
,
ix
,
false
,
update
);
}
m_scrollTimer
.
start
();
}
...
...
src/effectstack/effectstackview2.h
View file @
b6cdb35d
...
...
@@ -196,7 +196,7 @@ private slots:
/** @brief Checks whether the monitor scene has to be displayed. */
void
slotCheckMonitorPosition
(
int
renderPos
);
void
slotUpdateEffectParams
(
const
QDomElement
&
old
,
const
QDomElement
&
e
,
int
ix
);
void
slotUpdateEffectParams
(
const
QDomElement
&
old
,
const
QDomElement
&
e
,
int
ix
,
bool
update
);
/** @brief Move an effect in the stack.
* @param indexes The list of effect index in the stack
...
...
@@ -261,9 +261,9 @@ signals:
void
removeMasterEffect
(
const
QString
&
id
,
const
QDomElement
&
);
void
addMasterEffect
(
const
QString
&
id
,
const
QDomElement
&
);
/** Parameters for an effect changed, update the filter in timeline */
void
updateEffect
(
ClipItem
*
,
int
,
const
QDomElement
&
,
const
QDomElement
&
,
int
,
bool
);
void
updateEffect
(
ClipItem
*
,
int
,
const
QDomElement
&
,
const
QDomElement
&
,
int
,
bool
refreshStack
,
bool
updateClip
=
true
);
/** Parameters for an effect changed, update the filter in timeline */
void
updateMasterEffect
(
QString
,
const
QDomElement
&
,
const
QDomElement
&
,
int
ix
,
bool
refreshStack
=
false
);
void
updateMasterEffect
(
QString
,
const
QDomElement
&
,
const
QDomElement
&
,
int
ix
,
bool
refreshStack
=
false
,
bool
updateClip
=
true
);
/** An effect in stack was moved, we need to regenerate
all effects for this clip in the playlist */
void
refreshEffectStack
(
ClipItem
*
);
...
...
src/effectstack/parametercontainer.h
View file @
b6cdb35d
...
...
@@ -134,7 +134,7 @@ private:
bool
m_conditionParameter
;
signals:
void
parameterChanged
(
const
QDomElement
&
,
const
QDomElement
&
,
int
);
void
parameterChanged
(
const
QDomElement
&
,
const
QDomElement
&
,
int
,
bool
update
=
true
);
void
syncEffectsPos
(
int
);
void
disableCurrentFilter
(
bool
);
void
checkMonitorPosition
(
int
);
...
...
src/mainwindow.cpp
View file @
b6cdb35d
...
...
@@ -323,7 +323,7 @@ void MainWindow::init(const QString &MltPath, const QUrl &Url, const QString &cl
connect
(
pCore
->
bin
(),
&
Bin
::
masterClipSelected
,
m_effectStack
,
&
EffectStackView2
::
slotMasterClipItemSelected
);
connect
(
pCore
->
bin
(),
&
Bin
::
masterClipUpdated
,
m_effectStack
,
&
EffectStackView2
::
slotRefreshMasterClipEffects
);
connect
(
m_effectStack
,
SIGNAL
(
addMasterEffect
(
QString
,
QDomElement
)),
pCore
->
bin
(),
SLOT
(
slotEffectDropped
(
QString
,
QDomElement
)));
connect
(
m_effectStack
,
SIGNAL
(
updateMasterEffect
(
QString
,
QDomElement
,
QDomElement
,
int
,
bool
)),
pCore
->
bin
(),
SLOT
(
slotUpdateEffect
(
QString
,
QDomElement
,
QDomElement
,
int
,
bool
)));
connect
(
m_effectStack
,
SIGNAL
(
updateMasterEffect
(
QString
,
QDomElement
,
QDomElement
,
int
,
bool
,
bool
)),
pCore
->
bin
(),
SLOT
(
slotUpdateEffect
(
QString
,
QDomElement
,
QDomElement
,
int
,
bool
,
bool
)));
connect
(
m_effectStack
,
SIGNAL
(
changeMasterEffectState
(
QString
,
QList
<
int
>
,
bool
)),
pCore
->
bin
(),
SLOT
(
slotChangeEffectState
(
QString
,
QList
<
int
>
,
bool
)));
connect
(
m_effectStack
,
&
EffectStackView2
::
removeMasterEffect
,
pCore
->
bin
(),
&
Bin
::
slotDeleteEffect
);
connect
(
m_effectStack
,
SIGNAL
(
changeEffectPosition
(
QString
,
QList
<
int
>
,
int
)),
pCore
->
bin
(),
SLOT
(
slotMoveEffect
(
QString
,
QList
<
int
>
,
int
)));
...
...
src/mltcontroller/clipcontroller.cpp
View file @
b6cdb35d
...
...
@@ -784,7 +784,7 @@ void ClipController::changeEffectState(const QList<int> &indexes, bool disable)
m_binController
->
updateTrackProducer
(
clipId
());
}
void
ClipController
::
updateEffect
(
const
ProfileInfo
&
pInfo
,
const
QDomElement
&
e
,
int
ix
)
void
ClipController
::
updateEffect
(
const
ProfileInfo
&
pInfo
,
const
QDomElement
&
e
,
int
ix
,
bool
updateClip
)
{
QString
tag
=
e
.
attribute
(
QStringLiteral
(
"id"
));
if
(
tag
==
QLatin1String
(
"autotrack_rectangle"
)
||
tag
.
startsWith
(
QLatin1String
(
"ladspa"
))
||
tag
==
QLatin1String
(
"sox"
))
{
...
...
@@ -813,7 +813,9 @@ void ClipController::updateEffect(const ProfileInfo &pInfo, const QDomElement &e
}
service
.
unlock
();
}
m_binController
->
updateTrackProducer
(
clipId
());
if
(
updateClip
)
{
m_binController
->
updateTrackProducer
(
clipId
());
}
//slotRefreshTracks();
}
...
...
src/mltcontroller/clipcontroller.h
View file @
b6cdb35d
...
...
@@ -172,7 +172,7 @@ public:
EffectsList
effectList
();
/** @brief Enable/disable an effect. */
void
changeEffectState
(
const
QList
<
int
>
&
indexes
,
bool
disable
);
void
updateEffect
(
const
ProfileInfo
&
pInfo
,
const
QDomElement
&
e
,
int
ix
);
void
updateEffect
(
const
ProfileInfo
&
pInfo
,
const
QDomElement
&
e
,
int
ix
,
bool
updateClip
);
/** @brief Returns true if the bin clip has effects */
bool
hasEffects
()
const
;
/** @brief Returns info about clip audio */
...
...
src/timeline/customtrackview.cpp
View file @
b6cdb35d
...
...
@@ -1497,7 +1497,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
item->insertKeyframe(m_document->getProfileInfo(), item->getEffectAtIndex(item->selectedEffectIndex()), keyFramePos.frames(m_document->fps()), val);
//QString next = item->keyframes(item->selectedEffectIndex());
QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
EditEffectCommand
*
command
=
new
EditEffectCommand
(
this
,
item
->
track
(),
item
->
startPos
(),
oldEffect
,
newEffect
,
item
->
selectedEffectIndex
(),
false
,
false
,
true
);
EditEffectCommand *command = new EditEffectCommand(this, item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false,
true,
false, true);
m_commandStack->push(command);
updateEffect(item->track(), item->startPos(), item->selectedEffect());
emit clipItemSelected(item, item->selectedEffectIndex());
...
...
@@ -1646,7 +1646,7 @@ void CustomTrackView::slotAttachKeyframeToEnd(bool attach)
QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
item->attachKeyframeToEnd(item->getEffectAtIndex(item->selectedEffectIndex()), attach);
QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
EditEffectCommand
*
command
=
new
EditEffectCommand
(
this
,
item
->
track
(),
item
->
startPos
(),
oldEffect
,
newEffect
,
item
->
selectedEffectIndex
(),
false
,
false
,
false
);
EditEffectCommand *command = new EditEffectCommand(this, item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false,
true,
false, false);
m_commandStack->push(command);
updateEffect(item->track(), item->startPos(), item->selectedEffect());
emit clipItemSelected(item, item->selectedEffectIndex());
...
...
@@ -1659,7 +1659,7 @@ void CustomTrackView::slotEditKeyframeType(QAction *action)
QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
item->editKeyframeType(item->getEffectAtIndex(item->selectedEffectIndex()), type);
QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
EditEffectCommand
*
command
=
new
EditEffectCommand
(
this
,
item
->
track
(),
item
->
startPos
(),
oldEffect
,
newEffect
,
item
->
selectedEffectIndex
(),
false
,
false
,
false
);
EditEffectCommand *command = new EditEffectCommand(this, item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false,
true,
false, false);
m_commandStack->push(command);
updateEffect(item->track(), item->startPos(), item->selectedEffect());
emit clipItemSelected(item, item->selectedEffectIndex());
...
...
@@ -2471,7 +2471,7 @@ void CustomTrackView::slotDeleteEffect(ClipItem *clip, int track, const QDomElem
}
}
void
CustomTrackView
::
updateEffect
(
int
track
,
GenTime
pos
,
const
QDomElement
&
insertedEffect
,
bool
updateEffectStack
,
bool
replaceEffect
,
bool
refreshMonitor
)
void CustomTrackView::updateEffect(int track, GenTime pos, const QDomElement &insertedEffect, bool updateEffectStack, bool replaceEffect, bool refreshMonitor
, bool updateClip
)
{
if (insertedEffect.isNull()) {
//qCDebug(KDENLIVE_LOG)<<"// Trying to add null effect";
...
...
@@ -2492,11 +2492,13 @@ void CustomTrackView::updateEffect(int track, GenTime pos, const QDomElement &in
if (!m_timeline->track(track)->editTrackEffect(effectParams, replaceEffect)) {
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
m_timeline
->
setTrackEffect
(
track
,
ix
,
effect
);
if
(
refreshMonitor
&&
effect
.
attribute
(
QStringLiteral
(
"type"
))
!=
QLatin1String
(
"audio"
))
{
m_timeline->setTrackEffect(track, ix, effect
, updateClip
);
if (
updateClip &&
refreshMonitor && effect.attribute(QStringLiteral("type")) != QLatin1String("audio")) {
monitorRefresh();
}
emit
updateTrackEffectState
(
track
);
if (updateClip) {
emit updateTrackEffectState(track);
}
return;
}
...
...
@@ -2544,7 +2546,7 @@ void CustomTrackView::updateEffect(int track, GenTime pos, const QDomElement &in
bool success = m_timeline->track(clip->track())->editEffect(clip->startPos().seconds(), effectParams, replaceEffect);
if (success) {
clip->updateEffect(effect);
if
(
refreshMonitor
&&
clip
->
hasVisibleVideo
()
&&
effect
.
attribute
(
QStringLiteral
(
"type"
))
!=
QLatin1String
(
"audio"
))
{
if (
updateClip &&
refreshMonitor && clip->hasVisibleVideo() && effect.attribute(QStringLiteral("type")) != QLatin1String("audio")) {
monitorRefresh(clip->info(), true);
}
if (updateEffectStack && clip->isSelected()) {
...
...
@@ -2686,7 +2688,7 @@ void CustomTrackView::slotChangeEffectState(ClipItem *clip, int track, QList<int
speedEffectIndexes << effectIndexes.at(i);
QDomElement newEffect = effect.cloneNode().toElement();
newEffect.setAttribute(QStringLiteral("disable"), (int) disable);
EditEffectCommand
*
editcommand
=
new
EditEffectCommand
(
this
,
clip
->
track
(),
clip
->
startPos
(),
effect
,
newEffect
,
effectIndexes
.
at
(
i
),
false
,
true
,
true
);
EditEffectCommand *editcommand = new EditEffectCommand(this, clip->track(), clip->startPos(), effect, newEffect, effectIndexes.at(i), false, true,
true,
true);
m_commandStack->push(editcommand);
}
}
...
...
@@ -2710,13 +2712,13 @@ void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int track, const
m_commandStack->push(command);
}
void
CustomTrackView
::
slotUpdateClipEffect
(
ClipItem
*
clip
,
int
track
,
const
QDomElement
&
oldeffect
,
const
QDomElement
&
effect
,
int
ix
,
bool
refreshEffectStack
)
void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, int track, const QDomElement &oldeffect, const QDomElement &effect, int ix, bool refreshEffectStack
, bool updateClip
)
{
EditEffectCommand *command;
if (clip) {
command
=
new
EditEffectCommand
(
this
,
clip
->
track
(),
clip
->
startPos
(),
oldeffect
.
cloneNode
().
toElement
(),
effect
.
cloneNode
().
toElement
(),
ix
,
refreshEffectStack
,
true
,
true
);
command = new EditEffectCommand(this, clip->track(), clip->startPos(), oldeffect.cloneNode().toElement(), effect.cloneNode().toElement(), ix, refreshEffectStack,
updateClip,
true, true);
} else {
command
=
new
EditEffectCommand
(
this
,
track
,
GenTime
(
-
1
),
oldeffect
.
cloneNode
().
toElement
(),
effect
.
cloneNode
().
toElement
(),
ix
,
refreshEffectStack
,
true
,
true
);
command = new EditEffectCommand(this, track, GenTime(-1), oldeffect.cloneNode().toElement(), effect.cloneNode().toElement(), ix, refreshEffectStack,
updateClip,
true, true);
}
m_commandStack->push(command);
}
...
...
@@ -2726,7 +2728,7 @@ void CustomTrackView::slotUpdateClipRegion(ClipItem *clip, int ix, const QString
QDomElement effect = clip->getEffectAtIndex(ix);
QDomElement oldeffect = effect.cloneNode().toElement();
effect.setAttribute(QStringLiteral("region"), region);
EditEffectCommand
*
command
=
new
EditEffectCommand
(
this
,
clip
->
track
(),
clip
->
startPos
(),
oldeffect
,
effect
,
ix
,
true
,
true
,
true
);
EditEffectCommand *command = new EditEffectCommand(this, clip->track(), clip->startPos(), oldeffect, effect, ix, true, true,
true,
true);
m_commandStack->push(command);
}
...
...
@@ -8347,7 +8349,7 @@ void CustomTrackView::slotGotFilterJobResults(const QString &/*id*/, int startPo
EffectsList::setParameter(newEffect, i.key(), i.value());
++i;
}
EditEffectCommand
*
command
=
new
EditEffectCommand
(
this
,
clip
->
track
(),
clip
->
startPos
(),
effect
,
newEffect
,
clip
->
selectedEffectIndex
(),
true
,
true
,
true
);
EditEffectCommand *command = new EditEffectCommand(this, clip->track(), clip->startPos(), effect, newEffect, clip->selectedEffectIndex(), true, true,
true,
true);
m_commandStack->push(command);
emit clipItemSelected(clip);
} else {
...
...
@@ -8467,7 +8469,11 @@ void CustomTrackView::slotUpdateTimelineProducer(const QString &id)
{
Mlt::Producer *prod = m_document->renderer()->getBinProducer(id);
for (int i = 1; i < m_timeline->tracksCount(); i++) {
m_timeline
->
track
(
i
)
->
updateEffects
(
id
,
prod
);
const QList<ItemInfo> range = m_timeline->track(i)->updateEffects(id, prod);
if (!range.isEmpty()) {
// TODO: only on video clips
monitorRefresh(range, true);
}
}
}
...
...
src/timeline/customtrackview.h
View file @
b6cdb35d
...
...
@@ -90,7 +90,7 @@ public:
void
slotAddGroupEffect
(
const
QDomElement
&
effect
,
AbstractGroupItem
*
group
,
AbstractClipItem
*
dropTarget
=
nullptr
);
void
addEffect
(
int
track
,
GenTime
pos
,
const
QDomElement
&
effect
);
void
deleteEffect
(
int
track
,
const
GenTime
&
pos
,
const
QDomElement
&
effect
);
void
updateEffect
(
int
track
,
GenTime
pos
,
const
QDomElement
&
insertedEffect
,
bool
refreshEffectStack
=
false
,
bool
replaceEffect
=
false
,
bool
refreshMonitor
=
true
);
void
updateEffect
(
int
track
,
GenTime
pos
,
const
QDomElement
&
insertedEffect
,
bool
refreshEffectStack
=
false
,
bool
replaceEffect
=
false
,
bool
refreshMonitor
=
true
,
bool
updateClip
=
true
);
/** @brief Enable / disable a list of effects */
void
updateEffectState
(
int
track
,
GenTime
pos
,
const
QList
<
int
>
&
effectIndexes
,
bool
disable
,
bool
updateEffectStack
);
void
moveEffect
(
int
track
,
const
GenTime
&
pos
,
const
QList
<
int
>
&
oldPos
,
const
QList
<
int
>
&
newPos
);
...
...
@@ -337,7 +337,7 @@ public slots:
void
slotDeleteEffect
(
ClipItem
*
clip
,
int
track
,
const
QDomElement
&
effect
,
bool
affectGroup
=
true
,
QUndoCommand
*
parentCommand
=
nullptr
);
void
slotChangeEffectState
(
ClipItem
*
clip
,
int
track
,
QList
<
int
>
effectIndexes
,
bool
disable
);
void
slotChangeEffectPosition
(
ClipItem
*
clip
,
int
track
,
const
QList
<
int
>
&
currentPos
,
int
newPos
);
void
slotUpdateClipEffect
(
ClipItem
*
clip
,
int
track
,
const
QDomElement
&
oldeffect
,
const
QDomElement
&
effect
,
int
ix
,
bool
refreshEffectStack
=
true
);
void
slotUpdateClipEffect
(
ClipItem
*
clip
,
int
track
,
const
QDomElement
&
oldeffect
,
const
QDomElement
&
effect
,
int
ix
,
bool
refreshEffectStack
=
true
,
bool
updateClip
=
true
);
void
slotUpdateClipRegion
(
ClipItem
*
clip
,
int
ix
,
const
QString
&
region
);
void
slotRefreshEffects
(
ClipItem
*
clip
);
void
setDuration
(
int
duration
);
...
...
src/timeline/managers/selectmanager.cpp
View file @
b6cdb35d
...
...
@@ -279,7 +279,7 @@ void SelectManager::mouseRelease(QMouseEvent *event, GenTime pos)
QDomElement
newEffect
=
item
->
selectedEffect
().
cloneNode
().
toElement
();
EditEffectCommand
*
command
=
new
EditEffectCommand
(
m_view
,
item
->
track
(),
item
->
startPos
(),
oldEffect
,
newEffect
,
item
->
selectedEffectIndex
(),
false
,
false
,
true
);
EditEffectCommand
*
command
=
new
EditEffectCommand
(
m_view
,
item
->
track
(),
item
->
startPos
(),
oldEffect
,
newEffect
,
item
->
selectedEffectIndex
(),
false
,
true
,
false
,
true
);
m_commandStack
->
push
(
command
);
m_view
->
updateEffect
(
item
->
track
(),
item
->
startPos
(),
item
->
selectedEffect
());
m_view
->
clipItemSelected
(
item
);
...
...
src/timeline/timeline.cpp
View file @
b6cdb35d
...
...
@@ -1508,7 +1508,7 @@ bool Timeline::removeTrackEffect(int trackIndex, int effectIndex, const QDomElem
return
success
;
}
void
Timeline
::
setTrackEffect
(
int
trackIndex
,
int
effectIndex
,
QDomElement
effect
)
void
Timeline
::
setTrackEffect
(
int
trackIndex
,
int
effectIndex
,
QDomElement
effect
,
bool
updateTrack
)
{
if
(
trackIndex
<
0
||
trackIndex
>=
m_tracks
.
count
())
{
qCWarning
(
KDENLIVE_LOG
)
<<
"Set Track effect outisde of range"
;
...
...
@@ -1523,7 +1523,7 @@ void Timeline::setTrackEffect(int trackIndex, int effectIndex, QDomElement effec
sourceTrack
->
effectsList
.
removeAt
(
effect
.
attribute
(
QStringLiteral
(
"kdenlive_ix"
)).
toInt
());
effect
.
setAttribute
(
QStringLiteral
(
"kdenlive_ix"
),
effectIndex
);
sourceTrack
->
effectsList
.
insert
(
effect
);
if
(
effect
.
attribute
(
QStringLiteral
(
"type"
))
!=
QLatin1String
(
"audio"
))
{
if
(
updateTrack
&&
effect
.
attribute
(
QStringLiteral
(
"type"
))
!=
QLatin1String
(
"audio"
))
{
invalidateTrack
(
trackIndex
);
}
}
...
...
src/timeline/timeline.h
View file @
b6cdb35d
...
...
@@ -123,7 +123,7 @@ public:
QStringList
getTrackNames
();
void
addTrackEffect
(
int
trackIndex
,
QDomElement
effect
,
bool
addToPlaylist
=
true
);
bool
removeTrackEffect
(
int
trackIndex
,
int
effectIndex
,
const
QDomElement
&
effect
);
void
setTrackEffect
(
int
trackIndex
,
int
effectIndex
,
QDomElement
effect
);
void
setTrackEffect
(
int
trackIndex
,
int
effectIndex
,
QDomElement
effect
,
bool
updateTrack
=
true
);
bool
enableTrackEffects
(
int
trackIndex
,
const
QList
<
int
>
&
effectIndexes
,
bool
disable
);
const
EffectsList
getTrackEffects
(
int
trackIndex
);
QDomElement
getTrackEffect
(
int
trackIndex
,
int
effectIndex
);
...
...
src/timeline/timelinecommands.cpp
View file @
b6cdb35d
...
...
@@ -287,7 +287,7 @@ void ConfigTracksCommand::redo()
}
}
EditEffectCommand
::
EditEffectCommand
(
CustomTrackView
*
view
,
const
int
track
,
const
GenTime
&
pos
,
const
QDomElement
&
oldeffect
,
const
QDomElement
&
effect
,
int
stackPos
,
bool
refreshEffectStack
,
bool
doIt
,
bool
refreshMonitor
,
QUndoCommand
*
parent
)
:
EditEffectCommand
::
EditEffectCommand
(
CustomTrackView
*
view
,
const
int
track
,
const
GenTime
&
pos
,
const
QDomElement
&
oldeffect
,
const
QDomElement
&
effect
,
int
stackPos
,
bool
refreshEffectStack
,
bool
updateClip
,
bool
doIt
,
bool
refreshMonitor
,
QUndoCommand
*
parent
)
:
QUndoCommand
(
parent
),
m_view
(
view
),
m_track
(
track
),
...
...
@@ -297,6 +297,7 @@ EditEffectCommand::EditEffectCommand(CustomTrackView *view, const int track, con
m_stackPos
(
stackPos
),
m_doIt
(
doIt
),
m_refreshEffectStack
(
refreshEffectStack
),
m_updateClip
(
updateClip
),
m_replaceEffect
(
false
),
m_refreshMonitor
(
refreshMonitor
)
{
...
...
@@ -343,13 +344,13 @@ bool EditEffectCommand::mergeWith(const QUndoCommand *other)
// virtual
void
EditEffectCommand
::
undo
()
{
m_view
->
updateEffect
(
m_track
,
m_pos
,
m_oldeffect
,
true
,
m_replaceEffect
,
m_refreshMonitor
);
m_view
->
updateEffect
(
m_track
,
m_pos
,
m_oldeffect
,
true
,
m_replaceEffect
,
m_refreshMonitor
,
m_updateClip
);
}
// virtual
void
EditEffectCommand
::
redo
()
{
if
(
m_doIt
)
{
m_view
->
updateEffect
(
m_track
,
m_pos
,
m_effect
,
m_refreshEffectStack
,
m_replaceEffect
,
m_refreshMonitor
);
m_view
->
updateEffect
(
m_track
,
m_pos
,
m_effect
,
m_refreshEffectStack
,
m_replaceEffect
,
m_refreshMonitor
,
m_updateClip
);
}
m_doIt
=
true
;
m_refreshEffectStack
=
true
;
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment