Author: titmuss
Date: Thu Jan 24 09:36:57 2008
New Revision: 1607

URL: http://svn.slimdevices.com?rev=1607&root=Jive&view=rev
Log:
 [EMAIL PROTECTED] (orig r1606):  titmuss | 2008-01-24 17:34:28 +0000
 Bug: 6443
 Description:
 Modify Goodbye screen. Using a callback on the brightness could break if 
another applet modifies the brightness during 
 shutdown. Instead use a timer.
 
 Bug: 6651
 Description:
 On the power off screen, allow the user to press and hold home to turn off 
Jive.
 
 

Modified:
    trunk/   (props changed)
    
trunk/jive/src/pkg/jive_squeezeboxjive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua

Propchange: trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Thu Jan 24 09:36:57 2008
@@ -1,3 +1,3 @@
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1595
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1606
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
trunk/jive/src/pkg/jive_squeezeboxjive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive_squeezeboxjive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua?rev=1607&root=Jive&r1=1606&r2=1607&view=diff
==============================================================================
--- 
trunk/jive/src/pkg/jive_squeezeboxjive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
 (original)
+++ 
trunk/jive/src/pkg/jive_squeezeboxjive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
 Thu Jan 24 09:36:57 2008
@@ -31,6 +31,7 @@
 local Checkbox               = require("jive.ui.Checkbox")
 local Window                 = require("jive.ui.Window")
 
+local debug                  = require("jive.utils.debug")
 local log                    = 
require("jive.utils.log").logger("applets.setup")
 
 local jnt                    = jnt
@@ -58,6 +59,7 @@
 local EVENT_SWITCH           = 0x400000 -- XXXX fixme when public
 local EVENT_MOTION           = 0x800000 -- XXXX fixme when public
 local EVENT_WINDOW_PUSH      = jive.ui.EVENT_WINDOW_PUSH
+local EVENT_VISIBLE_ALL      = jive.ui.EVENT_VISIBLE_ALL
 local EVENT_CONSUME          = jive.ui.EVENT_CONSUME
 local EVENT_UNUSED           = jive.ui.EVENT_UNUSED
 
@@ -328,7 +330,7 @@
 end
 
 
-function _setBrightness(self, fade, lcdLevel, keyLevel, closure)
+function _setBrightness(self, fade, lcdLevel, keyLevel)
        -- stop existing fade
        if self.fadeTimer then
                self.fadeTimer:stop()
@@ -348,10 +350,6 @@
        local keyInc = (keyVal - keyLevel) / steps
 
        if lcdVal == lcdLevel and keyVal == keyLevel then
-               -- already at level, no need to fade so execute closure and 
return
-               if closure then
-                       closure()
-               end
                return
        end
 
@@ -364,10 +362,6 @@
 
                                                   -- ensure we hit the set 
value
                                                   _brightness(self, lcdLevel, 
keyLevel)
-
-                                                  if closure then
-                                                          closure()
-                                                  end
                                                   return
                                           end
 
@@ -650,9 +644,10 @@
 
 function batteryLowShow(self)
        if self.batteryPopup then
-               self.batteryPopup:show()
                return
        end
+
+       log:info("batteryLowShow")
 
        local popup = Popup("popupIcon")
 
@@ -674,10 +669,12 @@
 
        -- consume all key and scroll events
        self.batteryListener
-               = Framework:addListener(EVENT_SCROLL | EVENT_KEY_PRESS | 
EVENT_KEY_DOWN | EVENT_KEY_HOLD,
+               = Framework:addListener(EVENT_ALL_INPUT,
                                        function(event)
+                                               Framework.wakeup()
+
                                                -- allow power off
-                                               if event:getType() == 
EVENT_KEY_HOLD and event:getKeyCode() == KEY_HOME then
+                                               if event:getType() == 
EVENT_KEY_HOLD and event:getKeycode() == KEY_HOME then
                                                        self:settingsPowerOff()
                                                end
                                                return EVENT_CONSUME
@@ -692,6 +689,8 @@
 
 
 function batteryLowHide(self)
+       log:info("batteryLowHide")
+
        Framework:removeListener(self.batteryListener)
        self.batteryPopup:hide()
 
@@ -767,11 +766,20 @@
 function _powerOff(self)
        log:info("Poweroff begin")
 
-       self:_setBrightness(true, 0, 0,
-                           function()
-                                   log:info("Poweroff on")
-                                   os.execute("/sbin/poweroff")
-                           end)
+       self:_setBrightness(true, 0, 0)
+
+       -- power off when lcd is off, or after 1 seconds
+       local tries = 10
+       self.powerOffTimer = Timer(100,
+                                  function()
+                                          if self.lcdLevel == 0 or tries  == 0 
then
+                                                  log:info("Poweroff on")
+                                                  os.execute("/sbin/poweroff")
+                                          else
+                                                  tries = tries - 1
+                                          end
+                                  end)
+       self.powerOffTimer:start()
 end
 
 

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

Reply via email to