Author: bklaas
Date: Fri Jul 30 09:44:40 2010
New Revision: 9006
URL: http://svn.slimdevices.com/jive?rev=9006&view=rev
Log:
Bug: n/a
Description: support for a jive.ui.HomeMenu driven My Apps menu
uses an isApp flag to decide if the home menu item is an app, and builds the
items into the MyApps node accordingly
requires 7.6 r31139 server checkin to have the CM add/remove/reorder functions
work.
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/CustomizeHomeMenu/CustomizeHomeMenuApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/SlimMenusApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/strings.txt
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/CustomizeHomeMenu/CustomizeHomeMenuApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/CustomizeHomeMenu/CustomizeHomeMenuApplet.lua?rev=9006&r1=9005&r2=9006&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/CustomizeHomeMenu/CustomizeHomeMenuApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/CustomizeHomeMenu/CustomizeHomeMenuApplet.lua
Fri Jul 30 09:44:40 2010
@@ -179,6 +179,26 @@
local settings = self:getSettings()
+ -- theItem is either the special custom home item for an app
+ -- use theItem instead of item for the add/remove to home actions
+ -- use item for the reordering actions
+ local theItem = item
+ local customHomeItem = nil
+ local hiddenCustomHomeItem = nil
+ if item.node ~= 'home' then
+ local id = 'hm_' .. item.id
+ customHomeItem = jiveMain:getNodeItemById(id, 'home')
+ if not customHomeItem then
+ customHomeItem = jiveMain:getNodeItemById(id, 'hidden')
+ if customHomeItem then
+ hiddenCustomHomeItem = true
+ end
+ end
+ end
+ if customHomeItem then
+ theItem = customHomeItem
+ end
+
if item.noCustom and item.node == 'home' then
menu:addItem({
text = self:string('ITEM_CANNOT_BE_HIDDEN'),
@@ -187,24 +207,24 @@
return EVENT_CONSUME
end
})
- elseif item.node == 'home' or settings[item.id] == 'home' then
+ elseif item.node == 'home' or settings[item.id] == 'home' or
(customHomeItem and not hiddenCustomHomeItem) then
menu:addItem({
text = self:string('REMOVE_FROM_HOME'),
callback = function()
- if item.node == 'home' then
+ if theItem.node == 'home' then
self:_timedExec(
function()
-
jiveMain:setNode(item, 'hidden')
-
self:getSettings()[item.id] = 'hidden'
+
jiveMain:setNode(theItem, 'hidden')
+
self:getSettings()[theItem.id] = 'hidden'
end
)
else
self:_timedExec(
function()
-
self:getSettings()[item.id] = nil
-
jiveMain:removeItemFromNode(item, 'home')
+
self:getSettings()[theItem.id] = nil
+
jiveMain:removeItemFromNode(theItem, 'home')
end
)
@@ -218,8 +238,8 @@
menu:addItem({
text = self:string('ADD_TO_HOME'),
callback = function()
- self:getSettings()[item.id] = 'home'
- local homeItem = jiveMain:addItemToNode(item,
'home')
+ self:getSettings()[theItem.id] = 'home'
+ local homeItem =
jiveMain:addItemToNode(theItem, 'home')
jiveMain:itemToBottom(homeItem, 'home')
window:hide()
self:_storeSettings('home')
@@ -228,7 +248,7 @@
function()
appletManager:callService("goHome")
local menu =
jiveMain:getNodeMenu('home')
- local restoredItemIdx =
menu:getIdIndex(item.id)
+ local restoredItemIdx =
menu:getIdIndex(theItem.id)
menu:setSelectedIndex(restoredItemIdx)
end
)
@@ -247,7 +267,6 @@
-- e.g. move to top when already at top
local nodeMenu = jiveMain:getNodeMenu(node)
local itemIdx = nodeMenu:getIdIndex(item.id)
-
if itemIdx > 1 then
menu:addItem({
text = self:string("MOVE_TO_TOP"),
@@ -317,6 +336,7 @@
window:show(Window.transitionFadeIn)
return
end
+
-- many of the UI functions of repositioning items work better
-- if there's a small delay before execution so the user sees them happening
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua?rev=9006&r1=9005&r2=9006&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
Fri Jul 30 09:44:40 2010
@@ -2091,6 +2091,9 @@
s.hm_radios = _uses(s._buttonicon, {
img = _loadImage(self, "IconsResized/icon_internet_radio" ..
skinSuffix),
})
+ s.hm_myApps = _uses(s._buttonicon, {
+ img = _loadImage(self, "IconsResized/icon_my_apps" ..
skinSuffix),
+ })
s.hm_myMusic = _uses(s._buttonicon, {
img = _loadImage(self, "IconsResized/icon_mymusic" ..
skinSuffix),
})
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/SlimMenusApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/SlimMenusApplet.lua?rev=9006&r1=9005&r2=9006&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/SlimMenusApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/SlimMenusApplet.lua
Fri Jul 30 09:44:40 2010
@@ -1,6 +1,6 @@
-- stuff we use
-local tostring, tonumber, type, sort = tostring, tonumber, type, sort
+local tostring, tonumber, type, sort, setmetatable = tostring, tonumber, type,
sort, setmetatable
local pairs, ipairs, select, _assert = pairs, ipairs, select, _assert
local oo = require("loop.simple")
@@ -110,6 +110,23 @@
return res
end
+-- defines a new item that inherits from an existing item
+local function _uses(parent, value)
+ local item = {}
+ setmetatable(item, { __index = parent })
+
+ for k,v in pairs(value or {}) do
+ if type(v) == "table" and type(parent[k]) == "table" then
+ -- recursively inherrit from parent item
+ item[k] = _uses(parent[k], v)
+ else
+ item[k] = v
+ end
+ end
+
+ return item
+end
+
function init(self)
jnt:subscribe(self)
@@ -317,15 +334,21 @@
end
end
--add item to home menu only if this is for the current server or it doesn't
exist. Only current server responses may replace existing items.
-function _addItem(self, item, isCurrentServer)
+function _addItem(self, item, isCurrentServer, addToHome)
if isCurrentServer or not _playerMenus[item.id] then
_playerMenus[item.id] = item
jiveMain:addItem(item)
+ if addToHome then
+ local customHomeItem = _uses(item, {
+ id = 'hm_' .. item.id,
+ node = 'home',
+ })
+ jiveMain:addItem(customHomeItem)
+ end
else
log:debug("item already present: ", item.id)
end
end
-
--register remote ss only if it doesn't exist. Only current server responses
may replace existing items.
function _registerRemoteScreensaver(self, serverData)
@@ -394,6 +417,16 @@
return appType
end
+
+function _addMyAppsNode(self)
+ jiveMain:addNode( { id = 'myApps', iconStyle = 'hm_myApps', node =
'home', text = self:string('MENUS_MY_APPS'), weight = 30 } )
+ -- remove the old style My Apps item, if it exists
+ jiveMain:removeItemById('opmlmyapps')
+ self.myAppsNode = true
+ return
+end
+
+
-- _menuSink
-- returns a sink with a closure to self
-- cmd is passed in so we know what process function to call
@@ -442,9 +475,11 @@
for k, v in pairs(menuItems) do
+ local addAppToHome = false
local item = {
id = v.id,
node = v.node,
+ isApp = v.isApp,
style = v.style,
text = v.text,
homeMenuText = v.homeMenuText,
@@ -452,7 +487,17 @@
window = v.window,
sound = "WINDOWSHOW",
screensavers = v.screensavers
- }
+ }
+
+ if item.isApp == 1 then
+ if not self.myAppsNode then
+ self:_addMyAppsNode()
+ end
+ if item.node == 'home' then
+ addAppToHome = true
+ end
+ item.node = 'myApps'
+ end
local itemIcon
if v.window then
@@ -529,6 +574,8 @@
if not item.id then
log:info("no id for menu item: ", item.text)
+ elseif item.id == 'opmlmyapps' and self.myAppsNode then
+ --ignore, if self.myAppsNode is set that means
we're delivering My Apps via a node and opml home menu items
elseif item.id == "playerpower" and
System:hasSoftPower() and System:getMachine() ~= 'squeezeplay' then
--ignore, playerpower no longer shown to users
since we use power button, unless this is a device without a power button
elseif item.id == "settingsPIN" then
@@ -584,7 +631,7 @@
item.removeOnServerChange = true
--add the item to the menu
- self:_addItem(item, isCurrentServer)
+ self:_addItem(item, isCurrentServer,
addAppToHome)
else
local actionInternal = function (noLocking)
@@ -705,7 +752,8 @@
end
end
end
- self:_addItem(item, isCurrentServer)
+
+ self:_addItem(item, isCurrentServer,
addAppToHome)
end
end
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/strings.txt
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/strings.txt?rev=9006&r1=9005&r2=9006&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/strings.txt
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimMenus/strings.txt
Fri Jul 30 09:44:40 2010
@@ -17,6 +17,21 @@
RU ÐÐ¾Ñ Ð¼ÑзÑка
SV Min musik
+MENUS_MY_APPS
+ CS Moje aplikace
+ DA Mine programmer
+ DE Eigene Anwendungen
+ EN My Apps
+ ES Mis aplicaciones
+ FI Omat sovellukset
+ FR Mes applications
+ IT Applicazioni
+ NL Mijn toepassingen
+ NO Mine tjenester
+ PL Moje aplikacje
+ RU Ðои пÑиложениÑ
+ SV Mina program
+
MENUS_INTERNET_RADIO
CS Internetové rádio
DA Internetradio
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua?rev=9006&r1=9005&r2=9006&view=diff
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
(original)
+++
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
Fri Jul 30 09:44:40 2010
@@ -2634,6 +2634,9 @@
})
s.hm_radios = _uses(_buttonicon, {
img = _loadImage(self, "IconsResized/icon_internet_radio" ..
skinSuffix),
+ })
+ s.hm_myApps = _uses(_buttonicon, {
+ img = _loadImage(self, "IconsResized/icon_my_apps" ..
skinSuffix),
})
s.hm_myMusic = _uses(_buttonicon, {
img = _loadImage(self, "IconsResized/icon_mymusic" ..
skinSuffix),
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins