Prevent insertion in locked tracks

parent 09cf443b
......@@ -302,6 +302,9 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
bool ok = true;
int old_trackId = getClipTrackId(clipId);
if (old_trackId != -1) {
if (getTrackById_const(old_trackId)->isLocked()) {
return false;
}
ok = getTrackById(old_trackId)->requestClipDeletion(clipId, updateView, local_undo, local_redo);
if (!ok) {
bool undone = local_undo();
......@@ -309,6 +312,9 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
return false;
}
}
if (getTrackById_const(trackId)->isLocked()) {
return false;
}
ok = getTrackById(trackId)->requestClipInsertion(clipId, position, updateView, local_undo, local_redo);
if (!ok) {
// qDebug()<<"-------------\n\nINSERTION FAILED, REVERTING\n\n-------------------";
......@@ -589,6 +595,9 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
std::function<bool(void)> local_undo = []() { return true; };
std::function<bool(void)> local_redo = []() { return true; };
bool res = false;
if (getTrackById_const(trackId)->isLocked()) {
return false;
}
ClipType type = ClipType::Unknown;
if (KdenliveSettings::splitaudio()) {
QString bid = binClipId.section(QLatin1Char('/'), 0, 0);
......
......@@ -982,3 +982,9 @@ int TrackModel::trackDuration()
{
return std::max(m_playlists[0].get_playtime(), m_playlists[1].get_playtime());
}
bool TrackModel::isLocked() const
{
READ_LOCK();
return m_track->get_int("kdenlive:locked_track");
}
......@@ -81,6 +81,10 @@ public:
*/
operator Mlt::Producer &() { return *m_track.get(); }
/* Returns true if track is in locked state
*/
bool isLocked() const;
// TODO make protected
QVariant getProperty(const QString &name) const;
void setProperty(const QString &name, const QString &value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment