Commit 4b22fb81 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Loading a project with locked tracks should not insert an entry in undo history

parent 37b5c938
Pipeline #253632 passed with stage
in 8 minutes and 29 seconds
......@@ -258,7 +258,7 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
// load locked state as last step
for (int tid : qAsConst(lockedTracksIndexes)) {
timeline->setTrackLockedState(tid, true);
timeline->lockTrack(tid, true);
}
if (!ok) {
......
......@@ -6060,6 +6060,15 @@ bool TimelineModel::requestSetSelection(const std::unordered_set<int> &ids, Fun
return false;
}
void TimelineModel::lockTrack(int trackId, bool lock)
{
if (lock) {
getTrackById(trackId)->lock();
} else {
getTrackById(trackId)->unlock();
}
}
void TimelineModel::setTrackLockedState(int trackId, bool lock)
{
QWriteLocker locker(&m_lock);
......@@ -6068,11 +6077,11 @@ void TimelineModel::setTrackLockedState(int trackId, bool lock)
Fun redo = []() { return true; };
Fun lock_lambda = [this, trackId]() {
getTrackById(trackId)->lock();
lockTrack(trackId, true);
return true;
};
Fun unlock_lambda = [this, trackId]() {
getTrackById(trackId)->unlock();
lockTrack(trackId, false);
return true;
};
if (lock) {
......
......@@ -459,6 +459,10 @@ public:
*/
const QString sceneList(const QString &root, const QString &fullPath = QString(), const QString &filterData = QString());
/** @brief Lock or unlock a track
*/
void lockTrack(int trackId, bool lock);
protected:
/** @brief Creates a new clip instance without inserting it.
This action is undoable, returns true on success
......
Supports Markdown
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