Author: titmuss
Date: Thu Apr 10 15:15:08 2008
New Revision: 2187
URL: http://svn.slimdevices.com?rev=2187&root=Jive&view=rev
Log:
Bug: 6395
Description:
Use a spinny after setting the language, to provide user feedback something is
happening.
Modified:
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/strings.txt
trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua
Modified:
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
URL:
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua?rev=2187&root=Jive&r1=2186&r2=2187&view=diff
==============================================================================
---
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
(original)
+++
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/SetupLanguageApplet.lua
Thu Apr 10 15:15:08 2008
@@ -33,6 +33,7 @@
local Popup = require("jive.ui.Popup")
local Icon = require("jive.ui.Icon")
local Timer = require("jive.ui.Timer")
+local Task = require("jive.ui.Task")
local log = require("jive.utils.log").logger("applets.setup")
local locale = require("jive.utils.locale")
@@ -45,6 +46,7 @@
local EVENT_CONSUME = jive.ui.EVENT_CONSUME
local EVENT_ACTION = jive.ui.EVENT_ACTION
local EVENT_WINDOW_POP = jive.ui.EVENT_WINDOW_POP
+local EVENT_WINDOW_INACTIVE = jive.ui.EVENT_WINDOW_INACTIVE
local KEY_PLAY = jive.ui.KEY_PLAY
local jiveMain = jiveMain
@@ -72,9 +74,7 @@
text = self:string("LANGUAGE_" .. locale),
sound = "WINDOWSHOW",
callback = function()
- self:setLang(locale)
- self:storeSettings()
- setupNext()
+ self:setLang(locale, setupNext)
end,
focusGained = function() self:_showLang(locale) end
})
@@ -89,7 +89,7 @@
window:addWidget(menu)
-- Store the selected language when the menu is exited
- window:addListener(EVENT_WINDOW_POP,
+ window:addListener(EVENT_WINDOW_INACTIVE,
function()
self:_showLang(nil)
self:storeSettings()
@@ -164,31 +164,14 @@
Framework:styleChanged()
end
-function setLang(self, choice)
+function setLang(self, choice, next)
log:info("Locale choice set to ", choice)
- local popup = Popup("popupIcon")
- popup:setAllowScreensaver(false)
- popup:addWidget(Icon("iconConnecting"))
- local stringChoice = "LANGUAGE_" .. choice
- popup:addWidget(Label("text", self:string(stringChoice)))
- -- FIXME why doesn't this popup display immediately?
- popup:show()
-
- local langChanged = self:_setLang(choice)
- popup:addTimer(1000,
- function()
- if langChanged then
- popup:hide()
- end
- end
- )
-end
-
-function _setLang(self, choice)
self:_showLang(choice)
+
self:getSettings().locale = choice
+ -- FIXME SlimBrowser should use notification
-- if connected to a player, ask for the menu again
local player = _getCurrentPlayer(self)
if player then
@@ -198,10 +181,29 @@
end
end
- locale:setLocale(choice)
- jiveMain:jiveMainNodes()
- Framework:styleChanged()
- return true
+ -- changing the locale is slow, do this in a task with a spinny
+ self.popup = Popup("popupIcon")
+ self.popup:setAllowScreensaver(false)
+ self.popup:addWidget(Icon("iconConnecting"))
+ local stringChoice = "LOADING_LANGUAGE"
+ self.popup:addWidget(Label("text", self:string(stringChoice)))
+ self.popup:show()
+
+ self.task = Task('setLang', self,
+ function(self)
+ locale:setLocale(choice, true)
+
+ -- FIXME jiveMainNodes should use notification
+ jiveMain:jiveMainNodes()
+ Framework:styleChanged()
+
+ self.popup:hide()
+
+ if next then
+ next()
+ end
+ end
+ ):addTask()
end
function _getCurrentPlayer(self)
Modified:
trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/strings.txt
URL:
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/strings.txt?rev=2187&root=Jive&r1=2186&r2=2187&view=diff
==============================================================================
--- trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/strings.txt
(original)
+++ trunk/squeezeplay/src/squeezeplay/share/applets/SetupLanguage/strings.txt
Thu Apr 10 15:15:08 2008
@@ -94,3 +94,11 @@
IT Utilizzare la ghiera per scegliere la lingua. Premere il
pulsante centrale per continuare.
NL Gebruik het wiel om je taal te kiezen. Druk op de middelste
knop om verder te gaan.
+LOADING_LANGUAGE
+ DA Dansk
+ DE Deutsch
+ EN Loading English
+ ES Español
+ FR Français
+ IT Italiano
+ NL Nederlands
Modified: trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua
URL:
http://svn.slimdevices.com/trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua?rev=2187&root=Jive&r1=2186&r2=2187&view=diff
==============================================================================
--- trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua (original)
+++ trunk/squeezeplay/src/squeezeplay/share/jive/utils/locale.lua Thu Apr 10
15:15:08 2008
@@ -22,6 +22,7 @@
local log = require("jive.utils.log").logger("utils")
local Framework = require("jive.ui.Framework")
+local Task = require("jive.ui.Task")
module(...)
@@ -47,7 +48,7 @@
=cut
--]]
-function setLocale(self, newLocale)
+function setLocale(self, newLocale, doYield)
if newLocale == globalLocale then
return
end
@@ -55,10 +56,15 @@
globalLocale = newLocale or "EN"
readGlobalStringsFile(self)
+for i=1,100 do
-- reload existing strings files
for k, v in pairs(loadedFiles) do
+ if doYield then
+ Task:yield(true)
+ end
_parseStringsFile(self, newLocale, k, v)
end
+end
end
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins