Author: titmuss
Date: Fri Apr 18 15:33:37 2008
New Revision: 2291

URL: http://svn.slimdevices.com?rev=2291&root=Jive&view=rev
Log:
 [EMAIL PROTECTED] (orig r2287):  bklaas | 2008-04-18 22:48:38 +0100
 Bug: 6349
 Description:
 Update Player.lua to read player_needs_upgrade message which indicates player 
is sitting in "hold brightness to
 update" mode
 
 Add isUpgrading method to player object
 
 Add second argument for isUpgrading to playerNeedsUpgrade notification (will 
be used by SlimBrowser and not by SetupSqueezebox; these are the only spots 
that this notification is used)
 
 Display window with textarea telling user to dig up their IR remote and 
press-hold brightness to update their firmware.
 
 Add EN strings for new window

Modified:
    7.1/trunk/   (props changed)
    
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
    7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
    7.1/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua

Propchange: 7.1/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Apr 18 15:33:37 2008
@@ -1,4 +1,4 @@
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.0/trunk:2281
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.0/trunk:2287
 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.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=2291&root=Jive&r1=2290&r2=2291&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 Apr 18 15:33:37 2008
@@ -131,6 +131,7 @@
 -- connectingToPlayer and _upgradingPlayer popup handlers
 local _connectingPopup = false
 local _updatingPlayerPopup = false
+local _userUpdatePopup = false
 local _menuReceived = false
 
 local modeTokens = {   
@@ -494,8 +495,8 @@
 local function _connectingToPlayer(self)
        log:info("_connectingToPlayer popup show")
 
-       if _connectingPopup then
-               -- don't open this popup twice
+       if _connectingPopup or _userUpdatePopup or _updatingPlayerPopup then
+               -- don't open this popup twice or when firmware update windows 
are on screen
                return
        end
 
@@ -532,10 +533,57 @@
        _connectingPopup = popup
 end
 
+-- _userTriggeredUpdate
+-- full screen popup that appears until user hits brightness on player to 
start upgrade
+local function _userTriggeredUpdate(self)
+       log:warn("_connectingToPlayer popup show")
+
+
+       if _userUpdatePopup then
+               return
+       end
+
+       local window = Window("window", 
self:string('SLIMBROWSER_PLAYER_UPDATE_REQUIRED'))
+       local label = Textarea("textarea", 
self:string('SLIMBROWSER_USER_UPDATE_FIRMWARE_SQUEEZEBOX', _player:getName()))
+       window:addWidget(label)
+       window:setAlwaysOnTop(true)
+       window:setAllowScreensaver(false)
+
+       -- add a listener for KEY_HOLD that disconnects from the player and 
returns to home
+       window:addListener(
+               EVENT_KEY_PRESS | EVENT_KEY_HOLD,
+               function(event)
+                       local type = event:getType()
+                       local evtCode = event:getKeycode()
+
+                       if evtCode == KEY_BACK and type == EVENT_KEY_HOLD then
+                               -- disconnect from player and go home
+                               local manager = 
AppletManager:getAppletInstance("SlimDiscovery")
+                               if manager then
+                                       manager:setCurrentPlayer(nil)
+                               end
+                               window:hide()
+                       end
+                       -- other keys are disabled when this window is on screen
+                       return EVENT_CONSUME
+
+               end
+       )
+       
+       window:show()
+
+       _userUpdatePopup = window
+end
+
+
 -- _updatingPlayer
 -- full screen popup that appears until menus are loaded
 local function _updatingPlayer(self)
-       log:info("_connectingToPlayer popup show")
+       log:warn("_connectingToPlayer popup show")
+
+       if _userUpdatePopup then
+               _hideUserUpdatePopup()
+       end
 
        if _updatingPlayerPopup then
                -- don't open this popup twice
@@ -544,7 +592,7 @@
 
        local popup = Popup("popupIcon")
        local icon  = Icon("iconConnecting")
-       local label = Label("text", 
self:string('SLIMBROWSER_UPDATING_FIRMWARE_SQUEEZEBOX'))
+       local label = Label("text", 
self:string('SLIMBROWSER_UPDATING_FIRMWARE_SQUEEZEBOX', _player:getName()))
        popup:addWidget(icon)
        popup:addWidget(label)
        popup:setAlwaysOnTop(true)
@@ -584,6 +632,17 @@
                _connectingPopup = nil
        end
 end
+
+-- _hideUserUpdatePopup
+-- hide the full screen popup that appears until player is updated
+local function _hideUserUpdatePopup()
+       if _userUpdatePopup then
+               log:info("_userUpdatePopup popup hide")
+               _userUpdatePopup:hide()
+               _userUpdatePopup = false
+       end
+end
+
 
 -- _hidePlayerUpdating
 -- hide the full screen popup that appears until player is updated
@@ -2145,7 +2204,11 @@
        end
 
        if _player:isNeedsUpgrade() then
-               _updatingPlayer(self)
+               if _player:isUpgrading() then
+                       _updatingPlayer(self)
+               else
+                       _userTriggeredUpdate(self)
+               end
        else
                _hidePlayerUpdating()
        end
@@ -2158,18 +2221,21 @@
        _installPlayerKeyHandler(self)
 end
 
-function notify_playerNeedsUpgrade(self, player, needsUpgrade)
+function notify_playerNeedsUpgrade(self, player, needsUpgrade, isUpgrading)
        log:debug("SlimBrowserApplet:notify_playerNeedsUpgrade(", player, ")")
 
        if _player ~= player then
                return
        end
 
-       if needsUpgrade then
+       if isUpgrading then
                log:info('Show upgradingPlayer popup')
                _updatingPlayer(self)
+       elseif needsUpgrade then
+               log:info('Show userUpdate popup')
+               _userTriggeredUpdate(self)
        else
-               log:info('Hide upgradingPlayer popup')
+               _hideUserUpdatePopup()
                _hidePlayerUpdating()
        end
 
@@ -2330,6 +2396,7 @@
        -- remove connecting popup
        _hideConnectingToPlayer()
        _hidePlayerUpdating()
+       _hideUserUpdatePopup()
 
        _player = false
        _server = false

Modified: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt?rev=2291&root=Jive&r1=2290&r2=2291&view=diff
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt 
(original)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt 
Fri Apr 18 15:33:37 2008
@@ -142,5 +142,11 @@
 SLIMBROWSER_SCANNER
        EN      Song Position
 
+SLIMBROWSER_USER_UPDATE_FIRMWARE_SQUEEZEBOX
+       EN      Software Update ready for %s. To begin, press and hold the 
Brightness button on your original IR remote
+
+SLIMBROWSER_PLAYER_UPDATE_REQUIRED
+       EN      Player Update
+
 SLIMBROWSER_ENTER_PASSWORD
        EN      Enter Password

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=2291&root=Jive&r1=2290&r2=2291&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 Fri Apr 18 
15:33:37 2008
@@ -237,6 +237,7 @@
                connected = playerInfo.connected,
                power = playerInfo.power,
                needsUpgrade = (tonumber(playerInfo.player_needs_upgrade) == 1),
+               playerIsUpgrading = (tonumber(playerInfo.player_is_upgrading) 
== 1),
                pin = playerInfo.pin,
 
                -- menu item of home menu that represents this player
@@ -277,9 +278,11 @@
        -- Update player state
        local lastNeedsUpgrade = self.needsUpgrade
        self.needsUpgrade = (tonumber(playerInfo.player_needs_upgrade) == 1)
+       local lastIsUpgrading = self.playerIsUpgrading
+       self.playerIsUpgrading = (tonumber(playerInfo.player_is_upgrading) == 1)
 
        -- FIXME the object state needs setting before any notifications
-       -- this is now changed for needsUpgrade, but still needs to be done
+       -- this is now changed for needsUpgrade and playerIsUpgrading, but 
still needs to be done
        -- for all other player state
 
 
@@ -298,8 +301,8 @@
        
        self.model = playerInfo.model
 
-       if lastNeedsUpgrade != self.needsUpgrade then
-               self.jnt:notify('playerNeedsUpgrade', self, 
self:isNeedsUpgrade())
+       if lastNeedsUpgrade != self.needsUpgrade or lastIsUpgrading != 
self.playerIsUpgrading then
+               self.jnt:notify('playerNeedsUpgrade', self, 
self:isNeedsUpgrade(), self:isUpgrading())
        end
 
        _setPlayerName(self, playerInfo.name)
@@ -747,7 +750,7 @@
 
        -- update our cache in one go
        self.state = event.data
-
+debug.dump(event.data, -1)
        -- used for calculating getTrackElapsed(), getTrackRemaining()
        self.trackSeen = Framework:getTicks() / 1000
        self.trackCorrection = 0
@@ -855,6 +858,9 @@
        return self.needsUpgrade
 end
 
+function isUpgrading(self)
+       return self.playerIsUpgrading
+end
 
 -- play
 -- 

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

Reply via email to