Author: bklaas
Date: Thu May 29 12:32:03 2008
New Revision: 2537
URL: http://svn.slimdevices.com?rev=2537&root=Jive&view=rev
Log:
Bug: 8073
Description: support for \n as a newline instruction within showBriefly
strings, while not breaking the ability to do multiline representation from SC
via an array
Modified:
7.1/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
Modified: 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
URL:
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua?rev=2537&root=Jive&r1=2536&r2=2537&view=diff
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua (original)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua Thu May 29
12:32:03 2008
@@ -52,6 +52,7 @@
local Group = require("jive.ui.Group")
local debug = require("jive.utils.debug")
+local strings = require("jive.utils.strings")
local log = require("jive.utils.log").logger("player")
local EVENT_KEY_ALL = jive.ui.EVENT_KEY_ALL
@@ -151,6 +152,21 @@
end
end
+local function _formatShowBrieflyText(msg)
+ log:debug("_formatShowBrieflyText")
+
+ -- showBrieflyText needs to deal with both \n instructions within a
string
+ -- and also adding newlines between table elements
+
+ -- first compress the table elements into a single string with newlines
+ local text = table.concat(msg, "\n")
+ -- then split the new string on \n instructions within the concatenated
string, and into a table
+ local split = strings:split('\\n', text)
+ -- then compress the new table into a string with all newlines as needed
+ local text2 = table.concat(split, "\n")
+
+ return text2
+end
-- _setPlayerModeChange()
-- sends notifications when changes in the play mode (e.g., moves from play to
paused)
@@ -795,9 +811,11 @@
local s = self.currentSong
+ local textValue = _formatShowBrieflyText(display['text'])
if type == 'song' then
s.textarea:setValue("")
- s.text:setValue(table.concat(display["text"], "\n"))
+ log:warn(display['text'])
+ s.text:setValue(textValue)
s.artIcon:setStyle("icon")
if display['icon'] then
self.slimServer:fetchArtworkURL(display['icon'], s.artIcon, 56)
@@ -808,7 +826,7 @@
s.text:setValue('')
s.artIcon:setStyle("noimage")
s.artIcon:setValue(nil)
- s.textarea:setValue(table.concat(display["text"], "\n"))
+ s.textarea:setValue(textValue)
end
s.window:showBriefly(3000, nil, Window.transitionPushPopupUp,
Window.transitionPushPopupDown)
end
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins