Fix track insertion in mixed view mode.

CCBUG: 403443
parent 0f2968db
......@@ -410,13 +410,14 @@ int TimelineModel::getTrackSortValue(int trackId, int separated) const
}
}
if (isAudio) {
if (aCount > vCount && (trackPos - 1 > aCount - vCount)) {
return (aCount - vCount + 1) + 2 * (trackPos - (aCount - vCount +1));
}
if (aCount == vCount) {
return 2 * trackPos;
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 trackPos;
}
return trackPos;
return 2 * trackPos;
}
return 2 * (vCount + 1 - trackPos) + 1;
}
......
......@@ -83,14 +83,19 @@ void TrackDialog::buildCombo()
int TrackDialog::selectedTrackPosition() const
{
bool audioMode = audio_track->isChecked() || arec_track->isChecked();
if (comboTracks->count() > 0) {
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--;
}
return position;
}
bool audioMode = audio_track->isChecked() || arec_track->isChecked();
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