Merge pull request #1507 from 1hitsong/renamePauseMenu

This commit is contained in:
Charles Ewert 2023-11-16 12:45:54 -05:00 committed by GitHub
commit 8730f5abc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 54 deletions

View File

@ -79,7 +79,7 @@ sub resetFocusToDefaultButton()
m.optionControls.buttonFocused = m.optionControls.getChildCount() - 1 m.optionControls.buttonFocused = m.optionControls.getChildCount() - 1
end sub end sub
' onVisibleChanged: Handler for changes to the visibility of this pause menu. ' onVisibleChanged: Handler for changes to the visibility of this menu.
' '
sub onVisibleChanged() sub onVisibleChanged()
if m.top.visible if m.top.visible
@ -93,7 +93,7 @@ sub onVisibleChanged()
m.inactivityTimer.control = "stop" m.inactivityTimer.control = "stop"
end sub end sub
' onFocusChanged: Handler for changes to the focus of this pause menu. ' onFocusChanged: Handler for changes to the focus of this menu.
' '
sub onFocusChanged() sub onFocusChanged()
if m.top.hasfocus if m.top.hasfocus
@ -107,7 +107,7 @@ sub onFocusChanged()
end if end if
end sub end sub
' inactiveCheck: Checks if the time since last keypress is greater than or equal to the allowed inactive time of the pause menu. ' inactiveCheck: Checks if the time since last keypress is greater than or equal to the allowed inactive time of the menu.
' '
sub inactiveCheck() sub inactiveCheck()
if m.deviceInfo.timeSinceLastKeypress() >= m.top.inactiveTimeout if m.deviceInfo.timeSinceLastKeypress() >= m.top.inactiveTimeout
@ -115,7 +115,7 @@ sub inactiveCheck()
end if end if
end sub end sub
' onButtonSelected: Handler for selection of buttons from the pause menu. ' onButtonSelected: Handler for selection of buttons from the menu.
' '
sub onButtonSelected() sub onButtonSelected()
if m.optionControls.isInFocusChain() if m.optionControls.isInFocusChain()

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<component name="PauseMenu" extends="Group" initialFocus="chapterNext"> <component name="OSD" extends="Group" initialFocus="chapterNext">
<children> <children>
<ScrollingLabel id="itemTitle" font="font:LargeBoldSystemFont" translation="[103,61]" maxWidth="1400" /> <ScrollingLabel id="itemTitle" font="font:LargeBoldSystemFont" translation="[103,61]" maxWidth="1400" />
<Clock id="clock" translation="[1618, 46]" /> <Clock id="clock" translation="[1618, 46]" />

View File

@ -24,8 +24,8 @@ sub init()
m.chapterList = m.top.findNode("chapterList") m.chapterList = m.top.findNode("chapterList")
m.chapterMenu = m.top.findNode("chapterMenu") m.chapterMenu = m.top.findNode("chapterMenu")
m.chapterContent = m.top.findNode("chapterContent") m.chapterContent = m.top.findNode("chapterContent")
m.pauseMenu = m.top.findNode("pauseMenu") m.osd = m.top.findNode("osd")
m.pauseMenu.observeField("action", "onPauseMenuAction") m.osd.observeField("action", "onOSDAction")
m.playbackTimer = m.top.findNode("playbackTimer") m.playbackTimer = m.top.findNode("playbackTimer")
m.bufferCheckTimer = m.top.findNode("bufferCheckTimer") m.bufferCheckTimer = m.top.findNode("bufferCheckTimer")
@ -91,17 +91,17 @@ sub handleChapterSkipAction(action as string)
end if end if
end sub end sub
' handleHideAction: Handles action to hide pause menu ' handleHideAction: Handles action to hide OSD menu
' '
' @param {boolean} resume - controls whether or not to resume video playback when sub is called ' @param {boolean} resume - controls whether or not to resume video playback when sub is called
' '
sub handleHideAction(resume as boolean) sub handleHideAction(resume as boolean)
m.pauseMenu.visible = false m.osd.visible = false
m.chapterList.visible = false m.chapterList.visible = false
m.pauseMenu.showChapterList = false m.osd.showChapterList = false
m.chapterList.setFocus(false) m.chapterList.setFocus(false)
m.pauseMenu.hasFocus = false m.osd.hasFocus = false
m.pauseMenu.setFocus(false) m.osd.setFocus(false)
m.top.setFocus(true) m.top.setFocus(true)
if resume if resume
m.top.control = "resume" m.top.control = "resume"
@ -111,14 +111,14 @@ end sub
' handleChapterListAction: Handles action to show chapter list ' handleChapterListAction: Handles action to show chapter list
' '
sub handleChapterListAction() sub handleChapterListAction()
m.chapterList.visible = m.pauseMenu.showChapterList m.chapterList.visible = m.osd.showChapterList
if not m.chapterList.visible then return if not m.chapterList.visible then return
m.chapterMenu.jumpToItem = getCurrentChapterIndex() m.chapterMenu.jumpToItem = getCurrentChapterIndex()
m.pauseMenu.hasFocus = false m.osd.hasFocus = false
m.pauseMenu.setFocus(false) m.osd.setFocus(false)
m.chapterMenu.setFocus(true) m.chapterMenu.setFocus(true)
end sub end sub
@ -171,10 +171,10 @@ sub handleShowVideoInfoPopupAction()
handleHideAction(false) handleHideAction(false)
end sub end sub
' onPauseMenuAction: Process action events from pause menu to their respective handlers ' onOSDAction: Process action events from OSD to their respective handlers
' '
sub onPauseMenuAction() sub onOSDAction()
action = LCase(m.pauseMenu.action) action = LCase(m.osd.action)
if action = "hide" if action = "hide"
handleHideAction(false) handleHideAction(false)
@ -320,7 +320,7 @@ sub onVideoContentLoaded()
m.top.transcodeParams = videoContent[0].transcodeparams m.top.transcodeParams = videoContent[0].transcodeparams
m.chapters = videoContent[0].chapters m.chapters = videoContent[0].chapters
m.pauseMenu.itemTitleText = m.top.content.title m.osd.itemTitleText = m.top.content.title
populateChapterMenu() populateChapterMenu()
@ -380,7 +380,7 @@ end sub
' '
' Runs Next Episode button animation and sets focus to button ' Runs Next Episode button animation and sets focus to button
sub showNextEpisodeButton() sub showNextEpisodeButton()
if m.pauseMenu.visible then return if m.osd.visible then return
if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode" if m.top.content.contenttype <> 4 then return ' only display when content is type "Episode"
if m.nextupbuttonseconds = 0 then return ' is the button disabled? if m.nextupbuttonseconds = 0 then return ' is the button disabled?
@ -438,10 +438,10 @@ end sub
' When Video Player state changes ' When Video Player state changes
sub onPositionChanged() sub onPositionChanged()
' Pass video position data into pause menu ' Pass video position data into OSD
m.pauseMenu.progressPercentage = m.top.position / m.top.duration m.osd.progressPercentage = m.top.position / m.top.duration
m.pauseMenu.positionTime = m.top.position m.osd.positionTime = m.top.position
m.pauseMenu.remainingPositionTime = m.top.duration - m.top.position m.osd.remainingPositionTime = m.top.duration - m.top.position
if isValid(m.captionTask) if isValid(m.captionTask)
m.captionTask.currentPos = Int(m.top.position * 1000) m.captionTask.currentPos = Int(m.top.position * 1000)
@ -464,8 +464,8 @@ sub onState(msg)
m.captionTask.playerState = m.top.state + m.top.globalCaptionMode m.captionTask.playerState = m.top.state + m.top.globalCaptionMode
end if end if
' Pass video state into pause menu ' Pass video state into OSD
m.pauseMenu.playbackState = m.top.state m.osd.playbackState = m.top.state
' When buffering, start timer to monitor buffering process ' When buffering, start timer to monitor buffering process
if m.top.state = "buffering" and m.bufferCheckTimer <> invalid if m.top.state = "buffering" and m.bufferCheckTimer <> invalid
@ -568,10 +568,10 @@ sub bufferCheck(msg)
end sub end sub
' stateAllowsPauseMenu: Check if current video state allows showing the pause menu ' stateAllowsOSD: Check if current video state allows showing the OSD
' '
' @return {boolean} indicating if video state allows the pause menu to show ' @return {boolean} indicating if video state allows the OSD to show
function stateAllowsPauseMenu() as boolean function stateAllowsOSD() as boolean
validStates = ["playing", "paused", "stopped"] validStates = ["playing", "paused", "stopped"]
return inArray(validStates, m.top.state) return inArray(validStates, m.top.state)
end function end function
@ -596,10 +596,10 @@ function onKeyEvent(key as string, press as boolean) as boolean
if key = "back" or key = "replay" if key = "back" or key = "replay"
m.chapterList.visible = false m.chapterList.visible = false
m.pauseMenu.showChapterList = false m.osd.showChapterList = false
m.chapterMenu.setFocus(false) m.chapterMenu.setFocus(false)
m.pauseMenu.hasFocus = true m.osd.hasFocus = true
m.pauseMenu.setFocus(true) m.osd.setFocus(true)
return true return true
end if end if
@ -629,58 +629,58 @@ function onKeyEvent(key as string, press as boolean) as boolean
if key = "down" and not m.top.trickPlayBar.visible if key = "down" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading ' Don't allow user to open menu prior to video loading
if not stateAllowsPauseMenu() then return true if not stateAllowsOSD() then return true
m.pauseMenu.visible = true m.osd.visible = true
m.pauseMenu.hasFocus = true m.osd.hasFocus = true
m.pauseMenu.setFocus(true) m.osd.setFocus(true)
return true return true
end if end if
else if key = "up" and not m.top.trickPlayBar.visible else if key = "up" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading ' Don't allow user to open menu prior to video loading
if not stateAllowsPauseMenu() then return true if not stateAllowsOSD() then return true
m.pauseMenu.visible = true m.osd.visible = true
m.pauseMenu.hasFocus = true m.osd.hasFocus = true
m.pauseMenu.setFocus(true) m.osd.setFocus(true)
return true return true
end if end if
else if key = "OK" and not m.top.trickPlayBar.visible else if key = "OK" and not m.top.trickPlayBar.visible
if not m.LoadMetaDataTask.isIntro if not m.LoadMetaDataTask.isIntro
' Don't allow user to open menu prior to video loading ' Don't allow user to open menu prior to video loading
if not stateAllowsPauseMenu() then return true if not stateAllowsOSD() then return true
' Show pause menu, but don't pause video ' Show OSD, but don't pause video
m.pauseMenu.visible = true m.osd.visible = true
m.pauseMenu.hasFocus = true m.osd.hasFocus = true
m.pauseMenu.setFocus(true) m.osd.setFocus(true)
return true return true
end if end if
return false return false
end if end if
' Disable pause menu for intro videos ' Disable OSD for intro videos
if not m.LoadMetaDataTask.isIntro if not m.LoadMetaDataTask.isIntro
if key = "play" and not m.top.trickPlayBar.visible if key = "play" and not m.top.trickPlayBar.visible
' Don't allow user to open menu prior to video loading ' Don't allow user to open menu prior to video loading
if not stateAllowsPauseMenu() then return true if not stateAllowsOSD() then return true
' If video is paused, resume it and don't show pause menu ' If video is paused, resume it and don't show OSD
if m.top.state = "paused" if m.top.state = "paused"
m.top.control = "resume" m.top.control = "resume"
return true return true
end if end if
' Pause video and show pause menu ' Pause video and show OSD
m.top.control = "pause" m.top.control = "pause"
m.pauseMenu.visible = true m.osd.visible = true
m.pauseMenu.hasFocus = true m.osd.hasFocus = true
m.pauseMenu.setFocus(true) m.osd.setFocus(true)
return true return true
end if end if
end if end if

View File

@ -30,7 +30,7 @@
<Group id="captionGroup" translation="[960,1020]" /> <Group id="captionGroup" translation="[960,1020]" />
<timer id="playbackTimer" repeat="true" duration="30" /> <timer id="playbackTimer" repeat="true" duration="30" />
<timer id="bufferCheckTimer" repeat="true" /> <timer id="bufferCheckTimer" repeat="true" />
<PauseMenu id="pauseMenu" visible="false" inactiveTimeout="5" /> <OSD id="osd" visible="false" inactiveTimeout="5" />
<Rectangle id="chapterList" visible="false" color="0x00000098" width="400" height="380" translation="[103,210]"> <Rectangle id="chapterList" visible="false" color="0x00000098" width="400" height="380" translation="[103,210]">
<LabelList id="chaptermenu" itemSpacing="[0,20]" numRows="5" font="font:SmallSystemFont" itemSize="[315,40]" translation="[40,20]"> <LabelList id="chaptermenu" itemSpacing="[0,20]" numRows="5" font="font:SmallSystemFont" itemSize="[315,40]" translation="[40,20]">

View File

@ -1229,7 +1229,7 @@
<message> <message>
<source>No Chapter Data Found</source> <source>No Chapter Data Found</source>
<translation>No Chapter Data Found</translation> <translation>No Chapter Data Found</translation>
<extracomment>Message shown in pause menu when no chapter data is returned by the API</extracomment> <extracomment>Message shown in OSD when no chapter data is returned by the API</extracomment>
</message> </message>
</context> </context>
</TS> </TS>