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.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")
' set font sizes
m.optionText = m.top.findNode("overlayOptionsText")
@ -54,16 +51,7 @@ sub onVisibleChange()
end sub
sub updateTitle()
if m.top.title <> ""
m.leftSeperator.visible = "true"
else
m.leftSeperator.visible = "false"
end if
m.title.text = m.top.title
if not m.hideClock
resetTime()
end if
end sub
sub setClockVisibility()
@ -152,66 +140,22 @@ sub updateOptions()
end if
end sub
' Ensure the Jellyfin logo is shown on the overhang.
sub showLogo()
' component boolean field isLogoVisibleChange has changed value
sub isLogoVisibleChange()
isLogoVisible = m.top.isLogoVisible
scene = m.top.getScene()
logo = scene.findNode("overlayLogo")
leftSeperator = scene.findNode("overlayLeftSeperator")
if not isValid(leftSeperator)
seperator = createSeperator("overlayLeftSeperator")
m.leftGroup.insertChild(seperator, 0)
end if
if isLogoVisible
if not isValid(logo)
posterLogo = createLogoPoster()
m.leftGroup.insertChild(posterLogo, 0)
end if
end sub
' Remove the Jellyfin logo from the overhang.
sub hideLogo()
scene = m.top.getScene()
logo = scene.findNode("overlayLogo")
leftSeperator = scene.findNode("overlayLeftSeperator")
else
' remove the logo
if isValid(logo)
m.leftGroup.removeChild(logo)
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 sub

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<component name="JFOverhang" extends="Group">
<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" />
<Rectangle id="overlayLeftSeperator" color="#666666" width="2" height="64" />
<ScrollingLabel id="overlayTitle" font="font:LargeSystemFont" vertAlign="center" height="64" maxWidth="1100" repeatCount="0" />
</LayoutGroup>
<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="isVisible" value="true" type="boolean" onChange="onVisibleChange" />
<field id="disableMoveAnimation" value="false" type="boolean" />
<function name="showLogo" />
<function name="hideLogo" />
<function name="showUser" />
<function name="hideUser" />
<function name="resetTime" />
<field id="isLogoVisible" value="true" type="boolean" onChange="isLogoVisibleChange" />
</interface>
</component>

View File

@ -1,8 +1,20 @@
import "pkg:/source/utils/misc.bs"
sub init()
m.top.setFocus(true)
m.top.optionsAvailable = false
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
' Returns true if user navigates to a new focusable element
if not press then return false

View File

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

View File

@ -156,3 +156,15 @@ end function
sub clearErrorMessage()
m.top.errorMessage = ""
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"?>
<component name="SetServerScreen" extends="JFGroup">
<component name="SetServerScreen" extends="JFScreen">
<interface>
<field id="serverUrl" type="string" alias="serverUrlTextbox.text" />
<field id="serverWidth" alias="serverUrlOutline.width,serverUrlTextbox.width,serverUrlContainer.width,submitSizer.width" value="1620" />

View File

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

View File

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

View File

@ -24,6 +24,17 @@ sub redraw()
m.top.findNode("UserRow").translation = [leftBorder, topBorder]
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
if not press then return false

View File

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

View File

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

View File

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