From: <nor...@us...> - 2007-08-28 11:15:31
|
Revision: 874 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=874&view=rev Author: northern_sky Date: 2007-08-28 04:15:21 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Fixed sort for appitems, updated readme with final to-do's Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs trunk/plugins/myGUIProgramsAlt/README.txt Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-28 11:15:21 UTC (rev 874) @@ -54,7 +54,7 @@ shellexecuteCheckBox.Checked = applicationItem.UseShellExecute; quoteCheckBox.Checked = applicationItem.UseQuotes; waitExitCheckBox.Checked = (applicationItem.WaitForExit); - allowGUIImportCheckBox.Checked = applicationItem.RefreshGUIAllowed; + allowGUIImportCheckBox.Checked = applicationItem.ReimportFromGUIAllowed; if (applicationItem.PlatformId != 0) { platformComboBox.SelectedValue = applicationItem.PlatformId; @@ -76,7 +76,7 @@ curApp.UseQuotes = quoteCheckBox.Checked; curApp.WaitForExit = waitExitCheckBox.Checked; curApp.Item_Type = ItemType.DIRCACHE; - curApp.RefreshGUIAllowed = allowGUIImportCheckBox.Checked; + curApp.ReimportFromGUIAllowed = allowGUIImportCheckBox.Checked; curApp.PlatformId = (int)platformComboBox.SelectedValue; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-28 11:15:21 UTC (rev 874) @@ -53,7 +53,7 @@ this.startupDirComboBox.Text = curApp.StartupDir; this.quoteCheckBox.Checked = true; //(applicationItem.UseQuotes); this.waitExitCheckBox.Checked = (curApp.WaitForExit); - this.allowGUIImportCheckBox.Checked = curApp.RefreshGUIAllowed; + this.allowGUIImportCheckBox.Checked = curApp.ReimportFromGUIAllowed; } public override void SaveSettings(ApplicationItem curApp) @@ -65,7 +65,7 @@ curApp.UseQuotes = this.quoteCheckBox.Checked; curApp.WaitForExit = this.waitExitCheckBox.Checked; curApp.Item_Type = ItemType.GAMEBASE; - curApp.RefreshGUIAllowed = this.allowGUIImportCheckBox.Checked; + curApp.ReimportFromGUIAllowed = this.allowGUIImportCheckBox.Checked; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-28 11:15:21 UTC (rev 874) @@ -56,7 +56,7 @@ base.SaveSettings(curApp); curApp.Item_Type = ItemType.MAMEDIRECT; - curApp.RefreshGUIAllowed = true; + curApp.ReimportFromGUIAllowed = true; } public override bool ValidateEntries(ApplicationItem curApp) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-28 11:15:21 UTC (rev 874) @@ -61,7 +61,7 @@ { #region Variables - + bool currentSortAsc = true; ProgramViewHandler viewHandler = ProgramViewHandler.Instance; List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; @@ -74,7 +74,7 @@ ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Title; DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; - ApplicationItem currentApplicationItem = null; + ApplicationItem currentApplicationItem = null; string prevFilepath = ""; int selectedItemIndex = -1; Layout currentLayout = Layout.List; @@ -95,8 +95,8 @@ [SkinControl(50)] protected GUIFacadeControl facadeView = null; - + #endregion Variables #region Constructor / Destructor @@ -267,10 +267,10 @@ if (currentApplicationItem == null) {//create a fake tmpappitem so it's not null - currentApplicationItem = new ApplicationItemGrouper(); + currentApplicationItem = new ApplicationItemGrouper(); } currentApplicationItem.ApplicationItemId = xmlreader.GetValueAsInt("myProgramsAlt", "applicationItemId", -1); - + ViewHandler.CurrentLevel = xmlreader.GetValueAsInt("myProgramsAlt", "lastViewLevel", -1); CurrentSortAsc = xmlreader.GetValueAsBool("myProgramsAlt", "sortASC", true); ViewHandler.CurrentView = xmlreader.GetValueAsString("myProgramsAlt", "view", ""); @@ -297,7 +297,7 @@ } else { - btnReimport.IsVisible = currentApplicationItem.RefreshGUIAllowed; + btnReimport.IsVisible = currentApplicationItem.ReimportFromGUIAllowed; } facadeView.IsVisible = true; @@ -351,6 +351,7 @@ case ProgramSort.SortMethod.Platform: sortBy = "Sort by: Platform"; //tmp break; + } if (btnSortBy != null) @@ -402,7 +403,7 @@ // some preconditions... if (selectedGUIListItem == null) return; if (currentApplicationItem == null) return; - + ThumbnailPath = ""; if (selectedGUIListItem.ThumbnailImage != "" && selectedGUIListItem.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" @@ -803,6 +804,27 @@ } } + + bool DoesListOnlyContainsItemOfType<T>() + { + bool onlyContainsType = true; + + GUIListItem item = null; + if (facadeView != null) + { + for (int i = 0; i < facadeView.Count; ++i) + { + item = facadeView[i]; + if ((item.MusicTag != null) && !(item.MusicTag is T)) + { + return (onlyContainsType = false); + } + + } + } + return onlyContainsType; + } + void SelectSortMethod() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); @@ -812,14 +834,18 @@ dlg.Reset(); dlg.SetHeading(495); + dlg.AddLocalizedString(268); // title - dlg.AddLocalizedString(363); // filename - dlg.AddLocalizedString(367); // rating - dlg.Add("Sort by: Times launched");//"LaunchCount"//whats the mapping to these??? - dlg.Add("Sort by: Date launched"); - dlg.Add("Sort by: Platform"); + + if (DoesListOnlyContainsItemOfType<FileItem>()) + { + dlg.AddLocalizedString(363); // filename + dlg.AddLocalizedString(367); // rating + dlg.Add("Sort by: Times launched");//"LaunchCount"//whats the mapping to these??? + dlg.Add("Sort by: Date launched"); + dlg.Add("Sort by: Platform"); + } - dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) @@ -937,11 +963,11 @@ ViewHandler.CurrentView = selectedView.Name; - if (facadeView.Count <= 0) - { - GUIControl.FocusControl(GetID, btnViewAs.GetID); - } - + if (facadeView.Count <= 0) + { + GUIControl.FocusControl(GetID, btnViewAs.GetID); + } + } UpdateButtonStates(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-28 11:15:21 UTC (rev 874) @@ -204,7 +204,7 @@ set { enabled = value; } } - public bool RefreshGUIAllowed + public bool ReimportFromGUIAllowed { get { return refreshGUIAllowed; } set { refreshGUIAllowed = value; } @@ -757,7 +757,7 @@ parameterArray[15] = dbHandlerInstance.GetParameter<bool>(ImportValidImagesOnly, "@importValidImagesOnly", DbType.Boolean); parameterArray[16] = dbHandlerInstance.GetParameter<int>(Position, "@position", DbType.Int32); parameterArray[17] = dbHandlerInstance.GetParameter<bool>(Enabled, "@enabled", DbType.Boolean); - parameterArray[18] = dbHandlerInstance.GetParameter<bool>(RefreshGUIAllowed, "@refreshGUIAllowed", DbType.Boolean); + parameterArray[18] = dbHandlerInstance.GetParameter<bool>(ReimportFromGUIAllowed, "@refreshGUIAllowed", DbType.Boolean); parameterArray[19] = dbHandlerInstance.GetParameter<int>(PlatformId, "@platformId", DbType.Int32); parameterArray[20] = dbHandlerInstance.GetParameter<bool>(WaitForExit, "@waitForExit", DbType.Boolean); parameterArray[21] = dbHandlerInstance.GetParameter<string>(PreLaunch, "@preLaunch", DbType.String); @@ -855,7 +855,7 @@ parameterArray[15] = dbHandlerInstance.GetParameter<bool>(ImportValidImagesOnly, "@importValidImagesOnly", DbType.Boolean); parameterArray[16] = dbHandlerInstance.GetParameter<int>(Position, "@position", DbType.Int32); parameterArray[17] = dbHandlerInstance.GetParameter<bool>(Enabled, "@enabled", DbType.Boolean); - parameterArray[18] = dbHandlerInstance.GetParameter<bool>(RefreshGUIAllowed, "@refreshGUIAllowed", DbType.Boolean); + parameterArray[18] = dbHandlerInstance.GetParameter<bool>(ReimportFromGUIAllowed, "@refreshGUIAllowed", DbType.Boolean); parameterArray[19] = dbHandlerInstance.GetParameter<int>(PlatformId, "@platformId", DbType.Int32); parameterArray[20] = dbHandlerInstance.GetParameter<bool>(WaitForExit, "@waitForExit", DbType.Boolean); parameterArray[21] = dbHandlerInstance.GetParameter<string>(PreLaunch, "@preLaunch", DbType.String); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-28 11:15:21 UTC (rev 874) @@ -122,7 +122,7 @@ item.ValidExtensions = (string)dataReader["validextensions"]; item.ImportValidImagesOnly =(bool) dataReader["importvalidimagesonly"]; item.Position = Convert.ToInt32(dataReader["iposition"]); - item.RefreshGUIAllowed = (bool) dataReader["refreshGUIAllowed"]; + item.ReimportFromGUIAllowed = (bool) dataReader["refreshGUIAllowed"]; item.PlatformId = Convert.ToInt32(dataReader["platformId"]); item.WaitForExit =(bool) dataReader["waitforexit"]; item.PreLaunch = (string) dataReader["preLaunch"]; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs 2007-08-28 11:15:21 UTC (rev 874) @@ -68,66 +68,86 @@ if (item2 == null) return -1; if (item1.MusicTag == null) return -1; if (item2.MusicTag == null) return -1; - - - - if (item1.MusicTag.GetType().BaseType.Name == "ApplicationItem") return -1;//quick fix for not allowing applicationsitems... - if (item2.MusicTag.GetType().BaseType.Name == "ApplicationItem") return -1;//quick fix for not allowing applicationsitems... - if (item1.MusicTag.GetType().Name == "FilterItem") return -1;//quick fix for not allowing filteritems... if (item2.MusicTag.GetType().Name == "FilterItem") return -1;//quick fix for not allowing filteritems... - + if (item1.Label == "..") return -1; // if the .. item has no musicTag then, it is already catched at the beginning of this method if (item2.Label == "..") return -1; + + //applicationitem sort only allows by title for now + if ((item1.MusicTag is ApplicationItem) && (item2.MusicTag is ApplicationItem)) + + { + ApplicationItem Item1 = item1.MusicTag as ApplicationItem; + ApplicationItem Item2 = item2.MusicTag as ApplicationItem; + + switch (currentSortMethod) + { + case SortMethod.Title: + if (sortAscending) + return String.Compare(Item1.Title, Item2.Title, true); + else + return String.Compare(Item2.Title, Item1.Title, true); + default: + return -1; + } + } + + + string strSize1 = ""; string strSize2 = ""; if (item1.FileInfo != null) strSize1 = MediaPortal.Util.Utils.GetSize(item1.FileInfo.Length); if (item2.FileInfo != null) strSize2 = MediaPortal.Util.Utils.GetSize(item2.FileInfo.Length); + //fileitem sort + if ((item1.MusicTag is FileItem) && (item2.MusicTag is FileItem)) + { + FileItem fileItem1 = item1.MusicTag as FileItem; + FileItem fileItem2 = item2.MusicTag as FileItem; + if (fileItem1 == null) return -1; + if (fileItem2 == null) return -1; - FileItem fileItem1 = item1.MusicTag as FileItem; - FileItem fileItem2 = item2.MusicTag as FileItem; - if (fileItem1 == null) return -1; - if (fileItem2 == null) return -1; + switch (currentSortMethod) + { + case SortMethod.Title: + if (sortAscending) + return String.Compare(fileItem1.Title, fileItem2.Title, true); + else + return String.Compare(fileItem2.Title, fileItem1.Title, true); - switch (currentSortMethod) - { - case SortMethod.Title: - if (sortAscending) - return String.Compare(fileItem1.Title, fileItem2.Title, true); - else - return String.Compare(fileItem2.Title, fileItem1.Title, true); + case SortMethod.Filename: + if (sortAscending) + return String.Compare(fileItem1.filePath, fileItem2.filePath, true); + else + return String.Compare(fileItem2.filePath, fileItem1.filePath, true); - case SortMethod.Filename: - if (sortAscending) - return String.Compare(fileItem1.filePath, fileItem2.filePath, true); - else - return String.Compare(fileItem2.filePath, fileItem1.filePath, true); + case SortMethod.Rating: + if (sortAscending) + return fileItem1.Rating.CompareTo(fileItem2.Rating); + else + return fileItem2.Rating.CompareTo(fileItem1.Rating); - case SortMethod.Rating: - if (sortAscending) - return fileItem1.Rating.CompareTo(fileItem2.Rating); - else - return fileItem2.Rating.CompareTo(fileItem1.Rating); + case SortMethod.LaunchCount: + if (sortAscending) + return fileItem1.LaunchCount.CompareTo(fileItem2.LaunchCount); + else + return fileItem2.LaunchCount.CompareTo(fileItem1.LaunchCount); - case SortMethod.LaunchCount: - if (sortAscending) - return fileItem1.LaunchCount.CompareTo(fileItem2.LaunchCount); - else - return fileItem2.LaunchCount.CompareTo(fileItem1.LaunchCount); + case SortMethod.LastTimeLaunched: + if (sortAscending) + return DateTime.Compare(fileItem1.LastTimeLaunched, fileItem2.LastTimeLaunched); + else + return DateTime.Compare(fileItem2.LastTimeLaunched, fileItem1.LastTimeLaunched); - case SortMethod.LastTimeLaunched: - if (sortAscending) - return DateTime.Compare(fileItem1.LastTimeLaunched, fileItem2.LastTimeLaunched); - else - return DateTime.Compare(fileItem2.LastTimeLaunched, fileItem1.LastTimeLaunched); - - case SortMethod.Platform: - if (sortAscending) - return String.Compare(fileItem1.Platform, fileItem2.Platform, true); - else - return String.Compare(fileItem2.Platform, fileItem1.Platform, true); + case SortMethod.Platform: + if (sortAscending) + return String.Compare(fileItem1.Platform, fileItem2.Platform, true); + else + return String.Compare(fileItem2.Platform, fileItem1.Platform, true); + } + return 0; } return 0; } Modified: trunk/plugins/myGUIProgramsAlt/README.txt =================================================================== --- trunk/plugins/myGUIProgramsAlt/README.txt 2007-08-27 23:31:18 UTC (rev 873) +++ trunk/plugins/myGUIProgramsAlt/README.txt 2007-08-28 11:15:21 UTC (rev 874) @@ -32,9 +32,18 @@ ---------------- Testing,bugfixing,codecleanup -Optimize some things if possibly -- for example, try gamebase with 10000 items.. +-Optimize some things if possibly +-Change graphics for fileinfobackground (it says mymovies...) + +-Add sort for filteritems too. + +-Fix brokenprogressdialogs in gui reimport + +-Allow the amg best match update from fileinfo window for fileitem + + BUGS: - Just add em... @@ -49,10 +58,7 @@ .: Things to clear :. --------------------- -Name: -MyEmu...? - Add some more specific emulator support.. - using emulator ids??? yes at some point. this could benefit automatic downloads etc - easier application image assigning together with thumbsdir -> we also could provide icons for most common system This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |