Author: michael
Date: Fri Jan 15 03:32:59 2010
New Revision: 8351
URL: http://svn.slimdevices.com/jive?rev=8351&view=rev
Log:
Bug: n/a
Description: cleanup
- move more shared code to ImageSource base class
- don't load unused libraries
- remove/disable some unused code (context menu)
- update license :-)
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceCard.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceFlickr.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerMeta.lua
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua?rev=8351&r1=8350&r2=8351&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSource.lua
Fri Jan 15 03:32:59 2010
@@ -15,19 +15,16 @@
-- stuff we use
-local setmetatable, tonumber, tostring, ipairs, locale, assert = setmetatable,
tonumber, tostring, ipairs, locale, assert
-local require = require
-local Event = require("jive.ui.Event")
-local io = require("io")
-local oo = require("loop.simple")
-local math = require("math")
-local table = require("jive.utils.table")
-local string = require("jive.utils.string")
-local Textarea = require("jive.ui.Textarea")
+local assert = assert
+local require = require
+local oo = require("loop.simple")
+local math = require("math")
+local debug = require("jive.utils.debug")
+local string = require("jive.utils.string")
+local Textarea = require("jive.ui.Textarea")
local Window = require("jive.ui.Window")
-local Framework = require("jive.ui.Framework")
-local log =
require("jive.utils.log").logger("applet.ImageViewer")
-local jiveMain = jiveMain
+local log = require("jive.utils.log").logger("applet.ImageViewer")
+local jiveMain = jiveMain
local EVENT_KEY_PRESS = jive.ui.EVENT_KEY_PRESS
local EVENT_MOUSE_PRESS = jive.ui.EVENT_MOUSE_PRESS
@@ -66,16 +63,6 @@
local helpAction = function()
local window =
Window("help_info", self.applet:string(titleText), "helptitle")
window:setAllowScreensaver(false)
-
- -- no more help menu yet
- --[[
-
window:setButtonAction("rbutton", "more_help")
-
window:addActionListener("more_help", self, function()
-
window:playSound("WINDOWSHOW")
-
-
appletManager:callService("supportMenu")
- end)
- --]]
local textarea =
Textarea("text", self.applet:string(bodyText))
window:addWidget(textarea)
@@ -120,19 +107,42 @@
end
function nextImage(self, ordering)
- assert(false, "please implement in derived class")
+ if #self.imgFiles == 0 then
+ self:emptyListError()
+ return
+ end
+ if ordering == "random" then
+ self.currentImage = math.random(#self.imgFiles)
+ else
+ self.currentImage = self.currentImage + 1
+ if self.currentImage > #self.imgFiles then
+ self.currentImage = 1
+ end
+ end
end
function previousImage(self, ordering)
- assert(false, "please implement in derived class")
+ if #self.imgFiles == 0 then
+ self:emptyListError()
+ return
+ end
+ if ordering == "random" then
+ self.currentImage = math.random(#self.imgFiles)
+ else
+ self.currentImage = self.currentImage - 1
+ if self.currentImage < 1 then
+ self.currentImage = #self.imgFiles
+ end
+ end
end
+
function getImage(self)
- assert(false, "please implement in derived class")
+ return self.image
end
function getText(self)
- assert(false, "please implement in derived class")
+ return "", self.imgFiles[self.currentImage], ""
end
function getMultilineText(self)
@@ -148,4 +158,17 @@
end
function free(self)
-end
+end
+
+
+--[[
+
+=head1 LICENSE
+
+Copyright 2010 Logitech. All Rights Reserved.
+
+This file is licensed under BSD. Please see the LICENSE file for details.
+
+=cut
+--]]
+
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceCard.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceCard.lua?rev=8351&r1=8350&r2=8351&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceCard.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceCard.lua
Fri Jan 15 03:32:59 2010
@@ -17,35 +17,26 @@
-- stuff we use
-local setmetatable, tonumber, tostring, ipairs, locale, pairs = setmetatable,
tonumber, tostring, ipairs, locale, pairs
-
-local Applet = require("jive.Applet")
-local appletManager = require("jive.AppletManager")
-local Event = require("jive.ui.Event")
-local io = require("io")
-local oo = require("loop.simple")
-local math = require("math")
-local table = require("jive.utils.table")
-local string = require("jive.utils.string")
-local lfs = require('lfs')
-local Group = require("jive.ui.Group")
-local Keyboard = require("jive.ui.Keyboard")
+local pairs = pairs
+local oo = require("loop.simple")
+--local debug = require("jive.utils.debug")
+local math = require("math")
+local table = require("jive.utils.table")
+local string = require("jive.utils.string")
+local lfs = require('lfs')
+local Group = require("jive.ui.Group")
+local Keyboard = require("jive.ui.Keyboard")
local Task = require("jive.ui.Task")
-local Textarea = require("jive.ui.Textarea")
local Textinput = require("jive.ui.Textinput")
local Window = require("jive.ui.Window")
-
-local Surface = require("jive.ui.Surface")
-local Process = require("jive.net.Process")
-
-local jnt = jnt
+local Surface = require("jive.ui.Surface")
local log = require("jive.utils.log").logger("applet.ImageViewer")
local require = require
local ImageSource = require("applets.ImageViewer.ImageSource")
module(...)
-oo.class(_M, ImageSource)
+ImageSourceCard = oo.class(_M, ImageSource)
function __init(self, applet)
log:info("initialize ImageSourceCard!!!!")
@@ -137,41 +128,15 @@
end
end
-function nextImage(self, ordering)
- if #self.imgFiles == 0 then
- self:emptyListError()
- return
- end
- if ordering == "random" then
- self.currentImage = math.random(#self.imgFiles)
- else
- self.currentImage = self.currentImage + 1
- if self.currentImage > #self.imgFiles then
- self.currentImage = 1
- end
- end
+function nextImage(self, ordering)
+ oo.superclass(ImageSourceCard).nextImage(self, ordering)
self.imgReady = true
end
function previousImage(self, ordering)
- if #self.imgFiles == 0 then
- self:emptyListError()
- return
- end
- if ordering == "random" then
- self.currentImage = math.random(#self.imgFiles)
- else
- self.currentImage = self.currentImage - 1
- if self.currentImage < 1 then
- self.currentImage = #self.imgFiles
- end
- end
+ oo.superclass(ImageSourceCard).previousImage(self, ordering)
self.imgReady = true
end
-
-function getText(self)
- return "", self.imgFiles[self.currentImage], ""
-end
function listReady(self)
@@ -230,9 +195,9 @@
=head1 LICENSE
-Copyright 2008 Logitech. All Rights Reserved.
-
-This file is subject to the Logitech Public Source License Version 1.0. Please
see the LICENCE file for details.
+Copyright 2010 Logitech. All Rights Reserved.
+
+This file is licensed under BSD. Please see the LICENSE file for details.
=cut
--]]
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceFlickr.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceFlickr.lua?rev=8351&r1=8350&r2=8351&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceFlickr.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceFlickr.lua
Fri Jan 15 03:32:59 2010
@@ -17,31 +17,23 @@
-- stuff we use
-local setmetatable, tonumber, tostring, ipairs, locale, type, pairs =
setmetatable, tonumber, tostring, ipairs, locale, type, pairs
-
-local Applet = require("jive.Applet")
-local appletManager = require("jive.AppletManager")
-local Event = require("jive.ui.Event")
-local io = require("io")
+local ipairs, pairs = ipairs, pairs
+
local oo = require("loop.simple")
local math = require("math")
local table = require("jive.utils.table")
local string = require("jive.utils.string")
-local lfs = require('lfs')
local Group = require("jive.ui.Group")
local Keyboard = require("jive.ui.Keyboard")
local SimpleMenu = require("jive.ui.SimpleMenu")
local RadioButton = require("jive.ui.RadioButton")
local RadioGroup = require("jive.ui.RadioGroup")
-local Label = require("jive.ui.Label")
-local Textarea = require("jive.ui.Textarea")
local Textinput = require("jive.ui.Textinput")
local Window = require("jive.ui.Window")
local SocketHttp = require("jive.net.SocketHttp")
local RequestHttp = require("jive.net.RequestHttp")
local URL = require("socket.url")
local Surface = require("jive.ui.Surface")
-local Process = require("jive.net.Process")
local json = require("json")
local jnt = jnt
local apiKey = "6505cb025e34a7e9b3f88daa9fa87a04"
@@ -51,7 +43,7 @@
local ImageSource = require("applets.ImageViewer.ImageSource")
module(...)
-oo.class(_M, ImageSource)
+ImageSourceFlickr = oo.class(_M, ImageSource)
function __init(self, applet)
log:info("initialize ImageSourceFlickr")
@@ -128,11 +120,6 @@
end
-function getImage(self)
- return self.image
-end
-
-
function nextImage(self, ordering)
if #self.imgFiles == 0 then
self.lstReady = false
@@ -141,14 +128,7 @@
self:readImageList()
return
end
- if ordering == "random" then
- self.currentImage = math.random(#self.imgFiles)
- else
- self.currentImage = self.currentImage + 1
- if self.currentImage > #self.imgFiles then
- self.currentImage = 1
- end
- end
+ oo.superclass(ImageSourceFlickr).nextImage(self, ordering)
self:requestImage()
end
@@ -494,16 +474,15 @@
return true
end
-
-
+
--[[
=head1 LICENSE
-Copyright 2008 Logitech. All Rights Reserved.
-
-This file is subject to the Logitech Public Source License Version 1.0. Please
see the LICENCE file for details.
+Copyright 2010 Logitech. All Rights Reserved.
+
+This file is licensed under BSD. Please see the LICENSE file for details.
=cut
--]]
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua?rev=8351&r1=8350&r2=8351&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceHttp.lua
Fri Jan 15 03:32:59 2010
@@ -16,27 +16,17 @@
-- stuff we use
-local setmetatable, tonumber, tostring, ipairs, locale, type, pairs =
setmetatable, tonumber, tostring, ipairs, locale, type, pairs
-
-local Applet = require("jive.Applet")
-local appletManager = require("jive.AppletManager")
-local Event = require("jive.ui.Event")
-local io = require("io")
local oo = require("loop.simple")
local math = require("math")
-local table = require("jive.utils.table")
local string = require("jive.utils.string")
-local lfs = require('lfs')
local Group = require("jive.ui.Group")
local Keyboard = require("jive.ui.Keyboard")
-local Textarea = require("jive.ui.Textarea")
local Textinput = require("jive.ui.Textinput")
local Window = require("jive.ui.Window")
local SocketHttp = require("jive.net.SocketHttp")
local RequestHttp = require("jive.net.RequestHttp")
local URL = require("socket.url")
local Surface = require("jive.ui.Surface")
-local Process = require("jive.net.Process")
local jnt = jnt
@@ -45,7 +35,7 @@
local ImageSource = require("applets.ImageViewer.ImageSource")
module(...)
-oo.class(_M, ImageSource)
+ImageSourceHttp = oo.class(_M, ImageSource)
function __init(self, applet)
log:info("initialize ImageSourceHttp")
@@ -93,39 +83,13 @@
http:fetch(req)
end
-function getImage(self)
- return self.image
-end
-
function nextImage(self, ordering)
- if #self.imgFiles == 0 then
- self:emptyListError()
- return
- end
- if ordering == "random" then
- self.currentImage = math.random(#self.imgFiles)
- else
- self.currentImage = self.currentImage + 1
- if self.currentImage > #self.imgFiles then
- self.currentImage = 1
- end
- end
+ oo.superclass(ImageSourceHttp).nextImage(self, ordering)
self:requestImage()
end
function previousImage(self, ordering)
- if #self.imgFiles == 0 then
- self:emptyListError()
- return
- end
- if ordering == "random" then
- self.currentImage = math.random(#self.imgFiles)
- else
- self.currentImage = self.currentImage - 1
- if self.currentImage < 1 then
- self.currentImage = #self.imgFiles
- end
- end
+ oo.superclass(ImageSourceHttp).previousImage(self, ordering)
self:requestImage()
end
@@ -164,10 +128,6 @@
http:fetch(req)
end
-function getText(self)
- return "",self.imgFiles[self.currentImage],""
-end
-
function settings(self, window)
@@ -203,9 +163,9 @@
=head1 LICENSE
-Copyright 2008 Logitech. All Rights Reserved.
+Copyright 2010 Logitech. All Rights Reserved.
-This file is subject to the Logitech Public Source License Version 1.0. Please
see the LICENCE file for details.
+This file is licensed under BSD. Please see the LICENSE file for details.
=cut
--]]
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua?rev=8351&r1=8350&r2=8351&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceServer.lua
Fri Jan 15 03:32:59 2010
@@ -17,30 +17,18 @@
-- stuff we use
-local setmetatable, tonumber, tostring, ipairs, locale, type, pairs =
setmetatable, tonumber, tostring, ipairs, locale, type, pairs
-
-local Applet = require("jive.Applet")
-local appletManager = require("jive.AppletManager")
-local Event = require("jive.ui.Event")
-local io = require("io")
+local ipairs = ipairs
+
local oo = require("loop.simple")
-local math = require("math")
local table = require("jive.utils.table")
local string = require("jive.utils.string")
local json = require("json")
local debug = require("jive.utils.debug")
-local lfs = require('lfs')
-local Group = require("jive.ui.Group")
-local Keyboard = require("jive.ui.Keyboard")
-local Textarea = require("jive.ui.Textarea")
-local Textinput = require("jive.ui.Textinput")
-local Window = require("jive.ui.Window")
local SocketHttp = require("jive.net.SocketHttp")
local SlimServer = require("jive.slim.SlimServer")
local RequestHttp = require("jive.net.RequestHttp")
local URL = require("socket.url")
local Surface = require("jive.ui.Surface")
-local Process = require("jive.net.Process")
local Framework = require("jive.ui.Framework")
local jnt = jnt
@@ -81,10 +69,6 @@
playerId,
cmd
)
-end
-
-function getImage(self)
- return self.image
end
function imgFilesSink(self)
@@ -277,9 +261,9 @@
=head1 LICENSE
-Copyright 2008 Logitech. All Rights Reserved.
-
-This file is subject to the Logitech Public Source License Version 1.0. Please
see the LICENCE file for details.
+Copyright 2010 Logitech. All Rights Reserved.
+
+This file is licensed under BSD. Please see the LICENSE file for details.
=cut
--]]
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua?rev=8351&r1=8350&r2=8351&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerApplet.lua
Fri Jan 15 03:32:59 2010
@@ -17,36 +17,26 @@
-- stuff we use
-local setmetatable, tonumber, tostring, ipairs = setmetatable, tonumber,
tostring, ipairs
-
-local io = require("io")
+local tostring = tostring
+
local oo = require("loop.simple")
local math = require("math")
local table = require("jive.utils.table")
local string = require("jive.utils.string")
-local lfs = require('lfs')
local Applet = require("jive.Applet")
local appletManager = require("jive.AppletManager")
-local Checkbox = require("jive.ui.Checkbox")
-local Event = require("jive.ui.Event")
local Framework = require("jive.ui.Framework")
local Font = require("jive.ui.Font")
local Icon = require("jive.ui.Icon")
local Label = require("jive.ui.Label")
-local Group = require("jive.ui.Group")
-local Popup = require("jive.ui.Popup")
local RadioButton = require("jive.ui.RadioButton")
local RadioGroup = require("jive.ui.RadioGroup")
local Surface = require("jive.ui.Surface")
local Window = require("jive.ui.Window")
local SimpleMenu = require("jive.ui.SimpleMenu")
-local Task = require("jive.ui.Task")
local Timer = require("jive.ui.Timer")
-local Process = require("jive.net.Process")
-local ContextMenuWindow = require("jive.ui.ContextMenuWindow")
-local Textarea = require("jive.ui.Textarea")
-local System = require("jive.System")
+local System = require("jive.System")
local debug = require("jive.utils.debug")
@@ -60,8 +50,7 @@
local LAYER_FRAME = jive.ui.LAYER_FRAME
local LAYER_CONTENT = jive.ui.LAYER_CONTENT
-local jnt = jnt
-local jiveMain = jiveMain
+--local jiveMain = jiveMain
local MIN_SCROLL_INTERVAL = 750
@@ -95,9 +84,8 @@
if src == "card" then
self.imgSource = ImageSourceCard(self)
--- elseif src == "flickr" then
--- self.imgSource = ImageSourceFlickr(self)
--- elseif src == "http" then
+-- elseif src == "flickr" then
+-- self.imgSource = ImageSourceFlickr(self)
-- default to web list - it's available on all players
else
self.imgSource = ImageSourceHttp(self)
@@ -155,13 +143,13 @@
local label = Label("text", "")
local sublabel = Label("subtext", self:string("IMAGE_VIEWER_LOADING"))
- local icon = Icon("") -- blank for now until we get a proper default
loading image
+-- local icon = Icon("") -- blank for now until we get a proper default
loading image
--ran out of time for 7.4
-- self.imgSource:updateLoadingIcon(icon)
popup:addWidget(label)
- popup:addWidget(icon)
+-- popup:addWidget(icon)
popup:addWidget(sublabel)
popup:focusWidget(sublabel)
@@ -214,6 +202,7 @@
self:displaySlide()
end
+--[[
function showTextWindow(self)
local window = ContextMenuWindow(nil, nil, true)
local text = Textarea("multiline_text",
self.imgSource:getMultilineText())
@@ -231,6 +220,7 @@
window:show()
end
+--]]
function setupEventHandlers(self, window)
@@ -250,6 +240,7 @@
return EVENT_CONSUME
end
+--[[
local showTextWindowAction = function (self)
if self.imgSource:getText() then
self:showTextWindow()
@@ -259,6 +250,7 @@
--todo add takes user to meta data page
window:addActionListener("add", self, showTextWindowAction)
+--]]
window:addActionListener("go", self, nextSlideAction)
window:addActionListener("up", self, nextSlideAction)
window:addActionListener("down", self, previousSlideAction)
@@ -267,7 +259,6 @@
window:addListener(EVENT_MOUSE_DOWN | EVENT_KEY_PRESS | EVENT_KEY_HOLD
| EVENT_IR_PRESS | EVENT_SCROLL,
function(event)
local type = event:getType()
- local keyPress
-- next slide on touch
if type == EVENT_MOUSE_DOWN then
@@ -1246,9 +1237,9 @@
=head1 LICENSE
-Copyright 2008 Logitech. All Rights Reserved.
-
-This file is subject to the Logitech Public Source License Version 1.0. Please
see the LICENCE file for details.
+Copyright 2010 Logitech. All Rights Reserved.
+
+This file is licensed under BSD. Please see the LICENSE file for details.
=cut
--]]
Modified:
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerMeta.lua
URL:
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerMeta.lua?rev=8351&r1=8350&r2=8351&view=diff
==============================================================================
---
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerMeta.lua
(original)
+++
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageViewerMeta.lua
Fri Jan 15 03:32:59 2010
@@ -20,8 +20,6 @@
local System = require("jive.System")
local AppletMeta = require("jive.AppletMeta")
-local lfs = require("lfs")
-
local appletManager = appletManager
local jiveMain = jiveMain
@@ -81,9 +79,9 @@
=head1 LICENSE
-Copyright 2009 Logitech. All Rights Reserved.
+Copyright 2010 Logitech. All Rights Reserved.
-This file is subject to the Logitech Public Source License Version 1.0. Please
see the LICENCE file for details.
+This file is licensed under BSD. Please see the LICENSE file for details.
=cut
--]]
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins