Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/ui/qml/session/src/session_model_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,17 @@ void SessionModel::processChildren(const nlohmann::json &rj, const QModelIndex &
emit dataChanged(parent_index, parent_index, roles);
}

// After populating session/playlist children, re-trigger the viewport and
// current container lookup. On session restore the initial lookup fires
// before the model tree is fully built (the children arrive asynchronously),
// so timelines inside playlists are not yet findable. Re-checking here
// ensures the timeline panel picks up the active container once its node
// actually exists in the tree.
if (type == "Session" || type == "Container List" || type == "Playlist") {
updateCurrentMediaContainerIndexFromBackend();
updateViewportCurrentMediaContainerIndexFromBackend();
}

emit jsonChanged();

CHECK_SLOW_WATCHER_FAST()
Expand Down
24 changes: 24 additions & 0 deletions ui/qml/xstudio/views/timeline/XsTimeline.qml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,30 @@ Rectangle {
initTimeline()
}}(), 50);

} else if (viewedMediaSetProperties.index.valid && viewedMediaSetProperties.values.typeRole == "Playlist") {
// When restoring a session, the viewed container may be a Playlist
// rather than a Timeline. Find the first Timeline child inside the
// Playlist's Container List (row 2) and initialise from it.
let containerListIndex = theSessionData.index(2, 0, viewedMediaSetProperties.index)
let childCount = theSessionData.rowCount(containerListIndex)
for (let i = 0; i < childCount; i++) {
let childIndex = theSessionData.index(i, 0, containerListIndex)
if (theSessionData.get(childIndex, "typeRole") == "Timeline") {
// Switch the viewed container to this Timeline so the
// playhead and viewport are correctly attached.
theSessionData.viewportCurrentMediaContainerIndex = childIndex
return
}
}
// No timeline children found (or not yet loaded). If the container
// list is empty the data may still be arriving asynchronously, so
// retry after a short delay.
if (childCount == 0 && !timeline_items.rootIndex.valid) {
callbackTimer.setTimeout(function() { return function() {
viewedMediaSetChanged()
}}(), 250);
}

} else if (!timeline_items.rootIndex.valid) {
// if the user has selected something that is not a timeline (playlist,
// subset etc.), we do not update our index here (unless the timeline
Expand Down