Author: bklaas
Date: Mon Jan 14 10:46:23 2008
New Revision: 1435

URL: http://svn.slimdevices.com?rev=1435&root=Jive&view=rev
Log:
Bug: 5322
Description: Use full-screen popup "Connecting to %s" until the first 
menustatus update comes through
Install window listener to popup to allow using back key to exit popup. This 
action will disconnect from the current player as well.

Modified:
    trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
    trunk/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt

Modified: 
trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=1435&root=Jive&r1=1434&r2=1435&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua 
(original)
+++ trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua Mon 
Jan 14 10:46:23 2008
@@ -119,6 +119,9 @@
 -- The last entered text
 local _lastInput = ""
 
+-- connectingToPlayer popup handlers
+local _connectingPopup = false
+local _menuReceived = false
 
--==============================================================================
 -- Local functions
 
--==============================================================================
@@ -570,6 +573,39 @@
        end
 end
 
+-- _connectingToPlayer
+-- full screen popup that appears until menus are loaded
+local function _connectingToPlayer(self, player)
+
+       local popup = Popup("popupIcon")
+       local icon  = Icon("iconConnecting")
+       local label = Label("text", self:string("SLIMBROWSER_CONNECTING_TO", 
player.name))
+       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
+                               self:free()
+                               popup:hide()
+                       end
+                       -- other keys are disabled when this popup is on screen
+                       return EVENT_CONSUME
+
+               end
+       )
+       
+       popup:show()
+       _connectingPopup = popup
+
+end
+
 -- _bigArtworkPopup
 -- special case sink that pops up big artwork
 local function _bigArtworkPopup(chunk, err)
@@ -698,6 +734,9 @@
                        log:debug("This player is: ", _player.id)
                        return
                end
+
+               -- if we get here, it was for this player. set menuReceived to 
true
+               _menuReceived = true
 
                for k, v in pairs(menuItems) do
 
@@ -796,6 +835,10 @@
                                _playerMenus[item.id] = item
                                jiveMain:addItem(item)
                        end
+               end
+               if _menuReceived and _connectingPopup then
+                       _connectingPopup:hide()
+                       _connectingPopup = nil
                end
          end
 end
@@ -1720,7 +1763,7 @@
 -- notify_playerCurrent
 -- this is called when the current player changes (possibly from no player)
 function notify_playerCurrent(self, player)
-       log:debug("SlimBrowserApplet:notify_playerCurrent(", player, ")")
+       log:warn("SlimBrowserApplet:notify_playerCurrent(", player, ")")
 
        -- nothing to do if we don't have a player
        if not player then
@@ -1735,6 +1778,9 @@
        -- free current player
        if _player then
                self:free()
+               -- add a fullscreen popup that waits for the _menuSink to load
+               _menuReceived = false
+               _connectingToPlayer(self, player)
        else
                log:info("First load...get the correct wallpaper on screen")
                local SetupWallpaper = 
AppletManager:loadApplet("SetupWallpaper")
@@ -1746,7 +1792,6 @@
        _player = player
        _server = player:getSlimServer()
        _string = function(token) return self:string(token) end
-
 
        log:warn('**** SUBSCRIBING to /slim/menustatus/', _player.id)
        local cmd = { 'menustatus' }

Modified: trunk/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt?rev=1435&root=Jive&r1=1434&r2=1435&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt (original)
+++ trunk/jive/src/pkg/jive/share/applets/SlimBrowser/strings.txt Mon Jan 14 
10:46:23 2008
@@ -89,3 +89,12 @@
        FR      Rien
        IT      Niente
        NL      Niets
+
+SLIMBROWSER_CONNECTING_TO
+       DE      Verbindung mit %s
+       EN      Connecting to\n%s
+       ES      Conectando a %s
+       FR      Connexion à %s
+       IT      Connessione a %s
+       NL      Er wordt een verbinding met %s gemaakt
+

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

Reply via email to