Author: richard
Date: Mon Jan 19 16:16:49 2009
New Revision: 3885

URL: http://svn.slimdevices.com?rev=3885&root=Jive&view=rev
Log:
 r3...@harrypotter (orig r3873):  felix | 2009-01-19 01:09:38 +0000
 Bug: n/a
 Description: Get WPS IE from wireless driver and pass it to the application to 
be included into the scan results table. 
  
 
 r3...@harrypotter (orig r3878):  tom | 2009-01-19 20:17:09 +0000
 Bug: N/A
 Description:
 Action framework:
 - added char handler
 - making action names more functional
 - added widget action listeners
 r3...@harrypotter (orig r3879):  tom | 2009-01-19 20:42:28 +0000
 Bug: N/A
 Description:
 Action framework:
 - whitespace only changes, fixing my space->tab issues for the action code

Modified:
    7.4/branches/pango/   (props changed)
    
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/files/wpa_cli
    
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/files/wpa_supplicant
    
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-bin_1.0.bb
    
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-src_svn.bb
    
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
    7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua

Propchange: 7.4/branches/pango/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Mon Jan 19 16:16:49 2009
@@ -4,7 +4,7 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.2/trunk:2921
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/private-branches/jive-refresh:3653
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/trunk:3856
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:3869
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:3879
 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.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/files/wpa_cli
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/files/wpa_cli?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/files/wpa_supplicant
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/files/wpa_supplicant?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
Binary files - no diff available.

Modified: 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-bin_1.0.bb
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-bin_1.0.bb?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-bin_1.0.bb
 (original)
+++ 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-bin_1.0.bb
 Mon Jan 19 16:16:49 2009
@@ -2,7 +2,7 @@
 SECTION = "base"
 LICENSE = "binary only"
 
-#PR = "r0"
+PR = "r1"
 
 PROVIDES = "marvell-wlan-tools"
 

Modified: 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-src_svn.bb
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-src_svn.bb?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-src_svn.bb
 (original)
+++ 
7.4/branches/pango/squeezeos/poky/meta-squeezeos/packages/marvell-88W8686/marvell-wlan-tools-src_svn.bb
 Mon Jan 19 16:16:49 2009
@@ -3,7 +3,7 @@
 LICENSE = "binary only"
 
 PV = "1.0"
-#PR = "r0"
+PR = "r1"
 
 PROVIDES = "marvell-wlan-tools"
 

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
--- 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 (original)
+++ 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 Mon Jan 19 16:16:49 2009
@@ -2054,19 +2054,9 @@
        end
 
        _playerKeyHandler = Framework:addListener(
-               EVENT_KEY_DOWN | EVENT_KEY_PRESS | EVENT_KEY_HOLD | 
EVENT_CHAR_PRESS,
+               EVENT_KEY_DOWN | EVENT_KEY_PRESS | EVENT_KEY_HOLD,
                function(event)
                        local type = event:getType()
-
-                       if type == EVENT_CHAR_PRESS then
-                               local keyboardEntry = 
string.char(event:getUnicode())
-                               if keyboardEntry == "/" then
-                                       _goSearch()
-                                       return EVENT_CONSUME
-                               else
-                                       return EVENT_UNUSED
-                               end
-                       end
                        
                        local actionName = 
_keycodeActionName[event:getKeycode()]
                        if not actionName then
@@ -2509,6 +2499,8 @@
 
        jiveMain:setTitle(_player:getName())
        _installPlayerKeyHandler(self)
+       
+       Framework:addActionListener("go_search", self, "SlimBrowser", _goSearch)
 end
 
 function notify_playerNeedsUpgrade(self, player, needsUpgrade, isUpgrading)

Modified: 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/JiveMain.lua Mon 
Jan 19 16:16:49 2009
@@ -72,6 +72,7 @@
 local EVENT_SCROLL         = jive.ui.EVENT_SCROLL
 local EVENT_WINDOW_RESIZE  = jive.ui.EVENT_WINDOW_RESIZE
 local EVENT_UNUSED         = jive.ui.EVENT_UNUSED
+local EVENT_CONSUME        = jive.ui.EVENT_CONSUME
 
 local KEY_HOME             = jive.ui.KEY_HOME
 local KEY_FWD           = jive.ui.KEY_FWD
@@ -126,14 +127,23 @@
        ["\27"]  = { keyCode = KEY_BACK, event = EVENT_KEY_PRESS } -- ESC
 }
 
-local keyActionMappingsPress = {
-    [KEY_LEFT] = "arrow_left.press"  -- using button naming convention from SC 
default.map, though these are action events
+
+local charActionMappings = {}
+charActionMappings.press = {
+       ["/"] = "go_search"
 }
 
 
-local keyActionMappingsHold = {
-    [KEY_LEFT] = "arrow_left.hold",
-    [KEY_REW | KEY_PAUSE] = "take_screenshot"  -- a stab at how to handle 
multi-press
+local keyActionMappings = {}
+keyActionMappings.press = {
+       [KEY_HOME] = "go_home"
+}
+
+
+keyActionMappings.hold = {
+       [KEY_BACK] = "disconnect_player",
+       [KEY_LEFT] = "go_home",
+       [KEY_REW | KEY_PAUSE] = "take_screenshot"  -- a stab at how to handle 
multi-press
 }
 
 local _defaultSkin
@@ -152,8 +162,8 @@
 end
 
 local function _disconnectPlayer(self, event) --self, event not used in our 
case, could be left out
-    appletManager:callService("setCurrentPlayer", nil)
-    _goHome()
+       appletManager:callService("setCurrentPlayer", nil)
+       _goHome()
 end
 
 -- bring us to the home menu
@@ -165,20 +175,22 @@
                
                log:debug("Keyboard entry: ", keyboardEntry)
                
-               if keyboardShortcuts[keyboardEntry] then
-                       local keyCode = keyboardShortcuts[keyboardEntry].keyCode
-                       
Framework:pushEvent(Event:new(keyboardShortcuts[keyboardEntry].event, keyCode))
+               if not keyboardShortcuts[keyboardEntry] then
+                       return EVENT_UNUSED
                end
+
+               local keyCode = keyboardShortcuts[keyboardEntry].keyCode
+               
Framework:pushEvent(Event:new(keyboardShortcuts[keyboardEntry].event, keyCode))
                
                return EVENT_CONSUME
 
        elseif ( type == EVENT_KEY_PRESS and event:getKeycode() == KEY_HOME) 
then
 
-        _goHome()
-        
+               _goHome()
+               
                return EVENT_CONSUME
-      end
-      return EVENT_UNUSED
+         end
+         return EVENT_UNUSED
 end
 
 local function _addUserPathToLuaPath()
@@ -189,28 +201,33 @@
 
 -- transform user input events (key, etc) to a matching action name
 local function getAction(event)
-    --naive implementation for demonstration - will be more involved later
-
-    local eventType = event:getType()
-    local action = nil
-    
-    if eventType == EVENT_KEY_PRESS then
-        action = keyActionMappingsPress[event:getKeycode()]
-    elseif eventType == EVENT_KEY_HOLD then
-        action = keyActionMappingsHold[event:getKeycode()]
-    end
-    
-    return action
-    
+       --naive implementation for demonstration - will be more involved later
+
+       local eventType = event:getType()
+       local action = nil
+       
+       if eventType == EVENT_KEY_PRESS then
+               action = keyActionMappings.press[event:getKeycode()]
+       elseif eventType == EVENT_KEY_HOLD then
+               action = keyActionMappings.hold[event:getKeycode()]
+       elseif eventType == EVENT_CHAR_PRESS then
+               action = 
charActionMappings.press[string.char(event:getUnicode())]
+       end
+       
+       return action
+       
 end
 
 function registerDefaultActions()
-    for key, action in pairs(keyActionMappingsPress) do 
-        Framework:registerAction(action)
-    end
-    for key, action in pairs(keyActionMappingsHold) do 
-        Framework:registerAction(action)
-    end
+       for key, action in pairs(keyActionMappings.press) do 
+               Framework:registerAction(action)
+       end
+       for key, action in pairs(keyActionMappings.hold) do 
+               Framework:registerAction(action)
+       end
+       for key, action in pairs(charActionMappings.press) do 
+               Framework:registerAction(action)
+       end
 
 end
 
@@ -266,11 +283,11 @@
                end,
                10)
 
-    registerDefaultActions()
+       registerDefaultActions()
 
        -- action mapping listener, should be last listener in chain to allow 
for direct access to keys/other input types if needed.
        --todo add other input types
-       Framework:addListener(EVENT_KEY_ALL,
+       Framework:addListener(EVENT_KEY_ALL | EVENT_CHAR_PRESS ,
                function(event)
                    local action = getAction(event)
                    if not action then
@@ -285,13 +302,13 @@
                    
                    log:debug("Pushing action event (", action, ") - 
event:getAction: " , actionEvent:getAction())
                Framework:pushEvent(actionEvent)
-                       return EVENT_CONSUMED
+                       return EVENT_CONSUME
                end,
                9999)
                
        
-    -- disconnect from player on press and hold left
-    Framework:addActionListener("arrow_left.hold", self, _disconnectPlayer)
+       -- disconnect from player on press and hold left
+       Framework:addActionListener("disconnect_player", self, "JiveMain", 
_disconnectPlayer)
        
        -- show our window!
        jiveMain.window:show()

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Framework.lua 
Mon Jan 19 16:16:49 2009
@@ -99,8 +99,9 @@
 screen.bounds = { 0, 0, 240, 320 }
 screen.bpp = 16
 
-actionsByName = {}
-actionsByIndex = {}
+actions = {}
+actions.byName = {}
+actions.byIndex = {}
 
 -- Put default global settings here
 default_global_settings = {
@@ -543,28 +544,28 @@
 end
 
 function dumpActions(self)
-    local result = "Available Actions: " 
-    for action in table.pairsByKeys(self.actionsByName) do
-        result = result .. " " .. action
-    end
-    return result
+       local result = "Available Actions: " 
+       for action in table.pairsByKeys(self.actions.byName) do
+               result = result .. " " .. action
+       end
+       return result
 end
 
 function _getActionEventIndexByName(self, name)
-    if (self.actionsByName[name] == nil) then
-        return nil   
-    end
-    
-    return self.actionsByName[name].index
+       if (self.actions.byName[name] == nil) then
+               return nil   
+       end
+       
+       return self.actions.byName[name].index
 end
 
 function getActionEventNameByIndex(self, index)
-    if (index > #self.actionsByIndex) then
-        log:error("action event index out of bounds: " , index)
-        return nil   
-    end
-    
-    return self.actionsByIndex[index].name
+       if (index > #self.actions.byIndex) then
+               log:error("action event index out of bounds: " , index)
+               return nil   
+       end
+       
+       return self.actions.byIndex[index].name
 end
 
 --[[
@@ -576,65 +577,65 @@
 =cut
 --]]
 function newActionEvent(self, action)
-    local actionIndex = self:_getActionEventIndexByName(action)
-    if not actionIndex then
-        log:error("action name not registered: (" , action, "). Available 
actions: ", self:dumpActions() )
-        return nil
-    end
-    
-    return Event:new(ACTION, actionIndex)
-    
-end
-
---[[
-
-=head2 jive.ui.Framework:registerAction(action)
-
-Register an action. action is a unique string that represents an action.
+       local actionIndex = self:_getActionEventIndexByName(action)
+       if not actionIndex then
+               log:error("action name not registered: (" , action, "). 
Available actions: ", self:dumpActions() )
+               return nil
+       end
+       
+       return Event:new(ACTION, actionIndex)
+       
+end
+
+--[[
+
+=head2 jive.ui.Framework:registerAction(actionName)
+
+Register an action. actionName is a unique string that represents an action.
 Each action must be registered before listeners using it can be created (for 
typo prevention, and other future uses). 
 
 =cut
 --]]
 function registerAction(self, actionName)
-    if (self.actionsByName[actionName]) then
-        log:error("Action already registered, doing nothing")
-        return
-    end
-    
-    local actionEventDefinition = { name = actionName, index = 
#self.actionsByIndex + 1 }
-
-    log:debug("Registering action: ", actionEventDefinition.name, " with 
index: ", actionEventDefinition.index)
-    self.actionsByName[actionName] = actionEventDefinition
-    table.insert(self.actionsByIndex, actionEventDefinition)
-    
-end
-
-
---example: addActionListener("play", self, playAction)
-function addActionListener(self, action, obj, listener)
+       if (self.actions.byName[actionName]) then
+               log:error("Action already registered, doing nothing: ", 
actionName)
+               return
+       end
+       
+       local actionEventDefinition = { name = actionName, index = 
#self.actions.byIndex + 1 }
+
+       log:debug("Registering action: ", actionEventDefinition.name, " with 
index: ", actionEventDefinition.index)
+       self.actions.byName[actionName] = actionEventDefinition
+       table.insert(self.actions.byIndex, actionEventDefinition)
+       
+end
+
+
+--example: addActionListener("disconnect_player", self, "MyApplet" 
disconnectPlayerAction)
+function addActionListener(self, action, obj, sourceBreadCrumb, listener)
        _assert(type(listener) == "function")
 
 
-    if not self:_getActionEventIndexByName(action) then
-        log:error("action name not registered:(" , action, "). Available 
actions: ", self:dumpActions() )
-        return 
-    end
-
-    log:debug("Creating action listener for action: (" , action, ") from 
source: todo would be nice to be able to display the source of the listener in 
a meaningful way for debugging")
-    
+       if not self:_getActionEventIndexByName(action) then
+               log:error("action name not registered:(" , action, "). 
Available actions: ", self:dumpActions() )
+               return 
+       end
+       log:debug("Creating action listener for action: (" , action, ") from 
source: ", sourceBreadCrumb)
+       
        self:addListener(ACTION,
                function(event)
-                   local eventAction = event:getAction()
-                   if eventAction != action then
-                       return EVENT_UNUSED
-                   end
-
-            local listenerResult = listener(obj, event)
-            --default to consume unless the listener specifically wants to set 
a specific event return
-            return listenerResult and listenerResult or EVENT_CONSUME
+                       local eventAction = event:getAction()
+                       if eventAction != action then
+                               return EVENT_UNUSED
+                       end
+                       log:debug("Calling action listener for action: (" , 
action, ") from source: ", sourceBreadCrumb)
+               
+                       local listenerResult = listener(obj, event)
+                       --default to consume unless the listener specifically 
wants to set a specific event return
+                       return listenerResult and listenerResult or 
EVENT_CONSUME
                end
        )
-    
+       
 end
 
 --[[

Modified: 
7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua?rev=3885&root=Jive&r1=3884&r2=3885&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua 
(original)
+++ 7.4/branches/pango/squeezeplay/src/squeezeplay/share/jive/ui/Widget.lua Mon 
Jan 19 16:16:49 2009
@@ -408,6 +408,32 @@
        return handle
 end
 
+
+function addActionListener(self, action, obj, sourceBreadCrumb, listener)
+       _assert(type(listener) == "function")
+       
+       
+       if not Framework:_getActionEventIndexByName(action) then
+               log:error("action name not registered:(" , action, "). 
Available actions: ", self:dumpActions() )
+               return 
+       end
+       log:debug("Creating widget action listener for action: (" , action, ") 
from source: ", sourceBreadCrumb)
+       
+       self:addListener(ACTION,
+                       function(event)
+                               local eventAction = event:getAction()
+                               if eventAction != action then
+                                       return EVENT_UNUSED
+                               end
+                               log:debug("Calling widget action listener for 
action: (" , action, ") from source: ", sourceBreadCrumb)
+                               
+                               local listenerResult = listener(obj, event)
+                               --default to consume unless the listener 
specifically wants to set a specific event return
+                               return listenerResult and listenerResult or 
EVENT_CONSUME
+                       end
+       )
+    
+end
 
 --[[
 

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

Reply via email to