Author: bklaas
Date: Wed Feb 6 15:38:47 2008
New Revision: 1836
URL: http://svn.slimdevices.com?rev=1836&root=Jive&view=rev
Log:
Bug: 6981
Description:
In current playlist window, only update title bar with 'Off' when player is
off, but continue to show playlist
Do not hide NowPlaying window when player is off
Update title bar in NowPlaying correctly depending first on player power,
second (if on) on play mode
Poach a string for NowPlaying from SlimBrowser
Modified:
branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua
branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/strings.txt
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
Modified:
branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua?rev=1836&root=Jive&r1=1835&r2=1836&view=diff
==============================================================================
---
branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua
(original)
+++
branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/NowPlayingApplet.lua
Wed Feb 6 15:38:47 2008
@@ -73,7 +73,13 @@
local ARTWORK_SIZE = 154
local showProgressBar = true
-
+local modeTokens = {
+ off = "SCREENSAVER_OFF",
+ play = "SCREENSAVER_NOWPLAYING",
+ pause = "SCREENSAVER_PAUSED",
+ stop = "SCREENSAVER_STOPPED"
+}
+
----------------------------------------------------------------------------------------
-- Helper Functions
--
@@ -173,13 +179,37 @@
if player ~= self.player then
return
end
+
+ local mode = self.player:getPlayMode()
+
-- hide this window if the player is turned off
if power == 0 then
if self['browse'] and self['browse'].window then
- self['browse'].window:hide()
- end
- end
-end
+ self['browse'].titleGroup:setWidgetValue("title",
self:string(modeTokens['off']))
+ end
+ if self['ss'] and self['ss'].window then
+ self['ss'].titleGroup:setWidgetValue("title",
self:string(modeTokens['off']))
+ end
+ elseif power == 1 then
+ if self['browse'] and self['browse'].window then
+ self['browse'].titleGroup:setWidgetValue("title",
self:string(modeTokens[mode]))
+ end
+ if self['ss'] and self['ss'].window then
+ self['ss'].titleGroup:setWidgetValue("title",
self:string(modeTokens[mode]))
+ end
+ end
+end
+
+function notify_playerDelete(self, player)
+ if player ~= self.player then
+ return
+ end
+ -- player has left the building, close Now Playing browse window
+ if self['browse'] and self['browse'].window then
+ self['browse'].window:hide()
+ end
+end
+
function notify_playerTrackChange(self, player, nowPlaying)
log:warn("PLAYER TRACK NOTIFICATION RECEIVED")
@@ -329,8 +359,8 @@
local elapsed, duration = self.player:getTrackElapsed()
if ws.progressSlider then
- if duration and duration > 0 then
- ws.progressSlider:setRange(0, duration, elapsed)
+ if duration and tonumber(duration) > 0 then
+ ws.progressSlider:setRange(0, tonumber(duration),
tonumber(elapsed))
else
-- If 0 just set it to 100
ws.progressSlider:setRange(0, 100, 0)
@@ -381,14 +411,13 @@
function _updateMode(self, mode, ws)
if not ws then ws = self[windowStyle] end
if not ws then return end
+ local power = self.player:getPlayerPower()
+ local token = mode
+ if power == 0 then
+ token = 'off'
+ end
if ws.titleGroup then
- if mode == "play" then
- ws.titleGroup:setWidgetValue("title",
self:string("SCREENSAVER_NOWPLAYING"))
- elseif mode == "pause" then
- ws.titleGroup:setWidgetValue("title",
self:string("SCREENSAVER_PAUSED"))
- else
- ws.titleGroup:setWidgetValue("title",
self:string("SCREENSAVER_STOPPED"))
- end
+ ws.titleGroup:setWidgetValue("title",
self:string(modeTokens[token]))
end
end
Modified: branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/strings.txt
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/strings.txt?rev=1836&root=Jive&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/strings.txt
(original)
+++ branches/7.0/jive/src/pkg/jive/share/applets/NowPlaying/strings.txt Wed Feb
6 15:38:47 2008
@@ -42,3 +42,10 @@
IT %s di %s
NL %s van %s
+SCREENSAVER_OFF
+ DE Aus
+ EN Off
+ ES Apagado
+ FR Désactivé
+ IT Disattivato
+ NL Uit
Modified:
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=1836&root=Jive&r1=1835&r2=1836&view=diff
==============================================================================
---
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
(original)
+++
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
Wed Feb 6 15:38:47 2008
@@ -126,6 +126,13 @@
-- connectingToPlayer popup handlers
local _connectingPopup = false
local _menuReceived = false
+
+local modeTokens = {
+ play = "SLIMBROWSER_NOW_PLAYING",
+ pause = "SLIMBROWSER_PAUSED",
+ stop = "SLIMBROWSER_STOPPED",
+ off = "SLIMBROWSER_OFF"
+}
--==============================================================================
-- Local functions
--==============================================================================
@@ -1734,10 +1741,10 @@
end
-- showEmptyPlaylist
--- if the player is off or if the playlist is empty, we replace _statusStep
with this window
+-- if the player playlist is empty, we replace _statusStep with this window
function showEmptyPlaylist(token)
- local window = Window("window", _string('SLIMBROWSER_NOW_PLAYING'),
'currentplaylisttitle')
+ local window = Window("window", _string(modeTokens['play']),
'currentplaylisttitle')
local menu = SimpleMenu("menu")
menu:addItem({
text = _string(token),
@@ -1767,9 +1774,8 @@
local playerPower = _player:getPlayerPower()
if playerPower == 0 then
- local customWindow =
showEmptyPlaylist('SLIMBROWSER_OFF')
- customWindow:show()
- return EVENT_CONSUME
+ _statusStep.window:setTitle(_string(modeTokens['off']))
+ _statusStep.window:setTitleStyle("currentplaylisttitle")
end
if playlistSize == 0 then
@@ -1852,7 +1858,7 @@
end
function notify_playerPower(self, player, power)
- log:info('SlimBrowser.notify_playerPower')
+ log:debug('SlimBrowser.notify_playerPower')
if _player ~= player then
return
end
@@ -1863,56 +1869,60 @@
end
local playlistSize = playerStatus.playlist_tracks
+ local mode = player:getPlayMode()
-- when player goes off, user should get single item styled 'Off'
playlist
local step = _statusStep
local emptyStep = _emptyStep
if step.menu then
- -- show 'OFF' in playlist window when the player is off
+ -- show 'OFF' in playlist window title when the player is off
if power == 0 then
- local customWindow =
showEmptyPlaylist('SLIMBROWSER_OFF')
- if emptyStep then
- customWindow:replace(emptyStep.window,
Window.transitionFadeIn)
- end
if step.window then
- customWindow:replace(step.window,
Window.transitionFadeIn)
- end
- elseif power == 1 and emptyStep then
- -- only with the player on and a non-zero playlist do
we bring the playlist up
+ step.window:setTitle(_string("SLIMBROWSER_OFF"))
+
step.window:setTitleStyle("currentplaylisttitle")
+ end
+ elseif power == 1 then
if step.window then
- step.window:replace(emptyStep.window,
Window.transitionFadeIn)
+ if emptyStep then
+ step.window:replace(emptyStep.window,
Window.transitionFadeIn)
+ end
+ step.window:setTitle(_string(modeTokens[mode]))
+
step.window:setTitleStyle("currentplaylisttitle")
end
end
end
end
function notify_playerModeChange(self, player, mode)
- log:info('SlimBrowser.notify_playerModeChange')
+ log:debug('SlimBrowser.notify_playerModeChange')
if _player ~= player then
return
end
local step = _statusStep
-
- if mode == "play" then
- step.window:setTitle(_string("SLIMBROWSER_NOW_PLAYING"))
- step.window:setTitleStyle("currentplaylisttitle")
- elseif mode == "pause" then
- step.window:setTitle(_string("SLIMBROWSER_PAUSED"))
- step.window:setTitleStyle("currentplaylisttitle")
- elseif mode == "stop" then
- step.window:setTitle(_string("SLIMBROWSER_STOPPED"))
- step.window:setTitleStyle("currentplaylisttitle")
- end
+ local power = player:getPlayerPower()
+ local token = mode
+ if power == 0 then
+ token = 'off'
+ end
+
+ step.window:setTitle(_string(modeTokens[token]))
+ step.window:setTitleStyle("currentplaylisttitle")
+
end
function notify_playerPlaylistChange(self, player)
- log:info('SlimBrowser.notify_playerPlaylistChange')
+ log:warn('SlimBrowser.notify_playerPlaylistChange')
if _player ~= player then
return
end
+ local power = player:getPlayerPower()
+ if power == 0 then
+ return
+ end
+
local playerStatus = player:getPlayerStatus()
local step = _statusStep
@@ -1925,11 +1935,17 @@
end
function notify_playerTrackChange(self, player, nowplaying)
- log:info('SlimBrowser.notify_playerTrackChange')
+ log:warn('SlimBrowser.notify_playerTrackChange')
if _player ~= player then
return
end
+
+ local power = player:getPlayerPower()
+ if power == 0 then
+ return
+ end
+
local playerStatus = player:getPlayerStatus()
local step = _statusStep
@@ -2057,9 +2073,9 @@
local playerPower = _player:getPlayerPower()
log:info('power: ', playerPower)
if playerPower == 0 then
- local customWindow = showEmptyPlaylist('SLIMBROWSER_OFF')
if _statusStep.window then
- customWindow:replace(_statusStep.window,
Window.transitionFadeIn)
+ _statusStep.window:setTitle(_string("SLIMBROWSER_OFF"))
+ _statusStep.window:setTitleStyle("currentplaylisttitle")
end
end
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins