Skip to content

Commit

Permalink
Fix #226 unwanted seek when move clip to another track.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Apr 24, 2016
1 parent 8f25da7 commit 9ae45c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/models/multitrackmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ bool MultitrackModel::moveClip(int fromTrack, int toTrack, int clipIndex, int po
return result;
}

int MultitrackModel::overwriteClip(int trackIndex, Mlt::Producer& clip, int position)
int MultitrackModel::overwriteClip(int trackIndex, Mlt::Producer& clip, int position, bool seek)
{
createIfNeeded();
int result = -1;
Expand Down Expand Up @@ -839,7 +839,8 @@ int MultitrackModel::overwriteClip(int trackIndex, Mlt::Producer& clip, int posi
QModelIndex index = createIndex(result, 0, trackIndex);
AudioLevelsTask::start(clip.parent(), this, index);
emit modified();
emit seeked(playlist.clip_start(result) + playlist.clip_length(result));
if (seek)
emit seeked(playlist.clip_start(result) + playlist.clip_length(result));
}
}
return result;
Expand Down Expand Up @@ -1872,7 +1873,7 @@ bool MultitrackModel::moveClipToTrack(int fromTrack, int toTrack, int clipIndex,
playlistFrom.replace_with_blank(clipIndex);
endInsertRows();

result = overwriteClip(toTrack, *clip, position) >= 0;
result = overwriteClip(toTrack, *clip, position, false) >= 0;

// If there was an error, rollback the cross-track changes.
if (!result) {
Expand Down
2 changes: 1 addition & 1 deletion src/models/multitrackmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public slots:
void notifyClipOut(int trackIndex, int clipIndex);
bool moveClipValid(int fromTrack, int toTrack, int clipIndex, int position);
bool moveClip(int fromTrack, int toTrack, int clipIndex, int position);
int overwriteClip(int trackIndex, Mlt::Producer& clip, int position);
int overwriteClip(int trackIndex, Mlt::Producer& clip, int position, bool seek = true);
QString overwrite(int trackIndex, Mlt::Producer& clip, int position, bool seek = true);
int insertClip(int trackIndex, Mlt::Producer& clip, int position);
int appendClip(int trackIndex, Mlt::Producer &clip);
Expand Down

0 comments on commit 9ae45c1

Please sign in to comment.