Merge pull request #697 from 1hitsong/hide-header-clock

Add user setting: Hide Clock
This commit is contained in:
Jimi 2022-08-05 17:46:00 -06:00 committed by GitHub
commit 3717fb249d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 102 additions and 25 deletions

View File

@ -3,8 +3,10 @@ sub init()
' hide seperators till they're needed ' hide seperators till they're needed
leftSeperator = m.top.findNode("overlayLeftSeperator") leftSeperator = m.top.findNode("overlayLeftSeperator")
leftSeperator.visible = "false" leftSeperator.visible = "false"
rightSeperator = m.top.findNode("overlayRightSeperator") m.rightSeperator = m.top.findNode("overlayRightSeperator")
rightSeperator.visible = "false"
m.hideClock = get_user_setting("ui.design.hideclock") = "true"
' set font sizes ' set font sizes
optionText = m.top.findNode("overlayOptionsText") optionText = m.top.findNode("overlayOptionsText")
optionText.font.size = 20 optionText.font.size = 20
@ -12,20 +14,30 @@ sub init()
optionStar.font.size = 58 optionStar.font.size = 58
overlayMeridian = m.top.findNode("overlayMeridian") overlayMeridian = m.top.findNode("overlayMeridian")
overlayMeridian.font.size = 20 overlayMeridian.font.size = 20
m.overlayRightGroup = m.top.findNode("overlayRightGroup")
m.overlayTimeGroup = m.top.findNode("overlayTimeGroup")
if not m.hideClock
' get system preference clock format (12/24hr) ' get system preference clock format (12/24hr)
di = CreateObject("roDeviceInfo") di = CreateObject("roDeviceInfo")
m.clockFormat = di.GetClockFormat() m.clockFormat = di.GetClockFormat()
' grab current time ' grab current time
currentTime = CreateObject("roDateTime") currentTime = CreateObject("roDateTime")
currentTime.ToLocalTime() currentTime.ToLocalTime()
m.currentHours = currentTime.GetHours() m.currentHours = currentTime.GetHours()
m.currentMinutes = currentTime.GetMinutes() m.currentMinutes = currentTime.GetMinutes()
' start timer ' start timer
m.currentTimeTimer = m.top.findNode("currentTimeTimer") m.currentTimeTimer = m.top.findNode("currentTimeTimer")
m.currentTimeTimer.control = "start" m.currentTimeTimer.control = "start"
m.currentTimeTimer.ObserveField("fire", "updateTime") m.currentTimeTimer.ObserveField("fire", "updateTime")
updateTimeDisplay() updateTimeDisplay()
end if
setClockVisibility()
end sub end sub
sub updateTitle() sub updateTitle()
@ -37,16 +49,33 @@ sub updateTitle()
end if end if
title = m.top.findNode("overlayTitle") title = m.top.findNode("overlayTitle")
title.text = m.top.title title.text = m.top.title
if not m.hideClock
resetTime() resetTime()
end if
end sub
sub setClockVisibility()
if m.hideClock
m.overlayRightGroup.removeChild(m.overlayTimeGroup)
end if
end sub
sub setRightSeperatorVisibility()
if m.hideClock
m.top.removeChild(m.rightSeperator)
return
end if
if m.top.currentUser <> ""
m.rightSeperator.visible = "true"
else
m.rightSeperator.visible = "false"
end if
end sub end sub
sub updateUser() sub updateUser()
rightSeperator = m.top.findNode("overlayRightSeperator") setRightSeperatorVisibility()
if m.top.currentUser <> ""
rightSeperator.visible = "true"
else
rightSeperator.visible = "false"
end if
user = m.top.findNode("overlayCurrentUser") user = m.top.findNode("overlayCurrentUser")
user.text = m.top.currentUser user.text = m.top.currentUser
end sub end sub

View File

@ -19,7 +19,8 @@
id="overlayRightSeperator" id="overlayRightSeperator"
color="#666666" color="#666666"
width="2" width="2"
height="64"/> height="64"
visible="false"/>
<LayoutGroup id="overlayTimeGroup" layoutDirection="horiz" horizAlignment="right" itemSpacings="0" > <LayoutGroup id="overlayTimeGroup" layoutDirection="horiz" horizAlignment="right" itemSpacings="0" >
<Label id="overlayHours" font="font:MediumSystemFont" vertAlign="center" height="64" /> <Label id="overlayHours" font="font:MediumSystemFont" vertAlign="center" height="64" />
<Label font="font:MediumSystemFont" text=":" vertAlign="center" height="64" /> <Label font="font:MediumSystemFont" text=":" vertAlign="center" height="64" />
@ -45,4 +46,5 @@
<function name="resetTime" /> <function name="resetTime" />
</interface> </interface>
<script type="text/brightscript" uri="JFOverhang.brs" /> <script type="text/brightscript" uri="JFOverhang.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
</component> </component>

View File

@ -8,6 +8,10 @@ sub init()
m.top.transcodeReasons = [] m.top.transcodeReasons = []
m.bufferCheckTimer.duration = 10 m.bufferCheckTimer.duration = 10
if get_user_setting("ui.design.hideclock") = "true"
clockNode = findNodeBySubtype(m.top, "clock")
clockNode[0].parent.removeChild(clockNode[0].node)
end if
end sub end sub
' '

View File

@ -24,6 +24,8 @@
</interface> </interface>
<script type="text/brightscript" uri="JFVideo.brs" /> <script type="text/brightscript" uri="JFVideo.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
<children> <children>
<timer id="playbackTimer" repeat="true" duration="30" /> <timer id="playbackTimer" repeat="true" duration="30" />
<timer id="bufferCheckTimer" repeat="true" /> <timer id="bufferCheckTimer" repeat="true" />

View File

@ -68,8 +68,10 @@ sub itemContentChanged()
if type(itemData.RunTimeTicks) = "LongInteger" if type(itemData.RunTimeTicks) = "LongInteger"
setFieldText("runtime", stri(getRuntime()) + " mins") setFieldText("runtime", stri(getRuntime()) + " mins")
if get_user_setting("ui.design.hideclock") <> "true"
setFieldText("ends-at", tr("Ends at %1").Replace("%1", getEndTime())) setFieldText("ends-at", tr("Ends at %1").Replace("%1", getEndTime()))
end if end if
end if
if itemData.genres.count() > 0 if itemData.genres.count() > 0
setFieldText("genres", tr("Genres") + ": " + itemData.genres.join(", ")) setFieldText("genres", tr("Genres") + ": " + itemData.genres.join(", "))

View File

@ -32,8 +32,10 @@ sub itemContentChanged()
if type(itemData.RunTimeTicks) = "LongInteger" if type(itemData.RunTimeTicks) = "LongInteger"
m.top.findNode("runtime").text = stri(getRuntime()).trim() + " mins" m.top.findNode("runtime").text = stri(getRuntime()).trim() + " mins"
if get_user_setting("ui.design.hideclock") <> "true"
m.top.findNode("endtime").text = tr("Ends at %1").Replace("%1", getEndTime()) m.top.findNode("endtime").text = tr("Ends at %1").Replace("%1", getEndTime())
end if end if
end if
if itemData.communityRating <> invalid if itemData.communityRating <> invalid
m.top.findNode("star").visible = true m.top.findNode("star").visible = true

View File

@ -678,5 +678,15 @@
<translation>Cinema mode brings the theater experience straight to your living room with the ability to play custom intros before the main feature.</translation> <translation>Cinema mode brings the theater experience straight to your living room with the ability to play custom intros before the main feature.</translation>
<extracomment>Settings Menu - Description for option</extracomment> <extracomment>Settings Menu - Description for option</extracomment>
</message> </message>
<message>
<source>Hide Clock</source>
<translation>Hide Clock</translation>
<extracomment>Option Title in user setting screen</extracomment>
</message>
<message>
<source>Hides all clocks in Jellyfin. Jellyfin will need to be closed and reopened for change to take effect.</source>
<translation>Hides all clocks in Jellyfin. Jellyfin will need to be closed and reopened for change to take effect.</translation>
<extracomment>Settings Menu - Description for option</extracomment>
</message>
</context> </context>
</TS> </TS>

View File

@ -73,6 +73,13 @@
"title": "Design Elements", "title": "Design Elements",
"description": "Options that alter the design of Jellyfin.", "description": "Options that alter the design of Jellyfin.",
"children": [ "children": [
{
"title": "Hide Clock",
"description": "Hides all clocks in Jellyfin. Jellyfin will need to be closed and reopened for change to take effect.",
"settingName": "ui.design.hideclock",
"type": "bool",
"default": "false"
},
{ {
"title": "Use Splashscreen as Home Background", "title": "Use Splashscreen as Home Background",
"description": "Use generated splashscreen image as Jellyfin home background. Jellyfin will need to be closed and reopened for change to take effect.", "description": "Use generated splashscreen image as Jellyfin home background. Jellyfin will need to be closed and reopened for change to take effect.",

View File

@ -238,3 +238,22 @@ function versionChecker(versionToCheck as string, minVersionAccepted as string)
return leftHand >= rightHand return leftHand >= rightHand
end function end function
function findNodeBySubtype(node, subtype)
foundNodes = []
for each child in node.getChildren(-1, 0)
if lcase(child.subtype()) = "group"
return findNodeBySubtype(child, subtype)
end if
if lcase(child.subtype()) = lcase(subtype)
foundNodes.push({
node: child,
parent: node
})
end if
end for
return foundNodes
end function