Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move selected subtitle to top of selection menu #1605

Merged
merged 2 commits into from
Mar 11, 2024
Merged
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
27 changes: 17 additions & 10 deletions components/manager/ViewCreator.bs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,8 @@ end sub

' User requested subtitle selection popup
sub onSelectSubtitlePressed()
' None is always first in the subtitle list
subtitleData = {
data: [{
"Index": -1,
"IsExternal": false,
"Track": {
"description": "None"
},
"Type": "subtitleselection"
}]
data: []
}

for each item in m.view.fullSubtitleData
Expand All @@ -100,9 +92,24 @@ sub onSelectSubtitlePressed()
end if
end if

subtitleData.data.push(item)
' Put the selected item at the top of the option list
if isValid(item.selected) and item.selected
subtitleData.data.Unshift(item)
else
subtitleData.data.push(item)
end if
end for

' Manually create the None option and place at top
subtitleData.data.Unshift({
"Index": -1,
"IsExternal": false,
"Track": {
"description": "None"
},
"Type": "subtitleselection"
})

m.global.sceneManager.callFunc("radioDialog", tr("Select Subtitles"), subtitleData)
m.global.sceneManager.observeField("returnData", "onSelectionMade")
end sub
Expand Down
Loading