Author: bklaas
Date: Tue Apr 29 19:25:59 2008
New Revision: 2393

URL: http://svn.slimdevices.com?rev=2393&root=Jive&view=rev
Log:
Description: put the simple demo applet "Doomsday" in a specialProjects folder 
under squeezeplay
this is the applet used for instruction in 
http://mwiki.slimdevices.com/index.php/SqueezePlay_Applet_Guide

Added:
    7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/
    7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/
    
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayApplet.lua
    
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayMeta.lua
    7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/settings.lua
    7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/strings.txt  
 (with props)

Added: 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayApplet.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayApplet.lua?rev=2393&root=Jive&view=auto
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayApplet.lua
 (added)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayApplet.lua
 Tue Apr 29 19:25:59 2008
@@ -1,0 +1,137 @@
+
+--[[
+=head1 NAME
+
+applets.Doomsday.DoomsdayApplet - Doomsday Applet
+
+=head1 DESCRIPTION
+
+This applet was created solely for the purpose of the demonstration on
+http://mwiki.slimdevices.com/index.php/SqueezePlay_Applet_Guide
+
+=head1 FUNCTIONS
+
+Applet related methods are described in L<jive.Applet>. 
+
+=cut
+--]]
+
+
+-- stuff we use
+local tostring = tostring
+local oo                     = require("loop.simple")
+local string                 = require("string")
+
+local Applet                 = require("jive.Applet")
+local RadioButton            = require("jive.ui.RadioButton")
+local RadioGroup             = require("jive.ui.RadioGroup")
+local Window                 = require("jive.ui.Window")
+local Popup                  = require("jive.ui.Popup")
+local Textarea               = require('jive.ui.Textarea')
+
+local SimpleMenu             = require("jive.ui.SimpleMenu")
+local RadioGroup             = require("jive.ui.RadioGroup")
+local log                    = 
require("jive.utils.log").addCategory("doomsday", jive.utils.log.DEBUG)
+
+module(...)
+oo.class(_M, Applet)
+
+
+function menu(self, menuItem)
+
+       log:info("menu")
+       local group = RadioGroup()
+       local currentSetting = self:getSettings().currentSetting
+
+       -- create a SimpleMenu object with selections to be created     
+       local menu = SimpleMenu("menu", {
+               -- first menu item
+               {       
+                       -- text for the menu item
+                       text = self:string("DOOMSDAY_OPTION1"),
+                       -- add a radiobutton with a callback function to be 
used when selected
+                       icon = RadioButton(
+                               -- skin style of radio button (defined in 
DefaultSkin)
+                               "radio",
+                               -- group to attach button
+                               group,
+                               -- callback function
+                               function()
+                                       log:info("radio button 1 selected")
+                                       -- show the warning
+                                       self:warnMasses('DOOMSDAY_MESSAGE1')
+                                       -- store the setting to settings.lua
+                                       self:getSettings()['currentSetting'] = 1
+                                       self:storeSettings()
+                               end,
+                               -- fill the radio button if this is the 
currentSetting
+                               (currentSetting == 1)
+                       ),
+               },
+               {       
+                       text = self:string("DOOMSDAY_OPTION2"),
+                       icon = RadioButton(
+                               "radio",
+                               group,
+                               function()
+                                       log:info("radio button 2 selected")
+                                       self:warnMasses('DOOMSDAY_MESSAGE2')
+                                       self:getSettings()['currentSetting'] = 2
+                                       self:storeSettings()
+                               end,
+                               (currentSetting == 2)
+                       ),
+               },
+               {       
+                       text = self:string("DOOMSDAY_OPTION3"),
+                       icon = RadioButton(
+                               "radio",
+                               group,
+                               function()
+                                       log:info("radio button 3 selected")
+                                       self:warnMasses('DOOMSDAY_MESSAGE3')
+                                       self:getSettings()['currentSetting'] = 
3 
+                                       self:storeSettings()
+                               end,
+                               (currentSetting == 3)
+                       ),
+               },
+               {       
+                       text = self:string("DOOMSDAY_OPTION4"),
+                       icon = RadioButton(
+                               "radio",
+                               group,
+                               function()
+                                       log:info("radio button 4 selected")
+                                       self:warnMasses('DOOMSDAY_MESSAGE4')
+                                       self:getSettings()['currentSetting'] = 4
+                                       self:storeSettings()
+                               end,
+                               (currentSetting == 4)
+                       ),
+               },
+       })
+
+       -- create a window object
+       local window = Window("window", self:string("DOOMSDAY")) 
+       
+       -- add the SimpleMenu to the window
+       window:addWidget(menu)
+
+       -- show the window
+       window:show()
+end
+
+function warnMasses(self, warning)
+       log:info(self:string(warning))
+
+       -- create a Popup object, using already established 'currentsong' skin 
style
+       local doomsday = Popup('currentsong')
+
+       -- add message to popup
+       local doomsdayMessage = Textarea('popupplay', self:string(warning))
+       doomsday:addWidget(doomsdayMessage)
+
+       -- display the message for 3 seconds
+       doomsday:showBriefly(30000, nil, Window.transitionPushPopupUp, 
Window.transitionPushPopupDown)
+end

Added: 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayMeta.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayMeta.lua?rev=2393&root=Jive&view=auto
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayMeta.lua 
(added)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/DoomsdayMeta.lua 
Tue Apr 29 19:25:59 2008
@@ -1,0 +1,27 @@
+local oo            = require("loop.simple")
+local AppletMeta    = require("jive.AppletMeta")
+
+local appletManager = appletManager
+local jiveMain      = jiveMain
+
+
+module(...)
+oo.class(_M, AppletMeta)
+
+
+function jiveVersion(meta)
+       return 1, 1
+end
+
+
+function defaultSettings(meta)
+        return {
+                currentSetting = 0,
+        }
+end
+
+function registerApplet(meta)
+       
+       jiveMain:addItem(meta:menuItem('doomsdayApplet', 'home', "DOOMSDAY", 
function(applet, ...) applet:menu(...) end, 20))
+
+end

Added: 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/settings.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/settings.lua?rev=2393&root=Jive&view=auto
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/settings.lua 
(added)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/settings.lua 
Tue Apr 29 19:25:59 2008
@@ -1,0 +1,2 @@
+settings = {};
+settings["currentSetting"] = 2;

Added: 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/strings.txt
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/strings.txt?rev=2393&root=Jive&view=auto
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/strings.txt 
(added)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/strings.txt 
Tue Apr 29 19:25:59 2008
@@ -1,0 +1,34 @@
+#
+# The two letter codes are defined by ISO 639-1
+# http://en.wikipedia.org/wiki/List_of_ISO_639_codes
+
+DOOMSDAY
+       EN      Doomsday
+       DE      Doomstag
+
+DOOMSDAY_OPTION1
+       EN      Dire Warning 1
+
+DOOMSDAY_OPTION2
+       EN      Dire Warning 2
+
+DOOMSDAY_OPTION3
+       EN      Dire Warning 3
+
+DOOMSDAY_OPTION4
+       EN      Dire Warning 4
+
+DOOMSDAY_MESSAGE0
+       EN      Fear is in the air!
+
+DOOMSDAY_MESSAGE1
+       EN      The End is Nigh!
+
+DOOMSDAY_MESSAGE2
+       EN      Run for the hills!
+
+DOOMSDAY_MESSAGE3
+       EN      Get your affairs in order!
+
+DOOMSDAY_MESSAGE4
+       EN      DUCK!

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/specialProjects/Doomsday/strings.txt
------------------------------------------------------------------------------
    svn:executable = *

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

Reply via email to