Add actual buttons to details page, one of which plays

This commit is contained in:
Nick Bisby 2019-03-09 16:23:57 -06:00
parent d7105c061f
commit 196bb4d1f0
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
4 changed files with 22 additions and 6 deletions

View File

@ -29,7 +29,6 @@ sub itemContentChanged()
setFieldText("video_codec", "Video: " + itemData.mediaStreams[0].displayTitle)
setFieldText("audio_codec", "Audio: " + itemData.mediaStreams[1].displayTitle)
' TODO - cmon now. these are buttons, not words
setFieldText("buttons", "Play, Delete, Watched, Favorite, ...")
if itemData.taglines.count() > 0
setFieldText("tagline", itemData.taglines[0])
end if

View File

@ -18,7 +18,12 @@
<Label id="director" />
<Label id="video_codec" />
<Label id="audio_codec" />
<Label id="buttons" />
<ButtonGroup id="buttons" layoutDirection="horiz" itemSpacings="[10, 0]">
<Button text="Play" />
<Button text="Delete" />
<Button text="Watched" />
<Button text="Favorite" />
</ButtonGroup>
<Label id="tagline" />
<Label id="overview" />
@ -37,7 +42,7 @@
main = m.top.findNode("main_group")
dimensions = m.top.getScene().currentDesignResolution
m.top.setfocus(true)
m.top.findNode("buttons").setFocus(true)
end sub
]]>
</script>

View File

@ -10,6 +10,12 @@ sub itemFocusedQ(msg) as boolean
return type(msg) = "roSGNodeEvent" and msg.getField() = "itemFocused"
end sub
sub buttonSelectedQ(msg) as boolean
' "Q" stands for "Question mark" since buttonSelected? wasn't acceptable
' Probably needs a better name, but unique for now
return type(msg) = "roSGNodeEvent" and msg.getField() = "buttonSelected"
end sub
sub getMsgRowTarget(msg) as object
node = msg.getRoSGNode()
coords = node.rowItemSelected

View File

@ -131,7 +131,7 @@ sub ShowMovieOptions(library_id)
ShowMovieDetails(target.movieID)
'showVideoPlayer(target.movieID)
else if itemFocusedQ(msg)
print "Selected " + msg.getNode()
'print "Selected " + msg.getNode()
end if
end while
end sub
@ -146,12 +146,18 @@ sub ShowMovieDetails(movie_id)
scene.itemJson = ItemMetaData(movie_id)
buttons = scene.findNode("buttons")
buttons.observeField("buttonSelected", port)
while true
msg = wait(0, port)
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
return
else if itemSelectedQ(msg)
' showVideoPlayer(target.movieID)
else if buttonSelectedQ(msg)
button = msg.getROSGNode()
if button.buttonSelected = 0
showVideoPlayer(movie_id)
end if
else
print msg
print type(msg)