Author: titmuss
Date: Thu Jun  5 07:40:12 2008
New Revision: 2541

URL: http://svn.slimdevices.com?rev=2541&root=Jive&view=rev
Log:
 [EMAIL PROTECTED] (orig r2536):  bklaas | 2008-05-28 22:29:45 +0100
 Bug: 7201
 Description: add option 'Sleep' to power off menu, and strings to support it
 [EMAIL PROTECTED] (orig r2537):  bklaas | 2008-05-29 20:32:03 +0100
 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
 [EMAIL PROTECTED] (orig r2538):  bklaas | 2008-06-02 07:57:41 +0100
 Bugs: 6941, 8085, 6951, 6955
 Description:
 Airpline ride fixes :)
 - fix typo in playerNeedsUpgrade notification that was causing notficiations 
to be sent out at every playerstatus update
 - don't show music sources that can't be connected to
 - remove many unneeded log:warn() messages
 - change title bar on current playlist window from "Now Playing" to "Playlist"
 - remove playlistSize notification code and merge with playlistChange 
notification
 

Modified:
    7.2/trunk/   (props changed)
    
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceApplet.lua
    
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
    
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
    7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
    7.2/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
    
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
    
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/strings.txt

Propchange: 7.2/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Thu Jun  5 07:40:12 2008
@@ -1,5 +1,5 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.0/trunk:2502
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.1/trunk:2525
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.1/trunk:2538
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceApplet.lua
URL: 
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceApplet.lua?rev=2541&root=Jive&r1=2540&r2=2541&view=diff
==============================================================================
--- 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceApplet.lua
 (original)
+++ 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/ChooseMusicSource/ChooseMusicSourceApplet.lua
 Thu Jun  5 07:40:12 2008
@@ -137,6 +137,7 @@
        log:debug("_addServerItem ", server, " " , port)
 
        local id = server or address
+
 
        -- remove existing entry
        if self.serverList[id] then
@@ -174,6 +175,8 @@
        if currentPlayer and server == currentPlayer:getSlimServer() then
                item.style = 'checkedNoAction'
                item.callback = nil
+       elseif not currentPlayer or not currentPlayer:canConnectToServer() then
+               return
        end
 
        self.serverMenu:addItem(item)

Modified: 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
URL: 
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua?rev=2541&root=Jive&r1=2540&r2=2541&view=diff
==============================================================================
--- 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 (original)
+++ 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 Thu Jun  5 07:40:12 2008
@@ -171,7 +171,7 @@
 
 
 function notify_playerTrackChange(self, player, nowPlaying)
-       log:warn("PLAYER TRACK NOTIFICATION RECEIVED")
+       log:info("Notification received that track has changed")
 
        local thisPlayer = _isThisPlayer(self, player)
        if not thisPlayer then return end
@@ -524,7 +524,7 @@
 
        local playerStatus = self.player and self.player:getPlayerStatus()
 
-       log:warn("player=", self.player, " status=", playerStatus)
+       log:info("player=", self.player, " status=", playerStatus)
 
        -- playlist_tracks needs to be > 0 or else defer back to SlimBrowser
        if not self.player or not playerStatus 
@@ -605,7 +605,7 @@
        -- when we leave NowPlaying, ditch the window
        -- the screen can get loaded with two layouts, and by doing this
        -- we force the recreation of the UI when re-entering the screen, 
possibly in a different mode
-       log:warn("NowPlaying.free()")
+       log:info("NowPlaying.free()")
        self.player = false
        self['ss'] = nil
        self['browse'] = nil

Modified: 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=2541&root=Jive&r1=2540&r2=2541&view=diff
==============================================================================
--- 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 (original)
+++ 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 Thu Jun  5 07:40:12 2008
@@ -108,7 +108,7 @@
 local _menuReceived = false
 
 local modeTokens = {   
-                       play  = "SLIMBROWSER_NOW_PLAYING",
+                       play  = "SLIMBROWSER_PLAYLIST",
                        pause = "SLIMBROWSER_PAUSED", 
                        stop  = "SLIMBROWSER_STOPPED",
                        off   = "SLIMBROWSER_OFF"
@@ -1926,7 +1926,7 @@
                -- current playlist should select currently playing item 
                -- if there is only one item in the playlist, bring the 
selected item to top
                local playerStatus = _player:getPlayerStatus()
-               local playlistSize = playerStatus and 
playerStatus.playlist_tracks
+               local playlistSize = _player:getPlaylistSize() 
                local playerPower = _player:getPlayerPower()
 
                if playerPower == 0 then
@@ -1974,35 +1974,6 @@
 
 end
 
-function notify_playerPlaylistSize(self, player, playlistSize)
-       log:info('SlimBrowser.notify_playerPlaylistSize')
-       if _player ~= player then
-               return
-       end
-
-       local power = _player:getPlayerPower()
-       local step = _statusStep
-       local emptyStep = _emptyStep
-
-       -- display 'NOTHING' if the player is on and there aren't any tracks in 
the playlist
-       if power and playlistSize == 0 then
-               local customWindow = showEmptyPlaylist('SLIMBROWSER_NOTHING') 
-               if emptyStep then
-                       customWindow:replace(emptyStep.window, 
Window.transitionFadeIn)
-               end
-               if step.window then
-                       customWindow:replace(step.window, 
Window.transitionFadeIn)
-               end
-       -- make sure we have step.window replace emptyStep.window when there 
are tracks
-       elseif playlistSize and emptyStep then
-               if step.window then
-                       step.window:replace(emptyStep.window, 
Window.transitionFadeIn)
-               end
-       
-       end
-       
-end
-
 function notify_playerPower(self, player, power)
        log:debug('SlimBrowser.notify_playerPower')
        if _player ~= player then
@@ -2064,9 +2035,32 @@
                return
        end
 
+       local power        = _player:getPlayerPower()
        local playerStatus = player:getPlayerStatus()
-       local step = _statusStep
-
+       local playlistSize = _player:getPlaylistSize()
+       local step         = _statusStep
+       local emptyStep    = _emptyStep
+
+       -- display 'NOTHING' if the player is on and there aren't any tracks in 
the playlist
+       if power and playlistSize == 0 then
+               local customWindow = showEmptyPlaylist('SLIMBROWSER_NOTHING') 
+               if emptyStep then
+                       customWindow:replace(emptyStep.window, 
Window.transitionFadeIn)
+               end
+               if step.window then
+                       customWindow:replace(step.window, 
Window.transitionFadeIn)
+               end
+               -- we've done all we need to when the playlist is 0, so let's 
get outta here
+               return
+       -- make sure we have step.window replace emptyStep.window when there 
are tracks and emptyStep exists
+       elseif playlistSize and emptyStep then
+               if step.window then
+                       step.window:replace(emptyStep.window, 
Window.transitionFadeIn)
+               end
+       
+       end
+
+       -- update the window
        step.db:updateStatus(playerStatus)
        step.menu:reLayout()
 
@@ -2184,7 +2178,7 @@
                _newWindowSpec(
                        nil, 
                        {
-                               text = _string("SLIMBROWSER_NOW_PLAYING"),
+                               text = _string("SLIMBROWSER_PLAYLIST"),
                                window = { 
                                        ["menuStyle"] = "album", 
                                }

Modified: 
7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
URL: 
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt?rev=2541&root=Jive&r1=2540&r2=2541&view=diff
==============================================================================
--- 7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt 
(original)
+++ 7.2/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt 
Thu Jun  5 07:40:12 2008
@@ -1,6 +1,15 @@
 #
 # The two letter codes are defined by ISO 639-1
 # http://en.wikipedia.org/wiki/List_of_ISO_639_codes
+
+SLIMBROWSER_PLAYLIST
+       DA      Spilleliste
+       DE      Wiedergabeliste
+       EN      Playlist
+       ES      Lista de reproducción
+       FR      Liste de lecture
+       IT      Elenco di riproduzione
+       NL      Playlist
 
 SLIMBROWSER_NOW_PLAYING
        DA      Afspiller nu

Modified: 7.2/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua?rev=2541&root=Jive&r1=2540&r2=2541&view=diff
==============================================================================
--- 7.2/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua (original)
+++ 7.2/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua Thu Jun  5 
07:40:12 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
@@ -131,16 +132,6 @@
        end
 end
 
-local function _setPlayerPlaylistSize(self, playlistSize)
-       log:debug("_setPlayerPlaylistSize")
-
-       if playlistSize != self.playlistSize then
-               self.playlistSize = tonumber(playlistSize)
-               self.jnt:notify('playerPlaylistSize', self, 
tonumber(playlistSize))
-       end
-end
-
-
 local function _setPlayerPower(self, power)
        log:debug("_setPlayerPower")
 
@@ -151,6 +142,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)
@@ -762,14 +768,14 @@
        self.trackCorrection = 0
        self.trackTime = event.data.time
        self.trackDuration = event.data.duration
+       self.playlistSize = tonumber(event.data.playlist_tracks)
 
        _setConnected(self, self.state["player_connected"])
-       _setPlayerPlaylistSize(self, tonumber(event.data.playlist_tracks))
        _setPlayerPower(self, tonumber(event.data.power))
 
        _setPlayerModeChange(self, event.data.mode)
 
-       if self.needsUpgrade ~= lastNeedsUpgrading or self.playerIsUpgrading ~= 
lastIsUpgrading then
+       if self.needsUpgrade ~= lastNeedsUpgrade or self.playerIsUpgrading ~= 
lastIsUpgrading then
                self.jnt:notify('playerNeedsUpgrade', self, 
self:isNeedsUpgrade(), self:isUpgrading())
        end
 
@@ -795,9 +801,10 @@
 
                local s = self.currentSong
 
+               local textValue = _formatShowBrieflyText(display['text'])
                if type == 'song' then
                        s.textarea:setValue("")
-                       s.text:setValue(table.concat(display["text"], "\n"))
+                       s.text:setValue(textValue)
                        s.artIcon:setStyle("icon")
                        if display['icon'] then
                                
self.slimServer:fetchArtworkURL(display['icon'], s.artIcon, 56)
@@ -808,7 +815,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

Modified: 
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
URL: 
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua?rev=2541&root=Jive&r1=2540&r2=2541&view=diff
==============================================================================
--- 
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
 (original)
+++ 
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
 Thu Jun  5 07:40:12 2008
@@ -803,15 +803,47 @@
                        callback = function() window:hide() end
                },
                { 
-                       text = self:string("POWER_DOWN_CONFIRM"),
+                       text = self:string("POWER_DOWN"),
                        sound = "SELECT",
                        callback = function() settingsPowerOff(self) end
+               },      
+               { 
+                       text = self:string("POWER_DOWN_SLEEP"),
+                       sound = "SELECT",
+                       callback = function() settingsSleep(self) end
                }
        }
        menu:setItems(items)
 
        window:show()
         return window
+end
+
+function settingsSleep(self)
+       -- disconnect from SqueezeCenter
+       local slimDiscovery = appletManager:loadApplet("SlimDiscovery")
+       slimDiscovery.serversObj:disconnect()
+
+       self.popup = Popup("popupIcon")
+
+       self.popup:addWidget(Icon("iconConnecting"))
+       self.popup:addWidget(Label("text", self:string("SLEEPING")))
+
+       -- make sure this popup remains on screen
+       self.popup:setAllowScreensaver(false)
+       self.popup:setAlwaysOnTop(true)
+       self.popup:setAutoHide(false)
+
+       self.popup:addTimer(10000, 
+               function()
+                       self:_goToSleep()
+               end,
+               true
+       )
+
+       self.popup:show()
+
+       self.popup:playSound("SHUTDOWN")
 end
 
 
@@ -1118,6 +1150,16 @@
        self.suspendTask:addTask()
 end
 
+function _goToSleep(self)
+       log:info("Sleep begin")
+
+       self:_setBrightness(true, 0, 0)
+
+       -- give the user 10 seconds to put the thing down, otherwise the motion 
detector will just bring it right back out of sleep
+       self.popup:hide()
+       self:setPowerState('suspend')
+
+end
 
 function _powerOff(self)
        log:info("Poweroff begin")

Modified: 
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/strings.txt
URL: 
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/strings.txt?rev=2541&root=Jive&r1=2540&r2=2541&view=diff
==============================================================================
--- 
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/strings.txt
 (original)
+++ 
7.2/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/strings.txt
 Thu Jun  5 07:40:12 2008
@@ -211,6 +211,9 @@
        IT      Annulla
        NL      Annuleren
 
+POWER_DOWN_SLEEP
+       EN      Sleep
+
 POWER_DOWN_CONFIRM
        DA      Bekræft
        DE      Bestätigen
@@ -229,6 +232,9 @@
        IT      \nA presto
        NL      \nTot ziens
 
+SLEEPING
+       EN      \nSleeping
+
 POWER_DOWN_HELP
        DA      Afbrud eller Bekræft slukning af din fjernbetjening.
        DE      Herunterfahren der Fernbedienung Abbrechen oder Bestätigen

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

Reply via email to