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

Ensure audio target track is remembered if we click on a bin clip with the...

Ensure audio target track is remembered if we click on a bin clip with the same number of audio streams
CCBUG: 452495
parent 9a5dfcc3
......@@ -147,24 +147,35 @@ void TimelineController::setTargetTracks(bool hasVideo, const QMap <int, QString
videoTrack = m_model->getFirstVideoTrackIndex();
}
if (m_hasAudioTarget > 0) {
QVector <int> tracks;
auto it = m_model->m_allTracks.cbegin();
while (it != m_model->m_allTracks.cend()) {
if ((*it)->isAudioTrack()) {
tracks << (*it)->getId();
if (m_lastAudioTarget.count() == audioTargets.count()) {
// Use existing track targets
QList<int> audioStreams = audioTargets.keys();
QMapIterator <int, int>st(m_lastAudioTarget);
while (st.hasNext()) {
st.next();
audioTracks.insert(st.key(), audioStreams.takeLast());
}
++it;
}
if (KdenliveSettings::multistream_checktrack() && audioTargets.count() > tracks.count()) {
pCore->bin()->checkProjectAudioTracks(QString(), audioTargets.count());
}
QMapIterator <int, QString>st(audioTargets);
while (st.hasNext()) {
st.next();
if (tracks.isEmpty()) {
break;
} else {
// Use audio tracks from the first
QVector <int> tracks;
auto it = m_model->m_allTracks.cbegin();
while (it != m_model->m_allTracks.cend()) {
if ((*it)->isAudioTrack()) {
tracks << (*it)->getId();
}
++it;
}
if (KdenliveSettings::multistream_checktrack() && audioTargets.count() > tracks.count()) {
pCore->bin()->checkProjectAudioTracks(QString(), audioTargets.count());
}
QMapIterator <int, QString>st(audioTargets);
while (st.hasNext()) {
st.next();
if ( tracks.isEmpty()) {
break;
}
audioTracks.insert(tracks.takeLast(), st.key());
}
audioTracks.insert(tracks.takeLast(), st.key());
}
}
emit hasAudioTargetChanged();
......
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