Author: bklaas
Date: Wed Apr 21 14:44:07 2010
New Revision: 8721
URL: http://svn.slimdevices.com/jive?rev=8721&view=rev
Log:
Bug: 9057
Description: add ability to preview alarm sounds through a new 'preview' action
from the server
alarm preview is done through either pressing play or + (or on the touch
interface, through touch-hold)
window pops up while the alarm sound is previewed. when the window is exited,
the player is paused
current limitations of implementation:
1. very difficult to discover the means of previewing. there is currently no
mechanism for sending help text from the server in a slimbrowse menu such as
this to message the user.
2. previewing an alarm sound wipes the current playlist and replaces it with
the alarm sound.
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAlargeSkin/WQVGAlargeSkinApplet.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua?rev=8721&r1=8720&r2=8721&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/QVGAbaseSkin/QVGAbaseSkinApplet.lua
Wed Apr 21 14:44:07 2010
@@ -1652,7 +1652,7 @@
s.alarm_header = {
w = screenWidth,
- padding = { 50, 0, 0, 0 },
+ padding = { 50, 0, 50, 0 },
order = { 'icon', 'time' },
icon = {
h = WH_FILL,
@@ -1671,6 +1671,9 @@
align = "left",
font = _font(32),
}
+ s.preview_text = _uses(s.alarm_time, {
+ font = _boldfont(c.TITLE_FONT_SIZE),
+ })
-- alarm menu window
s.alarm_popup = {
@@ -1870,7 +1873,6 @@
padding = { 0, 66, 0, 0 },
})
-
s.icon_alarm = {
img = _loadImage(self, "Icons/icon_alarm.png")
}
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=8721&r1=8720&r2=8721&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
Wed Apr 21 14:44:07 2010
@@ -773,7 +773,7 @@
end
-- it's very helpful at times to dump the request table here to see
what command is being issued
- --debug.dump(request)
+ -- debug.dump(request)
-- send the command
_server:userRequest(sink, playerid, request)
@@ -1719,7 +1719,7 @@
log:debug("_actionHandler(", actionName, ")")
if log:isDebug() then
- debug.dump(item, 4)
+-- debug.dump(item, 4)
end
local choiceAction
@@ -1817,6 +1817,11 @@
iActionContextMenu = _safeDeref(item, 'actions', 'more')
onAction = _safeDeref(item, 'actions', 'on')
offAction = _safeDeref(item, 'actions', 'off')
+
+ -- preview is a special action handler for previewing alarm
sounds
+ elseif actionName == 'preview' then
+ bAction = _safeDeref(chunk, 'base', 'actions',
'preview')
+ iAction = _safeDeref(item, 'actions', 'preview')
end
local isContextMenu = _safeDeref(item, 'actions', actionName,
'params', 'isContextMenu')
@@ -1830,6 +1835,9 @@
if not (iAction or bAction or onAction or offAction or
choiceAction) then
bAction = _safeDeref(chunk, 'base', 'actions',
actionName)
iAction = _safeDeref(item, 'actions', actionName)
+ elseif actionName == 'preview' then
+ -- allow actionName of preview to stay that way
+
else
-- if we reach here, it's a DO action...
-- okay to call on or off this, as they are just
special cases of 'do'
@@ -1943,7 +1951,6 @@
end
end -- elseif bAction
---debug.dump(jsonAction, 8)
-- now we may have found a command
if jsonAction or useNextWindow then
log:debug("_actionHandler(", actionName, "):
json action")
@@ -2046,6 +2053,10 @@
end
end
+ if actionName == 'preview' then
+ return _alarmPreviewWindow(iAction and
iAction.title)
+ end
+
return EVENT_CONSUME
end
end
@@ -2075,6 +2086,56 @@
return EVENT_UNUSED
end
+function _alarmPreviewWindow(title)
+
+ -- popup
+ local window = Window("alarm_popup",
_string('SLIMBROWSER_ALARM_PREVIEW'))
+ local icon = Icon('icon_alarm')
+ local label = Label('preview_text', title )
+ local headerGroup = Group('alarm_header', {
+ icon = icon,
+ time = label,
+ })
+
+ local hideAction = function()
+ log:warn('hide alarm preview')
+ window:hide(Window.transitionNone)
+ return EVENT_CONSUME
+ end
+
+ local windowPopAction = function()
+ log:warn('window goes pop!')
+ _player:pause()
+ return EVENT_CONSUME
+ end
+
+ local menu = SimpleMenu('menu')
+ menu:addItem({
+ text = _string("SLIMBROWSER_DONE"),
+ sound = "WINDOWHIDE",
+ callback = hideAction,
+ })
+
+ window:ignoreAllInputExcept({"back", "go_home",
"go_home_or_now_playing", "volume_up", "volume_down", "stop", "pause", "power"})
+
+ window:addListener(EVENT_WINDOW_POP,
+ windowPopAction
+ )
+
+ menu:setHeaderWidget(headerGroup)
+
+ window:setButtonAction('rbutton', 'cancel')
+ window:addActionListener("cancel", window, hideAction)
+
+ window:setButtonAction('lbutton', nil, nil)
+
+ window:addWidget(menu)
+ window:setShowFrameworkWidgets(false)
+ window:setAllowScreensaver(false)
+ window:show(Window.transitionFadeIn)
+ return EVENT_CONSUME
+
+end
-- map from a key to an actionName
@@ -2155,6 +2216,17 @@
-- further, we want the event to propagate to the active widget, so
return EVENT_UNUSED
local item = db:item(dbIndex)
if item and item["_jive_button"] then
+ -- special case: an action of "preview", which is used to
preview alarm sounds before listening
+ if item and item.actions and item.actions.preview then
+ if evtType == ACTION then
+ log:warn('--->Trapped what Squeezeplay thinks
is an attempt to preview an alarm sound')
+ local action = event:getAction()
+ local actionName = _actionToActionName[action]
+ if actionName == 'play' or actionName == 'more'
then
+ return _actionHandler(menu, menuItem,
db, dbIndex, event, 'preview', item)
+ end
+ end
+ end
return EVENT_UNUSED
end
@@ -2335,7 +2407,6 @@
rbutton = nowPlayingButton,
})
window:setTitleWidget(newTitleWidget)
-
-- make sure it's a number for the comparison below
-- Lua insists on checking type while Perl couldn't care less :(
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt?rev=8721&r1=8720&r2=8721&view=diff
==============================================================================
--- 7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
(original)
+++ 7.5/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/strings.txt
Wed Apr 21 14:44:07 2010
@@ -364,3 +364,9 @@
RU ÐодклÑÑение к
SV Ansluts till
+SLIMBROWSER_ALARM_PREVIEW
+ EN Alarm Preview
+
+SLIMBROWSER_DONE
+ EN Done
+
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAlargeSkin/WQVGAlargeSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAlargeSkin/WQVGAlargeSkinApplet.lua?rev=8721&r1=8720&r2=8721&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAlargeSkin/WQVGAlargeSkinApplet.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAlargeSkin/WQVGAlargeSkinApplet.lua
Wed Apr 21 14:44:07 2010
@@ -1622,6 +1622,9 @@
font = _boldfont(62),
border = { 0, 14, 0, 0 },
}
+ s.preview_text = _uses(s.alarm_time, {
+ font = _boldfont(TITLE_FONT_SIZE),
+ })
-- alarm menu window
s.alarm_popup = {
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua?rev=8721&r1=8720&r2=8721&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/WQVGAsmallSkin/WQVGAsmallSkinApplet.lua
Wed Apr 21 14:44:07 2010
@@ -2162,6 +2162,10 @@
font = _boldfont(62),
}
+ s.preview_text = _uses(s.alarm_time, {
+ font = _boldfont(TITLE_FONT_SIZE),
+ })
+
-- alarm menu window
s.alarm_popup = {
x = 10,
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins