Skip to content
GitLab
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
c3fa2d7e
Commit
c3fa2d7e
authored
Mar 31, 2020
by
Jean-Baptiste Mardelle
Browse files
Rename track should trigger undo/redo command and update multitrack view.
Fixes
#600
parent
687ed62b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelineitemmodel.cpp
View file @
c3fa2d7e
...
...
@@ -430,6 +430,25 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
return
QVariant
();
}
void
TimelineItemModel
::
setTrackName
(
int
trackId
,
const
QString
&
text
)
{
QWriteLocker
locker
(
&
m_lock
);
const
QString
&
currentName
=
getTrackProperty
(
trackId
,
QStringLiteral
(
"kdenlive:track_name"
)).
toString
();
if
(
text
==
currentName
)
{
return
;
}
Fun
undo_lambda
=
[
this
,
trackId
,
currentName
]()
{
setTrackProperty
(
trackId
,
QStringLiteral
(
"kdenlive:track_name"
),
currentName
);
return
true
;
};
Fun
redo_lambda
=
[
this
,
trackId
,
text
]()
{
setTrackProperty
(
trackId
,
QStringLiteral
(
"kdenlive:track_name"
),
text
);
return
true
;
};
redo_lambda
();
PUSH_UNDO
(
undo_lambda
,
redo_lambda
,
i18n
(
"Edit item"
));
}
void
TimelineItemModel
::
setTrackProperty
(
int
trackId
,
const
QString
&
name
,
const
QString
&
value
)
{
std
::
shared_ptr
<
TrackModel
>
track
=
getTrackById
(
trackId
);
...
...
@@ -438,6 +457,9 @@ void TimelineItemModel::setTrackProperty(int trackId, const QString &name, const
bool
updateMultiTrack
=
false
;
if
(
name
==
QLatin1String
(
"kdenlive:track_name"
))
{
roles
.
push_back
(
NameRole
);
if
(
!
track
->
isAudioTrack
())
{
updateMultiTrack
=
true
;
}
}
else
if
(
name
==
QLatin1String
(
"kdenlive:locked_track"
))
{
roles
.
push_back
(
IsLockedRole
);
}
else
if
(
name
==
QLatin1String
(
"hide"
))
{
...
...
src/timeline2/model/timelineitemmodel.hpp
View file @
c3fa2d7e
...
...
@@ -83,6 +83,11 @@ public:
/* @brief Enabled/disabled a track's effect stack */
Q_INVOKABLE
void
setTrackStackEnabled
(
int
tid
,
bool
enable
);
Q_INVOKABLE
QVariant
getTrackProperty
(
int
tid
,
const
QString
&
name
)
const
;
/* @brief Sets a track name
@param trackId is of the track to alter
@param text is the new track name.
*/
Q_INVOKABLE
void
setTrackName
(
int
trackId
,
const
QString
&
text
);
/** @brief returns the lower video track index in timeline.
**/
int
getFirstVideoTrackIndex
()
const
;
...
...
src/timeline2/view/qml/TrackHead.qml
View file @
c3fa2d7e
...
...
@@ -472,7 +472,7 @@ Rectangle {
}
}*/
onEditingFinished
:
{
controller
.
setTrack
Property
(
trackId
,
"
kdenlive:track_name
"
,
text
)
controller
.
setTrack
Name
(
trackId
,
text
)
visible
=
false
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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