Merge pull request #1605 from 1hitsong/moveSelectedSubtileToTop

Move selected subtitle to top of selection menu
This commit is contained in:
1hitsong 2024-03-10 20:24:15 -04:00 committed by GitHub
commit 97a2fee81c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
@ -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