Author: bklaas
Date: Mon Oct 20 14:56:15 2008
New Revision: 3165

URL: http://svn.slimdevices.com?rev=3165&root=Jive&view=rev
Log:
Bug: 9680
Description: support for "Now Playing" button in FullscreenSkin. Still need to 
put support in a few remaining windows (album listing title style, e.g.), but 
it's mostly there.
note: I'm using a placeholder graphic for this.

Modified:
    
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
    
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
    7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua
    
7.3/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua

Modified: 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua?rev=3165&root=Jive&r1=3164&r2=3165&view=diff
==============================================================================
--- 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 (original)
+++ 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 Mon Oct 20 14:56:15 2008
@@ -133,7 +133,7 @@
 function init(self)
 
        jnt:subscribe(self)
-       self.player = {}
+       self.player = false
        self['browse'] = {}
        self['ss'] = {}
 
@@ -560,7 +560,14 @@
 -- can be found by the Screensaver applet correctly,
 -- while allowing the method to be called via the service API
 function goNowPlaying(self, style, transition)
-       self:openScreensaver(style, transition)
+
+       if self.player then
+               self:openScreensaver(style, transition)
+               return true
+       else
+               return false
+
+       end
 end
 
 function openScreensaver(self, style, transition)

Modified: 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=3165&root=Jive&r1=3164&r2=3165&view=diff
==============================================================================
--- 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 (original)
+++ 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 Mon Oct 20 14:56:15 2008
@@ -341,7 +341,25 @@
        -- if item is a windowSpec, then the icon is kept in the spec for 
nothing (overhead)
        -- however it guarantees the icon in the title is not shared with (the 
same) icon in the menu.
        if not group then
-               group = Group("item", { text = Label("text", ""), icon = 
Icon("icon"), play = Icon("play"), back = Button(Icon("back"), function() 
group:getWindow():dispatchNewEvent(EVENT_KEY_PRESS, KEY_BACK) return 
EVENT_CONSUME end) })
+               group = Group("item", { 
+                       text = Label("text", ""), 
+                       icon = Icon("icon"), 
+                       play = Icon("play"), 
+                       back = Button(
+                               Icon("back"), 
+                               function() 
+                                       
group:getWindow():dispatchNewEvent(EVENT_KEY_PRESS, KEY_BACK) 
+                                       return EVENT_CONSUME 
+                               end
+                       ), 
+                       nowplaying = Button(
+                               Icon("nowplaying"), 
+                               function() 
+                                       
group:getWindow():dispatchNewEvent(EVENT_KEY_PRESS, 
appletManager:callService('goNowPlaying', 'browse')) 
+                                       return EVENT_CONSUME 
+                               end
+                       ), 
+                       })
        end
 
        if item then

Modified: 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua?rev=3165&root=Jive&r1=3164&r2=3165&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua Mon Oct 20 
14:56:15 2008
@@ -90,6 +90,7 @@
 local LAYOUT_CENTER           = jive.ui.LAYOUT_CENTER
 local LAYOUT_NONE             = jive.ui.LAYOUT_NONE
 
+local appletManager           = require("jive.AppletManager")
 
 
 -- our class
@@ -126,10 +127,30 @@
        obj._DEFAULT_SHOW_TRANSITION = transitionPushLeft
        obj._DEFAULT_HIDE_TRANSITION = transitionPushRight
 
-       if titleStyle then
-               obj:setTitleWidget(Group(titleStyle, { text = Label("text", 
title), icon = Icon("icon"), back = Button(Icon("back"), function() 
obj:dispatchNewEvent(EVENT_KEY_PRESS, KEY_BACK) return EVENT_CONSUME end) }))
-       elseif title then
-               obj:setTitle(title)
+       if title then
+               obj:setTitleWidget(
+                       Group(titleStyle or 'title', { 
+                               text = Label("text", title), 
+                               icon = Icon("icon"), 
+                               back = Button(
+                                       Icon("back"), 
+                                       function() 
+                                               
obj:dispatchNewEvent(EVENT_KEY_PRESS, KEY_BACK) 
+                                               return EVENT_CONSUME 
+                                       end
+                               ), 
+                               nowplaying = Button(
+                                       Icon("nowplaying"), 
+                                       function() 
+                                               -- check if player is connected
+                                               if appletManager then
+                                                       
obj:dispatchNewEvent(EVENT_KEY_PRESS, self:_goNowPlaying(obj))
+                                               end
+                                               return EVENT_CONSUME 
+                                       end
+                               )
+                       })
+               )
        end
 
        obj:addListener(EVENT_ALL,
@@ -140,6 +161,14 @@
        return obj
 end
 
+function _goNowPlaying(self, obj)
+       local worked = appletManager:callService("goNowPlaying", "browse")
+       log:warn(worked)
+       if not worked then
+               obj:playSound("BUMP")
+               obj:bumpRight()
+       end
+end
 
 --[[
 

Modified: 
7.3/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua?rev=3165&root=Jive&r1=3164&r2=3165&view=diff
==============================================================================
--- 
7.3/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua
 (original)
+++ 
7.3/trunk/squeezeplay/src/squeezeplay_desktop/share/applets/FullscreenSkin/FullscreenSkinApplet.lua
 Mon Oct 20 14:56:15 2008
@@ -306,9 +306,7 @@
        s.title.padding = { 15, 5, 10, 0 }
        s.title.position = LAYOUT_NORTH
        s.title.bgImg = titleBox
-       s.title.order = { "back", "text" }
-       -- FIXME: for now playing button in title bar
-       --s.title.order = { "back", "text", 'nowplaying' }
+       s.title.order = { "back", "text", 'nowplaying' }
        s.title.text = {}
         s.title.text.w = WH_FILL
        s.title.text.padding = TITLE_PADDING
@@ -319,13 +317,10 @@
        --FIXME, this png path should likely change
        s.title.back.img = Surface:loadImage(imgpath .. 
"pointer_selector_L.png")
        s.title.back.align = "left"
---[[
        s.title.nowplaying = {}
        --FIXME, this png path should likely change
-       s.title.nowplaying.img = Surface:loadImage(imgpath .. 
"Icons/Mini/icon_quarter_note.png")
+       s.title.nowplaying.img = Surface:loadImage(imgpath .. 
"album_noartwork_56.png")
        s.title.nowplaying.align = "left"
---]]
-
 
 
        -- Menu with three basic styles: normal, selected and locked

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to