Author: bklaas
Date: Fri Feb  8 13:05:13 2008
New Revision: 1871

URL: http://svn.slimdevices.com?rev=1871&root=Jive&view=rev
Log:
Bug: 6984, 7041
Description: 

add full screen "spinny" while player needs upgrade
remove full screen spinny when player no longer needs upgrade (done through 
player notification)
add string for updating firmware, poached from SC

do not execute action for any item that sends an 'action' = 'none' in it's item 
data

Modified:
    
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
    branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt
    branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua

Modified: 
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=1871&root=Jive&r1=1870&r2=1871&view=diff
==============================================================================
--- 
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua 
(original)
+++ 
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua 
Fri Feb  8 13:05:13 2008
@@ -123,8 +123,9 @@
 -- The last entered text
 local _lastInput = ""
 
--- connectingToPlayer popup handlers
+-- connectingToPlayer and _upgradingPlayer popup handlers
 local _connectingPopup = false
+local _updatingPlayerPopup = false
 local _menuReceived = false
 
 local modeTokens = {   
@@ -537,7 +538,7 @@
 
 -- _connectingToPlayer
 -- full screen popup that appears until menus are loaded
-local function _connectingToPlayer(self, player)
+local function _connectingToPlayer(self)
        log:info("_connectingToPlayer popup show")
 
        if _connectingPopup then
@@ -547,7 +548,7 @@
 
        local popup = Popup("popupIcon")
        local icon  = Icon("iconConnecting")
-       local playerName = player:getName()
+       local playerName = _player:getName()
        local label = Label("text", self:string("SLIMBROWSER_CONNECTING_TO", 
playerName))
        popup:addWidget(icon)
        popup:addWidget(label)
@@ -578,13 +579,66 @@
        _connectingPopup = popup
 end
 
--- _connectedToPlayer
+-- _updatingPlayer
+-- full screen popup that appears until menus are loaded
+local function _updatingPlayer(self)
+       log:info("_connectingToPlayer popup show")
+
+       if _updatingPlayerPopup then
+               -- don't open this popup twice
+               return
+       end
+
+       local popup = Popup("popupIcon")
+       local icon  = Icon("iconConnecting")
+       local label = Label("text", 
self:string('SLIMBROWSER_UPDATING_FIRMWARE_SQUEEZEBOX'))
+       popup:addWidget(icon)
+       popup:addWidget(label)
+       popup:setAlwaysOnTop(true)
+
+       -- add a listener for KEY_PRESS that disconnects from the player and 
returns to home
+       popup:addListener(
+               EVENT_KEY_PRESS | EVENT_KEY_HOLD,
+               function(event)
+                       local evtCode = event:getKeycode()
+
+                       if evtCode == KEY_BACK then
+                               -- disconnect from player and go home
+                               local manager = 
AppletManager:getAppletInstance("SlimDiscovery")
+                               if manager then
+                                       manager:setCurrentPlayer(nil)
+                               end
+                               popup:hide()
+                       end
+                       -- other keys are disabled when this popup is on screen
+                       return EVENT_CONSUME
+
+               end
+       )
+       
+       popup:show()
+
+       _updatingPlayerPopup = popup
+end
+
+
+-- _hideConnectingToPlayer
 -- hide the full screen popup that appears until menus are loaded
-local function _connectedToPlayer()
+local function _hideConnectingToPlayer()
        if _connectingPopup then
                log:info("_connectingToPlayer popup hide")
                _connectingPopup:hide()
                _connectingPopup = nil
+       end
+end
+
+-- _hidePlayerUpdating
+-- hide the full screen popup that appears until player is updated
+local function _hidePlayerUpdating()
+       if _updatingPlayerPopup then
+               log:info("_updatingPlayer popup hide")
+               _updatingPlayerPopup:hide()
+               _updatingPlayerPopup = false
        end
 end
 
@@ -868,7 +922,7 @@
                        end
                end
                if _menuReceived then
-                       _connectedToPlayer()
+                       _hideConnectingToPlayer()
                end
          end
 end
@@ -1046,6 +1100,11 @@
                local onAction
                local offAction
                
+               -- we handle no action in the case of an item telling us not to
+               if item['action'] == 'none' then
+                       return EVENT_UNUSED
+               end
+
                -- special cases for go action:
                if actionName == 'go' then
                        
@@ -2079,14 +2138,35 @@
                end
        end
 
+       if _player:isNeedsUpgrade() then
+               _updatingPlayer(self)
+       else
+               _hidePlayerUpdating()
+       end
+
        -- add a fullscreen popup that waits for the _menuSink to load
        _menuReceived = false
-       _connectingToPlayer(self, player)
-
-       jiveMain:setTitle(player:getName())
+       _connectingToPlayer(self)
+
+       jiveMain:setTitle(_player:getName())
        _installPlayerKeyHandler(self)
 end
 
+function notify_playerNeedsUpgrade(self, player, needsUpgrade)
+
+       if _player ~= player then
+               return
+       end
+
+       if needsUpgrade then
+               log:info('Show upgradingPlayer popup')
+               _updatingPlayer(self)
+       else
+               log:info('Hide upgradingPlayer popup')
+               _hidePlayerUpdating()
+       end
+
+end
 
 function notify_serverConnected(self, server)
        if _server ~= server then
@@ -2205,7 +2285,8 @@
        _playerMenus = {}
 
        -- remove connecting popup
-       _connectedToPlayer()
+       _hideConnectingToPlayer()
+       _hidePlayerUpdating()
 
        _player = false
        _server = false

Modified: branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt
URL: 
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt?rev=1871&root=Jive&r1=1870&r2=1871&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt 
(original)
+++ branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt Fri 
Feb  8 13:05:13 2008
@@ -122,3 +122,12 @@
        IT      Volume (Audio disattivato)
        NL      Volume (Gedempt)
 
+SLIMBROWSER_UPDATING_FIRMWARE_SQUEEZEBOX
+       DA      Opdaterer Squeezebox firmware
+       DE      Squeezebox-Firmware wird aktualisiert
+       EN      Updating Squeezebox firmware
+       ES      Actualizando firmware de Squeezebox
+       FR      Mise à jour du micrologiciel Squeezebox
+       IT      Aggiornamento firmware Squeezebox
+       NL      Squeezebox-firmware wordt bijgewerkt
+

Modified: branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua?rev=1871&root=Jive&r1=1870&r2=1871&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua (original)
+++ branches/7.0/jive/src/pkg/jive/share/jive/slim/Player.lua Fri Feb  8 
13:05:13 2008
@@ -22,6 +22,7 @@
  playerModeChange
  playerPlaylistChange
  playerPlaylistSize
+ playerNeedsUpgrade
 
 =head1 FUNCTIONS
 
@@ -157,6 +158,16 @@
        end
 end
 
+-- _setPlayerNeedsUpgrade()
+-- sends notification of player_needs_upgrade value. 
+local function _setPlayerNeedsUpgrade(self, playerNeedsUpgrade)
+       local needsUpgrade = (tonumber(playerNeedsUpgrade) == 1)
+       if needsUpgrade != self.needsUpgrade then
+               self.needsUpgrade = needsUpgrade
+               self.jnt:notify('playerNeedsUpgrade', self, 
self:isNeedsUpgrade())
+       end
+end
+
 -- _whatsPlaying(obj)
 -- returns the track_id from a playerstatus structure
 local function _whatsPlaying(obj)
@@ -279,8 +290,8 @@
        end
        
        self.model = playerInfo.model
-       self.needsUpgrade = (tonumber(playerInfo.player_needs_upgrade) == 1)
-
+
+       _setPlayerNeedsUpgrade(self, playerInfo.player_needs_upgrade)
        _setPlayerName(self, playerInfo.name)
        _setPlayerPower(self, tonumber(playerInfo.power))
        _setConnected(self, playerInfo.connected)

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

Reply via email to