Author: titmuss
Date: Mon Aug 18 03:58:43 2008
New Revision: 2864

URL: http://svn.slimdevices.com?rev=2864&root=Jive&view=rev
Log:
Bug: N/A
Description:
Missing select skin applet.


Added:
    7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/
    
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinApplet.lua
    
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinMeta.lua

Added: 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinApplet.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinApplet.lua?rev=2864&root=Jive&view=auto
==============================================================================
--- 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinApplet.lua
 (added)
+++ 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinApplet.lua
 Mon Aug 18 03:58:43 2008
@@ -1,0 +1,95 @@
+
+--[[
+=head1 NAME
+
+applets.SelectSkin.SelectSkinApplet - An applet to select different 
SqueezePlay skins
+
+=head1 DESCRIPTION
+
+This applet allows the SqueezePlay skin to be selected.
+
+=head1 FUNCTIONS
+
+Applet related methods are described in L<jive.Applet>. 
+SelectSkinApplet overrides the following methods:
+
+=cut
+--]]
+
+
+-- stuff we use
+local pairs = pairs
+
+local table           = require("table")
+
+local oo              = require("loop.simple")
+local logging         = require("logging")
+
+local Applet          = require("jive.Applet")
+local RadioButton     = require("jive.ui.RadioButton")
+local RadioGroup      = require("jive.ui.RadioGroup")
+local SimpleMenu      = require("jive.ui.SimpleMenu")
+local Window          = require("jive.ui.Window")
+local Framework       = require("jive.ui.Framework")
+local jul             = require("jive.utils.log")
+
+local JiveMain        = jiveMain
+local log             = jul.logger("applets.browser")
+
+
+module(..., Framework.constants)
+oo.class(_M, Applet)
+
+
+function selectSkin(self, menuItem)
+       local window = Window("window", menuItem.text, 'settingstitle')
+       local menu = SimpleMenu("menu")
+       menu:setComparator(menu.itemComparatorAlpha)
+
+       local group = RadioGroup()
+
+       -- add skins
+       local selectedSkin = JiveMain:getSelectedSkin()
+       for appletName, name in JiveMain:skinIterator() do
+               menu:addItem({
+                       text = name,
+                       icon = RadioButton(
+                               "radio", 
+                               group, 
+                               function()
+                                       JiveMain:setSelectedSkin(appletName)
+
+                                       self:getSettings().skin = appletName
+                                       self.changed = true
+                               end,
+                               appletName == selectedSkin
+                       )
+               })
+       end
+
+       window:addWidget(menu)
+
+       window:addListener(EVENT_WINDOW_POP,
+               function()
+                       if self.changed then
+                               self:storeSettings()
+                       end
+               end
+       )
+
+       self:tieAndShowWindow(window)
+       return window
+end
+
+
+--[[
+
+=head1 LICENSE
+
+Copyright 2007 Logitech. All Rights Reserved.
+
+This file is subject to the Logitech Public Source License Version 1.0. Please 
see the LICENCE file for details.
+
+=cut
+--]]
+

Added: 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinMeta.lua
URL: 
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinMeta.lua?rev=2864&root=Jive&view=auto
==============================================================================
--- 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinMeta.lua
 (added)
+++ 
7.3/trunk/squeezeplay/src/squeezeplay/share/applets/SelectSkin/SelectSkinMeta.lua
 Mon Aug 18 03:58:43 2008
@@ -1,0 +1,75 @@
+
+--[[
+=head1 NAME
+
+applets.SelectSkin.SelectSkinMeta - Select SqueezePlay skin
+
+=head1 DESCRIPTION
+
+See L<applets.SelectSkin.SelectSkinApplet>.
+
+=head1 FUNCTIONS
+
+See L<jive.AppletMeta> for a description of standard applet meta functions.
+
+=cut
+--]]
+
+
+local oo            = require("loop.simple")
+
+local AppletMeta    = require("jive.AppletMeta")
+
+local log             = require("jive.utils.log").logger("applets.browser")
+
+local appletManager = appletManager
+local jiveMain      = jiveMain
+
+
+module(...)
+oo.class(_M, AppletMeta)
+
+
+function jiveVersion(meta)
+       return 1, 1
+end
+
+
+function defaultSettings(meta)
+       return { 
+               skin = "DefaultSkin",
+       }
+end
+
+
+function registerApplet(meta)
+       jiveMain:addItem(meta:menuItem('appletSelectSkin', 'settings', 
'SELECT_SKIN', function(applet, ...) applet:selectSkin(...) end))
+end
+
+
+function configureApplet(meta)
+       local skin = meta:getSettings().skin
+       jiveMain:setSelectedSkin(skin)
+
+       local skins = 0
+       for s in jiveMain:skinIterator() do
+               skins = skins + 1
+       end
+
+       if skins <= 1 then
+               jiveMain:removeItemById('appletSelectSkin')
+       end
+end
+
+
+--[[
+
+=head1 LICENSE
+
+Copyright 2007 Logitech. All Rights Reserved.
+
+This file is subject to the Logitech Public Source License Version 1.0. Please 
see the LICENCE file for details.
+
+=cut
+--]]
+

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

Reply via email to