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
fcc7016c
Commit
fcc7016c
authored
Mar 10, 2021
by
Jean-Baptiste Mardelle
Browse files
Various fixes for effect zones, disable for clips
parent
ad7f4785
Changes
21
Hide whitespace changes
Inline
Side-by-side
src/assets/model/assetparametermodel.hpp
View file @
fcc7016c
...
...
@@ -258,7 +258,7 @@ signals:
void
replugEffect
(
std
::
shared_ptr
<
AssetParameterModel
>
asset
);
void
rebuildEffect
(
std
::
shared_ptr
<
AssetParameterModel
>
asset
);
void
enabledChange
(
bool
);
void
showEffectZone
(
QPair
<
int
,
int
>
inOut
,
bool
checked
);
void
showEffectZone
(
ObjectId
id
,
QPair
<
int
,
int
>
inOut
,
bool
checked
);
};
#endif
src/core.cpp
View file @
fcc7016c
...
...
@@ -1051,10 +1051,16 @@ void Core::setWidgetKeyBinding(const QString &mess)
window
()
->
setWidgetKeyBinding
(
mess
);
}
void
Core
::
showEffectZone
(
QPair
<
int
,
int
>
inOut
,
bool
checked
)
void
Core
::
showEffectZone
(
ObjectId
id
,
QPair
<
int
,
int
>
inOut
,
bool
checked
)
{
if
(
m_guiConstructed
&&
m_mainWindow
->
getCurrentTimeline
()
->
controller
())
{
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
showRulerEffectZone
(
inOut
,
checked
);
}
}
void
Core
::
updateMasterZones
()
{
if
(
m_guiConstructed
&&
m_mainWindow
->
getCurrentTimeline
()
->
controller
())
{
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
updateMasterZones
(
m_mainWindow
->
getCurrentTimeline
()
->
controller
()
->
getModel
()
->
getMasterEffectZones
());
}
}
...
...
src/core.h
View file @
fcc7016c
...
...
@@ -294,7 +294,8 @@ public slots:
/** @brief Set current project modified. */
void
setDocumentModified
();
/** @brief Show currently selected effect zone in timeline ruler. */
void
showEffectZone
(
QPair
<
int
,
int
>
inOut
,
bool
checked
);
void
showEffectZone
(
ObjectId
id
,
QPair
<
int
,
int
>
inOut
,
bool
checked
);
void
updateMasterZones
();
signals:
void
coreIsReady
();
...
...
@@ -313,7 +314,7 @@ signals:
/** @brief This signal means that VOSK and/or SRT module availability changed*/
void
updateVoskAvailability
();
/** @brief Update current effect zone */
void
updateEffectZone
(
const
QPoint
p
);
void
updateEffectZone
(
const
QPoint
p
,
bool
withUndo
);
};
#endif
src/effects/effectstack/model/effectitemmodel.cpp
View file @
fcc7016c
...
...
@@ -241,7 +241,7 @@ QPair <int, int> EffectItemModel::getInOut() const
return
{
m_asset
->
get_int
(
"in"
),
m_asset
->
get_int
(
"out"
)};
}
void
EffectItemModel
::
setInOut
(
const
QString
&
effectName
,
QPair
<
int
,
int
>
bounds
,
bool
enabled
)
void
EffectItemModel
::
setInOut
(
const
QString
&
effectName
,
QPair
<
int
,
int
>
bounds
,
bool
enabled
,
bool
withUndo
)
{
QPair
<
int
,
int
>
currentInOut
=
{
m_asset
->
get_int
(
"in"
),
m_asset
->
get_int
(
"out"
)};
int
currentState
=
m_asset
->
get_int
(
"kdenlive:force_in_out"
);
...
...
@@ -254,7 +254,7 @@ void EffectItemModel::setInOut(const QString &effectName, QPair<int, int>bounds,
pCore
->
refreshProjectItem
(
m_ownerId
);
pCore
->
invalidateItem
(
m_ownerId
);
}
emit
showEffectZone
(
currentInOut
,
currentState
==
1
);
emit
showEffectZone
(
m_ownerId
,
currentInOut
,
currentState
==
1
);
return
true
;
};
Fun
redo
=
[
this
,
enabled
,
bounds
]()
{
...
...
@@ -266,9 +266,11 @@ void EffectItemModel::setInOut(const QString &effectName, QPair<int, int>bounds,
pCore
->
refreshProjectItem
(
m_ownerId
);
pCore
->
invalidateItem
(
m_ownerId
);
}
emit
showEffectZone
(
bounds
,
enabled
);
emit
showEffectZone
(
m_ownerId
,
bounds
,
enabled
);
return
true
;
};
redo
();
pCore
->
pushUndo
(
undo
,
redo
,
i18n
(
"Update zone for %1"
,
effectName
));
if
(
withUndo
)
{
pCore
->
pushUndo
(
undo
,
redo
,
i18n
(
"Update zone for %1"
,
effectName
));
}
}
src/effects/effectstack/model/effectitemmodel.hpp
View file @
fcc7016c
...
...
@@ -64,7 +64,7 @@ public:
bool
hasForcedInOut
()
const
;
bool
isValid
()
const
;
QPair
<
int
,
int
>
getInOut
()
const
;
void
setInOut
(
const
QString
&
effectName
,
QPair
<
int
,
int
>
bounds
,
bool
enabled
);
void
setInOut
(
const
QString
&
effectName
,
QPair
<
int
,
int
>
bounds
,
bool
enabled
,
bool
withUndo
);
protected:
EffectItemModel
(
const
QList
<
QVariant
>
&
effectData
,
std
::
unique_ptr
<
Mlt
::
Properties
>
effect
,
const
QDomElement
&
xml
,
const
QString
&
effectId
,
...
...
src/effects/effectstack/model/effectstackmodel.cpp
View file @
fcc7016c
...
...
@@ -381,6 +381,9 @@ bool EffectStackModel::fromXml(const QDomElement &effectsXml, Fun &undo, Fun &re
effect
->
prepareKeyframes
();
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
showEffectZone
,
this
,
[
=
]()
{
emit
dataChanged
(
QModelIndex
(),
QModelIndex
(),
{
TimelineModel
::
EffectZonesRole
});
});
if
(
effectId
==
QLatin1String
(
"fadein"
)
||
effectId
==
QLatin1String
(
"fade_from_black"
))
{
m_fadeIns
.
insert
(
effect
->
getId
());
int
duration
=
effect
->
filter
().
get_length
()
-
1
;
...
...
@@ -445,6 +448,9 @@ bool EffectStackModel::copyEffect(const std::shared_ptr<AbstractEffectItem> &sou
effect
->
prepareKeyframes
();
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
showEffectZone
,
this
,
[
=
]()
{
emit
dataChanged
(
QModelIndex
(),
QModelIndex
(),
{
TimelineModel
::
EffectZonesRole
});
});
QVector
<
int
>
roles
=
{
TimelineModel
::
EffectNamesRole
};
if
(
effectId
==
QLatin1String
(
"fadein"
)
||
effectId
==
QLatin1String
(
"fade_from_black"
))
{
m_fadeIns
.
insert
(
effect
->
getId
());
...
...
@@ -507,6 +513,9 @@ bool EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
effect
->
prepareKeyframes
();
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
showEffectZone
,
this
,
[
=
]()
{
emit
dataChanged
(
QModelIndex
(),
QModelIndex
(),
{
TimelineModel
::
EffectZonesRole
});
});
int
currentActive
=
getActiveEffect
();
if
(
makeCurrent
)
{
if
(
auto
srvPtr
=
m_masterService
.
lock
())
{
...
...
@@ -1029,6 +1038,12 @@ void EffectStackModel::importEffects(const std::weak_ptr<Mlt::Service> &service,
imported
++
;
connect
(
effect
.
get
(),
&
AssetParameterModel
::
modelChanged
,
this
,
&
EffectStackModel
::
modelChanged
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
replugEffect
,
this
,
&
EffectStackModel
::
replugEffect
,
Qt
::
DirectConnection
);
connect
(
effect
.
get
(),
&
AssetParameterModel
::
showEffectZone
,
this
,
[
=
]()
{
emit
dataChanged
(
QModelIndex
(),
QModelIndex
(),
{
TimelineModel
::
EffectZonesRole
});
if
(
m_ownerId
.
first
==
ObjectType
::
Master
)
{
emit
updateMasterZones
();
}
});
Fun
redo
=
addItem_lambda
(
effect
,
rootItem
->
getId
());
effect
->
prepareKeyframes
();
if
(
redo
())
{
...
...
src/effects/effectstack/model/effectstackmodel.hpp
View file @
fcc7016c
...
...
@@ -188,6 +188,8 @@ signals:
*/
void
modelChanged
();
void
enabledStateChanged
();
/** @brief: The master effect stack zones changed, update */
void
updateMasterZones
();
};
#endif
src/effects/effectstack/view/collapsibleeffectview.cpp
View file @
fcc7016c
...
...
@@ -100,12 +100,9 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
title
=
new
KSqueezedTextLabel
(
this
);
l
->
insertWidget
(
2
,
title
);
m_keyframesButton
=
new
QToolButton
(
this
);
m_keyframesButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"keyframe"
)));
m_keyframesButton
->
setAutoRaise
(
true
);
m_keyframesButton
->
setCheckable
(
true
);
m_keyframesButton
->
setToolTip
(
i18n
(
"Enable Keyframes"
));
l
->
insertWidget
(
3
,
m_keyframesButton
);
keyframesButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"keyframe"
)));
keyframesButton
->
setCheckable
(
true
);
keyframesButton
->
setToolTip
(
i18n
(
"Enable Keyframes"
));
// Enable button
m_enabledButton
=
new
KDualAction
(
i18n
(
"Disable Effect"
),
i18n
(
"Enable Effect"
),
this
);
...
...
@@ -113,7 +110,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
m_enabledButton
->
setInactiveIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"visibility"
)));
enabledButton
->
setDefaultAction
(
m_enabledButton
);
connect
(
m_model
.
get
(),
&
AssetParameterModel
::
enabledChange
,
this
,
&
CollapsibleEffectView
::
enableView
);
connect
(
m_model
.
get
(),
&
AssetParameterModel
::
showEffectZone
,
[
this
]
(
QPair
<
int
,
int
>
inOut
,
bool
checked
)
{
connect
(
m_model
.
get
(),
&
AssetParameterModel
::
showEffectZone
,
this
,
[
=
]
(
ObjectId
id
,
QPair
<
int
,
int
>
inOut
,
bool
checked
)
{
m_inOutButton
->
setChecked
(
checked
);
zoneFrame
->
setFixedHeight
(
checked
?
frame
->
height
()
:
0
);
slotSwitch
(
m_collapse
->
isActive
());
...
...
@@ -123,7 +120,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
m_inPos
->
setValue
(
inOut
.
first
);
m_outPos
->
setValue
(
inOut
.
second
);
}
emit
showEffectZone
(
inOut
,
checked
);
emit
showEffectZone
(
id
,
inOut
,
checked
);
});
m_groupAction
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"folder-new"
)),
i18n
(
"Create Group"
),
this
);
connect
(
m_groupAction
,
&
QAction
::
triggered
,
this
,
&
CollapsibleEffectView
::
slotCreateGroup
);
...
...
@@ -154,11 +151,11 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
m_outPos
=
new
TimecodeDisplay
(
pCore
->
timecode
(),
this
);
layZone
->
addWidget
(
m_outPos
);
connect
(
setIn
,
&
QToolButton
::
clicked
,
[
this
]()
{
connect
(
setIn
,
&
QToolButton
::
clicked
,
this
,
[
=
]()
{
m_inPos
->
setValue
(
pCore
->
getTimelinePosition
());
updateEffectZone
();
});
connect
(
setOut
,
&
QToolButton
::
clicked
,
[
this
]()
{
connect
(
setOut
,
&
QToolButton
::
clicked
,
this
,
[
=
]()
{
m_outPos
->
setValue
(
pCore
->
getTimelinePosition
());
updateEffectZone
();
});
...
...
@@ -174,6 +171,7 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
}
else
{
zoneFrame
->
setFixedHeight
(
0
);
}
inOutButton
->
setVisible
(
m_model
->
getOwnerId
().
first
!=
ObjectType
::
TimelineClip
);
connect
(
m_inPos
,
&
TimecodeDisplay
::
timeCodeEditingFinished
,
this
,
&
CollapsibleEffectView
::
updateEffectZone
);
connect
(
m_outPos
,
&
TimecodeDisplay
::
timeCodeEditingFinished
,
this
,
&
CollapsibleEffectView
::
updateEffectZone
);
connect
(
m_inOutButton
,
&
QAction
::
triggered
,
this
,
&
CollapsibleEffectView
::
switchInOut
);
...
...
@@ -196,16 +194,16 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
});
connect
(
m_view
,
&
AssetParameterView
::
updateHeight
,
this
,
&
CollapsibleEffectView
::
updateHeight
);
connect
(
this
,
&
CollapsibleEffectView
::
refresh
,
m_view
,
&
AssetParameterView
::
slotRefresh
);
m_
keyframesButton
->
setVisible
(
m_view
->
keyframesAllowed
());
keyframesButton
->
setVisible
(
m_view
->
keyframesAllowed
());
auto
*
lay
=
new
QVBoxLayout
(
widgetFrame
);
lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
lay
->
setSpacing
(
0
);
lay
->
addWidget
(
m_view
);
connect
(
m_
keyframesButton
,
&
QToolButton
::
toggled
,
this
,
[
this
](
bool
toggle
)
{
connect
(
keyframesButton
,
&
QToolButton
::
toggled
,
this
,
[
this
](
bool
toggle
)
{
if
(
toggle
)
{
m_
keyframesButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"keyframe"
)));
keyframesButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"keyframe"
)));
}
else
{
m_
keyframesButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"keyframe-disable"
)));
keyframesButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"keyframe-disable"
)));
}
m_view
->
toggleKeyframes
(
toggle
);
});
...
...
@@ -215,10 +213,10 @@ CollapsibleEffectView::CollapsibleEffectView(const std::shared_ptr<EffectItemMod
if
(
hideByDefault
)
{
m_view
->
toggleKeyframes
(
false
);
}
else
{
m_
keyframesButton
->
setChecked
(
true
);
keyframesButton
->
setChecked
(
true
);
}
}
else
{
m_
keyframesButton
->
setChecked
(
true
);
keyframesButton
->
setChecked
(
true
);
}
// Presets
presetButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"adjustlevels"
)));
...
...
@@ -401,9 +399,9 @@ void CollapsibleEffectView::slotActivateEffect(bool active)
}
emit
m_view
->
initKeyframeView
(
active
);
if
(
m_inOutButton
->
isChecked
())
{
emit
showEffectZone
(
m_model
->
getInOut
(),
true
);
emit
showEffectZone
(
m_model
->
getOwnerId
(),
m_model
->
getInOut
(),
true
);
}
else
{
emit
showEffectZone
({
0
,
0
},
false
);
emit
showEffectZone
(
m_model
->
getOwnerId
(),
{
0
,
0
},
false
);
}
}
...
...
@@ -876,13 +874,11 @@ void CollapsibleEffectView::switchInOut(bool checked)
QPair
<
int
,
int
>
inOut
=
m_model
->
getInOut
();
zoneFrame
->
setFixedHeight
(
checked
?
frame
->
height
()
:
0
);
slotSwitch
(
m_collapse
->
isActive
());
qDebug
()
<<
"==== INITIAL IN / OUT: "
<<
inOut
.
first
<<
"-"
<<
inOut
.
second
;
if
(
inOut
.
first
==
inOut
.
second
||
!
checked
)
{
ObjectId
owner
=
m_model
->
getOwnerId
();
switch
(
owner
.
first
)
{
case
ObjectType
::
TimelineClip
:
{
qDebug
()
<<
"==== SWITCHING TIMELINE CLIP"
;
int
in
=
pCore
->
getItemIn
(
owner
);
inOut
=
{
in
,
in
+
pCore
->
getItemDuration
(
owner
)};
break
;
...
...
@@ -890,12 +886,11 @@ void CollapsibleEffectView::switchInOut(bool checked)
case
ObjectType
::
TimelineTrack
:
case
ObjectType
::
Master
:
{
qDebug
()
<<
"==== SWITCHING MASTER/TRACK"
;
if
(
!
checked
)
{
inOut
=
{
0
,
0
};
}
else
{
int
in
=
pCore
->
getTimelinePosition
()
-
50
;
inOut
=
{
in
,
in
+
100
};
int
in
=
pCore
->
getTimelinePosition
();
inOut
=
{
in
,
in
+
pCore
->
getDurationFromString
(
KdenliveSettings
::
transition_duration
())
};
}
break
;
}
...
...
@@ -906,13 +901,13 @@ void CollapsibleEffectView::switchInOut(bool checked)
}
qDebug
()
<<
"==== SWITCHING IN / OUT: "
<<
inOut
.
first
<<
"-"
<<
inOut
.
second
;
if
(
inOut
.
first
>
-
1
)
{
m_model
->
setInOut
(
effectName
,
inOut
,
checked
);
m_model
->
setInOut
(
effectName
,
inOut
,
checked
,
true
);
m_inPos
->
setValue
(
inOut
.
first
);
m_outPos
->
setValue
(
inOut
.
second
);
}
}
void
CollapsibleEffectView
::
updateInOut
(
QPair
<
int
,
int
>
inOut
)
void
CollapsibleEffectView
::
updateInOut
(
QPair
<
int
,
int
>
inOut
,
bool
withUndo
)
{
if
(
!
m_inOutButton
->
isChecked
())
{
qDebug
()
<<
"=== CANNOT UPDATE ZONE ON EFFECT!!!"
;
...
...
@@ -921,7 +916,7 @@ void CollapsibleEffectView::updateInOut(QPair<int, int> inOut)
QString
effectId
=
m_model
->
getAssetId
();
QString
effectName
=
EffectsRepository
::
get
()
->
getName
(
effectId
);
if
(
inOut
.
first
>
-
1
)
{
m_model
->
setInOut
(
effectName
,
inOut
,
true
);
m_model
->
setInOut
(
effectName
,
inOut
,
true
,
withUndo
);
m_inPos
->
setValue
(
inOut
.
first
);
m_outPos
->
setValue
(
inOut
.
second
);
}
...
...
@@ -932,6 +927,6 @@ void CollapsibleEffectView::updateEffectZone()
QString
effectId
=
m_model
->
getAssetId
();
QString
effectName
=
EffectsRepository
::
get
()
->
getName
(
effectId
);
QPair
<
int
,
int
>
inOut
=
{
m_inPos
->
getValue
(),
m_outPos
->
getValue
()};
m_model
->
setInOut
(
effectName
,
inOut
,
true
);
m_model
->
setInOut
(
effectName
,
inOut
,
true
,
true
);
}
src/effects/effectstack/view/collapsibleeffectview.hpp
View file @
fcc7016c
...
...
@@ -86,7 +86,7 @@ public:
QDomDocument
toXml
()
const
;
/** @brief Update monitor scene depending on effect enabled state. */
void
updateScene
();
void
updateInOut
(
QPair
<
int
,
int
>
inOut
);
void
updateInOut
(
QPair
<
int
,
int
>
inOut
,
bool
withUndo
);
public
slots
:
void
slotSyncEffectsPos
(
int
pos
);
...
...
@@ -125,7 +125,6 @@ private:
AssetParameterView
*
m_view
;
std
::
shared_ptr
<
EffectItemModel
>
m_model
;
KDualAction
*
m_collapse
;
QToolButton
*
m_keyframesButton
;
QList
<
CollapsibleEffectView
*>
m_subParamWidgets
;
QDomElement
m_effect
;
ItemInfo
m_itemInfo
;
...
...
@@ -174,7 +173,7 @@ signals:
void
switchHeight
(
std
::
shared_ptr
<
EffectItemModel
>
model
,
int
height
);
void
startDrag
(
QPixmap
,
std
::
shared_ptr
<
EffectItemModel
>
effectModel
);
void
activateEffect
(
std
::
shared_ptr
<
EffectItemModel
>
effectModel
);
void
showEffectZone
(
QPair
<
int
,
int
>
inOut
,
bool
checked
);
void
showEffectZone
(
ObjectId
id
,
QPair
<
int
,
int
>
inOut
,
bool
checked
);
void
refresh
();
/** @brief Requests saving the full effect stack. */
void
saveStack
();
...
...
src/effects/effectstack/view/effectstackview.cpp
View file @
fcc7016c
...
...
@@ -265,18 +265,15 @@ void EffectStackView::loadEffects()
connect
(
this
,
&
EffectStackView
::
blockWheenEvent
,
view
,
&
CollapsibleEffectView
::
blockWheenEvent
);
connect
(
view
,
&
CollapsibleEffectView
::
seekToPos
,
this
,
[
this
](
int
pos
)
{
// at this point, the effects returns a pos relative to the clip. We need to convert it to a global time
qDebug
()
<<
"==== CEFFECTSTACK SEEK TO POS: "
<<
pos
;
int
clipIn
=
pCore
->
getItemPosition
(
m_model
->
getOwnerId
());
emit
seekToPos
(
pos
+
clipIn
);
});
connect
(
this
,
&
EffectStackView
::
switchCollapsedView
,
view
,
&
CollapsibleEffectView
::
switchCollapsed
);
connect
(
pCore
.
get
(),
&
Core
::
updateEffectZone
,
[
this
](
const
QPoint
p
)
{
connect
(
pCore
.
get
(),
&
Core
::
updateEffectZone
,
view
,
[
=
](
const
QPoint
p
,
bool
withUndo
)
{
// Update current effect zone
int
i
=
m_model
->
getActiveEffect
();
auto
item
=
m_model
->
getEffectStackRow
(
i
);
QModelIndex
ix
=
m_model
->
getIndexFromItem
(
item
);
CollapsibleEffectView
*
w
=
static_cast
<
CollapsibleEffectView
*>
(
m_effectsTree
->
indexWidget
(
ix
));
if
(
w
)
{
w
->
updateInOut
({
p
.
x
(),
p
.
y
()});
if
(
view
->
isActive
())
{
view
->
updateInOut
({
p
.
x
(),
p
.
y
()},
withUndo
);
}
});
QModelIndex
ix
=
m_model
->
getIndexFromItem
(
effectModel
);
...
...
@@ -406,8 +403,8 @@ void EffectStackView::unsetModel(bool reset)
// Release ownership of smart pointer
Kdenlive
::
MonitorId
id
=
Kdenlive
::
NoMonitor
;
if
(
m_model
)
{
pCore
->
showEffectZone
({
0
,
0
},
false
);
ObjectId
item
=
m_model
->
getOwnerId
();
pCore
->
showEffectZone
(
item
,
{
0
,
0
},
false
);
id
=
item
.
first
==
ObjectType
::
BinClip
?
Kdenlive
::
ClipMonitor
:
Kdenlive
::
ProjectMonitor
;
disconnect
(
m_model
.
get
(),
&
EffectStackModel
::
dataChanged
,
this
,
&
EffectStackView
::
refresh
);
disconnect
(
m_model
.
get
(),
&
EffectStackModel
::
enabledStateChanged
,
this
,
&
EffectStackView
::
changeEnabledState
);
...
...
src/timeline2/model/timelineitemmodel.cpp
View file @
fcc7016c
...
...
@@ -247,6 +247,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const
roles
[
TrackActiveRole
]
=
"trackActive"
;
roles
[
EffectNamesRole
]
=
"effectNames"
;
roles
[
EffectsEnabledRole
]
=
"isStackEnabled"
;
roles
[
EffectZonesRole
]
=
"effectZones"
;
roles
[
GrabbedRole
]
=
"isGrabbed"
;
roles
[
SelectedRole
]
=
"selected"
;
return
roles
;
...
...
@@ -410,6 +411,9 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
case
EffectsEnabledRole
:
{
return
getTrackById_const
(
id
)
->
stackEnabled
();
}
case
EffectZonesRole
:
{
return
getTrackById_const
(
id
)
->
stackZones
();
}
default:
break
;
}
...
...
src/timeline2/model/timelinemodel.cpp
View file @
fcc7016c
...
...
@@ -4626,6 +4626,7 @@ std::shared_ptr<EffectStackModel> TimelineModel::getMasterEffectStackModel()
if
(
m_masterStack
==
nullptr
)
{
m_masterService
.
reset
(
new
Mlt
::
Service
(
*
m_tractor
.
get
()));
m_masterStack
=
EffectStackModel
::
construct
(
m_masterService
,
{
ObjectType
::
Master
,
0
},
m_undoStack
);
connect
(
m_masterStack
.
get
(),
&
EffectStackModel
::
updateMasterZones
,
pCore
.
get
(),
&
Core
::
updateMasterZones
);
}
return
m_masterStack
;
}
...
...
src/timeline2/model/timelinemodel.hpp
View file @
fcc7016c
...
...
@@ -167,7 +167,8 @@ public:
GrabbedRole
,
/// clip+composition only
SelectedRole
,
/// clip+composition only
TrackActiveRole
,
/// track only
AudioRecordRole
/// track only
AudioRecordRole
,
/// track only
EffectZonesRole
/// track only
};
~
TimelineModel
()
override
;
...
...
src/timeline2/model/trackmodel.cpp
View file @
fcc7016c
...
...
@@ -71,6 +71,7 @@ TrackModel::TrackModel(const std::weak_ptr<TimelineModel> &parent, int id, const
QObject
::
connect
(
m_effectStack
.
get
(),
&
EffectStackModel
::
dataChanged
,
[
&
](
const
QModelIndex
&
,
const
QModelIndex
&
,
QVector
<
int
>
roles
)
{
if
(
auto
ptr2
=
m_parent
.
lock
())
{
QModelIndex
ix
=
ptr2
->
makeTrackIndexFromID
(
m_id
);
qDebug
()
<<
"==== TRACK ZONES CHANGED"
;
emit
ptr2
->
dataChanged
(
ix
,
ix
,
roles
);
}
});
...
...
@@ -2308,3 +2309,8 @@ void TrackModel::switchMix(int cid, const QString composition, Fun &undo, Fun &r
};
UPDATE_UNDO_REDO
(
local_redo
,
local_undo
,
undo
,
redo
);
}
QVariantList
TrackModel
::
stackZones
()
const
{
return
m_effectStack
->
getEffectZones
();
}
src/timeline2/model/trackmodel.hpp
View file @
fcc7016c
...
...
@@ -145,6 +145,8 @@ public:
void
setMixDuration
(
int
cid
,
int
mixDuration
,
int
mixCut
);
/** @brief Get the assetparameter model for a mix */
const
std
::
shared_ptr
<
AssetParameterModel
>
mixModel
(
int
cid
);
/** @brief Get a list of current effect stack zones */
QVariantList
stackZones
()
const
;
protected:
/** @brief This will lock the track: it will no longer allow insertion/deletion/resize of items
...
...
src/timeline2/view/qml/Ruler.qml
View file @
fcc7016c
...
...
@@ -31,7 +31,7 @@ Item {
property
int
workingPreview
:
timeline
.
workingPreview
property
int
labelMod
:
1
property
bool
useTimelineRuler
:
timeline
.
useRuler
property
int
zoneHeight
:
Math
.
ceil
(
root
.
baseUnit
/
2
)
property
int
zoneHeight
:
Math
.
ceil
(
root
.
baseUnit
/
2
)
+
1
property
bool
showZoneLabels
:
false
property
bool
resizeActive
:
false
// Used to decide which mouse cursor we should display
property
var
effectZones
:
timeline
.
masterEffectZones
...
...
@@ -174,12 +174,12 @@ Item {
property
:
"
frameOut
"
value
:
timeline
.
effectZone
.
y
}
color
:
'
blueviolet
'
opacity
:
0.7
color
:
Qt
.
rgba
(
148
,
0
,
211
,
0.7
)
anchors.bottom
:
parent
.
bottom
height
:
zoneHeight
function
updateZone
(
start
,
end
,
update
)
{
console
.
log
(
'
EFFECT RULER UPDATE:::::
'
)
timeline
.
updateEffectZone
(
start
,
end
,
update
)
}
}
...
...
src/timeline2/view/qml/RulerZone.qml
View file @
fcc7016c
...
...
@@ -74,13 +74,14 @@ Rectangle {
// Zone frame indicator
Rectangle
{
visible
:
trimInMouseArea
.
drag
.
active
||
trimInMouseArea
.
containsMouse
width
:
inLabel
.
contentWidth
width
:
inLabel
.
contentWidth
+
4
height
:
inLabel
.
contentHeight
anchors.to
p
:
rzone
.
bot
to
m
anchors.
bot
to
m
:
rzone
.
to
p
color
:
activePalette
.
highlight
Label
{
id
:
inLabel
anchors.fill
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
text
:
timeline
.
timecode
(
frameIn
)
font
:
miniFont
color
:
activePalette
.
highlightedText
...
...
@@ -88,14 +89,15 @@ Rectangle {
}
Rectangle
{
visible
:
trimOutMouseArea
.
drag
.
active
||
trimOutMouseArea
.
containsMouse
width
:
outLabel
.
contentWidth
width
:
outLabel
.
contentWidth
+
4
height
:
outLabel
.
contentHeight
anchors.to
p
:
rzone
.
bot
to
m
anchors.
bot
to
m
:
rzone
.
to
p
color
:
activePalette
.
highlight
x
:
rzone
.
width
-
outLabel
.
contentWidth
x
:
rzone
.
width
-
(
outLabel
.
contentWidth
+
4
)
Label
{
id
:
outLabel
anchors.fill
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
text
:
timeline
.
timecode
(
frameOut
)
font
:
miniFont
color
:
activePalette
.
highlightedText
...
...
@@ -103,7 +105,7 @@ Rectangle {
}
Rectangle
{
id
:
durationRect
anchors.to
p
:
rzone
.
bot
to
m
anchors.
bot
to
m
:
rzone
.
to
p
visible
:
(
!
useTimelineRuler
&&
moveMouseArea
.
containsMouse
)
||
((
useTimelineRuler
||
trimInMouseArea
.
drag
.
active
||
trimOutMouseArea
.
drag
.
active
)
&&
showZoneLabels
&&
parent
.
width
>
3
*
width
)
||
(
useTimelineRuler
&&
!
trimInMouseArea
.
drag
.
active
&&
!
trimOutMouseArea
.
drag
.
active
)
||
moveMouseArea
.
drag
.
active
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
durationLabel
.
contentWidth
+
4
...
...
src/timeline2/view/qml/Track.qml
View file @
fcc7016c
...
...
@@ -30,6 +30,7 @@ Item{
property
int
trackInternalId
:
-
42
property
int
trackThumbsFormat
property
int
itemType
:
0
property
var
effectZones
opacity
:
model
.
disabled
?
0.4
:
1
function
clipAt
(
index
)
{
...
...
@@ -453,4 +454,15 @@ Item{
NumberAnimation
{
property
:
"
opacity
"
;
duration
:
300
}
}
]
}
Repeater
{
model
:
effectZones
Rectangle
{
x
:
effectZones
[
index
].
x
*
timeline
.
scaleFactor
height
:
2
width
:
(
effectZones
[
index
].
y
-
effectZones
[
index
].
x
)
*
timeline
.
scaleFactor
color
:
'
blueviolet
'
opacity
:
1
anchors.top
:
parent
.
top
}
}
}
src/timeline2/view/qml/timeline.qml
View file @
fcc7016c
...
...
@@ -1769,6 +1769,7 @@ Rectangle {
isAudio
:
audio
trackThumbsFormat
:
thumbsFormat
trackInternalId
:
item
effectZones
:
model
.
effectZones
z
:
tracksRepeater
.
count
-
index
}
}
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
fcc7016c
...
...
@@ -1456,7 +1456,7 @@ void TimelineController::updateZone(const QPoint oldZone, const QPoint newZone,
void
TimelineController
::
updateEffectZone
(
const
QPoint
oldZone
,
const
QPoint
newZone
,
bool
withUndo
)
{
pCore
->
updateEffectZone
(
newZone
);
pCore
->
updateEffectZone
(
newZone
,
withUndo
);
}
void
TimelineController
::
setZoneIn
(
int
inPoint
)
...
...
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