Commit 2bc61984 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

add some debug info for clip move errors

parent 27903764
Pipeline #88124 passed with stage
in 8 minutes and 31 seconds
......@@ -612,18 +612,22 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
{
Q_UNUSED(moveMirrorTracks)
if (trackId == -1) {
qWarning() << "clip is not on a track";
return false;
}
Q_ASSERT(isClip(clipId));
if (m_allClips[clipId]->clipState() == PlaylistState::Disabled) {
if (getTrackById_const(trackId)->trackType() == PlaylistState::AudioOnly && !m_allClips[clipId]->canBeAudio()) {
qWarning() << "clip type mismatch 1";
return false;
}
if (getTrackById_const(trackId)->trackType() == PlaylistState::VideoOnly && !m_allClips[clipId]->canBeVideo()) {
qWarning() << "clip type mismatch 2";
return false;
}
} else if (getTrackById_const(trackId)->trackType() != m_allClips[clipId]->clipState()) {
// Move not allowed (audio / video mismatch)
qWarning() << "clip type mismatch 3";
return false;
}
std::function<bool(void)> local_undo = []() { return true; };
......@@ -677,7 +681,6 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
bool hadMix = mixData.first.firstClipId > -1 || mixData.second.secondClipId > -1;
if (old_trackId == -1 && isTrack(previous_track) && hadMix && previous_track != trackId) {
// Clip is moved to another track
bool mixGroupMove = false;
if (mixData.first.firstClipId > 0) {
allowedClipMixes << mixData.first.firstClipId;
......@@ -800,6 +803,7 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
if (!ok) {
bool undone = local_undo();
Q_ASSERT(undone);
qWarning() << "clip deletion failed";
return false;
}
}
......
......@@ -196,12 +196,14 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
if (allowedClipMixes.isEmpty()) {
if (!m_playlists[0].is_blank_at(position) || !m_playlists[1].is_blank_at(position)) {
// Track is not empty
qWarning() << "clip insert failed - non blank 1";
return []() { return false; };
}
} else {
// This is a group move with a mix, some clips are allowed
if (!m_playlists[target_playlist].is_blank_at(position)) {
// Track is not empty
qWarning() << "clip insert failed - non blank 2";
return []() { return false; };
}
// Check if there are clips on the other playlist, and if they are in the allowed list
......@@ -210,6 +212,7 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
for (int c : collisions) {
if (!allowedClipMixes.contains(c)) {
// Track is not empty
qWarning() << "clip insert failed - non blank 3";
return []() { return false; };
}
}
......@@ -218,7 +221,10 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
if (target_clip >= count && m_playlists[target_playlist].is_blank_at(position)) {
// In that case, we append after, in the first playlist
return [this, position, clipId, end_function, finalMove, groupMove, target_playlist]() {
if (isLocked()) return false;
if (isLocked()) {
qWarning() << "clip insert failed - locked track";
return false;
}
if (auto ptr = m_parent.lock()) {
// Lock MLT playlist so that we don't end up with an invalid frame being displayed
m_playlists[target_playlist].lock();
......
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