Author: bklaas
Date: Fri May 23 13:15:26 2008
New Revision: 2519

URL: http://svn.slimdevices.com?rev=2519&root=Jive&view=rev
Log:
Bug: n/a
Description: allow icon to be sent with current window request response
add getTitleStyle and getTitleWidget Window methods

Modified:
    
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
    7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua

Modified: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=2519&root=Jive&r1=2518&r2=2519&view=diff
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 (original)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 Fri May 23 13:15:26 2008
@@ -813,8 +813,9 @@
                        step.menu:setStyle(step.db:menuStyle())
                        if data.window then
                                -- if a titleStyle is being sent, we need to 
setTitleWidget completely
-                               if data.window.titleStyle then
-                                       local titleText
+                               if data.window.titleStyle or 
data.window['icon-id'] then
+                                       local titleText, titleStyle, titleIcon
+                                       local titleWidget = 
step.window:getTitleWidget()
                                        -- set the title text if specified
                                        if data.window.text then
                                                titleText = data.window.text
@@ -826,8 +827,23 @@
                                                        titleText = ''
                                                end
                                        end
-                                       local titleStyle = 
data.window.titleStyle .. 'title'
-                                       local newTitleWidget = 
Group(titleStyle, { text = Label("text", titleText), icon = Icon("icon") })     
 
+                                       if data.window.titleStyle then
+                                               titleStyle = 
data.window.titleStyle .. 'title'
+                                       else
+                                               titleStyle = 
step.window:getTitleStyle()
+                                       end
+                                       -- add the icon if it's been specified 
in the window params
+                                       if data.window['icon-id'] then
+                                               -- Fetch an image from 
SlimServer
+                                               titleIcon = Icon("icon")
+                                               
_server:fetchArtworkThumb(data.window["icon-id"], titleIcon, THUMB_SIZE)
+                                       -- only allow the existing icon to stay 
if titleStyle isn't being changed
+                                       elseif not data.window.titleStyle and 
titleWidget:getWidget('icon') then
+                                               titleIcon = 
titleWidget:getWidget('icon')
+                                       else
+                                               titleIcon = Icon("icon")
+                                       end
+                                       local newTitleWidget = 
Group(titleStyle, { text = Label("text", titleText), icon = titleIcon }) 
                                        
step.window:setTitleWidget(newTitleWidget)
                                -- change the text as specified if no 
titleStyle param was also sent
                                elseif data.window.text then

Modified: 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua?rev=2519&root=Jive&r1=2518&r2=2519&view=diff
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua (original)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Window.lua Fri May 23 
13:15:26 2008
@@ -475,6 +475,39 @@
        return nil
 end
 
+--[[
+
+=head2 jive.ui.Window:getTitleWidget()
+
+Returns the window's title widget.
+
+=cut
+--]]
+function getTitleWidget(self)
+       if self.title then
+               return self.title
+       end
+       return nil
+end
+
+
+--[[
+
+=head2 jive.ui.Window:getTitleStyle()
+
+Returns the style of the title widget.
+
+=cut
+--]]
+function getTitleStyle(self)
+       if self.title then
+               if self.title:getWidget('text') then
+                       return self.title:getWidget('text'):getStyle()
+               end
+       end
+       return nil
+end
+
 
 --[[
 

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

Reply via email to