Author: adrian
Date: Wed Apr 30 14:30:34 2008
New Revision: 2414

URL: http://svn.slimdevices.com?rev=2414&root=Jive&view=rev
Log:
Bug: N/A
Description: add nettest front end for controlle

Added:
    7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/
    
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua
   (with props)
    
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
   (with props)
    
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt   
(with props)
Modified:
    7.1/trunk/squeezeplay/src/squeezeplay/Makefile.am
    7.1/trunk/squeezeplay/src/squeezeplay/Makefile.in

Modified: 7.1/trunk/squeezeplay/src/squeezeplay/Makefile.am
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/Makefile.am?rev=2414&root=Jive&r1=2413&r2=2414&view=diff
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/Makefile.am (original)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/Makefile.am Wed Apr 30 14:30:34 2008
@@ -363,6 +363,12 @@
        share/applets/HttpAuth/HttpAuthApplet.lua \
        share/applets/HttpAuth/HttpAuthMeta.lua \
        share/applets/HttpAuth/strings.txt
+
+applets_setupnettestdir = $(datadir)/jive/applets/SetupNetTest
+dist_applets_setupnettest_DATA = \
+       share/applets/SetupNetTest/SetupNetTestApplet.lua \
+       share/applets/SetupNetTest/SetupNetTestMeta.lua \
+       share/applets/SetupNetTest/strings.txt  
 
 # Default skin
 applets_defaultskindir = $(pkgdatadir)/applets/DefaultSkin

Modified: 7.1/trunk/squeezeplay/src/squeezeplay/Makefile.in
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/Makefile.in?rev=2414&root=Jive&r1=2413&r2=2414&view=diff
==============================================================================
--- 7.1/trunk/squeezeplay/src/squeezeplay/Makefile.in (original)
+++ 7.1/trunk/squeezeplay/src/squeezeplay/Makefile.in Wed Apr 30 14:30:34 2008
@@ -55,6 +55,7 @@
        $(dist_applets_setupappletinstaller_DATA) \
        $(dist_applets_setupdatetime_DATA) \
        $(dist_applets_setuplanguage_DATA) \
+       $(dist_applets_setupnettest_DATA) \
        $(dist_applets_setupsoundeffects_DATA) \
        $(dist_applets_setupsoundeffects_sounds_DATA) \
        $(dist_applets_setupwallpaper_DATA) \
@@ -109,6 +110,7 @@
        "$(DESTDIR)$(applets_setupappletinstallerdir)" \
        "$(DESTDIR)$(applets_setupdatetimedir)" \
        "$(DESTDIR)$(applets_setuplanguagedir)" \
+       "$(DESTDIR)$(applets_setupnettestdir)" \
        "$(DESTDIR)$(applets_setupsoundeffectsdir)" \
        "$(DESTDIR)$(applets_setupsoundeffects_soundsdir)" \
        "$(DESTDIR)$(applets_setupwallpaperdir)" \
@@ -167,6 +169,7 @@
 dist_applets_setupappletinstallerDATA_INSTALL = $(INSTALL_DATA)
 dist_applets_setupdatetimeDATA_INSTALL = $(INSTALL_DATA)
 dist_applets_setuplanguageDATA_INSTALL = $(INSTALL_DATA)
+dist_applets_setupnettestDATA_INSTALL = $(INSTALL_DATA)
 dist_applets_setupsoundeffectsDATA_INSTALL = $(INSTALL_DATA)
 dist_applets_setupsoundeffects_soundsDATA_INSTALL = $(INSTALL_DATA)
 dist_applets_setupwallpaperDATA_INSTALL = $(INSTALL_DATA)
@@ -193,6 +196,7 @@
        $(dist_applets_setupappletinstaller_DATA) \
        $(dist_applets_setupdatetime_DATA) \
        $(dist_applets_setuplanguage_DATA) \
+       $(dist_applets_setupnettest_DATA) \
        $(dist_applets_setupsoundeffects_DATA) \
        $(dist_applets_setupsoundeffects_sounds_DATA) \
        $(dist_applets_setupwallpaper_DATA) \
@@ -652,6 +656,12 @@
        share/applets/HttpAuth/HttpAuthApplet.lua \
        share/applets/HttpAuth/HttpAuthMeta.lua \
        share/applets/HttpAuth/strings.txt
+
+applets_setupnettestdir = $(datadir)/jive/applets/SetupNetTest
+dist_applets_setupnettest_DATA = \
+       share/applets/SetupNetTest/SetupNetTestApplet.lua \
+       share/applets/SetupNetTest/SetupNetTestMeta.lua \
+       share/applets/SetupNetTest/strings.txt  
 
 
 # Default skin
@@ -1511,6 +1521,23 @@
          echo " rm -f '$(DESTDIR)$(applets_setuplanguagedir)/$$f'"; \
          rm -f "$(DESTDIR)$(applets_setuplanguagedir)/$$f"; \
        done
+install-dist_applets_setupnettestDATA: $(dist_applets_setupnettest_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(applets_setupnettestdir)" || $(mkdir_p) 
"$(DESTDIR)$(applets_setupnettestdir)"
+       @list='$(dist_applets_setupnettest_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_applets_setupnettestDATA_INSTALL) '$$d$$p' 
'$(DESTDIR)$(applets_setupnettestdir)/$$f'"; \
+         $(dist_applets_setupnettestDATA_INSTALL) "$$d$$p" 
"$(DESTDIR)$(applets_setupnettestdir)/$$f"; \
+       done
+
+uninstall-dist_applets_setupnettestDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_applets_setupnettest_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(applets_setupnettestdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(applets_setupnettestdir)/$$f"; \
+       done
 install-dist_applets_setupsoundeffectsDATA: 
$(dist_applets_setupsoundeffects_DATA)
        @$(NORMAL_INSTALL)
        test -z "$(applets_setupsoundeffectsdir)" || $(mkdir_p) 
"$(DESTDIR)$(applets_setupsoundeffectsdir)"
@@ -1767,7 +1794,7 @@
 distdir: $(DISTFILES)
        $(am__remove_distdir)
        mkdir $(distdir)
-       $(mkdir_p) $(distdir)/config $(distdir)/share/applets/ChooseMusicSource 
$(distdir)/share/applets/Clock $(distdir)/share/applets/DefaultSkin 
$(distdir)/share/applets/DefaultSkin/images $(distdir)/share/applets/Flickr 
$(distdir)/share/applets/HttpAuth $(distdir)/share/applets/InfoBrowser 
$(distdir)/share/applets/LogSettings $(distdir)/share/applets/MacroPlay 
$(distdir)/share/applets/NowPlaying $(distdir)/share/applets/NowPlaying/images 
$(distdir)/share/applets/ScreenSavers $(distdir)/share/applets/Screenshot 
$(distdir)/share/applets/SelectPlayer 
$(distdir)/share/applets/SetupAppletInstaller 
$(distdir)/share/applets/SetupDateTime $(distdir)/share/applets/SetupLanguage 
$(distdir)/share/applets/SetupSoundEffects 
$(distdir)/share/applets/SetupSoundEffects/sounds 
$(distdir)/share/applets/SetupSqueezebox 
$(distdir)/share/applets/SetupWallpaper 
$(distdir)/share/applets/SetupWallpaper/wallpaper 
$(distdir)/share/applets/SlimBrowser $(distdir)/share/applets/SlimDiscovery 
$(distdir)/share/applets/SqueezeNetworkPIN $(distdir)/share/jive 
$(distdir)/share/jive/net $(distdir)/share/jive/slim $(distdir)/share/jive/ui 
$(distdir)/share/jive/utils $(distdir)/src
+       $(mkdir_p) $(distdir)/config $(distdir)/share/applets/ChooseMusicSource 
$(distdir)/share/applets/Clock $(distdir)/share/applets/DefaultSkin 
$(distdir)/share/applets/DefaultSkin/images $(distdir)/share/applets/Flickr 
$(distdir)/share/applets/HttpAuth $(distdir)/share/applets/InfoBrowser 
$(distdir)/share/applets/LogSettings $(distdir)/share/applets/MacroPlay 
$(distdir)/share/applets/NowPlaying $(distdir)/share/applets/NowPlaying/images 
$(distdir)/share/applets/ScreenSavers $(distdir)/share/applets/Screenshot 
$(distdir)/share/applets/SelectPlayer 
$(distdir)/share/applets/SetupAppletInstaller 
$(distdir)/share/applets/SetupDateTime $(distdir)/share/applets/SetupLanguage 
$(distdir)/share/applets/SetupNetTest 
$(distdir)/share/applets/SetupSoundEffects 
$(distdir)/share/applets/SetupSoundEffects/sounds 
$(distdir)/share/applets/SetupSqueezebox 
$(distdir)/share/applets/SetupWallpaper 
$(distdir)/share/applets/SetupWallpaper/wallpaper 
$(distdir)/share/applets/SlimBrowser $(distdir)/share/applets/SlimDiscovery 
$(distdir)/share/applets/SqueezeNetworkPIN $(distdir)/share/jive 
$(distdir)/share/jive/net $(distdir)/share/jive/slim $(distdir)/share/jive/ui 
$(distdir)/share/jive/utils $(distdir)/src
        @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
        list='$(DISTFILES)'; for file in $$list; do \
@@ -1896,7 +1923,7 @@
        $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA)
 installdirs:
-       for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(testdir)" 
"$(DESTDIR)$(applets_choosemusicsourcedir)" "$(DESTDIR)$(applets_clockdir)" 
"$(DESTDIR)$(applets_defaultskindir)" 
"$(DESTDIR)$(applets_defaultskin_imagesdir)" "$(DESTDIR)$(applets_flickrdir)" 
"$(DESTDIR)$(applets_httpauthdir)" "$(DESTDIR)$(applets_infobrowserdir)" 
"$(DESTDIR)$(applets_logdir)" "$(DESTDIR)$(applets_macroplaydir)" 
"$(DESTDIR)$(applets_nowplayingdir)" 
"$(DESTDIR)$(applets_nowplaying_imagesdir)" 
"$(DESTDIR)$(applets_screensaversdir)" "$(DESTDIR)$(applets_screenshotdir)" 
"$(DESTDIR)$(applets_selectplayerdir)" 
"$(DESTDIR)$(applets_setupSqueezeboxdir)" 
"$(DESTDIR)$(applets_setupappletinstallerdir)" 
"$(DESTDIR)$(applets_setupdatetimedir)" "$(DESTDIR)$(applets_setuplanguagedir)" 
"$(DESTDIR)$(applets_setupsoundeffectsdir)" 
"$(DESTDIR)$(applets_setupsoundeffects_soundsdir)" 
"$(DESTDIR)$(applets_setupwallpaperdir)" 
"$(DESTDIR)$(applets_setupwallpaper_wallpaperdir)" 
"$(DESTDIR)$(applets_slimbrowserdir)" "$(DESTDIR)$(applets_slimdiscoverydir)" 
"$(DESTDIR)$(applets_squeezenetworkpindir)" "$(DESTDIR)$(jivedir)" 
"$(DESTDIR)$(jiveuidir)" "$(DESTDIR)$(luanetdir)" "$(DESTDIR)$(luaslimdir)" 
"$(DESTDIR)$(luautildir)"; do \
+       for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(testdir)" 
"$(DESTDIR)$(applets_choosemusicsourcedir)" "$(DESTDIR)$(applets_clockdir)" 
"$(DESTDIR)$(applets_defaultskindir)" 
"$(DESTDIR)$(applets_defaultskin_imagesdir)" "$(DESTDIR)$(applets_flickrdir)" 
"$(DESTDIR)$(applets_httpauthdir)" "$(DESTDIR)$(applets_infobrowserdir)" 
"$(DESTDIR)$(applets_logdir)" "$(DESTDIR)$(applets_macroplaydir)" 
"$(DESTDIR)$(applets_nowplayingdir)" 
"$(DESTDIR)$(applets_nowplaying_imagesdir)" 
"$(DESTDIR)$(applets_screensaversdir)" "$(DESTDIR)$(applets_screenshotdir)" 
"$(DESTDIR)$(applets_selectplayerdir)" 
"$(DESTDIR)$(applets_setupSqueezeboxdir)" 
"$(DESTDIR)$(applets_setupappletinstallerdir)" 
"$(DESTDIR)$(applets_setupdatetimedir)" "$(DESTDIR)$(applets_setuplanguagedir)" 
"$(DESTDIR)$(applets_setupnettestdir)" 
"$(DESTDIR)$(applets_setupsoundeffectsdir)" 
"$(DESTDIR)$(applets_setupsoundeffects_soundsdir)" 
"$(DESTDIR)$(applets_setupwallpaperdir)" 
"$(DESTDIR)$(applets_setupwallpaper_wallpaperdir)" 
"$(DESTDIR)$(applets_slimbrowserdir)" "$(DESTDIR)$(applets_slimdiscoverydir)" 
"$(DESTDIR)$(applets_squeezenetworkpindir)" "$(DESTDIR)$(jivedir)" 
"$(DESTDIR)$(jiveuidir)" "$(DESTDIR)$(luanetdir)" "$(DESTDIR)$(luaslimdir)" 
"$(DESTDIR)$(luautildir)"; do \
          test -z "$$dir" || $(mkdir_p) "$$dir"; \
        done
 install: $(BUILT_SOURCES)
@@ -1965,6 +1992,7 @@
        install-dist_applets_setupappletinstallerDATA \
        install-dist_applets_setupdatetimeDATA \
        install-dist_applets_setuplanguageDATA \
+       install-dist_applets_setupnettestDATA \
        install-dist_applets_setupsoundeffectsDATA \
        install-dist_applets_setupsoundeffects_soundsDATA \
        install-dist_applets_setupwallpaperDATA \
@@ -2023,6 +2051,7 @@
        uninstall-dist_applets_setupappletinstallerDATA \
        uninstall-dist_applets_setupdatetimeDATA \
        uninstall-dist_applets_setuplanguageDATA \
+       uninstall-dist_applets_setupnettestDATA \
        uninstall-dist_applets_setupsoundeffectsDATA \
        uninstall-dist_applets_setupsoundeffects_soundsDATA \
        uninstall-dist_applets_setupwallpaperDATA \
@@ -2061,6 +2090,7 @@
        install-dist_applets_setupappletinstallerDATA \
        install-dist_applets_setupdatetimeDATA \
        install-dist_applets_setuplanguageDATA \
+       install-dist_applets_setupnettestDATA \
        install-dist_applets_setupsoundeffectsDATA \
        install-dist_applets_setupsoundeffects_soundsDATA \
        install-dist_applets_setupwallpaperDATA \
@@ -2095,6 +2125,7 @@
        uninstall-dist_applets_setupappletinstallerDATA \
        uninstall-dist_applets_setupdatetimeDATA \
        uninstall-dist_applets_setuplanguageDATA \
+       uninstall-dist_applets_setupnettestDATA \
        uninstall-dist_applets_setupsoundeffectsDATA \
        uninstall-dist_applets_setupsoundeffects_soundsDATA \
        uninstall-dist_applets_setupwallpaperDATA \

Added: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua?rev=2414&root=Jive&view=auto
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua
 (added)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua
 Wed Apr 30 14:30:34 2008
@@ -1,0 +1,292 @@
+
+--[[
+=head1 NAME
+
+SetupNetTest Applet
+
+=head1 DESCRIPTION
+
+Test the network bandwidth between SqueezeCenter and a Player
+
+=cut
+--]]
+
+-- stuff we use
+local pairs, ipairs, tonumber, tostring, type = pairs, ipairs, tonumber, 
tostring, type
+
+local oo            = require("loop.simple")
+local table         = require("table")
+local string        = require("string")
+
+local Applet        = require("jive.Applet")
+local SlimServers   = require("jive.slim.SlimServers")
+
+local AppletManager = require("jive.AppletManager")
+
+local Framework     = require("jive.ui.Framework")
+local SimpleMenu    = require("jive.ui.SimpleMenu")
+local Window        = require("jive.ui.Window")
+local Textarea      = require("jive.ui.Textarea")
+local Label         = require("jive.ui.Label")
+local Surface       = require("jive.ui.Surface")
+local Icon          = require("jive.ui.Icon")
+local Popup         = require("jive.ui.Popup")
+local Timer         = require("jive.ui.Timer")
+
+local log           = require("jive.utils.log").logger("applets.misc")
+local debug         = require("jive.utils.debug")
+
+local EVENT_SCROLL     = jive.ui.EVENT_SCROLL
+local EVENT_KEY_PRESS  = jive.ui.EVENT_KEY_PRESS
+local KEY_BACK         = jive.ui.KEY_BACK
+local KEY_GO           = jive.ui.KEY_GO
+local KEY_ADD          = jive.ui.KEY_ADD
+local EVENT_CONSUME    = jive.ui.EVENT_CONSUME
+local EVENT_UNUSED     = jive.ui.EVENT_UNUSED
+local EVENT_ACTION     = jive.ui.EVENT_ACTION
+
+
+module(...)
+oo.class(_M, Applet)
+
+local scroll = 2
+
+local bground = 0x808080FF
+local graphBG = 0x303040FF
+local graphFG = 0x808080FF
+local graphR  = 0x800000FF
+local graphA  = 0x808000FF
+local graphG  = 0x008000FF
+
+-- open window
+function open(self, menuItem)
+
+       -- find a server: server for current player, else first server
+       sd = AppletManager:getAppletInstance("SlimDiscovery")
+
+       if sd and sd:getCurrentPlayer() then
+               self.player = sd:getCurrentPlayer()
+               self.server = self.player:getSlimServer()
+       end
+
+       self.window = Window("nettest", self:string('SETUPNETTEST_TESTING'))
+
+       self:tieAndShowWindow(self.window)
+
+       local timer = Timer(1000, function() 
self.window:addWidget(Textarea("textarea", 
self:string('SETUPNETTEST_NOSERVER'))) end, true)
+       timer:start()
+
+       self:requestStatus(function() timer:stop() self:showMainWindow() end)
+end
+
+
+function showMainWindow(self)
+       self.window:addWidget(Label("graphtitle", 
self:string('SETUPNETTEST_CURRENT')))
+
+       self.graph1 = Surface:newRGBA(200, 80)
+       self.graph1:filledRectangle(0, 0, 200, 80, graphBG)
+       local icon1 = Icon("icon", self.graph1)
+       self.window:addWidget(icon1)
+       icon1:setPosition(20, 20)
+
+       self.window:addWidget(Label("graphtitle", 
self:string('SETUPNETTEST_HISTORY')))
+
+       self.graph2 = Surface:newRGBA(200, 80)
+       self.graph2:filledRectangle(0, 0, 200, 80, graphBG)
+       local icon2 = Icon("icon", self.graph2)
+       self.window:addWidget(icon2)
+       icon2:setPosition(20, 180)
+
+       self.window:addWidget(Label("graphaxis", "0                             
            100 %"))
+
+       self.window:addWidget(Textarea("help", 
tostring(self:string('SETUPNETTEST_TESTINGTO')) .. ' ' .. self.player.name .. 
"\n" .. tostring(self:string('SETUPNETTEST_INFO'))))
+       
+       self.window:setAllowScreensaver(false)
+
+       self.window:addListener(EVENT_SCROLL | EVENT_KEY_PRESS,
+               function(event)
+                       return _event_handler(self, event)
+               end
+       )
+
+       self.timer = Timer(1000, function() self:requestStatus(response) end)
+       self.timer:start()
+end
+
+
+function _event_handler(self, event)
+
+       if self.rates == nil or #self.rates == 0 then
+               return
+       end
+       
+       local type = event:getType()
+
+       if type == EVENT_SCROLL then
+               local rate = self.rate or 0
+               local index = self.index[rate] or 1
+
+               if event:getScroll() > 0 then
+                       if index < #self.rates then index = index + 1 end
+               else
+                       if index > 1 then index = index - 1 end
+               end
+
+               self:startTest(self.rates[index])
+               
+               return EVENT_CONSUME
+       end
+
+       if type == EVENT_KEY_PRESS then
+               local key = event:getKeycode()
+               
+               if key == KEY_BACK then
+                       self.window:hide()
+               end
+               if key == KEY_ADD then
+                       self:startTest(self.rate)
+               end
+               if key == KEY_GO then
+                       self:showHelpWindow()
+               end
+
+               return EVENT_CONSUME
+       end
+
+       return EVENT_UNUSED
+end
+
+
+function showHelpWindow(self)
+       local window = Window("nettest", self:string('SETUPNETTEST_HELPTITLE'))
+       local help = Textarea("textarea", self:string('SETUPNETTEST_HELP'))
+
+       window:addWidget(help)
+       
+       self:tieAndShowWindow(window)
+
+       return window
+end
+
+
+-- request status
+function requestStatus(self, sink)
+       self.server.comet:request(
+               function(chunk, err)
+                       if err then
+                               log:debug(err)
+                       elseif chunk then
+                               sink(self, chunk.data)
+                       end
+               end,
+               self.player.id,
+               { 'nettest', self.rates and nil or 'rates' }
+       )
+end
+
+
+-- sink to process response
+function response(self, data)
+
+       if data.rates_loop then
+               local index = 1
+               self.rates = {}
+               self.index = {}
+               for _,entry in pairs(data.rates_loop) do
+                       for k, v in pairs(entry) do
+                               self.rates[index] = v
+                               self.index[v] = index
+                               index = index + 1
+                       end
+               end
+               self.default = data.default
+       end
+
+       if data.state == 'running' then
+               -- update display for current test
+               self.rate = data.rate
+               
self.window:setTitle(tostring(self:string('SETUPNETTEST_TESTING')) .. ' ' .. 
data.rate .. " kbps")
+               self:graph1Update(data.inst)
+               self:graph2Update(data.distrib)
+               Framework:reDraw(nil)
+
+       elseif self.default then
+               self:startTest(self.default)
+       end
+end
+
+
+function startTest(self, rate)
+       self.server.comet:request(nil, self.player.id, { 'nettest', 'start', 
rate })
+       self.timer.callback()
+       self.timer:restart()
+end
+
+
+function stopTest(self)
+       self.server.comet:request(nil, self.player.id, { 'nettest', 'stop' })
+end
+
+
+function graph1Update(self, val)
+       local graph = self.graph1
+       local w, h = graph:getSize()
+
+       graph:blitClip(scroll, 0, w - scroll, h, graph, 0, 0)
+       graph:filledRectangle(w - scroll, 0, w, h, graphBG)
+       graph:filledRectangle(w - scroll, h - (val * h / 100), w, h, graphFG)
+end
+
+
+function graph2Update(self, distrib)
+       local graph = self.graph2
+       local w, h = graph:getSize()
+
+       graph:filledRectangle(0, 0, w, h, graphBG)
+
+       local bar = w / #distrib
+       local count = 0
+
+       for i, res in ipairs(distrib) do
+               for k, v in pairs(res) do
+                       count = count + v
+               end
+       end
+
+       if count == 0 then return end
+
+       for i, res in ipairs(distrib) do
+               for k, v in pairs(res) do
+                       k = tonumber(k) or 100
+                       local color
+                       if     k > 95 then color = graphG
+                       elseif k > 80 then color = graphA
+                       else   color = graphR
+                       end
+                       graph:filledRectangle((i-1) * bar, h - (v / count * 
100), i * bar - 2, h, color)
+               end
+       end
+end
+
+
+function skin(self, s)
+       s.nettest = {
+               icon = {
+                       padding = { 20, 3, 20, 1 }
+               },
+               graphtitle = {
+                       padding = { 20, 7, 0, 0 },
+                       fg = { 0xE7, 0xE7, 0xE7 }
+               },
+               graphaxis = {
+                       padding = { 20, 1, 0, 0 },
+                       fg = { 0xE7, 0xE7, 0xE7 }
+               }
+       }
+end
+
+
+function free(self)
+       self.timer:stop()
+       self:stopTest()
+end

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua
------------------------------------------------------------------------------
    svn:keywords = Id Author LastChangedDate LastChangedBy

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestApplet.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua?rev=2414&root=Jive&view=auto
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
 (added)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
 Wed Apr 30 14:30:34 2008
@@ -1,0 +1,42 @@
+
+--[[
+
+SetupNetTest Meta
+
+--]]
+
+
+local oo            = require("loop.simple")
+
+local AppletMeta    = require("jive.AppletMeta")
+
+local appletManager = appletManager
+local jiveMain      = jiveMain
+
+local jnt           = jnt
+
+module(...)
+oo.class(_M, AppletMeta)
+
+
+function jiveVersion(self)
+       return 1, 1
+end
+
+
+function registerApplet(meta)
+       jnt:subscribe(meta)
+
+       meta.menu = meta:menuItem('appletSetupNetTest', 'advancedSettings', 
meta:string('SETUPNETTEST'), function(applet, ...) applet:open(...) end, 100)
+
+       jiveMain:loadSkin("SetupNetTest", "skin")
+end
+
+
+function notify_playerCurrent(meta, player)
+       if player == nil or player.slimServer:isSqueezeNetwork() then
+               jiveMain:removeItem(meta.menu)
+       else
+               jiveMain:addItem(meta.menu)
+       end
+end

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
------------------------------------------------------------------------------
    svn:keywords = Id Author LastChangedDate LastChangedBy

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/SetupNetTestMeta.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt
URL: 
http://svn.slimdevices.com/7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt?rev=2414&root=Jive&view=auto
==============================================================================
--- 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt 
(added)
+++ 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt 
Wed Apr 30 14:30:34 2008
@@ -1,0 +1,29 @@
+#
+
+SETUPNETTEST
+       EN      Network Test    
+
+SETUPNETTEST_NOSERVER
+       EN      Network tests are not supported by the server which this player 
is currently attached to.  Please ensure the Server and Network Health plugin 
is enabled on your server.
+
+SETUPNETTEST_TESTING
+       EN      Testing:
+
+SETUPNETTEST_CURRENT
+       EN      Current 
+
+SETUPNETTEST_HISTORY
+       EN      Test History
+
+SETUPNETTEST_TESTINGTO
+       EN      Testing to 
+
+SETUPNETTEST_INFO
+       EN      Press Right for Help
+
+SETUPNETTEST_HELPTITLE
+       EN      Network Test Help
+
+SETUPNETTEST_HELP
+       EN      Use the scroll wheel to select a data rate to test at and leave 
the test running for a period of time.\n\nThe top graph shows the current 
network performance as a fraction of the test rate.\n\nThe lower graph shows 
the history of test results grouped into performance bands which are colour 
coded Red, Amber and Green.\n\nGood network performance is indicated by minimal 
dips in the top graph and only Green bars on the lower graph.\n\nIf you see 
frequent dips in the top graph and significant Red bars on the lower graph, 
network performance may not be acceptable for streaming at this data rate.
+

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt
------------------------------------------------------------------------------
    svn:keywords = Id Author LastChangedDate LastChangedBy

Propchange: 
7.1/trunk/squeezeplay/src/squeezeplay/share/applets/SetupNetTest/strings.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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

Reply via email to