Commit 1156c6d7 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix track insertion in mixed view mode.

CCBUG: 403443
parent 0f2968db
...@@ -410,14 +410,15 @@ int TimelineModel::getTrackSortValue(int trackId, int separated) const ...@@ -410,14 +410,15 @@ int TimelineModel::getTrackSortValue(int trackId, int separated) const
} }
} }
if (isAudio) { if (isAudio) {
if (aCount > vCount && (trackPos - 1 > aCount - vCount)) { if (aCount > vCount) {
if (trackPos - 1 > aCount - vCount) {
// We have more audio tracks than video tracks
return (aCount - vCount + 1) + 2 * (trackPos - (aCount - vCount +1)); return (aCount - vCount + 1) + 2 * (trackPos - (aCount - vCount +1));
} }
if (aCount == vCount) {
return 2 * trackPos;
}
return trackPos; return trackPos;
} }
return 2 * trackPos;
}
return 2 * (vCount + 1 - trackPos) + 1; return 2 * (vCount + 1 - trackPos) + 1;
} }
......
...@@ -83,14 +83,19 @@ void TrackDialog::buildCombo() ...@@ -83,14 +83,19 @@ void TrackDialog::buildCombo()
int TrackDialog::selectedTrackPosition() const int TrackDialog::selectedTrackPosition() const
{ {
bool audioMode = audio_track->isChecked() || arec_track->isChecked();
if (comboTracks->count() > 0) { if (comboTracks->count() > 0) {
int position = m_positionByIndex.value(comboTracks->currentData().toInt()); int position = m_positionByIndex.value(comboTracks->currentData().toInt());
if (before_select->currentIndex() == 1) { if (audioMode && KdenliveSettings::audiotracksbelow() == 0) {
// In mixed track modes, indexes are sorted differently so above/under have different meaning
if (before_select->currentIndex() == 0) {
position--;
}
} else if (before_select->currentIndex() == 1) {
position--; position--;
} }
return position; return position;
} }
bool audioMode = audio_track->isChecked() || arec_track->isChecked();
return audioMode ? 0 : -1; return audioMode ? 0 : -1;
} }
......
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