Fix insertion of several clips

parent 0f13b96e
......@@ -537,9 +537,27 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
QWriteLocker locker(&m_lock);
Fun undo = []() { return true; };
Fun redo = []() { return true; };
bool result = requestClipInsertion(binClipId, trackId, position, id, logUndo, refreshView, undo, redo);
QStringList clips = binClipId.split(QLatin1Char(';'), QString::SkipEmptyParts);
bool result = false;
std::unordered_set<int> createdClips;
id = -1;
int tmpId;
for (const QString bin : clips) {
result = requestClipInsertion(bin, trackId, position, tmpId, logUndo, refreshView, undo, redo);
if (!result) {
break;
}
position += getClipPlaytime(tmpId);
createdClips.insert(tmpId);
if (id == -1) {
id = tmpId;
}
}
if (result && createdClips.size() > 1) {
requestClipsGroup(createdClips, false, GroupType::Selection);
}
if (result && logUndo) {
PUSH_UNDO(undo, redo, i18n("Insert Clip"));
PUSH_UNDO(undo, redo, i18np("Insert Clip", "Insert Clips", clips.count()));
}
return result;
}
......
......@@ -218,7 +218,9 @@ void TimelineController::checkDuration()
std::unordered_set<int> TimelineController::getCurrentSelectionIds() const
{
std::unordered_set<int> selection;
if (m_model->m_temporarySelectionGroup >= 0 || (!m_selection.selectedItems.isEmpty() && m_model->m_groups->isInGroup(m_selection.selectedItems.constFirst()))) {
if (m_model->m_temporarySelectionGroup >= 0) {
selection = m_model->getGroupElements(m_model->m_temporarySelectionGroup);
} else if (!m_selection.selectedItems.isEmpty() && m_model->m_groups->isInGroup(m_selection.selectedItems.constFirst())) {
selection = m_model->getGroupElements(m_selection.selectedItems.constFirst());
} else {
for (int i : m_selection.selectedItems) {
......
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