remove left seperator from overhang

This commit is contained in:
Charles Ewert 2023-12-06 09:37:20 -05:00
parent f28268a0d3
commit b41e08f232
12 changed files with 64 additions and 96 deletions

View File

@ -6,9 +6,6 @@ sub init()
m.leftGroup = m.top.findNode("overlayLeftGroup") m.leftGroup = m.top.findNode("overlayLeftGroup")
m.rightGroup = m.top.findNode("overlayRightGroup") m.rightGroup = m.top.findNode("overlayRightGroup")
' hide seperators till they're needed
m.leftSeperator = m.top.findNode("overlayLeftSeperator")
m.leftSeperator.visible = "false"
m.rightSeperator = m.top.findNode("overlayRightSeperator") m.rightSeperator = m.top.findNode("overlayRightSeperator")
' set font sizes ' set font sizes
m.optionText = m.top.findNode("overlayOptionsText") m.optionText = m.top.findNode("overlayOptionsText")
@ -54,16 +51,7 @@ sub onVisibleChange()
end sub end sub
sub updateTitle() sub updateTitle()
if m.top.title <> ""
m.leftSeperator.visible = "true"
else
m.leftSeperator.visible = "false"
end if
m.title.text = m.top.title m.title.text = m.top.title
if not m.hideClock
resetTime()
end if
end sub end sub
sub setClockVisibility() sub setClockVisibility()
@ -152,66 +140,22 @@ sub updateOptions()
end if end if
end sub end sub
' Ensure the Jellyfin logo is shown on the overhang. ' component boolean field isLogoVisibleChange has changed value
sub showLogo() sub isLogoVisibleChange()
isLogoVisible = m.top.isLogoVisible
scene = m.top.getScene() scene = m.top.getScene()
logo = scene.findNode("overlayLogo") logo = scene.findNode("overlayLogo")
leftSeperator = scene.findNode("overlayLeftSeperator")
if not isValid(leftSeperator) if isLogoVisible
seperator = createSeperator("overlayLeftSeperator")
m.leftGroup.insertChild(seperator, 0)
end if
if not isValid(logo) if not isValid(logo)
posterLogo = createLogoPoster() posterLogo = createLogoPoster()
m.leftGroup.insertChild(posterLogo, 0) m.leftGroup.insertChild(posterLogo, 0)
end if end if
end sub else
' remove the logo
' Remove the Jellyfin logo from the overhang.
sub hideLogo()
scene = m.top.getScene()
logo = scene.findNode("overlayLogo")
leftSeperator = scene.findNode("overlayLeftSeperator")
if isValid(logo) if isValid(logo)
m.leftGroup.removeChild(logo) m.leftGroup.removeChild(logo)
end if end if
if isValid(leftSeperator)
m.leftGroup.removeChild(leftSeperator)
end if
end sub
' Ensure the current user is shown on the overhang.
sub showUser()
print "HELLO from showUser()"
scene = m.top.getScene()
currentUser = scene.findNode("overlayCurrentUser")
rightSeperator = scene.findNode("overlayRightSeperator")
if not isValid(rightSeperator)
seperator = createSeperator("overlayRightSeperator")
m.rightGroup.insertChild(seperator, 0)
end if
if not isValid(currentUser)
myUser = createOverhangUser()
myUser.text = m.top.currentUser
m.rightGroup.insertChild(myUser, 0)
end if
end sub
' Remove the Jellyfin logo from the overhang.
sub hideUser()
scene = m.top.getScene()
currentUser = scene.findNode("overlayCurrentUser")
rightSeperator = scene.findNode("overlayRightSeperator")
if isValid(currentUser)
m.rightGroup.removeChild(currentUser)
end if
if isValid(rightSeperator)
m.rightGroup.removeChild(rightSeperator)
end if end if
end sub end sub

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<component name="JFOverhang" extends="Group"> <component name="JFOverhang" extends="Group">
<children> <children>
<LayoutGroup id="overlayLeftGroup" layoutDirection="horiz" translation="[54, 54]" itemSpacings="30"> <LayoutGroup id="overlayLeftGroup" layoutDirection="horiz" translation="[54, 54]" itemSpacings="60">
<Poster id="overlayLogo" uri="pkg:/images/logo.png" height="66" /> <Poster id="overlayLogo" uri="pkg:/images/logo.png" height="66" />
<Rectangle id="overlayLeftSeperator" color="#666666" width="2" height="64" />
<ScrollingLabel id="overlayTitle" font="font:LargeSystemFont" vertAlign="center" height="64" maxWidth="1100" repeatCount="0" /> <ScrollingLabel id="overlayTitle" font="font:LargeSystemFont" vertAlign="center" height="64" maxWidth="1100" repeatCount="0" />
</LayoutGroup> </LayoutGroup>
<LayoutGroup id="overlayRightGroup" layoutDirection="horiz" itemSpacings="30" translation="[1766, 53]" horizAlignment="right"> <LayoutGroup id="overlayRightGroup" layoutDirection="horiz" itemSpacings="30" translation="[1766, 53]" horizAlignment="right">
@ -38,10 +37,6 @@
<field id="showOptions" value="true" type="boolean" onChange="updateOptions" /> <field id="showOptions" value="true" type="boolean" onChange="updateOptions" />
<field id="isVisible" value="true" type="boolean" onChange="onVisibleChange" /> <field id="isVisible" value="true" type="boolean" onChange="onVisibleChange" />
<field id="disableMoveAnimation" value="false" type="boolean" /> <field id="disableMoveAnimation" value="false" type="boolean" />
<function name="showLogo" /> <field id="isLogoVisible" value="true" type="boolean" onChange="isLogoVisibleChange" />
<function name="hideLogo" />
<function name="showUser" />
<function name="hideUser" />
<function name="resetTime" />
</interface> </interface>
</component> </component>

View File

@ -1,8 +1,20 @@
import "pkg:/source/utils/misc.bs"
sub init() sub init()
m.top.setFocus(true) m.top.setFocus(true)
m.top.optionsAvailable = false m.top.optionsAvailable = false
end sub end sub
' JFScreen hook.
sub OnScreenShown()
scene = m.top.getScene()
overhang = scene.findNode("overhang")
if isValid(overhang)
overhang.isLogoVisible = true
overhang.currentUser = ""
end if
end sub
function onKeyEvent(key as string, press as boolean) as boolean function onKeyEvent(key as string, press as boolean) as boolean
' Returns true if user navigates to a new focusable element ' Returns true if user navigates to a new focusable element
if not press then return false if not press then return false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<component name="LoginScene" extends="JFGroup"> <component name="LoginScene" extends="JFScreen">
<children> <children>
<label text="Enter Configuration" <label text="Enter Configuration"
id="prompt" id="prompt"

View File

@ -156,3 +156,15 @@ end function
sub clearErrorMessage() sub clearErrorMessage()
m.top.errorMessage = "" m.top.errorMessage = ""
end sub end sub
' JFScreen hook.
' Used to show logo, update the focus, the state of the data, and tells the server about the device profile.
sub OnScreenShown()
scene = m.top.getScene()
overhang = scene.findNode("overhang")
if isValid(overhang)
overhang.isLogoVisible = true
overhang.currentUser = ""
overhang.title = ""
end if
end sub

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<component name="SetServerScreen" extends="JFGroup"> <component name="SetServerScreen" extends="JFScreen">
<interface> <interface>
<field id="serverUrl" type="string" alias="serverUrlTextbox.text" /> <field id="serverUrl" type="string" alias="serverUrlTextbox.text" />
<field id="serverWidth" alias="serverUrlOutline.width,serverUrlTextbox.width,serverUrlContainer.width,submitSizer.width" value="1620" /> <field id="serverWidth" alias="serverUrlOutline.width,serverUrlTextbox.width,serverUrlContainer.width,submitSizer.width" value="1620" />

View File

@ -124,20 +124,18 @@ sub popScene()
stopLoadingSpinner() stopLoadingSpinner()
end sub end sub
' '
' Return group at top of stack without removing ' Return group at top of stack without removing
function getActiveScene() as object function getActiveScene() as object
return m.groups.peek() return m.groups.peek()
end function end function
' '
' Clear all content from group stack ' Clear all content from group stack
sub clearScenes() sub clearScenes()
if m.content <> invalid then m.content.removeChildrenIndex(m.content.getChildCount(), 0) if m.content <> invalid then m.content.removeChildrenIndex(m.content.getChildCount(), 0)
for each group in m.groups for each group in m.groups
if LCase(group.subtype()) = "jfscreen" if type(group) = "roSGNode" and group.isSubtype("JFScreen")
group.callFunc("OnScreenHidden") group.callFunc("OnScreenHidden")
end if end if
end for end for
@ -191,35 +189,30 @@ sub registerOverhangData(group)
end if end if
end sub end sub
' '
' Remove observers for overhang data ' Remove observers for overhang data
sub unregisterOverhangData(group) sub unregisterOverhangData(group)
group.unobserveField("overhangTitle") group.unobserveField("overhangTitle")
end sub end sub
' '
' Update overhang title ' Update overhang title
sub updateOverhangTitle(msg) sub updateOverhangTitle(msg)
m.overhang.title = msg.getData() m.overhang.title = msg.getData()
end sub end sub
' '
' Update options availability ' Update options availability
sub updateOptions(msg) sub updateOptions(msg)
m.overhang.showOptions = msg.getData() m.overhang.showOptions = msg.getData()
end sub end sub
' '
' Update whether the overhang is visible or not ' Update whether the overhang is visible or not
sub updateOverhangVisible(msg) sub updateOverhangVisible(msg)
m.overhang.visible = msg.getData() m.overhang.visible = msg.getData()
end sub end sub
' '
' Update username in overhang ' Update username in overhang
sub updateUser() sub updateUser()
@ -227,7 +220,6 @@ sub updateUser()
if m.overhang <> invalid then m.overhang.currentUser = m.top.currentUser if m.overhang <> invalid then m.overhang.currentUser = m.top.currentUser
end sub end sub
' '
' Reset time ' Reset time
sub resetTime() sub resetTime()

View File

@ -35,10 +35,11 @@ end sub
sub OnScreenShown() sub OnScreenShown()
scene = m.top.getScene() scene = m.top.getScene()
overhang = scene.findNode("overhang") overhang = scene.findNode("overhang")
if isValid(overhang)
' show the jellyfin logo overhang.isLogoVisible = true
overhang.callFunc("showLogo") overhang.currentUser = m.global.session.user.name
overhang.callFunc("showUser") overhang.title = tr("Home")
end if
if isValid(m.top.lastFocus) if isValid(m.top.lastFocus)
m.top.lastFocus.setFocus(true) m.top.lastFocus.setFocus(true)
@ -66,8 +67,9 @@ sub OnScreenHidden()
scene = m.top.getScene() scene = m.top.getScene()
overhang = scene.findNode("overhang") overhang = scene.findNode("overhang")
if isValid(overhang) if isValid(overhang)
overhang.callFunc("hideLogo") overhang.isLogoVisible = false
overhang.callFunc("hideUser") overhang.currentUser = ""
overhang.title = ""
end if end if
end sub end sub

View File

@ -24,6 +24,17 @@ sub redraw()
m.top.findNode("UserRow").translation = [leftBorder, topBorder] m.top.findNode("UserRow").translation = [leftBorder, topBorder]
end sub end sub
' JFScreen hook.
' Used to show logo, update the focus, the state of the data, and tells the server about the device profile.
sub OnScreenShown()
scene = m.top.getScene()
overhang = scene.findNode("overhang")
if isValid(overhang)
overhang.isLogoVisible = true
overhang.currentUser = ""
end if
end sub
function onKeyEvent(key as string, press as boolean) as boolean function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false if not press then return false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<component name="UserSelect" extends="JFGroup"> <component name="UserSelect" extends="JFScreen">
<children> <children>
<Label text="Please sign in" horizAlign="center" font="font:LargeSystemFont" height="100" width="1920" translation="[0, 200]" /> <Label text="Please sign in" horizAlign="center" font="font:LargeSystemFont" height="100" width="1920" translation="[0, 200]" />
<UserRow id="userRow" translation="[130, 360]" /> <UserRow id="userRow" translation="[130, 360]" />

View File

@ -47,7 +47,6 @@ sub Main (args as dynamic) as void
sceneManager.callFunc("clearScenes") sceneManager.callFunc("clearScenes")
' load home page ' load home page
sceneManager.currentUser = m.global.session.user.name
group = CreateHomeGroup() group = CreateHomeGroup()
group.callFunc("loadLibraries") group.callFunc("loadLibraries")
stopLoadingSpinner() stopLoadingSpinner()

View File

@ -529,6 +529,7 @@ function createSeperator(id as string)
seperator.color = "#666666" seperator.color = "#666666"
seperator.width = "2" seperator.width = "2"
seperator.height = "64" seperator.height = "64"
seperator.visible = true
return seperator return seperator
end function end function