From: <gre...@us...> - 2007-07-18 21:32:24
|
Revision: 738 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=738&view=rev Author: gregmac45 Date: 2007-07-18 14:32:23 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Added Site logos and icons Thumbnaill code improvement Modified Paths: -------------- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs Modified: trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs =================================================================== --- trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-18 21:30:12 UTC (rev 737) +++ trunk/plugins/OnlineVideos/Source/OnlineVideos/GUIOnlineVideos.cs 2007-07-18 21:32:23 UTC (rev 738) @@ -22,6 +22,8 @@ protected GUIButtonControl btnViewAs = null; [SkinControlAttribute(50)] protected GUIFacadeControl facadeView = null; + [SkinControlAttribute(1)] + protected GUIImage logoImage = null; //private ILog moLog; protected View currentView = View.List; private Dictionary<String, Site> moSiteList = new Dictionary<String, Site>(); @@ -190,12 +192,14 @@ { //_log.Info("onPageLoad state home"); GUIPropertyManager.SetProperty("#header.label","Online Videos"); + //GUIPropertyManager. DisplaySites(); } else if (_CurrentState == State.categories) { - GUIPropertyManager.SetProperty("#header.label", moSiteList[msSelectedSiteId].name); - DisplayCategories(); + GUIPropertyManager.SetProperty("#header.label", "Online Videos"); + + DisplayCategories(); } else { @@ -203,7 +207,7 @@ DisplayVideos(false); facadeView.SelectedListItemIndex = miSelectedIndex; } - base.OnPageLoad(); + //base.OnPageLoad(); } protected override void OnShowContextMenu() { @@ -239,14 +243,14 @@ SaveVideo(loListItem); break; case 2: - Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); + //Log.Info("Getting related videos on {0} using tags:{1}",SiteUtilFactory.getSiteUtil(msSelectedSiteId),moCurrentVideoList[liSelected].Tags); SiteUtilBase site = SiteUtilFactory.getSiteUtil(msSelectedSiteId); - Log.Info("VideoList before:"); + //Log.Info("VideoList before:"); foreach(VideoInfo video in moCurrentVideoList){ Log.Info(video.Title); } moCurrentVideoList = site.getRelatedVideos(moCurrentVideoList[liSelected].Tags); - Log.Info("VideoList after:"); + //Log.Info("VideoList after:"); foreach(VideoInfo video in moCurrentVideoList){ Log.Info(video.Title); } @@ -285,14 +289,14 @@ } protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { - Log.Info("Onclicked action type:{0}",actionType); + //Log.Info("Onclicked action type:{0}",actionType); if (control == facadeView) { if (_CurrentState == State.home) { msSelectedSiteId = facadeView.SelectedListItem.Path; - GUIPropertyManager.SetProperty("#header.label", moSiteList[msSelectedSiteId].name); + GUIPropertyManager.SetProperty("#header.label", "Online Videos"); DisplayCategories(); _CurrentState = State.categories; } @@ -481,17 +485,18 @@ { loListItem = new GUIListItem(loSite.name); loListItem.Path = loSite.id; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + //loListItem.IsFolder = true; + //MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + loListItem.ThumbnailImage = GUIGraphicsContext.Skin+@"/Media/OnlineVidSiteIcon"+loSite.id+".jpeg"; facadeView.Add(loListItem); } - //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); + GUIPropertyManager.SetProperty("#header.image",""); } private void DisplayCategories() { // facadeView.Clear(); - GUIControl.ClearControl(GetID, facadeView.GetID); - + GUIControl.ClearControl(GetID, facadeView.GetID); + GUIPropertyManager.SetProperty("#header.image","OnlineVidlogo"+msSelectedSiteId+".jpeg"); GUIListItem loListItem; loListItem = new GUIListItem(".."); loListItem.IsFolder = true; @@ -578,9 +583,10 @@ //GUIListItem loListItem; List<String> loImageUrlList = new List<string>(); - + int liIdx = 0; foreach (VideoInfo loVideoInfo in loListItems) { + liIdx++; loVideoInfo.Description = cleanString(loVideoInfo.Description); if (FilterOut(loVideoInfo.Title) || FilterOut(loVideoInfo.Description)) { @@ -588,7 +594,12 @@ } loListItem = new GUIListItem(loVideoInfo.Title); loListItem.Path = loVideoInfo.VideoUrl; - facadeView.Add(loListItem); + loListItem.ItemId = liIdx; + loListItem.RetrieveArt = false; + loListItem.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + + facadeView.Add(loListItem); + //loListItem.RetrieveArt = true; loImageUrlList.Add(loVideoInfo.ImageUrl); if (fbRefresh) { @@ -597,7 +608,22 @@ } //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 +""); - + ImageDownloader.getImages(loImageUrlList,msThumbLocation,facadeView); +// Log.Info("Getting images"); +// BackgroundWorker worker = new BackgroundWorker(); +// +// worker.DoWork += new DoWorkEventHandler(downloadImages); +// worker.RunWorkerAsync(); +/* + using (WaitCursor cursor = new WaitCursor()) + { + while (_imagesDone == false) + { + GUIWindowManager.Process(); + } + } + */ + /* BackgroundWorker worker = new BackgroundWorker(); Object[] loParms = new Object[4]; loParms[0] = facadeView; @@ -616,9 +642,27 @@ } facadeView.SelectedListItemIndex = miSelectedIndex; } + */ } + /* + public void downloadImages(object sender, DoWorkEventArgs e) + { + + for(int i=1;i<facadeView.Count;i++){ + GUIListItem item = facadeView[i]; + item.RetrieveArt = true; + GUIWindowManager.Process(); + } + } + */ + void OnRetrieveCoverArt(GUIListItem item) + { + if(ImageDownloader._imageLocationList.Count>item.ItemId-1){ + item.ThumbnailImage = ImageDownloader._imageLocationList[item.ItemId-1]; + } + } private bool GetUserInputString(ref string sString) { VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |