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
20311cb5
Commit
20311cb5
authored
Oct 23, 2020
by
Jean-Baptiste Mardelle
Browse files
Add new option to apply bin tag color to timeline clips, enabled by default
parent
2f9edda6
Pipeline
#38519
canceled with stage
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
20311cb5
...
...
@@ -1159,13 +1159,14 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
refreshOnly
=
false
;
reload
=
true
;
}
QVector
<
int
>
refreshRoles
;
if
(
properties
.
contains
(
QStringLiteral
(
"kdenlive:tags"
)))
{
setTags
(
properties
.
value
(
QStringLiteral
(
"kdenlive:tags"
)));
if
(
auto
ptr
=
m_model
.
lock
())
{
std
::
static_pointer_cast
<
ProjectItemModel
>
(
ptr
)
->
onItemUpdated
(
std
::
static_pointer_cast
<
ProjectClip
>
(
shared_from_this
()),
AbstractProjectItem
::
DataTag
);
}
refreshRoles
<<
TimelineModel
::
TagRole
;
}
if
(
properties
.
contains
(
QStringLiteral
(
"kdenlive:clipname"
)))
{
m_name
=
properties
.
value
(
QStringLiteral
(
"kdenlive:clipname"
));
...
...
@@ -1174,10 +1175,11 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
std
::
static_pointer_cast
<
ProjectItemModel
>
(
ptr
)
->
onItemUpdated
(
std
::
static_pointer_cast
<
ProjectClip
>
(
shared_from_this
()),
AbstractProjectItem
::
DataName
);
}
// update timeline clips
if
(
!
reload
)
{
updateTimelineClips
({
TimelineModel
::
NameRole
});
}
refreshRoles
<<
TimelineModel
::
NameRole
;
}
// update timeline clips
if
(
!
reload
)
{
updateTimelineClips
(
refreshRoles
);
}
bool
audioStreamChanged
=
properties
.
contains
(
QStringLiteral
(
"audio_index"
));
if
(
reload
)
{
...
...
src/kdenlivesettings.kcfg
View file @
20311cb5
...
...
@@ -784,8 +784,8 @@
<default>
true
</default>
</entry>
<entry
name=
"
automatictran
siti
ons
"
type=
"Bool"
>
<label>
New transitions are automatic transitions
.
</label>
<entry
name=
"
tag
si
n
ti
meline
"
type=
"Bool"
>
<label>
Show color tags in timeline
.
</label>
<default>
true
</default>
</entry>
...
...
src/mainwindow.cpp
View file @
20311cb5
...
...
@@ -1195,11 +1195,11 @@ void MainWindow::setupActions()
m_buttonSnap
->
setChecked
(
KdenliveSettings
::
snaptopoints
());
connect
(
m_buttonSnap
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
slotSwitchSnap
);
m_button
AutomaticTransition
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"
auto-transition"
)),
i18n
(
"Automatic transitions
"
),
this
);
m_button
TimelineTags
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"
tag"
)),
i18n
(
"Show color tags in timeline
"
),
this
);
m_button
AutomaticTransition
->
setCheckable
(
true
);
m_button
AutomaticTransition
->
setChecked
(
KdenliveSettings
::
automatictran
siti
ons
());
connect
(
m_button
AutomaticTransition
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
slotS
witchAutomaticTransition
);
m_button
TimelineTags
->
setCheckable
(
true
);
m_button
TimelineTags
->
setChecked
(
KdenliveSettings
::
tag
si
n
ti
meline
());
connect
(
m_button
TimelineTags
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
slotS
howTimelineTags
);
m_buttonFitZoom
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"zoom-fit-best"
)),
i18n
(
"Fit zoom to project"
),
this
);
...
...
@@ -1240,7 +1240,7 @@ void MainWindow::setupActions()
toolbar
->
addWidget
(
m_trimLabel
);
toolbar
->
addAction
(
m_button
AutomaticTransition
);
toolbar
->
addAction
(
m_button
TimelineTags
);
toolbar
->
addAction
(
m_buttonVideoThumbs
);
toolbar
->
addAction
(
m_buttonAudioThumbs
);
toolbar
->
addAction
(
m_buttonShowMarkers
);
...
...
@@ -1273,7 +1273,7 @@ void MainWindow::setupActions()
addAction
(
QStringLiteral
(
"razor_tool"
),
m_buttonRazorTool
,
Qt
::
Key_X
);
addAction
(
QStringLiteral
(
"spacer_tool"
),
m_buttonSpacerTool
,
Qt
::
Key_M
);
addAction
(
QStringLiteral
(
"automatic_transition"
),
m_button
AutomaticTransition
);
addAction
(
QStringLiteral
(
"automatic_transition"
),
m_button
TimelineTags
);
addAction
(
QStringLiteral
(
"show_video_thumbs"
),
m_buttonVideoThumbs
);
addAction
(
QStringLiteral
(
"show_audio_thumbs"
),
m_buttonAudioThumbs
);
addAction
(
QStringLiteral
(
"show_markers"
),
m_buttonShowMarkers
);
...
...
@@ -2418,7 +2418,6 @@ void MainWindow::updateConfiguration()
m_buttonAudioThumbs
->
setChecked
(
KdenliveSettings
::
audiothumbnails
());
m_buttonVideoThumbs
->
setChecked
(
KdenliveSettings
::
videothumbnails
());
m_buttonShowMarkers
->
setChecked
(
KdenliveSettings
::
showmarkers
());
slotSwitchAutomaticTransition
();
// Update list of transcoding profiles
buildDynamicActions
();
...
...
@@ -2454,10 +2453,12 @@ void MainWindow::slotSwitchSnap()
emit
getMainTimeline
()
->
controller
()
->
snapChanged
();
}
void
MainWindow
::
slotS
witchAutomaticTransition
()
void
MainWindow
::
slotS
howTimelineTags
()
{
KdenliveSettings
::
setAutomatictransitions
(
!
KdenliveSettings
::
automatictransitions
());
m_buttonAutomaticTransition
->
setChecked
(
KdenliveSettings
::
automatictransitions
());
KdenliveSettings
::
setTagsintimeline
(
!
KdenliveSettings
::
tagsintimeline
());
m_buttonTimelineTags
->
setChecked
(
KdenliveSettings
::
tagsintimeline
());
// Reset view to update timeline colors
getMainTimeline
()
->
controller
()
->
getModel
()
->
_resetView
();
}
void
MainWindow
::
slotDeleteItem
()
...
...
src/mainwindow.h
View file @
20311cb5
...
...
@@ -219,7 +219,7 @@ private:
QAction
*
m_buttonVideoThumbs
;
QAction
*
m_buttonShowMarkers
;
QAction
*
m_buttonFitZoom
;
QAction
*
m_button
AutomaticTransition
;
QAction
*
m_button
TimelineTags
;
QAction
*
m_normalEditTool
;
QAction
*
m_overwriteEditTool
;
QAction
*
m_insertEditTool
;
...
...
@@ -307,7 +307,7 @@ private slots:
void
slotEditProjectSettings
();
void
slotSwitchMarkersComments
();
void
slotSwitchSnap
();
void
slotS
witchAutomaticTransition
();
void
slotS
howTimelineTags
();
void
slotRenderProject
();
void
slotStopRenderProject
();
void
slotFullScreen
();
...
...
src/mltcontroller/clipcontroller.cpp
View file @
20311cb5
...
...
@@ -849,64 +849,6 @@ void ClipController::mirrorOriginalProperties(Mlt::Properties &props)
}
}
void
ClipController
::
addEffect
(
QDomElement
&
xml
)
{
Q_UNUSED
(
xml
)
// TODO refac: this must be rewritten
/*
QMutexLocker lock(&m_effectMutex);
Mlt::Service service = m_masterProducer->parent();
ItemInfo info;
info.cropStart = GenTime();
info.cropDuration = getPlaytime();
EffectsList eff = effectList();
EffectsController::initEffect(info, eff, getProducerProperty(QStringLiteral("kdenlive:proxy")), xml);
// Add effect to list and setup a kdenlive_ix value
int kdenlive_ix = 0;
for (int i = 0; i < service.filter_count(); ++i) {
QScopedPointer<Mlt::Filter> effect(service.filter(i));
int ix = effect->get_int("kdenlive_ix");
if (ix > kdenlive_ix) {
kdenlive_ix = ix;
}
}
kdenlive_ix++;
xml.setAttribute(QStringLiteral("kdenlive_ix"), kdenlive_ix);
EffectsParameterList params = EffectsController::getEffectArgs(xml);
EffectManager effect(service);
effect.addEffect(params, getPlaytime().frames(pCore->getCurrentFps()));
if (auto ptr = m_binController.lock()) ptr->updateTrackProducer(m_controllerBinId);
*/
}
void
ClipController
::
removeEffect
(
int
effectIndex
,
bool
delayRefresh
)
{
Q_UNUSED
(
effectIndex
)
Q_UNUSED
(
delayRefresh
)
// TODO refac: this must be rewritten
/*
QMutexLocker lock(&m_effectMutex);
Mlt::Service service(m_masterProducer->parent());
EffectManager effect(service);
effect.removeEffect(effectIndex, true);
if (!delayRefresh) {
if (auto ptr = m_binController.lock()) ptr->updateTrackProducer(m_controllerBinId);
}
*/
}
void
ClipController
::
moveEffect
(
int
oldPos
,
int
newPos
)
{
Q_UNUSED
(
oldPos
)
Q_UNUSED
(
newPos
)
// TODO refac: this must be rewritten
/*
QMutexLocker lock(&m_effectMutex);
Mlt::Service service(m_masterProducer->parent());
EffectManager effect(service);
effect.moveEffect(oldPos, newPos);
*/
}
int
ClipController
::
effectsCount
()
{
int
count
=
0
;
...
...
@@ -922,61 +864,6 @@ int ClipController::effectsCount()
return
count
;
}
void
ClipController
::
changeEffectState
(
const
QList
<
int
>
&
indexes
,
bool
disable
)
{
Q_UNUSED
(
indexes
)
Q_UNUSED
(
disable
)
// TODO refac : this must be rewritten
/*
Mlt::Service service = m_masterProducer->parent();
for (int i = 0; i < service.filter_count(); ++i) {
QScopedPointer<Mlt::Filter> effect(service.filter(i));
if ((effect != nullptr) && effect->is_valid() && indexes.contains(effect->get_int("kdenlive_ix"))) {
effect->set("disable", (int)disable);
}
}
if (auto ptr = m_binController.lock()) ptr->updateTrackProducer(m_controllerBinId);
*/
}
void
ClipController
::
updateEffect
(
const
QDomElement
&
e
,
int
ix
)
{
Q_UNUSED
(
e
)
Q_UNUSED
(
ix
)
// TODO refac : this must be rewritten
/*
QString tag = e.attribute(QStringLiteral("id"));
if (tag == QLatin1String("autotrack_rectangle") || tag.startsWith(QLatin1String("ladspa")) || tag == QLatin1String("sox")) {
// this filters cannot be edited, remove and re-add it
removeEffect(ix, true);
QDomElement clone = e.cloneNode().toElement();
addEffect(clone);
return;
}
EffectsParameterList params = EffectsController::getEffectArgs(e);
Mlt::Service service = m_masterProducer->parent();
for (int i = 0; i < service.filter_count(); ++i) {
QScopedPointer<Mlt::Filter> effect(service.filter(i));
if (!effect || !effect->is_valid() || effect->get_int("kdenlive_ix") != ix) {
continue;
}
service.lock();
QString prefix;
QString ser = effect->get("mlt_service");
if (ser == QLatin1String("region")) {
prefix = QStringLiteral("filter0.");
}
for (int j = 0; j < params.count(); ++j) {
effect->set((prefix + params.at(j).name()).toUtf8().constData(), params.at(j).value().toUtf8().constData());
// qCDebug(KDENLIVE_LOG)<<params.at(j).name()<<" = "<<params.at(j).value();
}
service.unlock();
}
if (auto ptr = m_binController.lock()) ptr->updateTrackProducer(m_controllerBinId);
// slotRefreshTracks();
*/
}
bool
ClipController
::
hasEffects
()
const
{
return
m_effectStack
->
rowCount
()
>
0
;
...
...
src/mltcontroller/clipcontroller.h
View file @
20311cb5
...
...
@@ -177,12 +177,7 @@ public:
void
forceLimitedDuration
();
Mlt
::
Properties
&
properties
();
void
mirrorOriginalProperties
(
Mlt
::
Properties
&
props
);
void
addEffect
(
QDomElement
&
xml
);
bool
copyEffect
(
const
std
::
shared_ptr
<
EffectStackModel
>
&
stackModel
,
int
rowId
);
void
removeEffect
(
int
effectIndex
,
bool
delayRefresh
=
false
);
/** @brief Enable/disable an effect. */
void
changeEffectState
(
const
QList
<
int
>
&
indexes
,
bool
disable
);
void
updateEffect
(
const
QDomElement
&
e
,
int
ix
);
/** @brief Returns true if the bin clip has effects */
bool
hasEffects
()
const
;
/** @brief Returns true if the clip contains at least one audio stream */
...
...
@@ -202,8 +197,6 @@ public:
void
setBinEffectsEnabled
(
bool
enabled
);
/** @brief Returns the number of Kdenlive added effects for this bin clip */
int
effectsCount
();
/** @brief Move an effect in stack for this bin clip */
void
moveEffect
(
int
oldPos
,
int
newPos
);
/** @brief Save an xml playlist of current clip with in/out points as zone.x()/y() */
void
saveZone
(
QPoint
zone
,
const
QDir
&
dir
);
...
...
src/timeline2/model/clipmodel.cpp
View file @
20311cb5
...
...
@@ -915,6 +915,14 @@ const QString ClipModel::clipName() const
return
pCore
->
projectItemModel
()
->
getClipByBinID
(
m_binClipId
)
->
clipName
();
}
const
QString
ClipModel
::
clipTag
()
const
{
if
(
KdenliveSettings
::
tagsintimeline
())
{
return
pCore
->
projectItemModel
()
->
getClipByBinID
(
m_binClipId
)
->
tags
();
}
return
QString
();
}
FileStatus
::
ClipStatus
ClipModel
::
clipStatus
()
const
{
std
::
shared_ptr
<
ProjectClip
>
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
m_binClipId
);
...
...
src/timeline2/model/clipmodel.hpp
View file @
20311cb5
...
...
@@ -75,6 +75,7 @@ public:
/** @brief returns the bin clip name
*/
const
QString
clipName
()
const
;
const
QString
clipTag
()
const
;
QSize
getFrameSize
()
const
;
Q_INVOKABLE
bool
showKeyframes
()
const
;
Q_INVOKABLE
void
setShowKeyframes
(
bool
show
);
...
...
src/timeline2/model/timelineitemmodel.cpp
View file @
20311cb5
...
...
@@ -193,6 +193,7 @@ QHash<int, QByteArray> TimelineItemModel::roleNames() const
roles
[
ServiceRole
]
=
"mlt_service"
;
roles
[
BinIdRole
]
=
"binId"
;
roles
[
TrackIdRole
]
=
"trackId"
;
roles
[
TagRole
]
=
"tag"
;
roles
[
FakeTrackIdRole
]
=
"fakeTrackId"
;
roles
[
FakePositionRole
]
=
"fakePosition"
;
roles
[
StartRole
]
=
"start"
;
...
...
@@ -343,6 +344,8 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return
clip
->
isGrabbed
();
case
SelectedRole
:
return
clip
->
selected
;
case
TagRole
:
return
clip
->
clipTag
();
default:
break
;
}
...
...
src/timeline2/model/timelinemodel.hpp
View file @
20311cb5
...
...
@@ -138,6 +138,7 @@ public:
IsDisabledRole
,
/// track only
IsAudioRole
,
SortRole
,
TagRole
,
/// clip only
ShowKeyframesRole
,
AudioLevelsRole
,
/// clip only
AudioChannelsRole
,
/// clip only
...
...
src/timeline2/view/qml/Clip.qml
View file @
20311cb5
...
...
@@ -28,6 +28,7 @@ Rectangle {
id
:
clipRoot
property
real
timeScale
:
1
property
string
clipName
:
''
property
string
tagColor
:
''
property
string
clipResource
:
''
property
string
mltService
:
''
property
string
effectNames
...
...
@@ -198,6 +199,9 @@ Rectangle {
if
(
clipState
==
ClipState
.
Disabled
)
{
return
'
grey
'
}
if
(
clipRoot
.
tagColor
)
{
return
clipRoot
.
tagColor
}
if
(
itemType
==
ProducerType
.
Text
)
{
return
titleColor
}
...
...
src/timeline2/view/qml/Track.qml
View file @
20311cb5
...
...
@@ -62,6 +62,12 @@ Item{
value
:
model
.
fakeTrackId
when
:
loader
.
status
==
Loader
.
Ready
&&
loader
.
item
&&
isClip
(
model
.
clipType
)
}
Binding
{
target
:
loader
.
item
property
:
"
tagColor
"
value
:
model
.
tag
when
:
loader
.
status
==
Loader
.
Ready
&&
loader
.
item
&&
isClip
(
model
.
clipType
)
}
Binding
{
target
:
loader
.
item
property
:
"
fakePosition
"
...
...
Write
Preview
Markdown
is supported
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