From: <nor...@us...> - 2007-08-27 13:37:15
|
Revision: 870 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=870&view=rev Author: northern_sky Date: 2007-08-27 03:30:17 -0700 (Mon, 27 Aug 2007) Log Message: ----------- more cleanups Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-27 05:44:33 UTC (rev 869) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-27 10:30:17 UTC (rev 870) @@ -61,25 +61,20 @@ { #region Variables - - + bool currentSortAsc = true; - // FacadeView - const int facadeIDConst = 50; ProgramViewHandler viewHandler = ProgramViewHandler.Instance; List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; DirectoryHistory itemHistory = new DirectoryHistory(); int slideSpeed = 3000; // speed in milliseconds between two slides long slideTime = 0; - bool skipInit = false; static string _thumbnailPath = string.Empty; static string _lastThumbnailPath = string.Empty; ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Title; DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; - GUIProgramsAltUserSettings userSettings = new GUIProgramsAltUserSettings(); - ApplicationItem lastApp = null; + ApplicationItem currentApplicationItem = null; string prevFilepath = ""; int selectedItemIndex = -1; Layout currentLayout = Layout.List; @@ -97,125 +92,19 @@ [SkinControl(6)] protected GUIImage screenShotImage = null; - [SkinControl(facadeIDConst)] + [SkinControl(50)] protected GUIFacadeControl facadeView = null; #endregion Variables - void SaveSettings() - { - using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - switch ((Layout)userSettings.ViewLayout) - { - case Layout.List: - xmlwriter.SetValue("myprograms", "viewLayout", "list"); - break; - case Layout.Icons: - xmlwriter.SetValue("myprograms", "viewLayout", "icons"); - break; - case Layout.LargeIcons: - xmlwriter.SetValue("myprograms", "viewLayout", "largeicons"); - break; - case Layout.FilmStrip: - xmlwriter.SetValue("myprograms", "viewLayout", "filmstrip"); - break; - } - xmlwriter.SetValue("myprograms", "lastAppID", userSettings.LastAppID.ToString()); - // xmlwriter.SetValue("myprograms", "lastViewLevel", userSettings.LastViewLevel.ToString()); - xmlwriter.SetValue("myprograms", "lastViewLevel", ViewHandler.CurrentLevel); - xmlwriter.SetValue("myprograms", "sortMethod", userSettings.SortMethod); - // avoid bool conversion...... don't wanna know why it doesn't work! :-( - if (userSettings.SortAscending) - { - xmlwriter.SetValue("myprograms", "sortASC", "yes"); - } - else - { - xmlwriter.SetValue("myprograms", "sortASC", "no"); - } - - if (userSettings.OverviewVisible) - { - xmlwriter.SetValue("myprograms", "overviewvisible", "yes"); - } - else - { - xmlwriter.SetValue("myprograms", "overviewvisible", "no"); - } - - xmlwriter.SetValue("myprograms", "startview", (int)userSettings.ViewLayout); - } - } - - void LoadSettings() - { - slideSpeed = ProgramUtils.GetSleepTime(); - - using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - string curText = ""; - curText = xmlreader.GetValueAsString("myprograms", "viewLayout", "list"); - - if (curText == "list") userSettings.ViewLayout = (int)Layout.List; - else if (curText == "icons") userSettings.ViewLayout = (int)Layout.Icons; - else if (curText == "largeicons") userSettings.ViewLayout = (int)Layout.LargeIcons; - else if (curText == "filmstrip") userSettings.ViewLayout = (int)Layout.FilmStrip; - else userSettings.ViewLayout = (int)Layout.List; - - CurrentSortMethod = (ProgramSort.SortMethod)xmlreader.GetValueAsInt("myprograms", "sortMethod", (int)ProgramSort.SortMethod.Title); - - userSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); - userSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - userSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortASC", true); - userSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "sortASC", true); - } - } - - void LoadLastAppIDFromSettings() - { - using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - userSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); - userSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - userSettings.SortMethod = xmlreader.GetValueAsInt("myprograms", "sortMethod", 0); - userSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortAsc", true); - userSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "overviewvisible", true); - } - } - - void LoadFolderSettings(string directoryName) - { - if (directoryName == "") - directoryName = "root"; - - object o; - FolderSettings.GetFolderSetting(directoryName, "Programs", typeof(GUIProgramsAltUserSettings), out o); - if (o != null) - userSettings = o as GUIProgramsAltUserSettings; - if (userSettings == null) - userSettings = new GUIProgramsAltUserSettings(); - } - - void SaveFolderSettings(string directoryName) - { - if (directoryName == "") - directoryName = "root"; - FolderSettings.AddFolderSetting(directoryName, "Programs", typeof(GUIProgramsAltUserSettings), userSettings); - } - #region Constructor / Destructor public GUIProgramsAlt() { - - GetID = (int)Window.WINDOW_FILES; + GetID = (int)Window.WINDOW_FILES; } - - - #endregion Constructor / Destructor #region Properties / Helper Routines @@ -271,9 +160,9 @@ int GetCurrentFatherID() { - if (lastApp != null) + if (currentApplicationItem != null) { - return lastApp.ApplicationItemId; + return currentApplicationItem.ApplicationItemId; } else { @@ -284,27 +173,66 @@ bool ThereAreAppsToDisplay() { - if (lastApp == null) + if (currentApplicationItem == null) { return true; // root has globalApplicationList } else { - return lastApp.SubItemsAllowed(); // grouper items for example + return currentApplicationItem.SubItemsAllowed(); // grouper items for example } } - bool ThereAreFilesOrLinksToDisplay() + bool IsCurrentApplicationItemNull() { - return (lastApp != null); // all globalApplicationList can have files except the root + return (currentApplicationItem != null); // all globalApplicationList can have files except the root } - bool IsBackButtonNecessary() + #endregion + + string GetViewLayoutAsText() { - return (lastApp != null); // always show back button except for root + string result; + + switch (CurrentLayout) + { + case Layout.List: + result = GUILocalizeStrings.Get(101); + break; + case Layout.Icons: + result = GUILocalizeStrings.Get(100); + break; + case Layout.LargeIcons: + result = GUILocalizeStrings.Get(417); + break; + case Layout.FilmStrip: + result = GUILocalizeStrings.Get(733); + break; + default: + result = ""; + break; + } + return result; } - #endregion + public void SwitchToNextViewLayout() + { + switch (CurrentLayout) + { + case Layout.List: + CurrentLayout = Layout.Icons; + break; + case Layout.Icons: + CurrentLayout = Layout.LargeIcons; + break; + case Layout.LargeIcons: + CurrentLayout = Layout.FilmStrip; + break; + case Layout.FilmStrip: + CurrentLayout = Layout.List; + break; + } + } #region Private Methods @@ -313,9 +241,55 @@ dbHandlerInstance.LoadAllApplicationItems(); globalApplicationList = dbHandlerInstance.ApplicationItemList; LoadSettings(); - skipInit = true; } + void SaveSettings() + { + using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + if (currentApplicationItem != null) + { + xmlwriter.SetValue("myProgramsAlt", "applicationItemId", currentApplicationItem.ApplicationItemId); + } + xmlwriter.SetValue("myProgramsAlt", "lastViewLevel", ViewHandler.CurrentLevel); + xmlwriter.SetValue("myProgramsAlt", "sortMethod", (int)CurrentSortMethod); + xmlwriter.SetValue("myProgramsAlt", "view", ViewHandler.CurrentView); + + // avoid bool conversion...... don't wanna know why it doesn't work! :-( + if (CurrentSortAsc) + { + xmlwriter.SetValue("myProgramsAlt", "sortASC", "yes"); + } + else + { + xmlwriter.SetValue("myProgramsAlt", "sortASC", "no"); + } + xmlwriter.SetValue("myProgramsAlt", "viewLayout", (int)CurrentLayout); + } + } + + void LoadSettings() + { + slideSpeed = ProgramUtils.GetSleepTime(); + + using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + CurrentSortMethod = (ProgramSort.SortMethod)xmlreader.GetValueAsInt("myProgramsAlt", "sortMethod", (int)ProgramSort.SortMethod.Title); + CurrentLayout = (Layout)xmlreader.GetValueAsInt("myProgramsAlt", "viewLayout", (int)Layout.List); + + if (currentApplicationItem == null) + {//create a fake tmpappitem so it's not null + 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", ""); + } + } + + void SortChanged(object sender, SortEventArgs args) { this.CurrentSortAsc = args.Order != System.Windows.Forms.SortOrder.Descending; @@ -329,13 +303,13 @@ GUIPropertyManager.SetProperty("#view", ViewHandler.LocalizedCurrentView); - if (lastApp == null) + if (currentApplicationItem == null) { btnRefresh.IsVisible = false; } else { - btnRefresh.IsVisible = lastApp.RefreshGUIAllowed; + btnRefresh.IsVisible = currentApplicationItem.RefreshGUIAllowed; } facadeView.IsVisible = true; @@ -343,7 +317,7 @@ GUIControl.FocusControl(GetID, facadeView.GetID); // display apptitle if available..... - if (lastApp != null) + if (currentApplicationItem != null) { if ((ViewHandler.CurrentView != null) && (ViewHandler.MaxLevels > 0)) { @@ -351,7 +325,7 @@ } else { - GUIPropertyManager.SetProperty("#curheader", lastApp.Title); + GUIPropertyManager.SetProperty("#curheader", currentApplicationItem.Title); } } else @@ -367,7 +341,7 @@ } } - btnViewAs.Label = userSettings.ViewLayoutTextName; + btnViewAs.Label = GetViewLayoutAsText(); switch (CurrentSortMethod) { @@ -402,7 +376,7 @@ { int itemIndex = facadeView.SelectedListItemIndex; - switch ((Layout)userSettings.ViewLayout) + switch (CurrentLayout) { case Layout.List: facadeView.View = GUIFacadeControl.ViewMode.List; @@ -439,7 +413,7 @@ void RefreshThumbnail() { - ApplicationItem appWithImg = lastApp; + ApplicationItem appWithImg = currentApplicationItem; GUIListItem item = GetSelectedItem(); // some preconditions... @@ -467,16 +441,16 @@ void UpdateListControl() { GUIControl.ClearControl(GetID, facadeView.GetID); - if (IsBackButtonNecessary()) + if (IsCurrentApplicationItemNull()) ProgramUtils.AddBackButton(facadeView); int TotalItems = 0; if (ThereAreAppsToDisplay()) TotalItems += DisplayApps(); - if (ThereAreFilesOrLinksToDisplay()) + if (IsCurrentApplicationItemNull()) TotalItems += DisplayFiles(); - if (lastApp != null) + if (currentApplicationItem != null) facadeView.Sort(new ProgramSort(CurrentSortMethod, CurrentSortAsc)); //set object count label @@ -491,16 +465,16 @@ int DisplayFiles() { - if (lastApp == null) return 0; + if (currentApplicationItem == null) return 0; // Refresh FileList if view has changed, while this appItem was not active - if ((lastApp.CurrentView != ViewHandler.CurrentView) || (lastApp.filesAreLoaded == false)) + if ((currentApplicationItem.CurrentView != ViewHandler.CurrentView) || (currentApplicationItem.filesAreLoaded == false)) { - lastApp.LoadFiles(); - lastApp.CurrentView = ViewHandler.CurrentView; + currentApplicationItem.LoadFiles(); + currentApplicationItem.CurrentView = ViewHandler.CurrentView; } int totalFiles = 0; - totalFiles = totalFiles + DisplayItemList(lastApp.ItemList, facadeView); + totalFiles = totalFiles + DisplayItemList(currentApplicationItem.ItemList, facadeView); return (totalFiles); } @@ -544,45 +518,13 @@ return (totalApps); } - string BuildHistoryKey(ApplicationItem app, int viewLevel, string pathSub) - { - int appID; - if (app != null) - { - appID = app.ApplicationItemId; - } - else - { - appID = 1; // root - } - return String.Format("applicationItem{0}#level{1}#sub_{2}", appID, viewLevel, pathSub); - } - public void SaveItemIndex(string value, ApplicationItem app, string pathSub) - { - string key = BuildHistoryKey(app, ViewHandler.CurrentLevel, pathSub); - itemHistory.Set(value, key); - } - void RestoreItemIndex(ApplicationItem app, string pathSub) - { - string key = BuildHistoryKey(app, ViewHandler.CurrentLevel, pathSub); - string itemHist = itemHistory.Get(key); - if (itemHist != "") - { - int itemIndex = ProgramUtils.StringToInteger(itemHist, -1); - if ((itemIndex >= 0) && (itemIndex <= facadeView.Count - 1)) - { - GUIControl.SelectItemControl(GetID, facadeView.GetID, itemIndex); - } - } - } - void BackItemClicked() { - if (lastApp != null) + if (currentApplicationItem != null) { - if ((prevFilepath != null) && (prevFilepath != "") && (prevFilepath != lastApp.FileDirectory)) + if ((prevFilepath != null) && (prevFilepath != "") && (prevFilepath != currentApplicationItem.FileDirectory)) { // back item in filelist clicked prevFilepath = Path.GetDirectoryName(prevFilepath); @@ -593,22 +535,22 @@ { FilterItem curFilter; // force reload, this will load the next filter-level..... - lastApp.LoadFiles(); + currentApplicationItem.LoadFiles(); // auto-remove filters if there is only ONE EMPTY Filteritem // displaying - bool doAutoRemove = ((lastApp.ItemList.Count == 1) && (ViewHandler.IsFilterQuery)); + bool doAutoRemove = ((currentApplicationItem.ItemList.Count == 1) && (ViewHandler.IsFilterQuery)); while (doAutoRemove) { doAutoRemove = false; - if (lastApp.ItemList[0] is FilterItem) + if (currentApplicationItem.ItemList[0] is FilterItem) { - curFilter = lastApp.ItemList[0] as FilterItem; + curFilter = currentApplicationItem.ItemList[0] as FilterItem; if ((curFilter.Title == "") && (curFilter.Title2 == "")) { if (ViewHandler.RemoveFilterItem()) { - lastApp.LoadFiles(); - doAutoRemove = ((lastApp.ItemList.Count == 1) && (ViewHandler.IsFilterQuery)); + currentApplicationItem.LoadFiles(); + doAutoRemove = ((currentApplicationItem.ItemList.Count == 1) && (ViewHandler.IsFilterQuery)); } } } @@ -618,23 +560,23 @@ { // back item in application list clicked // go to father item - lastApp = this.dbHandlerInstance.GetAppByID(lastApp.FatherID); - if (lastApp != null) + currentApplicationItem = this.dbHandlerInstance.GetAppByID(currentApplicationItem.FatherID); + if (currentApplicationItem != null) { - userSettings.LastAppID = lastApp.ApplicationItemId; - prevFilepath = lastApp.DefaultFilepath(); + //userSettings.LastAppID = currentApplicationItem.ApplicationItemId; + prevFilepath = currentApplicationItem.DefaultFilepath(); } else { // back to home screen..... - userSettings.LastAppID = -1; + //currentApplicationItem.ApplicationItemId = -1; prevFilepath = ""; } } } UpdateButtonStates(); UpdateListControl(); - RestoreItemIndex(lastApp, prevFilepath); + //RestoreItemIndex(currentApplicationItem, prevFilepath); } else { @@ -739,7 +681,7 @@ dlgProgress.ShowProgressBar(false); curFile.FileInfoFavourite = (FileItemInfo)curFile.FileInfoList[iSelectedGame]; - curFile.FindFileInfoDetail(lastApp, curFile.FileInfoFavourite, ScraperType.ALLGAME, saveType); + curFile.FindFileInfoDetail(currentApplicationItem, curFile.FileInfoFavourite, ScraperType.ALLGAME, saveType); if ((saveType == ScraperSaveType.DataAndImages) || (saveType == ScraperSaveType.Data)) { // dlgProgress.SetPercentage(60); @@ -807,35 +749,35 @@ if (item is ApplicationItem) { - lastApp = (ApplicationItem)item; - SaveItemIndex(GetSelectedItemNo().ToString(), lastApp, lastApp.lastFilepath); - userSettings.LastAppID = lastApp.ApplicationItemId; - prevFilepath = lastApp.DefaultFilepath(); + currentApplicationItem = (ApplicationItem)item; + //SaveItemIndex(GetSelectedItemNo().ToString(), currentApplicationItem, currentApplicationItem.lastFilepath); + + prevFilepath = currentApplicationItem.DefaultFilepath(); ViewHandler.CurrentLevel = 0; - //lastApp.ViewHandler = ViewHandler; + //currentApplicationItem.ViewHandler = ViewHandler; } else if (item is FileItem) { FileItem fileItem = (FileItem)item; selectedItemIndex = GetSelectedItemNo(); - if (lastApp != null) + if (currentApplicationItem != null) { - userSettings.LastAppID = lastApp.ApplicationItemId; - prevFilepath = lastApp.DefaultFilepath(); - lastApp.LaunchFile(fileItem); + + prevFilepath = currentApplicationItem.DefaultFilepath(); + currentApplicationItem.LaunchFile(fileItem); } } else if (item is FilterItem) { FilterItem filterItem = (FilterItem)item; - SaveItemIndex(GetSelectedItemNo().ToString(), lastApp, prevFilepath); + // SaveItemIndex(GetSelectedItemNo().ToString(), currentApplicationItem, prevFilepath); ViewHandler.AddFilterItem(filterItem); - if (lastApp != null) + if (currentApplicationItem != null) { // force reload, this will load the next filter-level..... - lastApp.LoadFiles(); + currentApplicationItem.LoadFiles(); } } @@ -892,7 +834,7 @@ string imgFile = String.Empty; if (ProgramUtils.UseThumbsDir()) - imgFile = ProgramUtils.GetFileImage(lastApp, curFileItem); + imgFile = ProgramUtils.GetFileImage(currentApplicationItem, curFileItem); else imgFile = curFileItem.Imagefile; @@ -977,7 +919,7 @@ void ShowInfoWindow() { - if (lastApp == null) return; + if (currentApplicationItem == null) return; selectedItemIndex = GetSelectedItemNo(); GUIListItem item = GetSelectedItem(); @@ -992,7 +934,7 @@ curFile = (FileItem)item.MusicTag; GUIProgramsAltFileInfo fileInfo = (GUIProgramsAltFileInfo)GUIWindowManager.GetWindow(9999); fileInfo.CurrentFileItem = curFile; - fileInfo.CurrentApplicationItem = lastApp; + fileInfo.CurrentApplicationItem = currentApplicationItem; fileInfo.FolderForThumbs = string.Empty; GUIWindowManager.ActivateWindow(9999); } @@ -1033,7 +975,7 @@ if (dlg.SelectedLabel == -1) return; if (dlg.SelectedLabel == 0) { - userSettings.ViewLayout = (int)Layout.List; + CurrentLayout = Layout.List; ViewHandler.CurrentView = GUILocalizeStrings.Get(100000 + GetID);//my files } else @@ -1064,39 +1006,26 @@ protected override void OnPageLoad() { - InitGUIProgramsAlt(); - base.OnPageLoad(); + InitGUIProgramsAlt(); + if (btnSortBy != null) btnSortBy.SortChanged += new SortEventHandler(SortChanged); - LoadFolderSettings(""); - - if (skipInit) + if (currentApplicationItem != null) { - userSettings.LastAppID = -1; + currentApplicationItem = this.dbHandlerInstance.GetAppByID(currentApplicationItem.ApplicationItemId); + prevFilepath = currentApplicationItem.DefaultFilepath(); } else { - LoadLastAppIDFromSettings(); // hacky load back the last applicationItem id, otherwise this can get lost from dx resets.... - } - lastApp = this.dbHandlerInstance.GetAppByID(userSettings.LastAppID); - - if (lastApp != null) - { - prevFilepath = lastApp.DefaultFilepath(); - this.CurrentSortAsc = userSettings.SortAscending; - ViewHandler.CurrentLevel = userSettings.LastViewLevel; - } - else - { prevFilepath = ""; } UpdateListControl(); ShowThumbPanel(); - skipInit = false; + } protected override void OnPageDestroy(int newWindowId) @@ -1131,7 +1060,6 @@ UpdateButtonStates(); break; case Action.ActionType.ACTION_CLOSE_DIALOG: - SaveFolderSettings(""); GUIWindowManager.ShowPreviousWindow(); break; case Action.ActionType.ACTION_SHOW_INFO: @@ -1152,9 +1080,9 @@ int iControl = message.SenderControlId; if (iControl == facadeView.GetID) { - if (lastApp != null) + if (currentApplicationItem != null) { - lastApp.ResetThumbs(); + currentApplicationItem.ResetThumbs(); } } } @@ -1169,7 +1097,7 @@ if (control == btnViewAs) { - userSettings.SwitchToNextViewLayout(); + SwitchToNextViewLayout(); ShowThumbPanel(); @@ -1177,10 +1105,10 @@ } else if (control == btnRefresh) { - if (lastApp != null) + if (currentApplicationItem != null) { - lastApp.Refresh(true); - prevFilepath = lastApp.DefaultFilepath(); + currentApplicationItem.Refresh(true); + prevFilepath = currentApplicationItem.DefaultFilepath(); // todo: reset viewHandler UpdateButtonStates(); UpdateListControl(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-27 05:44:33 UTC (rev 869) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-27 10:30:17 UTC (rev 870) @@ -142,7 +142,6 @@ </Compile> <Compile Include="GUIProgramsAlt.cs" /> <Compile Include="GUIProgramsAltFileInfo.cs" /> - <Compile Include="GUIProgramsAltUserSettings.cs" /> <Compile Include="Imports\AllGameScraper.cs" /> <Compile Include="Imports\DirectoryImport.cs" /> <Compile Include="Imports\GamebaseImport.cs" /> Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs 2007-08-27 05:44:33 UTC (rev 869) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs 2007-08-27 10:30:17 UTC (rev 870) @@ -1,137 +0,0 @@ -using System; - -using System.Xml.Serialization; -using System.Collections.Generic; -using System.Text; - - -using MediaPortal.GUI.Library; -using MediaPortal.Util; - -namespace GUIProgramsAlt -{ - [Serializable] - public class GUIProgramsAltUserSettings - { - protected int sortMethod; - protected int viewLayout; - protected bool sortAscending; - protected int lastApplicationID; - protected int lastFileID; - protected int lastViewLevel; - protected bool overviewVisible; - - public GUIProgramsAltUserSettings() - { - sortMethod = 0; //name - viewLayout = 0; //list - sortAscending = true; - overviewVisible = true; - lastApplicationID = -1; - lastFileID = -1; - lastViewLevel = 0; - } - - [XmlElement("SortMethod")] - public int SortMethod - { - get { return sortMethod; } - set { sortMethod = value; } - } - - [XmlElement("ViewLayout")] - public int ViewLayout - { - get { return viewLayout; } - set { viewLayout = value; } - } - - [XmlElement("SortAscending")] - public bool SortAscending - { - get { return sortAscending; } - set { sortAscending = value; } - } - - [XmlElement("OverviewVisible")] - public bool OverviewVisible - { - get { return overviewVisible; } - set { overviewVisible = value; } - } - - [XmlElement("LastAppID")] - public int LastAppID - { - get { return lastApplicationID; } - set { lastApplicationID = value; } - } - - [XmlElement("LastFileID")] - public int LastFileID - { - get { return lastFileID; } - set { lastFileID = value; } - } - - [XmlElement("LastViewLevelID")] - public int LastViewLevel - { - get { return lastViewLevel; } - set { lastViewLevel = value; } - } - - - public string ViewLayoutTextName - { - get { return GetViewLayoutAsText(); } - } - - string GetViewLayoutAsText() - { - string result = ""; - switch ((Layout)ViewLayout) - { - case Layout.List: - result = GUILocalizeStrings.Get(101); - break; - case Layout.Icons: - result = GUILocalizeStrings.Get(100); - break; - case Layout.LargeIcons: - result = GUILocalizeStrings.Get(417); - break; - case Layout.FilmStrip: - result = GUILocalizeStrings.Get(733); - break; - } - return result; - } - - public void SwitchToNextViewLayout() - { - switch ((Layout)ViewLayout) - { - case Layout.List: - ViewLayout = (int)Layout.Icons; - - break; - case Layout.Icons: - ViewLayout = (int)Layout.LargeIcons; - - break; - case Layout.LargeIcons: - ViewLayout = (int)Layout.FilmStrip; - - break; - case Layout.FilmStrip: - ViewLayout = (int)Layout.List; - - break; - } - } - - - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-08-27 13:37:30
|
Revision: 867 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=867&view=rev Author: northern_sky Date: 2007-08-26 11:09:04 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Cleanup , moved out settings into own class Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilterItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Properties/Resources.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Properties/Resources.resx Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -31,15 +31,15 @@ using System.IO; using System.Data; using MediaPortal.GUI.Library; -using GUIPrograms; +using GUIProgramsAlt; using MediaPortal.Database; using MediaPortal.Util; using MediaPortal.Configuration; using System.Data.SQLite; -using GUIPrograms.Items; +using GUIProgramsAlt.Items; #endregion Imports -namespace GUIPrograms.Database +namespace GUIProgramsAlt.Database { /// <summary> /// DBhandling methods Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class AppSettingsFilesImportProgress { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -31,10 +31,10 @@ using System.Text; using System.Windows.Forms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class AppSettingsFilesImportProgress : AppSettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class AppSettingsFilesView { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -33,11 +33,11 @@ using System.Windows.Forms; using Core.Util; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class AppSettingsFilesView : UserControl { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class AppSettingsBase { @@ -100,7 +100,7 @@ // // applicationExeButton // - this.applicationExeButton.Image = global::GUIPrograms.Properties.Resources.browseButton_Image; + this.applicationExeButton.Image = global::GUIProgramsAlt.Properties.Resources.browseButtonImage; this.applicationExeButton.Location = new System.Drawing.Point(426, 96); this.applicationExeButton.Name = "applicationExeButton"; this.applicationExeButton.Size = new System.Drawing.Size(31, 23); @@ -209,7 +209,7 @@ // // applicationImageButton // - this.applicationImageButton.Image = global::GUIPrograms.Properties.Resources.browseButton_Image; + this.applicationImageButton.Image = global::GUIProgramsAlt.Properties.Resources.browseButtonImage; this.applicationImageButton.Location = new System.Drawing.Point(426, 121); this.applicationImageButton.Name = "applicationImageButton"; this.applicationImageButton.Size = new System.Drawing.Size(31, 23); @@ -219,7 +219,7 @@ // // startupDirButton // - this.startupDirButton.Image = global::GUIPrograms.Properties.Resources.browseButton_Image; + this.startupDirButton.Image = global::GUIProgramsAlt.Properties.Resources.browseButtonImage; this.startupDirButton.Location = new System.Drawing.Point(426, 201); this.startupDirButton.Name = "startupDirButton"; this.startupDirButton.Size = new System.Drawing.Size(31, 23); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -34,12 +34,12 @@ using System.Windows.Forms; using Core.Util; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; using MediaPortal.Configuration; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class AppSettingsBase : SettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class AppSettingsDirCache { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -32,11 +32,11 @@ using System.Text; using System.Windows.Forms; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class AppSettingsDirCache : AppSettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class AppSettingsGamebase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -33,11 +33,11 @@ using System.Text; using System.Windows.Forms; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class AppSettingsGamebase : AppSettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class AppSettingsGrouper { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -31,11 +31,11 @@ using System.Text; using System.Windows.Forms; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class AppSettingsGrouper : AppSettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class AppSettingsMame { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -33,11 +33,11 @@ using System.Text; using System.Windows.Forms; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class AppSettingsMame : AppSettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class FileDetailsForm { @@ -89,7 +89,7 @@ // buttonViewImg // this.buttonViewImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.buttonViewImg.Image = global::GUIPrograms.Properties.Resources.previewButton_Image; + this.buttonViewImg.Image = global::GUIProgramsAlt.Properties.Resources.previewButtonImage; this.buttonViewImg.Location = new System.Drawing.Point(431, 72); this.buttonViewImg.Name = "buttonViewImg"; this.buttonViewImg.Size = new System.Drawing.Size(31, 23); @@ -324,7 +324,7 @@ // btnImageFile // this.btnImageFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnImageFile.Image = global::GUIPrograms.Properties.Resources.browseButton_Image; + this.btnImageFile.Image = global::GUIProgramsAlt.Properties.Resources.browseButtonImage; this.btnImageFile.Location = new System.Drawing.Point(468, 72); this.btnImageFile.Name = "btnImageFile"; this.btnImageFile.Size = new System.Drawing.Size(31, 23); @@ -383,7 +383,7 @@ // btnFilename // this.btnFilename.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnFilename.Image = global::GUIPrograms.Properties.Resources.browseButton_Image; + this.btnFilename.Image = global::GUIProgramsAlt.Properties.Resources.browseButtonImage; this.btnFilename.Location = new System.Drawing.Point(468, 45); this.btnFilename.Name = "btnFilename"; this.btnFilename.Size = new System.Drawing.Size(31, 23); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -31,13 +31,13 @@ using System.Windows.Forms; using Core.Util; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; using System.Data.SQLite; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class FileDetailsForm : Form { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class FileInfoScraperForm { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileInfoScraperForm.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -34,11 +34,11 @@ using System.Windows.Forms; using System.Data.SQLite; -using GUIPrograms; -using GUIPrograms.Database; -using GUIPrograms.Items; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; +using GUIProgramsAlt.Items; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class FileInfoScraperForm : Form { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class FileSettingsBox { @@ -52,7 +52,7 @@ // // Button // - this.Button.Image = global::GUIPrograms.Properties.Resources.browseButton_Image; + this.Button.Image = global::GUIProgramsAlt.Properties.Resources.browseButtonImage; this.Button.Location = new System.Drawing.Point(423, 2); this.Button.Name = "Button"; this.Button.Size = new System.Drawing.Size(31, 23); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -5,8 +5,9 @@ using System.Data; using System.Text; using System.Windows.Forms; +using GUIProgramsAlt; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class FileSettingsBox : UserControl { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class ProgramViews { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/ProgramViews.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -37,7 +37,7 @@ using MediaPortal.GUI.View; using MediaPortal.Util; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class ProgramViews : UserControl { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class SettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsBase.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -34,12 +34,12 @@ using System.Windows.Forms; using Core.Util; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; using MediaPortal.GUI.Library; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class SettingsBase : UserControl { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class SettingsRoot { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -31,11 +31,11 @@ using System.Text; using System.Windows.Forms; -using GUIPrograms; -using GUIPrograms.Items; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class SettingsRoot : SettingsBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -1,4 +1,4 @@ -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { partial class SetupForm { @@ -142,7 +142,7 @@ // // deleteApplicationToolStripMenuItem // - this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; + this.deleteApplicationToolStripMenuItem.Image = global::GUIProgramsAlt.Properties.Resources.deleteButtonImage; this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(169, 22); this.deleteApplicationToolStripMenuItem.Text = "Delete application"; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -14,14 +14,14 @@ using MediaPortal.Configuration; using System.IO; -using GUIPrograms.Database; -using GUIPrograms; -using GUIPrograms.Items; +using GUIProgramsAlt.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Items; #endregion -namespace GUIPrograms.Design +namespace GUIProgramsAlt.Design { public partial class SetupForm : Form { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -23,6 +23,7 @@ #endregion +#region Imports using System; using System.Collections.Generic; using System.Drawing; @@ -41,153 +42,73 @@ using MediaPortal.Profile; using MediaPortal.Util; -using GUIPrograms.Items; -using GUIPrograms.Database; -using GUIPrograms.Design; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Database; +using GUIProgramsAlt.Design; using System.Data.SQLite; using System.Data; -namespace GUIPrograms +#endregion Imports + +namespace GUIProgramsAlt { /// <summary> - /// The GUIProgramsAlt plugin is used to list a collection of arbitrary files + /// The GUIProgramsAlt plugin is used to list a collection of arbitrary files ,(focused on emulators) /// and use them as arguments when launching external applications. /// </summary> /// public class GUIProgramsAlt : GUIWindow, ISetupForm, IShowPlugin { - #region Serialisation + #region Variables - [Serializable] - public class MapSettings - { - protected int sortMethod; - protected int viewLayout; - protected bool sortAscending; - protected int lastApplicationID; - protected int lastFileID; - protected int lastViewLevel; - protected bool overviewVisible; - public MapSettings() - { - sortMethod = 0; //name - viewLayout = 0; //list - sortAscending = true; - overviewVisible = true; - lastApplicationID = -1; - lastFileID = -1; - lastViewLevel = 0; - } + bool currentSortAsc = true; + // FacadeView + const int facadeIDConst = 50; + ProgramViewHandler viewHandler = ProgramViewHandler.Instance; + List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; + DirectoryHistory itemHistory = new DirectoryHistory(); + int slideSpeed = 3000; // speed in milliseconds between two slides + long slideTime = 0; + bool skipInit = false; + static string _thumbnailPath = string.Empty; + static string _lastThumbnailPath = string.Empty; + ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Title; + DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; - [XmlElement("SortMethod")] - public int SortMethod - { - get { return sortMethod; } - set { sortMethod = value; } - } + GUIProgramsAltUserSettings userSettings = new GUIProgramsAltUserSettings(); + ApplicationItem lastApp = null; + string prevFilepath = ""; + int selectedItemIndex = -1; + Layout currentLayout = Layout.List; - [XmlElement("ViewLayout")] - public int ViewLayout - { - get { return viewLayout; } - set { viewLayout = value; } - } + // Buttons + [SkinControl(2)] + protected GUIButtonControl btnViewAs = null; + [SkinControlAttribute(3)] + protected GUISortButtonControl btnSortBy = null; + [SkinControl(4)] + protected GUIButtonControl btnViews = null; + [SkinControl(5)] + protected GUIButtonControl btnRefresh = null; + //Images + [SkinControl(6)] + protected GUIImage screenShotImage = null; - [XmlElement("SortAscending")] - public bool SortAscending - { - get { return sortAscending; } - set { sortAscending = value; } - } + [SkinControl(facadeIDConst)] + protected GUIFacadeControl facadeView = null; - [XmlElement("OverviewVisible")] - public bool OverviewVisible - { - get { return overviewVisible; } - set { overviewVisible = value; } - } + - [XmlElement("LastAppID")] - public int LastAppID - { - get { return lastApplicationID; } - set { lastApplicationID = value; } - } + #endregion Variables - [XmlElement("LastFileID")] - public int LastFileID - { - get { return lastFileID; } - set { lastFileID = value; } - } - - [XmlElement("LastViewLevelID")] - public int LastViewLevel - { - get { return lastViewLevel; } - set { lastViewLevel = value; } - } - - - public string ViewLayoutTextName - { - get { return GetViewLayoutAsText(); } - } - - public void SwitchToNextViewLayout() - { - switch ((Layout)ViewLayout) - { - case Layout.List: - ViewLayout = (int)Layout.Icons; - - break; - case Layout.Icons: - ViewLayout = (int)Layout.LargeIcons; - - break; - case Layout.LargeIcons: - ViewLayout = (int)Layout.FilmStrip; - - break; - case Layout.FilmStrip: - ViewLayout = (int)Layout.List; - - break; - } - } - - string GetViewLayoutAsText() - { - string result = ""; - switch ((Layout)ViewLayout) - { - case Layout.List: - result = GUILocalizeStrings.Get(101); - break; - case Layout.Icons: - result = GUILocalizeStrings.Get(100); - break; - case Layout.LargeIcons: - result = GUILocalizeStrings.Get(417); - break; - case Layout.FilmStrip: - result = GUILocalizeStrings.Get(733); - break; - } - return result; - } - } - - void SaveSettings() { using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { - switch ((Layout)mapSettings.ViewLayout) + switch ((Layout)userSettings.ViewLayout) { case Layout.List: xmlwriter.SetValue("myprograms", "viewLayout", "list"); @@ -202,12 +123,12 @@ xmlwriter.SetValue("myprograms", "viewLayout", "filmstrip"); break; } - xmlwriter.SetValue("myprograms", "lastAppID", mapSettings.LastAppID.ToString()); - // xmlwriter.SetValue("myprograms", "lastViewLevel", mapSettings.LastViewLevel.ToString()); + xmlwriter.SetValue("myprograms", "lastAppID", userSettings.LastAppID.ToString()); + // xmlwriter.SetValue("myprograms", "lastViewLevel", userSettings.LastViewLevel.ToString()); xmlwriter.SetValue("myprograms", "lastViewLevel", ViewHandler.CurrentLevel); - xmlwriter.SetValue("myprograms", "sortMethod", mapSettings.SortMethod); + xmlwriter.SetValue("myprograms", "sortMethod", userSettings.SortMethod); // avoid bool conversion...... don't wanna know why it doesn't work! :-( - if (mapSettings.SortAscending) + if (userSettings.SortAscending) { xmlwriter.SetValue("myprograms", "sortASC", "yes"); } @@ -216,7 +137,7 @@ xmlwriter.SetValue("myprograms", "sortASC", "no"); } - if (mapSettings.OverviewVisible) + if (userSettings.OverviewVisible) { xmlwriter.SetValue("myprograms", "overviewvisible", "yes"); } @@ -225,8 +146,7 @@ xmlwriter.SetValue("myprograms", "overviewvisible", "no"); } - xmlwriter.SetValue("myprograms", "startWindow", StartWindow.ToString()); - xmlwriter.SetValue("myprograms", "startview", (int)mapSettings.ViewLayout); + xmlwriter.SetValue("myprograms", "startview", (int)userSettings.ViewLayout); } } @@ -239,33 +159,30 @@ string curText = ""; curText = xmlreader.GetValueAsString("myprograms", "viewLayout", "list"); - if (curText == "list") mapSettings.ViewLayout = (int)Layout.List; - else if (curText == "icons") mapSettings.ViewLayout = (int)Layout.Icons; - else if (curText == "largeicons") mapSettings.ViewLayout = (int)Layout.LargeIcons; - else if (curText == "filmstrip") mapSettings.ViewLayout = (int)Layout.FilmStrip; - else mapSettings.ViewLayout = (int)Layout.List; + if (curText == "list") userSettings.ViewLayout = (int)Layout.List; + else if (curText == "icons") userSettings.ViewLayout = (int)Layout.Icons; + else if (curText == "largeicons") userSettings.ViewLayout = (int)Layout.LargeIcons; + else if (curText == "filmstrip") userSettings.ViewLayout = (int)Layout.FilmStrip; + else userSettings.ViewLayout = (int)Layout.List; CurrentSortMethod = (ProgramSort.SortMethod)xmlreader.GetValueAsInt("myprograms", "sortMethod", (int)ProgramSort.SortMethod.Title); - mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); - mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortASC", true); - mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "sortASC", true); - - StartWindow = xmlreader.GetValueAsInt("myprograms", "startWindow", GetID); + userSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); + userSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); + userSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortASC", true); + userSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "sortASC", true); } } - void LoadLastAppIDFromSettings() { using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { - mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); - mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - mapSettings.SortMethod = xmlreader.GetValueAsInt("myprograms", "sortMethod", 0); - mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortAsc", true); - mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "overviewvisible", true); + userSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); + userSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); + userSettings.SortMethod = xmlreader.GetValueAsInt("myprograms", "sortMethod", 0); + userSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortAsc", true); + userSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "overviewvisible", true); } } @@ -273,92 +190,34 @@ { if (directoryName == "") directoryName = "root"; + object o; - FolderSettings.GetFolderSetting(directoryName, "Programs", typeof(MapSettings), out o); + FolderSettings.GetFolderSetting(directoryName, "Programs", typeof(GUIProgramsAltUserSettings), out o); if (o != null) - mapSettings = o as MapSettings; - if (mapSettings == null) - mapSettings = new MapSettings(); + userSettings = o as GUIProgramsAltUserSettings; + if (userSettings == null) + userSettings = new GUIProgramsAltUserSettings(); } void SaveFolderSettings(string directoryName) { if (directoryName == "") directoryName = "root"; - FolderSettings.AddFolderSetting(directoryName, "Programs", typeof(MapSettings), mapSettings); + FolderSettings.AddFolderSetting(directoryName, "Programs", typeof(GUIProgramsAltUserSettings), userSettings); } - #endregion Serialisation - - - #region Variables - - static int startWindow = (int)GUIWindow.Window.WINDOW_FILES; - bool currentSortAsc = true; - // FacadeView - const int facadeIDConst = 50; - ProgramViewHandler viewHandler = ProgramViewHandler.Instance; - List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; - DirectoryHistory itemHistory = new DirectoryHistory(); - int slideSpeed = 3000; // speed in milliseconds between two slides - long slideTime = 0; - bool skipInit = false; - static string _thumbnailPath = string.Empty; - static string _lastThumbnailPath = string.Empty; - - ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Title; - DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; - - MapSettings mapSettings = new MapSettings(); - ApplicationItem lastApp = null; - string prevFilepath = ""; - int selectedItemIndex = -1; - Layout currentLayout = Layout.List; - - // Buttons - [SkinControl(2)] - protected GUIButtonControl btnViewAs = null; - [SkinControlAttribute(3)] - protected GUISortButtonControl btnSortBy = null; - [SkinControl(4)] - protected GUIButtonControl btnViews = null; - [SkinControl(5)] - protected GUIButtonControl btnRefresh = null; - //Images - [SkinControl(6)] - protected GUIImage screenShotImage = null; - - [SkinControl(facadeIDConst)] - protected GUIFacadeControl facadeView = null; - - - - #endregion Variables - - #region Enums - - public enum Layout - { - List = 0, - Icons = 1, - LargeIcons = 2, - FilmStrip = 3, - } - - #endregion Enums - #region Constructor / Destructor public GUIProgramsAlt() { - GetID = (int)Window.WINDOW_FILES; + + GetID = (int)Window.WINDOW_FILES; } #endregion Constructor / Destructor - #region Properties / Helper Routines public ProgramViewHandler ViewHandler @@ -382,12 +241,6 @@ } } - public int StartWindow - { - get { return startWindow; } - set { startWindow = value; } - } - public virtual Layout CurrentLayout { get { return currentLayout; } @@ -514,7 +367,7 @@ } } - btnViewAs.Label = mapSettings.ViewLayoutTextName; + btnViewAs.Label = userSettings.ViewLayoutTextName; switch (CurrentSortMethod) { @@ -549,7 +402,7 @@ { int itemIndex = facadeView.SelectedListItemIndex; - switch ((Layout)mapSettings.ViewLayout) + switch ((Layout)userSettings.ViewLayout) { case Layout.List: facadeView.View = GUIFacadeControl.ViewMode.List; @@ -768,13 +621,13 @@ lastApp = this.dbHandlerInstance.GetAppByID(lastApp.FatherID); if (lastApp != null) { - mapSettings.LastAppID = lastApp.ApplicationItemId; + userSettings.LastAppID = lastApp.ApplicationItemId; prevFilepath = lastApp.DefaultFilepath(); } else { // back to home screen..... - mapSettings.LastAppID = -1; + userSettings.LastAppID = -1; prevFilepath = ""; } } @@ -956,7 +809,7 @@ lastApp = (ApplicationItem)item; SaveItemIndex(GetSelectedItemNo().ToString(), lastApp, lastApp.lastFilepath); - mapSettings.LastAppID = lastApp.ApplicationItemId; + userSettings.LastAppID = lastApp.ApplicationItemId; prevFilepath = lastApp.DefaultFilepath(); ViewHandler.CurrentLevel = 0; //lastApp.ViewHandler = ViewHandler; @@ -968,7 +821,7 @@ if (lastApp != null) { - mapSettings.LastAppID = lastApp.ApplicationItemId; + userSettings.LastAppID = lastApp.ApplicationItemId; prevFilepath = lastApp.DefaultFilepath(); lastApp.LaunchFile(fileItem); } @@ -1180,35 +1033,20 @@ if (dlg.SelectedLabel == -1) return; if (dlg.SelectedLabel == 0) { - int nNewWindow = (int)Window.WINDOW_FILES; - StartWindow = nNewWindow; - mapSettings.ViewLayout = (int)Layout.List; + userSettings.ViewLayout = (int)Layout.List; ViewHandler.CurrentView = GUILocalizeStrings.Get(100000 + GetID);//my files - if (nNewWindow != GetID) - { - GUIWindowManager.ReplaceWindow(nNewWindow); - } } else { ViewDefinition selectedView = (ViewDefinition)ViewHandler.Views[dlg.SelectedLabel - 1]; ViewHandler.CurrentView = selectedView.Name; - int nNewWindow = (int)Window.WINDOW_FILES; - if (GetID != nNewWindow) - { - StartWindow = nNewWindow; - if (nNewWindow != GetID) - { - GUIWindowManager.ReplaceWindow(nNewWindow); - } - } - else - { + + if (facadeView.Count <= 0) { GUIControl.FocusControl(GetID, btnViewAs.GetID); } - } + } UpdateButtonStates(); @@ -1237,19 +1075,19 @@ if (skipInit) { - mapSettings.LastAppID = -1; + userSettings.LastAppID = -1; } else { LoadLastAppIDFromSettings(); // hacky load back the last applicationItem id, otherwise this can get lost from dx resets.... } - lastApp = this.dbHandlerInstance.GetAppByID(mapSettings.LastAppID); + lastApp = this.dbHandlerInstance.GetAppByID(userSettings.LastAppID); if (lastApp != null) { prevFilepath = lastApp.DefaultFilepath(); - this.CurrentSortAsc = mapSettings.SortAscending; - ViewHandler.CurrentLevel = mapSettings.LastViewLevel; + this.CurrentSortAsc = userSettings.SortAscending; + ViewHandler.CurrentLevel = userSettings.LastViewLevel; } else { @@ -1331,7 +1169,7 @@ if (control == btnViewAs) { - mapSettings.SwitchToNextViewLayout(); + userSettings.SwitchToNextViewLayout(); ShowThumbPanel(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj 2007-08-26 18:09:04 UTC (rev 867) @@ -7,8 +7,8 @@ <ProjectGuid>{F34EBAC9-C5B9-48FD-B82D-C6BA907F81B0}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>GUIPrograms</RootNamespace> - <AssemblyName>GUIPrograms</AssemblyName> + <RootNamespace>GUIProgramsAlt</RootNamespace> + <AssemblyName>GUIProgramsAlt</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -142,6 +142,7 @@ </Compile> <Compile Include="GUIProgramsAlt.cs" /> <Compile Include="GUIProgramsAltFileInfo.cs" /> + <Compile Include="GUIProgramsAltUserSettings.cs" /> <Compile Include="Imports\AllGameScraper.cs" /> <Compile Include="Imports\DirectoryImport.cs" /> <Compile Include="Imports\GamebaseImport.cs" /> Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltFileInfo.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -40,14 +40,14 @@ using MediaPortal.Video.Database; -using GUIPrograms.Database; +using GUIProgramsAlt.Database; using MediaPortal.Configuration; -using GUIPrograms.Items; +using GUIProgramsAlt.Items; -namespace GUIPrograms +namespace GUIProgramsAlt { /// <summary> /// Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAltUserSettings.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -0,0 +1,137 @@ +using System; + +using System.Xml.Serialization; +using System.Collections.Generic; +using System.Text; + + +using MediaPortal.GUI.Library; +using MediaPortal.Util; + +namespace GUIProgramsAlt +{ + [Serializable] + public class GUIProgramsAltUserSettings + { + protected int sortMethod; + protected int viewLayout; + protected bool sortAscending; + protected int lastApplicationID; + protected int lastFileID; + protected int lastViewLevel; + protected bool overviewVisible; + + public GUIProgramsAltUserSettings() + { + sortMethod = 0; //name + viewLayout = 0; //list + sortAscending = true; + overviewVisible = true; + lastApplicationID = -1; + lastFileID = -1; + lastViewLevel = 0; + } + + [XmlElement("SortMethod")] + public int SortMethod + { + get { return sortMethod; } + set { sortMethod = value; } + } + + [XmlElement("ViewLayout")] + public int ViewLayout + { + get { return viewLayout; } + set { viewLayout = value; } + } + + [XmlElement("SortAscending")] + public bool SortAscending + { + get { return sortAscending; } + set { sortAscending = value; } + } + + [XmlElement("OverviewVisible")] + public bool OverviewVisible + { + get { return overviewVisible; } + set { overviewVisible = value; } + } + + [XmlElement("LastAppID")] + public int LastAppID + { + get { return lastApplicationID; } + set { lastApplicationID = value; } + } + + [XmlElement("LastFileID")] + public int LastFileID + { + get { return lastFileID; } + set { lastFileID = value; } + } + + [XmlElement("LastViewLevelID")] + public int LastViewLevel + { + get { return lastViewLevel; } + set { lastViewLevel = value; } + } + + + public string ViewLayoutTextName + { + get { return GetViewLayoutAsText(); } + } + + string GetViewLayoutAsText() + { + string result = ""; + switch ((Layout)ViewLayout) + { + case Layout.List: + result = GUILocalizeStrings.Get(101); + break; + case Layout.Icons: + result = GUILocalizeStrings.Get(100); + break; + case Layout.LargeIcons: + result = GUILocalizeStrings.Get(417); + break; + case Layout.FilmStrip: + result = GUILocalizeStrings.Get(733); + break; + } + return result; + } + + public void SwitchToNextViewLayout() + { + switch ((Layout)ViewLayout) + { + case Layout.List: + ViewLayout = (int)Layout.Icons; + + break; + case Layout.Icons: + ViewLayout = (int)Layout.LargeIcons; + + break; + case Layout.LargeIcons: + ViewLayout = (int)Layout.FilmStrip; + + break; + case Layout.FilmStrip: + ViewLayout = (int)Layout.List; + + break; + } + } + + + } + +} Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/AllGameScraper.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -31,12 +31,12 @@ using System.Text.RegularExpressions; using MediaPortal.Utils; -using GUIPrograms; +using GUIProgramsAlt; using MediaPortal.GUI.Library; -using GUIPrograms.Database; -using GUIPrograms.Items; +using GUIProgramsAlt.Database; +using GUIProgramsAlt.Items; -namespace GUIPrograms.Imports +namespace GUIProgramsAlt.Imports { /// <summary> /// Gets information from an AllGame WebPage Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -5,14 +5,14 @@ using MediaPortal.GUI.Library; -using GUIPrograms.Items; -using GUIPrograms; -using GUIPrograms.Database; +using GUIProgramsAlt.Items; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; using System.Data.SQLite; using System.IO; -namespace GUIPrograms.Imports +namespace GUIProgramsAlt.Imports { public class DirectoryImport: ImportBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -29,13 +29,13 @@ using MediaPortal.GUI.Library; -using GUIPrograms.Items; -using GUIPrograms; -using GUIPrograms.Database; +using GUIProgramsAlt.Items; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; using System.Data.SQLite; -namespace GUIPrograms.Imports +namespace GUIProgramsAlt.Imports { /// <summary> /// Summary description for GamebaseImport. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -3,9 +3,9 @@ using System.Text; using System.IO; -using GUIPrograms.Items; +using GUIProgramsAlt.Items; -namespace GUIPrograms.Imports +namespace GUIProgramsAlt.Imports { public abstract class ImportBase { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -35,13 +35,13 @@ using System.Text.RegularExpressions; using System.Text; -using GUIPrograms.Items; -using GUIPrograms; -using GUIPrograms.Database; +using GUIProgramsAlt.Items; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Imports +namespace GUIProgramsAlt.Imports { /// <summary> /// Summary description for MameImport. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -40,13 +40,13 @@ using MediaPortal.Dialogs; using MediaPortal.Util; -using GUIPrograms; -using GUIPrograms.Database; -using GUIPrograms.Items; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; +using GUIProgramsAlt.Items; #endregion Imports -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { public abstract class ApplicationItem { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -37,15 +37,15 @@ using MediaPortal.GUI.Library; using MediaPortal.Util; -using GUIPrograms; -using GUIPrograms.Imports; -using GUIPrograms.Database; -using GUIPrograms.Items; +using GUIProgramsAlt; +using GUIProgramsAlt.Imports; +using GUIProgramsAlt.Database; +using GUIProgramsAlt.Items; #endregion Imports -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { /// <summary> /// Summary description for ApplicationItemDirectoryCache. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -24,12 +24,12 @@ #endregion using System; -using GUIPrograms; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; using System.Data.SQLite; using System.Data; -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { /// <summary> /// Factory like object that creates the matchin Application descendant class Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -31,11 +31,11 @@ using MediaPortal.Dialogs; using MediaPortal.GUI.Library; -using GUIPrograms; -using GUIPrograms.Database; -using GUIPrograms.Imports; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; +using GUIProgramsAlt.Imports; -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { /// <summary> /// Summary description for ApplicationItemGameBase. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGrouper.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -26,11 +26,11 @@ using MediaPortal.GUI.Library; using System.Data.SQLite; using System.Data; -using GUIPrograms.Database; +using GUIProgramsAlt.Database; -using GUIPrograms.Items; +using GUIProgramsAlt.Items; -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { /// <summary> /// Summary description for appFilesEdit. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -34,12 +34,12 @@ using MediaPortal.Dialogs; using MediaPortal.GUI.Library; -using GUIPrograms; -using GUIPrograms.Imports; +using GUIProgramsAlt; +using GUIProgramsAlt.Imports; #endregion Imports -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { /// <summary> /// Summary description for ApplicationItemMame. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -33,12 +33,12 @@ using MediaPortal.Configuration; using MediaPortal.GUI.Library; -using GUIPrograms; -using GUIPrograms.Database; -using GUIPrograms.Items; -using GUIPrograms.Imports; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; +using GUIProgramsAlt.Items; +using GUIProgramsAlt.Imports; -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { public class FileItem { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItemInfo.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -29,12 +29,12 @@ using MediaPortal.Util; -using GUIPrograms.Items; +using GUIProgramsAlt.Items; // just 4 useMPsThumbsDirectory variable -using GUIPrograms.Database; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { /// <summary> /// Summary description for FileInfo. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -30,10 +30,10 @@ using MediaPortal.GUI.Library; -using GUIPrograms; -using GUIPrograms.Database; +using GUIProgramsAlt; +using GUIProgramsAlt.Database; -namespace GUIPrograms.Items +namespace GUIProgramsAlt.Items { /// <summary> /// Summary description for FilelinkItem. Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilterItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilterItem.cs 2007-08-25 22:33:24 UTC (rev 866) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilterItem.cs 2007-08-26 18:09:04 UTC (rev 867) @@ -11,12 +11,12 @@ using MediaPortal.Ripper; using MediaPortal.Util; -using GUIPrograms; -using GUIPrograms... [truncated message content] |
From: <nor...@us...> - 2007-08-27 18:35:39
|
Revision: 866 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=866&view=rev Author: northern_sky Date: 2007-08-25 15:33:24 -0700 (Sat, 25 Aug 2007) Log Message: ----------- cleanup Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Properties/AssemblyInfo.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Properties/Resources.Designer.cs Added Paths: ----------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-25 00:37:22 UTC (rev 865) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIPrograms.cs 2007-08-25 22:33:24 UTC (rev 866) @@ -1,1519 +0,0 @@ -#region Copyright (C) 2005-2007 Team MediaPortal - -/* - * Copyright (C) 2005-2007 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Threading; -using System.Xml.Serialization; -using Microsoft.DirectX; -using Microsoft.DirectX.Direct3D; -using Direct3D = Microsoft.DirectX.Direct3D; - -using MediaPortal.Configuration; -using MediaPortal.Database; -using MediaPortal.Dialogs; -using MediaPortal.GUI.Library; -using MediaPortal.GUI.View; -using MediaPortal.Profile; -using MediaPortal.Util; - -using GUIPrograms.Items; -using GUIPrograms.Database; -using GUIPrograms.Design; -using System.Data.SQLite; -using System.Data; - -namespace GUIPrograms -{ - /// <summary> - /// The GUIPrograms plugin is used to list a collection of arbitrary files - /// and use them as arguments when launching external applications. - /// </summary> - /// - public class GUIPrograms : GUIWindow, ISetupForm, IShowPlugin - { - #region defaultOverrides - /// <summary> - /// If the plugin should have its own button on the main menu of Mediaportal then it - /// should return true to this method, otherwise if it should not be on home - /// it should return false - /// </summary> - /// <param name="strButtonText">text the button should have</param> - /// <param name="strButtonImage">image for the button, or empty for default</param> - /// <param name="strButtonImageFocus">image for the button, or empty for default</param> - /// <param name="strPictureImage">subpicture for the button or empty for none</param> - /// <returns>true : plugin needs its own button on home - /// false : plugin does not need its own button on home</returns> - public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) - { - string strText = dbHandlerInstance.ReadSetting(ProgramUtils.cPLUGINTITLE); - if ((strText != "") && (strText != null)) - { - strButtonText = strText; - } - else - { - strButtonText = GUILocalizeStrings.Get(0); - } - strButtonImage = ""; - strButtonImageFocus = ""; - strPictureImage = ""; - return true; - } - - public string PluginName() - { - return "My Programs Alt. 0.1"; - } - public string Description() - { - return "Launches external applications"; - } - public string Author() - { - return "Reconstruct by Northern,Chefkoch,Org. by waebard"; - } - public void ShowPlugin() - { - SetupForm setup = new SetupForm(); - setup.ShowDialog(); - } - - // Indicates whether plugin can be enabled/disabled - public bool CanEnable() - { - return true; - } - - // get ID of windowplugin belonging to this setup - public int GetWindowId() - { - return (int)GUIWindow.Window.WINDOW_FILES; - } - - public bool DefaultEnabled() - { - return false; - } - - public bool HasSetup() - { - return true; - } - - #region IShowPlugin Members - - public bool ShowDefaultHome() - { - return false; - } - - #endregion - - #endregion defaultOverrides - - #region Serialisation - - [Serializable] - public class MapSettings - { - protected int sortMethod; - protected int viewLayout; - protected bool sortAscending; - protected int lastApplicationID; - protected int lastFileID; - protected int lastViewLevel; - protected bool overviewVisible; - - public MapSettings() - { - sortMethod = 0; //name - viewLayout = 0; //list - sortAscending = true; - overviewVisible = true; - lastApplicationID = -1; - lastFileID = -1; - lastViewLevel = 0; - } - - - [XmlElement("SortMethod")] - public int SortMethod - { - get { return sortMethod; } - set { sortMethod = value; } - } - - [XmlElement("ViewLayout")] - public int ViewLayout - { - get { return viewLayout; } - set { viewLayout = value; } - } - - [XmlElement("SortAscending")] - public bool SortAscending - { - get { return sortAscending; } - set { sortAscending = value; } - } - - [XmlElement("OverviewVisible")] - public bool OverviewVisible - { - get { return overviewVisible; } - set { overviewVisible = value; } - } - - [XmlElement("LastAppID")] - public int LastAppID - { - get { return lastApplicationID; } - set { lastApplicationID = value; } - } - - [XmlElement("LastFileID")] - public int LastFileID - { - get { return lastFileID; } - set { lastFileID = value; } - } - - [XmlElement("LastViewLevelID")] - public int LastViewLevel - { - get { return lastViewLevel; } - set { lastViewLevel = value; } - } - - - public string ViewLayoutTextName - { - get { return GetViewLayoutAsText(); } - } - - public void SwitchToNextViewLayout() - { - switch ((Layout)ViewLayout) - { - case Layout.List: - ViewLayout = (int)Layout.Icons; - - break; - case Layout.Icons: - ViewLayout = (int)Layout.LargeIcons; - - break; - case Layout.LargeIcons: - ViewLayout = (int)Layout.FilmStrip; - - break; - case Layout.FilmStrip: - ViewLayout = (int)Layout.List; - - break; - } - } - - string GetViewLayoutAsText() - { - string result = ""; - switch ((Layout)ViewLayout) - { - case Layout.List: - result = GUILocalizeStrings.Get(101); - break; - case Layout.Icons: - result = GUILocalizeStrings.Get(100); - break; - case Layout.LargeIcons: - result = GUILocalizeStrings.Get(417); - break; - case Layout.FilmStrip: - result = GUILocalizeStrings.Get(733); - break; - } - return result; - } - } - - - void SaveSettings() - { - using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - switch ((Layout)mapSettings.ViewLayout) - { - case Layout.List: - xmlwriter.SetValue("myprograms", "viewLayout", "list"); - break; - case Layout.Icons: - xmlwriter.SetValue("myprograms", "viewLayout", "icons"); - break; - case Layout.LargeIcons: - xmlwriter.SetValue("myprograms", "viewLayout", "largeicons"); - break; - case Layout.FilmStrip: - xmlwriter.SetValue("myprograms", "viewLayout", "filmstrip"); - break; - } - xmlwriter.SetValue("myprograms", "lastAppID", mapSettings.LastAppID.ToString()); - // xmlwriter.SetValue("myprograms", "lastViewLevel", mapSettings.LastViewLevel.ToString()); - xmlwriter.SetValue("myprograms", "lastViewLevel", ViewHandler.CurrentLevel); - xmlwriter.SetValue("myprograms", "sortMethod", mapSettings.SortMethod); - // avoid bool conversion...... don't wanna know why it doesn't work! :-( - if (mapSettings.SortAscending) - { - xmlwriter.SetValue("myprograms", "sortASC", "yes"); - } - else - { - xmlwriter.SetValue("myprograms", "sortASC", "no"); - } - - if (mapSettings.OverviewVisible) - { - xmlwriter.SetValue("myprograms", "overviewvisible", "yes"); - } - else - { - xmlwriter.SetValue("myprograms", "overviewvisible", "no"); - } - - xmlwriter.SetValue("myprograms", "startWindow", StartWindow.ToString()); - xmlwriter.SetValue("myprograms", "startview", (int)mapSettings.ViewLayout); - } - } - - void LoadSettings() - { - slideSpeed = ProgramUtils.GetSleepTime(); - - using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - string curText = ""; - curText = xmlreader.GetValueAsString("myprograms", "viewLayout", "list"); - - if (curText == "list") mapSettings.ViewLayout = (int)Layout.List; - else if (curText == "icons") mapSettings.ViewLayout = (int)Layout.Icons; - else if (curText == "largeicons") mapSettings.ViewLayout = (int)Layout.LargeIcons; - else if (curText == "filmstrip") mapSettings.ViewLayout = (int)Layout.FilmStrip; - else mapSettings.ViewLayout = (int)Layout.List; - - CurrentSortMethod = (ProgramSort.SortMethod)xmlreader.GetValueAsInt("myprograms", "sortMethod", (int)ProgramSort.SortMethod.Title); - - mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); - mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortASC", true); - mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "sortASC", true); - - StartWindow = xmlreader.GetValueAsInt("myprograms", "startWindow", GetID); - } - } - - - void LoadLastAppIDFromSettings() - { - using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) - { - mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); - mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); - mapSettings.SortMethod = xmlreader.GetValueAsInt("myprograms", "sortMethod", 0); - mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortAsc", true); - mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "overviewvisible", true); - } - } - - void LoadFolderSettings(string directoryName) - { - if (directoryName == "") - directoryName = "root"; - object o; - FolderSettings.GetFolderSetting(directoryName, "Programs", typeof(MapSettings), out o); - if (o != null) - mapSettings = o as MapSettings; - if (mapSettings == null) - mapSettings = new MapSettings(); - } - - void SaveFolderSettings(string directoryName) - { - if (directoryName == "") - directoryName = "root"; - FolderSettings.AddFolderSetting(directoryName, "Programs", typeof(MapSettings), mapSettings); - } - - #endregion Serialisation - - #region SkinControls - - public enum Layout - { - List = 0, - Icons = 1, - LargeIcons = 2, - FilmStrip = 3, - } - - // Buttons - [SkinControl(2)] - protected GUIButtonControl btnViewAs = null; - [SkinControlAttribute(3)] - protected GUISortButtonControl btnSortBy = null; - [SkinControl(4)] - protected GUIButtonControl btnViews = null; - [SkinControl(5)] - protected GUIButtonControl btnRefresh = null; - //Images - [SkinControl(6)] - protected GUIImage screenShotImage = null; - - // FacadeView - const int facadeIDConst = 50; - [SkinControl(facadeIDConst)] - protected GUIFacadeControl facadeView = null; - - #endregion - - #region Constructor / Destructor - - public GUIPrograms() - { - dbHandlerInstance.LoadAllApplicationItems(); - globalApplicationList = dbHandlerInstance.ApplicationItemList; - GetID = (int)Window.WINDOW_FILES; - LoadSettings(); - skipInit = true; - } - - - #endregion - #region Init / DeInit - - void DeInitMyPrograms() - { - SaveSettings(); - - // make sure the selected index wasn't reseted already - // and save the index only if it's non-zero - // otherwise: DXDevice.Reset clears selection - int itemIndex = GetSelectedItemNo(); - if (itemIndex > 0) - { - selectedItemIndex = GetSelectedItemNo(); - } - - - if (dbHandlerInstance.SqlLiteConn.State == ConnectionState.Open) - { - dbHandlerInstance.SqlLiteConn.Close(); - } - } - - void InitMyPrograms() - { - LoadFolderSettings(""); - - if (skipInit) - { - mapSettings.LastAppID = -1; - } - else - { - LoadLastAppIDFromSettings(); // hacky load back the last applicationItem id, otherwise this can get lost from dx resets.... - } - lastApp = this.dbHandlerInstance.GetAppByID(mapSettings.LastAppID); - if (lastApp != null) - { - prevFilepath = lastApp.DefaultFilepath(); - this.CurrentSortAsc = mapSettings.SortAscending; - ViewHandler.CurrentLevel = mapSettings.LastViewLevel; - //lastApp.ViewHandler = this.ViewHandler; - } - else - { - prevFilepath = ""; - } - UpdateListControl(); - ShowThumbPanel(); - skipInit = false; - } - - #endregion - - #region Base & Content Variables - - - static int startWindow = (int)GUIWindow.Window.WINDOW_FILES; - protected ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Title; - protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; - - bool currentSortAsc = true; - ProgramViewHandler viewHandler = ProgramViewHandler.Instance; - - List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; - public MapSettings mapSettings = new MapSettings(); - DirectoryHistory itemHistory = new DirectoryHistory(); - public ApplicationItem lastApp = null; - - public string prevFilepath = ""; - public int selectedItemIndex = -1; - int slideSpeed = 3000; // speed in milliseconds between two slides - long slideTime = 0; - public Layout currentLayout = Layout.List; - - bool skipInit = false; - - static string _thumbnailPath = string.Empty; - static string _lastThumbnailPath = string.Empty; - - #endregion - - #region Properties / Helper Routines - - public ProgramViewHandler ViewHandler - { - get { return viewHandler; } - set { viewHandler = value; } - } - - public static string ThumbnailPath - { - get - { - return _thumbnailPath; - } - set - { - if (value == "") - _thumbnailPath = ""; - else if (File.Exists(value)) - _thumbnailPath = value; - } - } - - public int StartWindow - { - get { return startWindow; } - set { startWindow = value; } - } - - public virtual Layout CurrentLayout - { - get { return currentLayout; } - set { currentLayout = value; } - } - - bool CurrentSortAsc - { - get { return currentSortAsc; } - set { currentSortAsc = value; } - } - - protected virtual ProgramSort.SortMethod CurrentSortMethod - { - get { return currentSortMethod; } - set { currentSortMethod = value; } - } - - GUIListItem GetSelectedItem() - { - return facadeView.SelectedListItem; - } - - public int GetSelectedItemNo() - { - return facadeView.SelectedListItemIndex; - } - - int GetCurrentFatherID() - { - if (lastApp != null) - { - return lastApp.ApplicationItemId; - } - else - { - return -1; // root - } - } - - - bool ThereAreAppsToDisplay() - { - if (lastApp == null) - { - return true; // root has globalApplicationList - } - else - { - return lastApp.SubItemsAllowed(); // grouper items for example - } - } - - bool ThereAreFilesOrLinksToDisplay() - { - return (lastApp != null); // all globalApplicationList can have files except the root - } - - bool IsBackButtonNecessary() - { - return (lastApp != null); // always show back button except for root - } - - #endregion - - #region Overrides - - public override bool Init() - { - return Load(GUIGraphicsContext.Skin + @"\myProgramsAlt.xml"); - } - - protected override void OnPageLoad() - { - base.OnPageLoad(); - - if (btnSortBy != null) - btnSortBy.SortChanged += new SortEventHandler(SortChanged); - - InitMyPrograms(); - } - - protected override void OnPageDestroy(int newWindowId) - { - DeInitMyPrograms(); - base.OnPageDestroy(newWindowId); - } - - void SortChanged(object sender, SortEventArgs args) - { - this.CurrentSortAsc = args.Order != System.Windows.Forms.SortOrder.Descending; - - OnSort(); - UpdateButtonStates(); - } - - public override void OnAction(Action action) - { - switch (action.wID) - { - case Action.ActionType.ACTION_PARENT_DIR: - case Action.ActionType.ACTION_PREVIOUS_MENU: - // <U> keypress - BackItemClicked(); - UpdateButtonStates(); - break; - case Action.ActionType.ACTION_CLOSE_DIALOG: - SaveFolderSettings(""); - GUIWindowManager.ShowPreviousWindow(); - break; - case Action.ActionType.ACTION_SHOW_INFO: - OnInfo(); - break; - default: - base.OnAction(action); - break; - } - } - - public override bool OnMessage(GUIMessage message) - { - switch (message.Message) - { - case GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED: - { - int iControl = message.SenderControlId; - if (iControl == facadeView.GetID) - { - if (lastApp != null) - { - lastApp.ResetThumbs(); - } - } - } - break; - } - return base.OnMessage(message); - } - - protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) - { - base.OnClicked(controlId, control, actionType); - - if (control == btnViewAs) - { - mapSettings.SwitchToNextViewLayout(); - - - ShowThumbPanel(); - - } - else if (control == btnRefresh) - { - if (lastApp != null) - { - lastApp.Refresh(true); - prevFilepath = lastApp.DefaultFilepath(); - // todo: reset viewHandler - UpdateButtonStates(); - UpdateListControl(); - } - } - else if (control == btnViews) - { - OnShowViews(); - } - else if (control == btnSortBy) - { - OnShowSort(); - } - else if (control == facadeView) - { - // application or file-item was clicked.... - if (actionType == Action.ActionType.ACTION_SELECT_ITEM) - { - OnClick(); - } - } - } - - protected override void OnShowContextMenu() - { - GUIListItem item = facadeView.SelectedListItem; - int itemNo = facadeView.SelectedListItemIndex; - if (item == null) - return; - - GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - if (dlg == null) - return; - dlg.Reset(); - dlg.SetHeading(498); // menu - - if (!((item.MusicTag) is ApplicationItem)) - { - dlg.AddLocalizedString(13041); //Show File Info - } - - dlg.DoModal(GetID); - if (dlg.SelectedId == -1) - return; - switch (dlg.SelectedId) - { - case 13041: // Show file info - OnInfo(); - break; - } - } - - public override void Render(float timePassed) - { - base.Render(timePassed); - - if (ThumbnailPath != _lastThumbnailPath) - { - screenShotImage.FileName = ThumbnailPath; - facadeView.FilmstripView.InfoImageFileName = ThumbnailPath; - facadeView.FilmstripView.NeedRefresh(); - - _lastThumbnailPath = ThumbnailPath; - } - RenderThumbnail(timePassed); - } - #endregion - - #region Display - - protected virtual void UpdateButtonStates() - { - string sortBy = string.Empty; - - GUIPropertyManager.SetProperty("#view", ViewHandler.LocalizedCurrentView); - - if (lastApp == null) - { - btnRefresh.IsVisible = false; - } - else - { - btnRefresh.IsVisible = lastApp.RefreshGUIAllowed; - } - - facadeView.IsVisible = true; - - GUIControl.FocusControl(GetID, facadeView.GetID); - - // display apptitle if available..... - if (lastApp != null) - { - if ((ViewHandler.CurrentView != null) && (ViewHandler.MaxLevels > 0)) - { - GUIPropertyManager.SetProperty("#curheader", ViewHandler.LocalizedCurrentView); - } - else - { - GUIPropertyManager.SetProperty("#curheader", lastApp.Title); - } - } - else - { - string strText = dbHandlerInstance.ReadSetting(ProgramUtils.cPLUGINTITLE); - if ((strText != "") && (strText != null)) - { - GUIPropertyManager.SetProperty("#curheader", strText); - } - else - { - GUIPropertyManager.SetProperty("#curheader", GUILocalizeStrings.Get(0)); - } - } - - btnViewAs.Label = mapSettings.ViewLayoutTextName; - - switch (CurrentSortMethod) - { - case ProgramSort.SortMethod.Title: - sortBy = GUILocalizeStrings.Get(268); - break; - case ProgramSort.SortMethod.Filename: - sortBy = GUILocalizeStrings.Get(363); - break; - case ProgramSort.SortMethod.Rating: - sortBy = GUILocalizeStrings.Get(367); - break; - case ProgramSort.SortMethod.LastTimeLaunched: //tmp until mapped - sortBy = "Sort by: Date launched"; - break; - case ProgramSort.SortMethod.LaunchCount: - sortBy = "Sort by: Times launchedSort by: Date launched"; //tmp - break; - case ProgramSort.SortMethod.Platform: - sortBy = "Sort by: Platform"; //tmp - break; - } - - if (btnSortBy != null) - { - btnSortBy.Label = sortBy; - btnSortBy.IsAscending = CurrentSortAsc; - } - } - - void ShowThumbPanel() - { - int itemIndex = facadeView.SelectedListItemIndex; - - switch ((Layout)mapSettings.ViewLayout) - { - case Layout.List: - facadeView.View = GUIFacadeControl.ViewMode.List; - screenShotImage.Visible = true; - break; - case Layout.Icons: - facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; - screenShotImage.Visible = false; - break; - case Layout.LargeIcons: - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; - screenShotImage.Visible = false; - break; - case Layout.FilmStrip: - facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; - screenShotImage.Visible = false; - break; - } - facadeView.SelectedListItemIndex = itemIndex; - UpdateButtonStates(); - } - - void RenderThumbnail(float timePassed) - { - // does the thumb needs replacing?? - long now = (DateTime.Now.Ticks / 10000); - long timeElapsed = now - slideTime; - if (timeElapsed >= (slideSpeed)) - { - RefreshThumbnail(); - // only refresh the picture, don't refresh the other data otherwise scrolling of labels is interrupted! - } - } - - void RefreshThumbnail() - { - ApplicationItem appWithImg = lastApp; - GUIListItem item = GetSelectedItem(); - - // some preconditions... - if (item == null) return; - if (appWithImg == null) - { - if (item.MusicTag == null) return; - appWithImg = item.MusicTag as ApplicationItem; - if (appWithImg == null) return; - } - - ThumbnailPath = ""; - if (item.ThumbnailImage != "" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" - ) - { - // only show big thumb if there is really one.... - ThumbnailPath = appWithImg.GetCurThumb(item); // some modes look for thumbs differently - } - appWithImg.NextThumb(); // try to find a next thumbnail - slideTime = (DateTime.Now.Ticks / 10000); // reset timer! - } - - void UpdateListControl() - { - GUIControl.ClearControl(GetID, facadeView.GetID); - if (IsBackButtonNecessary()) - ProgramUtils.AddBackButton(facadeView); - - int TotalItems = 0; - if (ThereAreAppsToDisplay()) - TotalItems += DisplayApps(); - if (ThereAreFilesOrLinksToDisplay()) - TotalItems += DisplayFiles(); - - if (lastApp != null) - facadeView.Sort(new ProgramSort(CurrentSortMethod, CurrentSortAsc)); - - //set object count label - GUIPropertyManager.SetProperty("#itemcount", Utils.GetObjectCountLabel(TotalItems)); - - if (selectedItemIndex >= 0) - { - GUIControl.SelectItemControl(GetID, facadeView.GetID, selectedItemIndex); - } - SetLabels(); - } - - int DisplayFiles() - { - if (lastApp == null) return 0; - - // Refresh FileList if view has changed, while this appItem was not active - if ((lastApp.CurrentView != ViewHandler.CurrentView) || (lastApp.filesAreLoaded == false)) - { - lastApp.LoadFiles(); - lastApp.CurrentView = ViewHandler.CurrentView; - } - int totalFiles = 0; - totalFiles = totalFiles + DisplayItemList(lastApp.ItemList, facadeView); - return (totalFiles); - } - - int DisplayApps() - { - int totalApps = 0; - - foreach (ApplicationItem applicationItem in AppsOfFatherID(GetCurrentFatherID())) - { - if (!applicationItem.Enabled) continue; - - totalApps++; - GUIListItem item = new GUIListItem(applicationItem.Title); - - // check whether to use thumbsdir or not - string imgFile = String.Empty; - if (ProgramUtils.UseThumbsDir()) - imgFile = ProgramUtils.GetApplicationImage(applicationItem); - else - imgFile = applicationItem.Imagefile; - - // use skin default image if file does not exist - if (File.Exists(imgFile)) - { - item.ThumbnailImage = imgFile; - item.IconImageBig = imgFile; - item.IconImage = imgFile; - } - else - { - item.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - item.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - item.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; - } - - item.MusicTag = applicationItem; - //item.IsFolder = true; // pseudo-folder.... - item.OnItemSelected += new GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(item); - } - return (totalApps); - } - - string BuildHistoryKey(ApplicationItem app, int viewLevel, string pathSub) - { - int appID; - if (app != null) - { - appID = app.ApplicationItemId; - } - else - { - appID = 1; // root - } - return String.Format("applicationItem{0}#level{1}#sub_{2}", appID, viewLevel, pathSub); - } - - public void SaveItemIndex(string value, ApplicationItem app, string pathSub) - { - string key = BuildHistoryKey(app, ViewHandler.CurrentLevel, pathSub); - itemHistory.Set(value, key); - } - - void RestoreItemIndex(ApplicationItem app, string pathSub) - { - string key = BuildHistoryKey(app, ViewHandler.CurrentLevel, pathSub); - string itemHist = itemHistory.Get(key); - if (itemHist != "") - { - int itemIndex = ProgramUtils.StringToInteger(itemHist, -1); - if ((itemIndex >= 0) && (itemIndex <= facadeView.Count - 1)) - { - GUIControl.SelectItemControl(GetID, facadeView.GetID, itemIndex); - } - } - } - - #endregion - - #region EventHandlers - - void BackItemClicked() - { - if (lastApp != null) - { - if ((prevFilepath != null) && (prevFilepath != "") && (prevFilepath != lastApp.FileDirectory)) - { - // back item in filelist clicked - prevFilepath = Path.GetDirectoryName(prevFilepath); - } - else - { - if (ViewHandler.RemoveFilterItem()) - { - FilterItem curFilter; - // force reload, this will load the next filter-level..... - lastApp.LoadFiles(); - // auto-remove filters if there is only ONE EMPTY Filteritem - // displaying - bool doAutoRemove = ((lastApp.ItemList.Count == 1) && (ViewHandler.IsFilterQuery)); - while (doAutoRemove) - { - doAutoRemove = false; - if (lastApp.ItemList[0] is FilterItem) - { - curFilter = lastApp.ItemList[0] as FilterItem; - if ((curFilter.Title == "") && (curFilter.Title2 == "")) - { - if (ViewHandler.RemoveFilterItem()) - { - lastApp.LoadFiles(); - doAutoRemove = ((lastApp.ItemList.Count == 1) && (ViewHandler.IsFilterQuery)); - } - } - } - } - } - else - { - // back item in application list clicked - // go to father item - lastApp = this.dbHandlerInstance.GetAppByID(lastApp.FatherID); - if (lastApp != null) - { - mapSettings.LastAppID = lastApp.ApplicationItemId; - prevFilepath = lastApp.DefaultFilepath(); - } - else - { - // back to home screen..... - mapSettings.LastAppID = -1; - prevFilepath = ""; - } - } - } - UpdateButtonStates(); - UpdateListControl(); - RestoreItemIndex(lastApp, prevFilepath); - } - else - { - // from root.... go back to main menu - GUIWindowManager.ShowPreviousWindow(); - } - - - } - - public List<ApplicationItem> AppsOfFatherID(int FatherID) - { - List<ApplicationItem> applicationItemList = new List<ApplicationItem>(); - - foreach (ApplicationItem curApp in globalApplicationList) - { - if (curApp.FatherID == FatherID) - { - applicationItemList.Add(curApp); - } - } - return applicationItemList; - } - - public List<ApplicationItem> AppsOfFather(ApplicationItem father) - { - if (father == null) - { - return AppsOfFatherID(-1); // return children of root node! - } - else - { - return AppsOfFatherID(father.ApplicationItemId); - } - } - - public int GetMaxPosition(int fatherID) - { - int res = 0; - foreach (ApplicationItem curApp in globalApplicationList) - { - if ((curApp.FatherID == fatherID) && (curApp.Position > res)) - { - res = curApp.Position; - } - } - return res; - } - - - - /* public ApplicationItem CloneAppItem(ApplicationItem sourceApp) - { - ApplicationItem newApp = (ApplicationItem)ItemFactory.itemFactoryInstance.GetItem(sqlDB, sourceApp.Item_Type, null, 0); - newApp.Assign(sourceApp); - newApp.ApplicationItemId = -1; // to force a sql INSERT when written - Add(newApp); - return newApp; - }*/ - - //TO DO - //Fix this method - void ScrapeFileInfo(FileItem curFile) - { - int minRelevance = 30; - bool bSuccess = false; - ScraperSaveType saveType = ScraperSaveType.DataAndImages; - GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); - GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PROGRESS); - dlgProgress.ShowWaitCursor = false; - dlgProgress.ShowProgressBar(false); - dlgProgress.SetHeading("Lookup Gameinfo"); - dlgProgress.SetLine(1, curFile.Title); - dlgProgress.SetLine(2, curFile.Platform); - dlgProgress.SetLine(3, ""); - dlgProgress.StartModal(GetID); - // dlgProgress.SetPercentage(60); - dlgProgress.Progress(); - bSuccess = curFile.FindFileInfo(ScraperType.ALLGAME); - if ((bSuccess && curFile.FileInfoList.Count > 0) && ((FileItemInfo)(curFile.FileInfoList[0])).RelevanceNorm >= minRelevance) - { - GUIDialogSelect pDlg = (GUIDialogSelect)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_SELECT); - if (null != pDlg) - { - pDlg.Reset(); - pDlg.SetHeading("Select Title"); - foreach (FileItemInfo item in curFile.FileInfoList) - { - if (item.RelevanceNorm >= minRelevance) - { - pDlg.Add(String.Format("{0} ({1})", item.Title, item.Platform)); - } - } - pDlg.DoModal(GetID); - - // and wait till user selects one - int iSelectedGame = pDlg.SelectedLabel; - if (iSelectedGame < 0) return; - - dlgProgress.StartModal(GetID); - dlgProgress.Progress(); - dlgProgress.ShowProgressBar(false); - curFile.FileInfoFavourite = (FileItemInfo)curFile.FileInfoList[iSelectedGame]; - - curFile.FindFileInfoDetail(lastApp, curFile.FileInfoFavourite, ScraperType.ALLGAME, saveType); - if ((saveType == ScraperSaveType.DataAndImages) || (saveType == ScraperSaveType.Data)) - { - // dlgProgress.SetPercentage(60); - dlgProgress.Progress(); - curFile.SaveFromFileInfoFavourite(false); - } - // dlgProgress.SetPercentage(100); - dlgProgress.Progress(); - dlgProgress.Close(); - dlgProgress = null; - } - OnInfo(); - } - else - { - string strMsg = ""; - if (!bSuccess) - { - strMsg = "Connection failed"; - Log.Info("myPrograms: RefreshData failed"); - } - else - { - strMsg = String.Format("No match for '{0}'", curFile.Title); - Log.Info("myPrograms: No data found for '{0}'", curFile.Title); - } - if (null != dlgOk) - { - dlgOk.SetHeading(187); - dlgOk.SetLine(1, strMsg); - dlgOk.SetLine(2, String.Empty); - dlgOk.DoModal(GetID); - } - } - } - - /* protected void OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIPrograms.ThumbnailPath = ""; - if (item.ThumbnailImage != "" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" - ) - { - // only show big thumb if there is really one.... - GUIPrograms.ThumbnailPath = item.ThumbnailImage; - } - }*/ - - void OnItemSelected(GUIListItem item, GUIControl parent) - { - ThumbnailPath = ""; - if (item.ThumbnailImage != "" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png") - { - // only show big thumb if there is really one.... - ThumbnailPath = item.ThumbnailImage; - } - - GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; - if (filmstrip != null) - { - filmstrip.InfoImageFileName = ThumbnailPath; - } - } - - void OnClick() - { - GUIListItem selectedGUIListItem = GetSelectedItem(); - - if (selectedGUIListItem.MusicTag != null) - { - object item = selectedGUIListItem.MusicTag; - - if (item is ApplicationItem) - { - - lastApp = (ApplicationItem)item; - SaveItemIndex(GetSelectedItemNo().ToString(), lastApp, lastApp.lastFilepath); - mapSettings.LastAppID = lastApp.ApplicationItemId; - prevFilepath = lastApp.DefaultFilepath(); - ViewHandler.CurrentLevel = 0; - //lastApp.ViewHandler = ViewHandler; - } - else if (item is FileItem) - { - FileItem fileItem = (FileItem)item; - selectedItemIndex = GetSelectedItemNo(); - - if (lastApp != null) - { - mapSettings.LastAppID = lastApp.ApplicationItemId; - prevFilepath = lastApp.DefaultFilepath(); - lastApp.LaunchFile(fileItem); - } - } - else if (item is FilterItem) - { - FilterItem filterItem = (FilterItem)item; - - SaveItemIndex(GetSelectedItemNo().ToString(), lastApp, prevFilepath); - ViewHandler.AddFilterItem(filterItem); - if (lastApp != null) - { - // force reload, this will load the next filter-level..... - lastApp.LoadFiles(); - } - } - - - UpdateButtonStates(); - UpdateListControl(); - } - else if (selectedGUIListItem.Label.Equals(ProgramUtils.cBackLabel)) - { // folder-item clicked.... - selectedItemIndex = -1; - BackItemClicked(); - UpdateButtonStates(); - } - } - - #region moved from BaseItem - - public int DisplayItemList(List<object> dbItems, GUIFacadeControl facadeView) - { - int totalItems = 0; - - foreach (object baseItem in dbItems) - { - totalItems = totalItems + 1; - - if (baseItem is FileItem) - { - FileItem curFile = baseItem as FileItem; - GUIListItem gli = new GUIListItem(curFile.Title); - - gli.MusicTag = curFile; - // gli.IsFolder = curFile.IsFolder; - gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(gli); - } - if (baseItem is FilterItem) - { - FilterItem curFile = baseItem as FilterItem; - GUIListItem gli = new GUIListItem(curFile.Title); - gli.MusicTag = curFile; - //gli.IsFolder = false; - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(OnItemSelected); - facadeView.Add(gli); - } - } - return totalItems; - } - - protected void OnRetrieveCoverArt(GUIListItem guiListItem) - { - if (guiListItem.MusicTag == null) return; - FileItem curFileItem = (FileItem)guiListItem.MusicTag; - if (curFileItem == null) return; - - string imgFile = String.Empty; - - if (ProgramUtils.UseThumbsDir()) - imgFile = ProgramUtils.GetFileImage(lastApp, curFileItem); - else - imgFile = curFileItem.Imagefile; - - if (File.Exists(imgFile)) - { - guiListItem.ThumbnailImage = imgFile; - guiListItem.IconImageBig = imgFile; - guiListItem.IconImage = imgFile; - } - else - { - guiListItem.ThumbnailImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - guiListItem.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; - guiListItem.IconImage = GUIGraphicsContext.Skin + @"\media\DefaultFolderNF.png"; - } - } - - #endregion - - protected void OnShowSort() - { - GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - if (dlg == null) - return; - 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"); - - - dlg.DoModal(GetID); - - if (dlg.SelectedLabel == -1) - return; - - switch (dlg.SelectedId) - { - case 268: - CurrentSortMethod = ProgramSort.SortMethod.Title; - break; - case 363: - CurrentSortMethod = ProgramSort.SortMethod.Filename; - break; - case 367: - CurrentSortMethod = ProgramSort.SortMethod.Rating; - break; - default: - CurrentSortMethod = ProgramSort.SortMethod.Title; - break; - } - //ToDo - //tmp fix until all mappings in place. - switch (dlg.SelectedLabelText) - { - case "Sort by: Times launched": - CurrentSortMethod = ProgramSort.SortMethod.LaunchCount; - break; - case "Sort by: Date launched": - CurrentSortMethod = ProgramSort.SortMethod.LastTimeLaunched; - break; - case "Sort by: Platform": - CurrentSortMethod = ProgramSort.SortMethod.Platform; - break; - default: - break; - } - - - OnSort(); - GUIControl.FocusControl(GetID, btnSortBy.GetID); - } - - protected virtual void OnSort() - { - SetLabels(); - facadeView.Sort(new ProgramSort(CurrentSortMethod, CurrentSortAsc)); - UpdateButtonStates(); - } - - protected void OnInfo() - { - - if (lastApp == null) return; - - selectedItemIndex = GetSelectedItemNo(); - GUIListItem item = GetSelectedItem(); - FileItem curFile = null; - - if (item.Label.Equals(ProgramUtils.cBackLabel)) return; - if (item.MusicTag == null) return; - if (item.MusicTag is ApplicationItem) return; - - if (item.MusicTag is FileItem) - { - curFile = (FileItem)item.MusicTag; - GUIProgramsAltFileInfo fileInfo = (GUIProgramsAltFileInfo)GUIWindowManager.GetWindow(9999); - fileInfo.CurrentFileItem = curFile; - fileInfo.CurrentApplicationItem = lastApp; - fileInfo.FolderForThumbs = string.Empty; - GUIWindowManager.ActivateWindow(9999); - } - } - - protected void SetLabels() - { - if (facadeView != null) - { - try - { - for (int i = 0; i < facadeView.Count; ++i) - { - GUIListItem item = facadeView[i]; - ViewHandler.SetLabel(item.MusicTag as FileItem, ref item); - } - } - catch (Exception ex) - { - Log.Error("GUIMusicPlaylist: exception occured - item without Albumtag? - {0} / {1}", ex.Message, ex.StackTrace); - } - } - } - - void OnShowViews() - { - GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); - if (dlg == null) return; - dlg.Reset(); - dlg.SetHeading(499); // Actions - dlg.Add(GUILocalizeStrings.Get(100000 + GetID)); // Files - foreach (ViewDefinition view in ViewHandler.Views) - { - dlg.Add(view.LocalizedName); - } - dlg.DoModal(GetID); - if (dlg.SelectedLabel == -1) return; - if (dlg.SelectedLabel == 0) - { - int nNewWindow = (int)Window.WINDOW_FILES; - StartWindow = nNewWindow; - mapSettings.ViewLayout = (int)Layout.List; - ViewHandler.CurrentView = GUILocalizeStrings.Get(100000 + GetID);//my files - if (nNewWindow != GetID) - { - GUIWindowManager.ReplaceWindow(nNewWindow); - } - } - else - { - ViewDefinition selectedView = (ViewDefinition)ViewHandler.Views[dlg.SelectedLabel - 1]; - ViewHandler.CurrentView = selectedView.Name; - int nNewWindow = (int)Window.WINDOW_FILES; - if (GetID != nNewWindow) - { - StartWindow = nNewWindow; - if (nNewWindow != GetID) - { - GUIWindowManager.ReplaceWindow(nNewWindow); - } - } - else - { - if (facadeView.Count <= 0) - { - GUIControl.FocusControl(GetID, btnViewAs.GetID); - } - } - } - - UpdateButtonStates(); - UpdateListControl(); - } - - #endregion - } -} \ No newline at end of file Added: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs (rev 0) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-25 22:33:24 UTC (rev 866) @@ -0,0 +1,1496 @@ +#region Copyright (C) 2005-2007 Team MediaPortal + +/* + * Copyright (C) 2005-2007 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Threading; +using System.Xml.Serialization; +using Microsoft.DirectX; +using Microsoft.DirectX.Direct3D; +using Direct3D = Microsoft.DirectX.Direct3D; + +using MediaPortal.Configuration; +using MediaPortal.Database; +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +using MediaPortal.GUI.View; +using MediaPortal.Profile; +using MediaPortal.Util; + +using GUIPrograms.Items; +using GUIPrograms.Database; +using GUIPrograms.Design; +using System.Data.SQLite; +using System.Data; + +namespace GUIPrograms +{ + /// <summary> + /// The GUIProgramsAlt plugin is used to list a collection of arbitrary files + /// and use them as arguments when launching external applications. + /// </summary> + /// + public class GUIProgramsAlt : GUIWindow, ISetupForm, IShowPlugin + { + + #region Serialisation + + [Serializable] + public class MapSettings + { + protected int sortMethod; + protected int viewLayout; + protected bool sortAscending; + protected int lastApplicationID; + protected int lastFileID; + protected int lastViewLevel; + protected bool overviewVisible; + + public MapSettings() + { + sortMethod = 0; //name + viewLayout = 0; //list + sortAscending = true; + overviewVisible = true; + lastApplicationID = -1; + lastFileID = -1; + lastViewLevel = 0; + } + + + [XmlElement("SortMethod")] + public int SortMethod + { + get { return sortMethod; } + set { sortMethod = value; } + } + + [XmlElement("ViewLayout")] + public int ViewLayout + { + get { return viewLayout; } + set { viewLayout = value; } + } + + [XmlElement("SortAscending")] + public bool SortAscending + { + get { return sortAscending; } + set { sortAscending = value; } + } + + [XmlElement("OverviewVisible")] + public bool OverviewVisible + { + get { return overviewVisible; } + set { overviewVisible = value; } + } + + [XmlElement("LastAppID")] + public int LastAppID + { + get { return lastApplicationID; } + set { lastApplicationID = value; } + } + + [XmlElement("LastFileID")] + public int LastFileID + { + get { return lastFileID; } + set { lastFileID = value; } + } + + [XmlElement("LastViewLevelID")] + public int LastViewLevel + { + get { return lastViewLevel; } + set { lastViewLevel = value; } + } + + + public string ViewLayoutTextName + { + get { return GetViewLayoutAsText(); } + } + + public void SwitchToNextViewLayout() + { + switch ((Layout)ViewLayout) + { + case Layout.List: + ViewLayout = (int)Layout.Icons; + + break; + case Layout.Icons: + ViewLayout = (int)Layout.LargeIcons; + + break; + case Layout.LargeIcons: + ViewLayout = (int)Layout.FilmStrip; + + break; + case Layout.FilmStrip: + ViewLayout = (int)Layout.List; + + break; + } + } + + string GetViewLayoutAsText() + { + string result = ""; + switch ((Layout)ViewLayout) + { + case Layout.List: + result = GUILocalizeStrings.Get(101); + break; + case Layout.Icons: + result = GUILocalizeStrings.Get(100); + break; + case Layout.LargeIcons: + result = GUILocalizeStrings.Get(417); + break; + case Layout.FilmStrip: + result = GUILocalizeStrings.Get(733); + break; + } + return result; + } + } + + + void SaveSettings() + { + using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + switch ((Layout)mapSettings.ViewLayout) + { + case Layout.List: + xmlwriter.SetValue("myprograms", "viewLayout", "list"); + break; + case Layout.Icons: + xmlwriter.SetValue("myprograms", "viewLayout", "icons"); + break; + case Layout.LargeIcons: + xmlwriter.SetValue("myprograms", "viewLayout", "largeicons"); + break; + case Layout.FilmStrip: + xmlwriter.SetValue("myprograms", "viewLayout", "filmstrip"); + break; + } + xmlwriter.SetValue("myprograms", "lastAppID", mapSettings.LastAppID.ToString()); + // xmlwriter.SetValue("myprograms", "lastViewLevel", mapSettings.LastViewLevel.ToString()); + xmlwriter.SetValue("myprograms", "lastViewLevel", ViewHandler.CurrentLevel); + xmlwriter.SetValue("myprograms", "sortMethod", mapSettings.SortMethod); + // avoid bool conversion...... don't wanna know why it doesn't work! :-( + if (mapSettings.SortAscending) + { + xmlwriter.SetValue("myprograms", "sortASC", "yes"); + } + else + { + xmlwriter.SetValue("myprograms", "sortASC", "no"); + } + + if (mapSettings.OverviewVisible) + { + xmlwriter.SetValue("myprograms", "overviewvisible", "yes"); + } + else + { + xmlwriter.SetValue("myprograms", "overviewvisible", "no"); + } + + xmlwriter.SetValue("myprograms", "startWindow", StartWindow.ToString()); + xmlwriter.SetValue("myprograms", "startview", (int)mapSettings.ViewLayout); + } + } + + void LoadSettings() + { + slideSpeed = ProgramUtils.GetSleepTime(); + + using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + string curText = ""; + curText = xmlreader.GetValueAsString("myprograms", "viewLayout", "list"); + + if (curText == "list") mapSettings.ViewLayout = (int)Layout.List; + else if (curText == "icons") mapSettings.ViewLayout = (int)Layout.Icons; + else if (curText == "largeicons") mapSettings.ViewLayout = (int)Layout.LargeIcons; + else if (curText == "filmstrip") mapSettings.ViewLayout = (int)Layout.FilmStrip; + else mapSettings.ViewLayout = (int)Layout.List; + + CurrentSortMethod = (ProgramSort.SortMethod)xmlreader.GetValueAsInt("myprograms", "sortMethod", (int)ProgramSort.SortMethod.Title); + + mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); + mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); + mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortASC", true); + mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "sortASC", true); + + StartWindow = xmlreader.GetValueAsInt("myprograms", "startWindow", GetID); + } + } + + + void LoadLastAppIDFromSettings() + { + using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + mapSettings.LastAppID = xmlreader.GetValueAsInt("myprograms", "lastAppID", -1); + mapSettings.LastViewLevel = xmlreader.GetValueAsInt("myprograms", "lastViewLevel", -1); + mapSettings.SortMethod = xmlreader.GetValueAsInt("myprograms", "sortMethod", 0); + mapSettings.SortAscending = xmlreader.GetValueAsBool("myprograms", "sortAsc", true); + mapSettings.OverviewVisible = xmlreader.GetValueAsBool("myprograms", "overviewvisible", true); + } + } + + void LoadFolderSettings(string directoryName) + { + if (directoryName == "") + directoryName = "root"; + object o; + FolderSettings.GetFolderSetting(directoryName, "Programs", typeof(MapSettings), out o); + if (o != null) + mapSettings = o as MapSettings; + if (mapSettings == null) + mapSettings = new MapSettings(); + } + + void SaveFolderSettings(string directoryName) + { + if (directoryName == "") + directoryName = "root"; + FolderSettings.AddFolderSetting(directoryName, "Programs", typeof(MapSettings), mapSettings); + } + + #endregion Serialisation + + + #region Variables + + static int startWindow = (int)GUIWindow.Window.WINDOW_FILES; + bool currentSortAsc = true; + // FacadeView + const int facadeIDConst = 50; + ProgramViewHandler viewHandler = ProgramViewHandler.Instance; + List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; + DirectoryHistory itemHistory = new DirectoryHistory(); + int slideSpeed = 3000; // speed in milliseconds between two slides + long slideTime = 0; + bool skipInit = false; + static string _thumbnailPath = string.Empty; + static string _lastThumbnailPath = string.Empty; + + ProgramSort.SortMethod currentSortMethod = ProgramSort.SortMethod.Title; + DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; + + MapSettings mapSettings = new MapSettings(); + ApplicationItem lastApp = null; + string prevFilepath = ""; + int selectedItemIndex = -1; + Layout currentLayout = Layout.List; + + // Buttons + [SkinControl(2)] + protected GUIButtonControl btnViewAs = null; + [SkinControlAttribute(3)] + protected GUISortButtonControl btnSortBy = null; + [SkinControl(4)] + protected GUIButtonControl btnViews = null; + [SkinControl(5)] + protected GUIButtonControl btnRefresh = null; + //Images + [SkinControl(6)] + protected GUIImage screenShotImage = null; + + [SkinControl(facadeIDConst)] + protected GUIFacadeControl facadeView = null; + + + + #endregion Variables + + #region Enums + + public enum Layout + { + List = 0, + Icons = 1, + LargeIcons = 2, + FilmStrip = 3, + } + + #endregion Enums + + #region Constructor / Destructor + + public GUIProgramsAlt() + { + GetID = (int)Window.WINDOW_FILES; + } + + + + #endregion Constructor / Destructor + + + #region Properties / Helper Routines + + public ProgramViewHandler ViewHandler + { + get { return viewHandler; } + set { viewHandler = value; } + } + + public static string ThumbnailPath + { + get + { + return _thumbnailPath; + } + set + { + if (value == "") + _thumbnailPath = ""; + else if (File.Exists(value)) + _thumbnailPath = value; + } + } + + public int StartWindow + { + get { return startWindow; } + set { startWindow = value; } + } + + public virtual Layout CurrentLayout + { + get { return currentLayout; } + set { currentLayout = value; } + } + + bool CurrentSortAsc + { + get { return currentSortAsc; } + set { currentSortAsc = value; } + } + + protected virtual ProgramSort.SortMethod CurrentSortMethod + { + get { return currentSortMethod; } + set { currentSortMethod = value; } + } + + GUIListItem GetSelectedItem() + { + return facadeView.SelectedListItem; + } + + public int GetSelectedItemNo() + { + return facadeView.SelectedListItemIndex; + } + + int GetCurrentFatherID() + { + if (lastApp != null) + { + return lastApp.ApplicationItemId; + } + else + { + return -1; // root + } + } + + + bool ThereAreAppsToDisplay() + { + if (lastApp == null) + { + return true; // root has globalApplicationList + } + else + { + return lastApp.SubItemsAllowed(); // grouper items for example + } + } + + bool ThereAreFilesOrLinksToDisplay() + { + return (lastApp != null); // all globalApplicationList can have files except the root + } + + bool IsBackButtonNecessary() + { + return (lastApp != null); // always show back button except for root + } + + #endregion + + #region Private Methods + + void InitGUIProgramsAlt() + { + dbHandlerInstance.LoadAllApplicationItems(); + globalApplicationList = dbHandlerInstance.ApplicationItemList; + LoadSettings(); + skipInit = true; + } + + void SortChanged(object sender, SortEventArgs args) + { + this.CurrentSortAsc = args.Order != System.Windows.Forms.SortOrder.Descending; + SortItems(); + UpdateButtonStates(); + } + + void UpdateButtonStates() + { + string sortBy = string.Empty; + + GUIPropertyManager.SetProperty("#view", ViewHandler.LocalizedCurrentView); + + if (lastApp == null) + { + btnRefresh.IsVisible = false; + } + else + { + btnRefresh.IsVisible = lastApp.RefreshGUIAllowed; + } + + facadeView.IsVisible = true; + + GUIControl.FocusControl(GetID, facadeView.GetID); + + // di... [truncated message content] |
From: <nor...@us...> - 2007-08-27 23:30:35
|
Revision: 872 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=872&view=rev Author: northern_sky Date: 2007-08-27 16:30:33 -0700 (Mon, 27 Aug 2007) Log Message: ----------- cleanups Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAlt.xml Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.Designer.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -76,9 +76,9 @@ this.toolTip.SetToolTip(this.quoteCheckBox, "Quotes are usually needed to handle filenames with spaces correctly. \r\nAvoid doub" + "le quotes though!"); // - // allowRefreshCheckBox + // allowGUIImportCheckBox // - this.toolTip.SetToolTip(this.allowRefreshCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + + this.toolTip.SetToolTip(this.allowGUIImportCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + ""); // // progressBar @@ -125,7 +125,7 @@ this.Controls.SetChildIndex(this.quoteCheckBox, 0); this.Controls.SetChildIndex(this.applicationImageButton, 0); this.Controls.SetChildIndex(this.startupDirButton, 0); - this.Controls.SetChildIndex(this.allowRefreshCheckBox, 0); + this.Controls.SetChildIndex(this.allowGUIImportCheckBox, 0); this.Controls.SetChildIndex(this.informationLabel, 0); this.Controls.SetChildIndex(this.applicationExeTextBox, 0); this.Controls.SetChildIndex(this.progressBar, 0); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -71,7 +71,7 @@ quoteCheckBox.Visible = false; - allowRefreshCheckBox.Visible = false; + allowGUIImportCheckBox.Visible = false; waitExitCheckBox.Visible = false; shellexecuteCheckBox.Visible = false; informationLabel.Visible = false; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -46,7 +46,7 @@ this.quoteCheckBox = new System.Windows.Forms.CheckBox(); this.applicationImageButton = new System.Windows.Forms.Button(); this.startupDirButton = new System.Windows.Forms.Button(); - this.allowRefreshCheckBox = new System.Windows.Forms.CheckBox(); + this.allowGUIImportCheckBox = new System.Windows.Forms.CheckBox(); this.informationLabel = new System.Windows.Forms.Label(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); @@ -227,15 +227,15 @@ this.startupDirButton.UseVisualStyleBackColor = true; this.startupDirButton.Click += new System.EventHandler(this.startupDirButton_Click); // - // allowRefreshCheckBox + // allowGUIImportCheckBox // - this.allowRefreshCheckBox.AutoSize = true; - this.allowRefreshCheckBox.Location = new System.Drawing.Point(5, 368); - this.allowRefreshCheckBox.Name = "allowRefreshCheckBox"; - this.allowRefreshCheckBox.Size = new System.Drawing.Size(154, 17); - this.allowRefreshCheckBox.TabIndex = 30; - this.allowRefreshCheckBox.Text = "Allow refresh in mediaportal"; - this.allowRefreshCheckBox.UseVisualStyleBackColor = true; + this.allowGUIImportCheckBox.AutoSize = true; + this.allowGUIImportCheckBox.Location = new System.Drawing.Point(5, 368); + this.allowGUIImportCheckBox.Name = "allowGUIImportCheckBox"; + this.allowGUIImportCheckBox.Size = new System.Drawing.Size(201, 17); + this.allowGUIImportCheckBox.TabIndex = 30; + this.allowGUIImportCheckBox.Text = "Allow reimport from within mediaportal"; + this.allowGUIImportCheckBox.UseVisualStyleBackColor = true; // // informationLabel // @@ -323,7 +323,7 @@ this.Controls.Add(this.startupDirComboBox); this.Controls.Add(this.applicationExeTextBox); this.Controls.Add(this.informationLabel); - this.Controls.Add(this.allowRefreshCheckBox); + this.Controls.Add(this.allowGUIImportCheckBox); this.Controls.Add(this.startupDirButton); this.Controls.Add(this.applicationImageButton); this.Controls.Add(this.quoteCheckBox); @@ -367,7 +367,7 @@ protected System.Windows.Forms.CheckBox quoteCheckBox; protected System.Windows.Forms.Button applicationImageButton; protected System.Windows.Forms.Button startupDirButton; - protected System.Windows.Forms.CheckBox allowRefreshCheckBox; + protected System.Windows.Forms.CheckBox allowGUIImportCheckBox; protected System.Windows.Forms.Label informationLabel; protected System.Windows.Forms.ToolTip toolTip; protected System.Windows.Forms.FolderBrowserDialog folderBrowserDialog; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -123,7 +123,7 @@ toolTip.SetToolTip(applicationImageTextBox, "Optional filename for an image to display in MediaPortal"); toolTip.SetToolTip(enabledCheckbox, "Only enabled items will appear in MediaPortal"); toolTip.SetToolTip(applicationExeTextBox, "Program you wish to execute, include the full path (mandatory if ShellExecute is " + "OFF)"); - toolTip.SetToolTip(allowRefreshCheckBox, "If you want to be able to run the import through the REFRESH button in MediaPortal."); + toolTip.SetToolTip(allowGUIImportCheckBox, "If you want to be able to run the import through the Reimport button in MediaPortal."); toolTip.SetToolTip(preCommandTextBox, "Configure an command to run as pre of the main filelaunching ie explorer; joy2key; etc .Separate with ;."); toolTip.SetToolTip(postCommandTextBox, "Configure an command to run as post of the main filelaunching ie explorer; joy2key; etc .Separate with ;."); toolTip.SetToolTip(waitExitCheckBox, "If you want mediaportal to wait for exit while running application."); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.Designer.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -71,9 +71,9 @@ this.toolTip.SetToolTip(this.quoteCheckBox, "Quotes are usually needed to handle filenames with spaces correctly. \r\nAvoid doub" + "le quotes though!"); // - // allowRefreshCheckBox + // allowGUIImportCheckBox // - this.toolTip.SetToolTip(this.allowRefreshCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + + this.toolTip.SetToolTip(this.allowGUIImportCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + ""); // // platformComboBox @@ -124,7 +124,7 @@ this.Controls.SetChildIndex(this.quoteCheckBox, 0); this.Controls.SetChildIndex(this.applicationImageButton, 0); this.Controls.SetChildIndex(this.startupDirButton, 0); - this.Controls.SetChildIndex(this.allowRefreshCheckBox, 0); + this.Controls.SetChildIndex(this.allowGUIImportCheckBox, 0); this.Controls.SetChildIndex(this.informationLabel, 0); this.Controls.SetChildIndex(this.applicationExeTextBox, 0); this.Controls.SetChildIndex(this.startupDirComboBox, 0); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -54,7 +54,7 @@ shellexecuteCheckBox.Checked = applicationItem.UseShellExecute; quoteCheckBox.Checked = applicationItem.UseQuotes; waitExitCheckBox.Checked = (applicationItem.WaitForExit); - allowRefreshCheckBox.Checked = applicationItem.RefreshGUIAllowed; + allowGUIImportCheckBox.Checked = applicationItem.RefreshGUIAllowed; 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 = allowRefreshCheckBox.Checked; + curApp.RefreshGUIAllowed = allowGUIImportCheckBox.Checked; curApp.PlatformId = (int)platformComboBox.SelectedValue; } @@ -120,7 +120,7 @@ informationLabel.Text = "Directory Cache"; //untiil we really do something with this option in appdircache.. - allowRefreshCheckBox.Checked = false; + allowGUIImportCheckBox.Checked = false; } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.Designer.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -76,10 +76,10 @@ this.toolTip.SetToolTip(this.quoteCheckBox, "Quotes are usually needed to handle filenames with spaces correctly. \r\nAvoid doub" + "le quotes though!"); // - // allowRefreshCheckBox + // allowGUIImportCheckBox // - this.allowRefreshCheckBox.Location = new System.Drawing.Point(7, 366); - this.toolTip.SetToolTip(this.allowRefreshCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + + this.allowGUIImportCheckBox.Location = new System.Drawing.Point(7, 366); + this.toolTip.SetToolTip(this.allowGUIImportCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + ""); // // informationLabel Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGamebase.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -53,7 +53,7 @@ this.startupDirComboBox.Text = curApp.StartupDir; this.quoteCheckBox.Checked = true; //(applicationItem.UseQuotes); this.waitExitCheckBox.Checked = (curApp.WaitForExit); - this.allowRefreshCheckBox.Checked = curApp.RefreshGUIAllowed; + this.allowGUIImportCheckBox.Checked = curApp.RefreshGUIAllowed; } 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.allowRefreshCheckBox.Checked; + curApp.RefreshGUIAllowed = this.allowGUIImportCheckBox.Checked; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.Designer.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -68,9 +68,9 @@ this.toolTip.SetToolTip(this.quoteCheckBox, "Quotes are usually needed to handle filenames with spaces correctly. \r\nAvoid doub" + "le quotes though!"); // - // allowRefreshCheckBox + // allowGUIImportCheckBox // - this.toolTip.SetToolTip(this.allowRefreshCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + + this.toolTip.SetToolTip(this.allowGUIImportCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + ""); // // AppSettingsGrouper Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsGrouper.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -76,7 +76,7 @@ startupDirComboBox.Visible = false; quoteCheckBox.Visible = false; - allowRefreshCheckBox.Visible = false; + allowGUIImportCheckBox.Visible = false; waitExitCheckBox.Visible = false; shellexecuteCheckBox.Visible = false; informationLabel.Visible = false; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -74,9 +74,9 @@ this.toolTip.SetToolTip(this.quoteCheckBox, "Quotes are usually needed to handle filenames with spaces correctly. \r\nAvoid doub" + "le quotes though!"); // - // allowRefreshCheckBox + // allowGUIImportCheckBox // - this.toolTip.SetToolTip(this.allowRefreshCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + + this.toolTip.SetToolTip(this.allowGUIImportCheckBox, "Check this if users can run the import through the REFRESH button in MediaPortal." + ""); // // informationLabel @@ -155,7 +155,7 @@ this.Controls.SetChildIndex(this.quoteCheckBox, 0); this.Controls.SetChildIndex(this.applicationImageButton, 0); this.Controls.SetChildIndex(this.startupDirButton, 0); - this.Controls.SetChildIndex(this.allowRefreshCheckBox, 0); + this.Controls.SetChildIndex(this.allowGUIImportCheckBox, 0); this.Controls.SetChildIndex(this.groupBox1, 0); this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-08-27 23:30:33 UTC (rev 872) @@ -87,10 +87,10 @@ [SkinControl(4)] protected GUIButtonControl btnViews = null; [SkinControl(5)] - protected GUIButtonControl btnRefresh = null; + protected GUIButtonControl btnReimport = null; //Images [SkinControl(6)] - protected GUIImage screenShotImage = null; + protected GUIImage thumbGUIImage = null; [SkinControl(50)] protected GUIFacadeControl facadeView = null; @@ -148,30 +148,18 @@ set { currentSortMethod = value; } } - GUIListItem GetSelectedItem() + GUIListItem SelectedGUIListItem() { return facadeView.SelectedListItem; } - public int GetSelectedItemNo() + public int SelectedGUIListItemIndex() { return facadeView.SelectedListItemIndex; } - int GetCurrentFatherID() - { - if (currentApplicationItem != null) - { - return currentApplicationItem.ApplicationItemId; - } - else - { - return -1; // root - } - } - - bool ThereAreAppsToDisplay() + bool ApplicationItemSubItemsAllowed() { if (currentApplicationItem == null) { @@ -183,7 +171,7 @@ } } - bool IsCurrentApplicationItemNull() + bool IsCurrentApplicationItemNotNull() { return (currentApplicationItem != null); // all globalApplicationList can have files except the root } @@ -305,11 +293,11 @@ if (currentApplicationItem == null) { - btnRefresh.IsVisible = false; + btnReimport.IsVisible = false; } else { - btnRefresh.IsVisible = currentApplicationItem.RefreshGUIAllowed; + btnReimport.IsVisible = currentApplicationItem.RefreshGUIAllowed; } facadeView.IsVisible = true; @@ -372,31 +360,27 @@ } } - void ShowThumbPanel() + void ShouldShowThumbPanel() { - int itemIndex = facadeView.SelectedListItemIndex; - switch (CurrentLayout) { case Layout.List: facadeView.View = GUIFacadeControl.ViewMode.List; - screenShotImage.Visible = true; + thumbGUIImage.Visible = true; break; case Layout.Icons: facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; - screenShotImage.Visible = false; + thumbGUIImage.Visible = false; break; case Layout.LargeIcons: facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; - screenShotImage.Visible = false; + thumbGUIImage.Visible = false; break; case Layout.FilmStrip: facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; - screenShotImage.Visible = false; + thumbGUIImage.Visible = false; break; } - facadeView.SelectedListItemIndex = itemIndex; - UpdateButtonStates(); } void RenderThumbnail(float timePassed) @@ -413,41 +397,35 @@ void RefreshThumbnail() { - ApplicationItem appWithImg = currentApplicationItem; - GUIListItem item = GetSelectedItem(); + GUIListItem selectedGUIListItem = SelectedGUIListItem(); // some preconditions... - if (item == null) return; - if (appWithImg == null) - { - if (item.MusicTag == null) return; - appWithImg = item.MusicTag as ApplicationItem; - if (appWithImg == null) return; - } - + if (selectedGUIListItem == null) return; + if (currentApplicationItem == null) return; + ThumbnailPath = ""; - if (item.ThumbnailImage != "" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" - && item.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" + if (selectedGUIListItem.ThumbnailImage != "" + && selectedGUIListItem.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png" + && selectedGUIListItem.ThumbnailImage != GUIGraphicsContext.Skin + @"\media\DefaultAlbum.png" ) { // only show big thumb if there is really one.... - ThumbnailPath = appWithImg.GetCurThumb(item); // some modes look for thumbs differently + ThumbnailPath = currentApplicationItem.GetCurThumb(selectedGUIListItem); // some modes look for thumbs differently } - appWithImg.NextThumb(); // try to find a next thumbnail + currentApplicationItem.NextThumb(); // try to find a next thumbnail slideTime = (DateTime.Now.Ticks / 10000); // reset timer! } void UpdateListControl() { GUIControl.ClearControl(GetID, facadeView.GetID); - if (IsCurrentApplicationItemNull()) + if (IsCurrentApplicationItemNotNull()) ProgramUtils.AddBackButton(facadeView); int TotalItems = 0; - if (ThereAreAppsToDisplay()) + if (ApplicationItemSubItemsAllowed()) TotalItems += DisplayApps(); - if (IsCurrentApplicationItemNull()) + if (IsCurrentApplicationItemNotNull()) TotalItems += DisplayFiles(); if (currentApplicationItem != null) @@ -482,7 +460,7 @@ { int totalApps = 0; - foreach (ApplicationItem applicationItem in AppsOfFatherID(GetCurrentFatherID())) + foreach (ApplicationItem applicationItem in AppsOfFatherID(currentApplicationItem == null ? -1 : currentApplicationItem.ApplicationItemId)) { if (!applicationItem.Enabled) continue; @@ -491,6 +469,7 @@ // check whether to use thumbsdir or not string imgFile = String.Empty; + if (ProgramUtils.UseThumbsDir()) imgFile = ProgramUtils.GetApplicationImage(applicationItem); else @@ -511,7 +490,6 @@ } item.MusicTag = applicationItem; - //item.IsFolder = true; // pseudo-folder.... item.OnItemSelected += new GUIListItem.ItemSelectedHandler(SetItemThumb); facadeView.Add(item); } @@ -599,33 +577,8 @@ return applicationItemList; } - List<ApplicationItem> AppsOfFather(ApplicationItem father) - { - if (father == null) - { - return AppsOfFatherID(-1); // return children of root node! - } - else - { - return AppsOfFatherID(father.ApplicationItemId); - } - } - int GetMaxPosition(int fatherID) - { - int res = 0; - foreach (ApplicationItem curApp in globalApplicationList) - { - if ((curApp.FatherID == fatherID) && (curApp.Position > res)) - { - res = curApp.Position; - } - } - return res; - } - - /* public ApplicationItem CloneAppItem(ApplicationItem sourceApp) { ApplicationItem newApp = (ApplicationItem)ItemFactory.itemFactoryInstance.GetItem(sqlDB, sourceApp.Item_Type, null, 0); @@ -740,7 +693,7 @@ void ItemClicked() { - GUIListItem selectedGUIListItem = GetSelectedItem(); + GUIListItem selectedGUIListItem = SelectedGUIListItem(); if (selectedGUIListItem.MusicTag != null) { @@ -750,20 +703,18 @@ { currentApplicationItem = (ApplicationItem)item; - //SaveItemIndex(GetSelectedItemNo().ToString(), currentApplicationItem, currentApplicationItem.lastFilepath); + //SaveItemIndex(SelectedGUIListItemIndex().ToString(), currentApplicationItem, currentApplicationItem.lastFilepath); prevFilepath = currentApplicationItem.DefaultFilepath(); ViewHandler.CurrentLevel = 0; - //currentApplicationItem.ViewHandler = ViewHandler; } else if (item is FileItem) { FileItem fileItem = (FileItem)item; - selectedItemIndex = GetSelectedItemNo(); + selectedItemIndex = SelectedGUIListItemIndex(); if (currentApplicationItem != null) { - prevFilepath = currentApplicationItem.DefaultFilepath(); currentApplicationItem.LaunchFile(fileItem); } @@ -772,7 +723,6 @@ { FilterItem filterItem = (FilterItem)item; - // SaveItemIndex(GetSelectedItemNo().ToString(), currentApplicationItem, prevFilepath); ViewHandler.AddFilterItem(filterItem); if (currentApplicationItem != null) { @@ -781,7 +731,6 @@ } } - UpdateButtonStates(); UpdateListControl(); } @@ -796,6 +745,9 @@ int DisplayItemList(List<object> dbItems, GUIFacadeControl facadeView) { int totalItems = 0; + FileItem fileItem = null; + FilterItem filterItem = null; + GUIListItem guiListItem = null; foreach (object baseItem in dbItems) { @@ -803,23 +755,22 @@ if (baseItem is FileItem) { - FileItem curFile = baseItem as FileItem; - GUIListItem gli = new GUIListItem(curFile.Title); + fileItem = baseItem as FileItem; + guiListItem = new GUIListItem(fileItem.Title); - gli.MusicTag = curFile; - // gli.IsFolder = curFile.IsFolder; - gli.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(SetImageFile); - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(SetItemThumb); - facadeView.Add(gli); + guiListItem.MusicTag = fileItem; + // guiListItem.IsFolder = curFile.IsFolder; + guiListItem.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(SetImageFile); + guiListItem.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(SetItemThumb); + facadeView.Add(guiListItem); } - if (baseItem is FilterItem) + else if (baseItem is FilterItem) { - FilterItem curFile = baseItem as FilterItem; - GUIListItem gli = new GUIListItem(curFile.Title); - gli.MusicTag = curFile; - //gli.IsFolder = false; - gli.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(SetItemThumb); - facadeView.Add(gli); + filterItem = baseItem as FilterItem; + guiListItem = new GUIListItem(filterItem.Title); + guiListItem.MusicTag = filterItem; + guiListItem.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(SetItemThumb); + facadeView.Add(guiListItem); } } return totalItems; @@ -855,12 +806,12 @@ void SelectSortMethod() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + if (dlg == null) return; dlg.Reset(); dlg.SetHeading(495); - dlg.AddLocalizedString(268); // title dlg.AddLocalizedString(363); // filename dlg.AddLocalizedString(367); // rating @@ -921,8 +872,9 @@ if (currentApplicationItem == null) return; - selectedItemIndex = GetSelectedItemNo(); - GUIListItem item = GetSelectedItem(); + selectedItemIndex = SelectedGUIListItemIndex(); + + GUIListItem item = SelectedGUIListItem(); FileItem curFile = null; if (item.Label.Equals(ProgramUtils.cBackLabel)) return; @@ -942,19 +894,20 @@ void SetLabels() { + GUIListItem item = null; if (facadeView != null) { try { for (int i = 0; i < facadeView.Count; ++i) { - GUIListItem item = facadeView[i]; + item = facadeView[i]; ViewHandler.SetLabel(item.MusicTag as FileItem, ref item); } } catch (Exception ex) { - Log.Error("GUIMusicPlaylist: exception occured - item without Albumtag? - {0} / {1}", ex.Message, ex.StackTrace); + Log.Error("Exeption occured - item without Albumtag? - {0} / {1}", ex.Message, ex.StackTrace); } } } @@ -1024,7 +977,8 @@ } UpdateListControl(); - ShowThumbPanel(); + ShouldShowThumbPanel(); + UpdateButtonStates(); } @@ -1035,10 +989,10 @@ // make sure the selected index wasn't reseted already // and save the index only if it's non-zero // otherwise: DXDevice.Reset clears selection - int itemIndex = GetSelectedItemNo(); + int itemIndex = SelectedGUIListItemIndex(); if (itemIndex > 0) { - selectedItemIndex = GetSelectedItemNo(); + selectedItemIndex = SelectedGUIListItemIndex(); } if (dbHandlerInstance.SqlLiteConn.State == ConnectionState.Open) @@ -1098,12 +1052,11 @@ if (control == btnViewAs) { SwitchToNextViewLayout(); + ShouldShowThumbPanel(); + UpdateButtonStates(); - - ShowThumbPanel(); - } - else if (control == btnRefresh) + else if (control == btnReimport) { if (currentApplicationItem != null) { @@ -1167,7 +1120,7 @@ if (ThumbnailPath != _lastThumbnailPath) { - screenShotImage.FileName = ThumbnailPath; + thumbGUIImage.FileName = ThumbnailPath; facadeView.FilmstripView.InfoImageFileName = ThumbnailPath; facadeView.FilmstripView.NeedRefresh(); Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAlt.xml =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAlt.xml 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAlt.xml 2007-08-27 23:30:33 UTC (rev 872) @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<window> - <id>3</id> - <defaultcontrol>2</defaultcontrol> - <allowoverlay>yes</allowoverlay> - <define>#header.label:#curheader</define> - <define>#header.image:programs_logo.png</define> - <define>#header.hover:hover_my programs.png</define> - <controls> - <import>common.window.xml</import> - <import>common.time.xml</import> - <control> - <description>group element</description> - <type>group</type> - <animation effect="fade" time="250">WindowOpen</animation> - <animation effect="fade" time="500">WindowClose</animation> - <animation effect="slide" time="250" start="-300,0">WindowOpen</animation> - <animation effect="slide" time="500" end="0,-300">WindowClose</animation> - <posX>60</posX> - <posY>97</posY> - <layout>StackLayout</layout> - <control> - <description>View-As</description> - <type>button</type> - <id>2</id> - <label>100</label> - <onright>50</onright> - <onup>17</onup> - </control> - <control> - <description>Sort</description> - <type>sortbutton</type> - <id>3</id> - <label>103</label> - <onright>50</onright> - </control> - <control> - <description>Switch View</description> - <type>button</type> - <id>4</id> - <label>457</label> - <onright>50</onright> - <ondown>3</ondown> - </control> - <control> - <description>Refresh</description> - <type>button</type> - <id>5</id> - <label>184</label> - <onright>50</onright> - <ondown>99</ondown> - </control> - </control> - <control> - <description>Screenshot</description> - <type>image</type> - <animation effect="fade" time="250">WindowOpen</animation> - <animation effect="fade" time="500">WindowClose</animation> - <animation effect="slide" time="250" start="-300,0">WindowOpen</animation> - <animation effect="slide" time="500" end="0,-300">WindowClose</animation> - <id>6</id> - <posX>60</posX> - <posY>230</posY> - <width>190</width> - <height>190</height> - <texture /> - <align>center</align> - <keepaspectratio>yes</keepaspectratio> - </control> - <import>common.facade.xml</import> - </controls> -</window> \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml 2007-08-27 12:46:19 UTC (rev 871) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/skin/BlueTwo/myProgramsAltFileInfo.xml 2007-08-27 23:30:33 UTC (rev 872) @@ -63,13 +63,13 @@ <animation effect="fade" time="200">WindowClose</animation> </control> <control> - <description>Refresh</description> + <description>Refresh from AMG</description> <type>button</type> <id>5</id> <posX>60</posX> <posY>199</posY> <width>120</width> - <label>184</label> + <label>Allgame import</label> <onleft>22</onleft> <onright>22</onright> <onup>2</onup> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-09-04 18:53:42
|
Revision: 893 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=893&view=rev Author: northern_sky Date: 2007-09-04 11:53:33 -0700 (Tue, 04 Sep 2007) Log Message: ----------- some importrestructure Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -16,34 +16,32 @@ { public class DirectoryImport: ImportBase { - private ApplicationItem applicationItem = null; - private DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; - public DirectoryImport(ApplicationItem objApp) + public DirectoryImport(ApplicationItem applicationItem) { - applicationItem = objApp; + this.applicationItem = applicationItem; } private void ImportFileItem(FileInfo fileInfo) { - FileItem curFile = new FileItem(); - curFile.FileID = -1; // to force an INSERT statement when writing the item - curFile.ApplicationItemId = applicationItem.ApplicationItemId; - curFile.Title = Path.GetFileNameWithoutExtension(fileInfo.Name); - curFile.Filename = fileInfo.FullName; - curFile.LastTimeLaunched = DateTime.MinValue; - curFile.LaunchCount = 0; + FileItem newFileItem = new FileItem(); + newFileItem.FileID = -1; // to force an INSERT statement when writing the item + newFileItem.ApplicationItemId = applicationItem.ApplicationItemId; + newFileItem.Title = Path.GetFileNameWithoutExtension(fileInfo.Name); + newFileItem.Filename = fileInfo.FullName; + newFileItem.LastTimeLaunched = DateTime.MinValue; + newFileItem.LaunchCount = 0; //curFile.Imagefile = GetThumbsFile(fileInfo, curFile.Title); - curFile.Imagefile = ImportImageFiles(curFile.Filename, curFile.Title, applicationItem); + newFileItem.Imagefile = ImportImageFiles(newFileItem.Filename, newFileItem.Title, applicationItem); - if ((curFile.Imagefile == "") && (applicationItem.ImportValidImagesOnly)) + if ((newFileItem.Imagefile == "") && (applicationItem.ImportValidImagesOnly)) { // SendDisplayText("", (int)(100 * (((double)count) / total))); } else { - curFile.Write(); + newFileItem.Write(); } } @@ -117,7 +115,7 @@ } } - public void StartImport() + public override void StartImport() { string[] fileDirPaths = this.applicationItem.FileDirectory.Split(';'); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/GamebaseImport.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -42,58 +42,61 @@ /// </summary> public class GamebaseImport : ImportBase { - private ApplicationItem applicationItem = null; - - public GamebaseImport(ApplicationItem objApp) + + public GamebaseImport(ApplicationItem applicationItem) { - applicationItem = objApp; + this.applicationItem = applicationItem; } - void DBImportGamebaseItem(OleDbDataReader myReader, string romFilename, string imgFilename, int curPos, int maxGames) { - FileItem curFile = new FileItem(); - curFile.FileID = -1; // to force an INSERT statement when writing the item - curFile.ApplicationItemId = applicationItem.ApplicationItemId; - curFile.Title = myReader["name"].ToString(); - curFile.Filename = romFilename; - curFile.Imagefile = imgFilename; + FileItem newFileItem = new FileItem(); + newFileItem.FileID = -1; // to force an INSERT statement when writing the item + newFileItem.ApplicationItemId = applicationItem.ApplicationItemId; + newFileItem.Title = myReader["name"].ToString(); + newFileItem.Filename = romFilename; + newFileItem.Imagefile = imgFilename; string strGenre1 = myReader["ParentGenre"].ToString(); string strGenre2 = myReader["Genre"].ToString(); int LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", strGenre1); - curFile.GenreId = LexiconId; + newFileItem.GenreId = LexiconId; LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblGenre", "genre", strGenre2); - curFile.GenreStyleId = LexiconId; + newFileItem.GenreStyleId = LexiconId; // todo: country - curFile.Country = ""; + newFileItem.Country = ""; LexiconId = DatabaseHandler.DBHandlerInstance.LexiconDataExists("tblManufacturer", "manufacturer", myReader["Publisher"].ToString()); - curFile.ManufacturerId = LexiconId; - curFile.Year = Convert.ToInt32(myReader["Year"]); - curFile.Rating = Convert.ToInt32(myReader["Rating"]) * 2; - if (curFile.Rating > 10) + newFileItem.ManufacturerId = LexiconId; + newFileItem.Year = Convert.ToInt32(myReader["Year"]); + newFileItem.Rating = Convert.ToInt32(myReader["Rating"]) * 2; + if (newFileItem.Rating > 10) { - curFile.Rating = 10; + newFileItem.Rating = 10; } - if (curFile.Rating < 1) + if (newFileItem.Rating < 1) { - curFile.Rating = 5; // average / not rated.... + newFileItem.Rating = 5; // average / not rated.... } - curFile.Overview = myReader["MemoText"].ToString(); - curFile.Platform = applicationItem.Title; + newFileItem.Overview = myReader["MemoText"].ToString(); + newFileItem.Platform = applicationItem.Title; // not imported properties => set default values - curFile.LastTimeLaunched = DateTime.MinValue; - curFile.LaunchCount = 0; - curFile.Write(); + newFileItem.LastTimeLaunched = DateTime.MinValue; + newFileItem.LaunchCount = 0; + newFileItem.Write(); return; } - public void StartImport() + public override void StartImport() { + string curRomname = ""; + string curFullRomname = ""; + string curTitleImage = ""; + bool bDoImport = false; + // string strCon = "Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=C:\\media\\GameBase\\snes\\Snes.mdb"; string strCon = String.Format("Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source={0}", applicationItem.ApplicationItemSource); @@ -125,27 +128,20 @@ ORDER BY Games.Name "; - string curRomname = ""; - string curFullRomname = ""; - string curTitleImage = ""; - bool bDoImport = false; + try { using (OleDbConnection myCon = new OleDbConnection(strCon)) { - using (OleDbCommand myCmd = new OleDbCommand(sqlStr, myCon)) { - using (SQLiteTransaction transaction = DatabaseHandler.DBHandlerInstance.SqlLiteConn.BeginTransaction()) { myCon.Open(); int maxGames = CountGames(myCon, sqlStrCount); - using (OleDbDataReader myReader = myCmd.ExecuteReader()) { - int i = 0; while (myReader.Read()) { @@ -221,7 +217,6 @@ { Log.Info("myProgams error in connecting to gamebase-mdb \n {0}", er.ToString()); } - return res; } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/ImportBase.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -5,8 +5,8 @@ using System.IO; using GUIProgramsAlt.Items; using GUIProgramsAlt; +using GUIProgramsAlt.Database; - namespace GUIProgramsAlt.Imports { public abstract class ImportBase @@ -15,6 +15,8 @@ public delegate void ReadNewFileEventHandler(object sender, FileReadEventArgs e); public event ReadNewFileEventHandler ReadNewFileEvent = null; + protected ApplicationItem applicationItem = null; + protected DatabaseHandler dbHandlerInstance = DatabaseHandler.DBHandlerInstance; protected void OnReadNewFileEvent(object sender,FileReadEventArgs e) { @@ -24,7 +26,9 @@ } } - public virtual void startImport() + + + public virtual void StartImport() { //override Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -48,7 +48,6 @@ /// </summary> public class MameImport : ImportBase { - ApplicationItem currentApplication = null; ConditionChecker conditionChecker = new ConditionChecker(); @@ -73,7 +72,7 @@ public MameImport(ApplicationItem applicationItem) { - currentApplication = applicationItem; + this.applicationItem = applicationItem; } void ReadListFull() @@ -85,7 +84,7 @@ using (Process process = new Process()) { - ProcessStartInfo processStartInfo = new ProcessStartInfo(currentApplication.Executable); + ProcessStartInfo processStartInfo = new ProcessStartInfo(applicationItem.Executable); processStartInfo.Arguments = "-listfull"; processStartInfo.UseShellExecute = false; processStartInfo.RedirectStandardOutput = true; @@ -112,13 +111,13 @@ void ReadListClones() { string line; - if (((ApplicationItemMame)currentApplication).ImportOriginalsOnly) + if (((ApplicationItemMame)applicationItem).ImportOriginalsOnly) { OnReadNewFileEvent(this,new FileReadEventArgs(20,"generating mame list (clones)")); using (Process process = new Process()) { - ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(currentApplication.Executable); + ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(applicationItem.Executable); myProcessStartInfo.Arguments = "-listclones"; myProcessStartInfo.UseShellExecute = false; myProcessStartInfo.RedirectStandardOutput = true; @@ -234,11 +233,11 @@ { char separator = ';'; conditionChecker.Clear(); - string[] fileDirs = currentApplication.FileDirectory.Split(separator); + string[] fileDirs = applicationItem.FileDirectory.Split(separator); - if (conditionChecker.DoCheck(System.IO.File.Exists(currentApplication.Executable), "mame-application not found!")) + if (conditionChecker.DoCheck(System.IO.File.Exists(applicationItem.Executable), "mame-application not found!")) { - mameDir = Path.GetDirectoryName(currentApplication.Executable); + mameDir = Path.GetDirectoryName(applicationItem.Executable); catverIniFile = mameDir + "\\catver.ini"; historyDatFile = mameDir + "\\history.dat"; } @@ -276,7 +275,7 @@ } - public void StartImport() + public override void StartImport() { if (!CheckPrerequisites()) { @@ -329,9 +328,9 @@ string fullEntry = ""; string genreEntry = ""; string versionEntry = ""; - bool onlyOriginals = ((ApplicationItemMame)currentApplication).ImportOriginalsOnly; - bool importMahjongGames = currentApplication.ImportMameMahjong; - bool importPlaychoiceGames = currentApplication.ImportMamePlaychoice10; + bool onlyOriginals = ((ApplicationItemMame)applicationItem).ImportOriginalsOnly; + bool importMahjongGames = applicationItem.ImportMameMahjong; + bool importPlaychoiceGames = applicationItem.ImportMamePlaychoice10; bool shouldImport = true; MameHistoryContainer mameHistoryNode = null; @@ -342,11 +341,11 @@ { FileItem curFile = new FileItem(); - curFile.ApplicationItemId = currentApplication.ApplicationItemId; + curFile.ApplicationItemId = applicationItem.ApplicationItemId; curFile.Filename = fullRomname; - curFile.Imagefile = ImportImageFiles(curFile.Filename, curFile.Title, currentApplication); + curFile.Imagefile = ImportImageFiles(curFile.Filename, curFile.Title, applicationItem); - if ((curFile.Imagefile == "") && (currentApplication.ImportValidImagesOnly)) + if ((curFile.Imagefile == "") && (applicationItem.ImportValidImagesOnly)) { OnReadNewFileEvent(this,new FileReadEventArgs( (int)(100 * (((double)count) / total)),"")); return; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -51,6 +51,8 @@ { public abstract class ApplicationItem { + protected ImportBase importBase = null; + #region Events/Delegates // public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); @@ -67,6 +69,11 @@ public delegate void ImportDelegate(); protected ImportDelegate importDelegate = null; + protected void Import_ReadNewFileEvent(object sender, FileReadEventArgs e) + { + this.SetGUIProgressDialog(e.message, e.ctr); + } + public virtual void OnImportFinished(object sender, EventArgs e) { if (ImportFinishedEvent != null) @@ -463,7 +470,16 @@ protected virtual void Import(bool mpGUIMode) { - //override + + + if (!File.Exists(this.Executable)) // no "mame.exe" + return; + + + importBase.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(Import_ReadNewFileEvent); + importDelegate = new ImportDelegate(importBase.StartImport); + importDelegate.BeginInvoke(new AsyncCallback(ImportEnded), null); + } #endregion protected methods Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -80,7 +80,6 @@ { Import(mpGuiMode); FixFileLinks(); - LoadFiles(); } protected override void Import(bool mpGUIMode) @@ -89,27 +88,14 @@ { ShowProgressDialog("Importing from folders.."); } - DirectoryImport directoryImport = null; - if (!File.Exists(this.Executable)) // no "mame.exe" - return; - ValidExtensions = ValidExtensions.Replace(" ", ""); - + importBase = new DirectoryImport(this); + base.Import(mpGUIMode); + } - directoryImport = new DirectoryImport(this); - directoryImport.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(directoryImport_ReadNewFileEvent); - importDelegate = new ImportDelegate(directoryImport.StartImport); - importDelegate.BeginInvoke(new AsyncCallback(ImportEnded), null); - - - #endregion ApplicationItem Overloads - } - - void directoryImport_ReadNewFileEvent(object sender, FileReadEventArgs e) - { - this.SetGUIProgressDialog(e.message, e.ctr); - } + #endregion ApplicationItem Overloads + } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -60,35 +60,25 @@ if ((ApplicationItemSource == "") || (!File.Exists(ApplicationItemSource))) return; - GamebaseImport gameBaseImport = null; if (mpGUIMode) { ShowProgressDialog("Importing from gameBase.."); } - if (!File.Exists(this.Executable)) // no "mame.exe" - return; + importBase = new GamebaseImport(this); + base.Import(mpGUIMode); - gameBaseImport = new GamebaseImport(this); - gameBaseImport.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(gameBaseImport_ReadNewFileEvent); - importDelegate = new ImportDelegate(gameBaseImport.StartImport); - importDelegate.BeginInvoke(new AsyncCallback(ImportEnded), null); - } - void gameBaseImport_ReadNewFileEvent(object sender, FileReadEventArgs e) - { - this.SetGUIProgressDialog(e.message, e.ctr); - } + public override void Refresh(bool bGUIMode) { DeleteFiles(); Import(bGUIMode); FixFileLinks(); - LoadFiles(); } #endregion ApplicationItem Overloads } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-04 08:54:30 UTC (rev 892) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-04 18:53:33 UTC (rev 893) @@ -103,31 +103,20 @@ DeleteFiles(); Import(bGUIMode); FixFileLinks(); - LoadFiles(); } protected override void Import(bool mpGUIMode) { - if (!File.Exists(this.Executable)) // no "mame.exe" - return; - MameImport mameImport = null; - if (mpGUIMode) { - ShowProgressDialog("Importing Mameitems.."); + ShowProgressDialog("Importing from mame.."); } - mameImport = new MameImport(this); - mameImport.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(mameImport_OnReadNewFileEvent); - importDelegate = new ImportDelegate(mameImport.StartImport); - importDelegate.BeginInvoke(new AsyncCallback(ImportEnded),null); + importBase = new MameImport(this); + base.Import(mpGUIMode); } - void mameImport_OnReadNewFileEvent(object sender,FileReadEventArgs e) - { - this.SetGUIProgressDialog(e.message, e.ctr); - } #endregion ApplicationItem Overloads } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-09-16 10:46:01
|
Revision: 931 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=931&view=rev Author: northern_sky Date: 2007-09-16 03:45:58 -0700 (Sun, 16 Sep 2007) Log Message: ----------- Bugfixes: importfixes, ValidateEntries fixes, etc Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltPreconfiguration.xml Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -107,7 +107,7 @@ } } - private void RefreshInfo(string informationMessage, int progressBarCtr) + public void RefreshInfo(string informationMessage, int progressBarCtr) { progressTextBox.Text = informationMessage; progressBar.Value = progressBarCtr; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -74,6 +74,7 @@ public AppSettingsFilesView() { + InitializeComponent(); } @@ -100,13 +101,18 @@ public void Refresh(ApplicationItem curApp) { if (curApp == null) return; + currentApplicationItem = curApp; - currentApplicationItem = curApp; + + if (!currentApplicationItem.filesAreLoaded) { currentApplicationItem.LoadFiles(); } SyncListView(); + SetupFileView(); + SyncListViewButtons(); + SetFileSettingsTextBoxes(); } private void SyncListView() @@ -147,9 +153,7 @@ { fileListView.EndUpdate(); } - SetupFileView(); - SyncListViewButtons(); - SetFileSettingsTextBoxes(); + } private void SyncListViewButtons() @@ -238,6 +242,9 @@ fileItem.Write(); currentApplicationItem.LoadFiles(); SyncListView(); + SetupFileView(); + SyncListViewButtons(); + SetFileSettingsTextBoxes(); } } @@ -258,6 +265,9 @@ fileItem.Write(); currentApplicationItem.LoadFiles(); SyncListView(); + SetupFileView(); + SyncListViewButtons(); + SetFileSettingsTextBoxes(); } } } @@ -311,6 +321,9 @@ } currentApplicationItem.LoadFiles(); SyncListView(); + SetupFileView(); + SyncListViewButtons(); + SetFileSettingsTextBoxes(); } private void SetEnabledComponents(bool enabled) @@ -466,6 +479,9 @@ frmScraper.Setup(); frmScraper.ShowDialog(this); SyncListView(); + SetupFileView(); + SyncListViewButtons(); + SetFileSettingsTextBoxes(); } else { @@ -478,15 +494,8 @@ if (this.OnRefreshClick != null) { updateDatabaseButton.Enabled = false; - try - { - OnRefreshClick(this, null); - } - finally - { - SyncListView(); - updateDatabaseButton.Enabled = true; - } + currentApplicationItem.ImportFinishedEvent += new ApplicationItem.ImportFinishedEventHandler(currentApplicationItem_ImportFinishedEvent); + OnRefreshClick(this, null); } } @@ -677,6 +686,8 @@ if (currentApplicationItem != null) { + + //fill import options if ((currentApplicationItem.ImportOptionList != null) && (currentApplicationItem.ImportOptionList.Count > 0)) { @@ -733,6 +744,15 @@ } } + void currentApplicationItem_ImportFinishedEvent(object sender, EventArgs e) + { + currentApplicationItem.LoadFiles(); + SyncListView(); + updateDatabaseButton.Enabled = true; + currentApplicationItem.ImportFinishedEvent -= new ApplicationItem.ImportFinishedEventHandler(currentApplicationItem_ImportFinishedEvent); + + } + private void SetUpFileSettingsBoxButtonEvents() { foreach (FileSettingsBox fileSettingBox in filesettingsPanel.Controls) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsBase.Designer.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -239,7 +239,7 @@ // // informationLabel // - this.informationLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.informationLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 19F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.informationLabel.Location = new System.Drawing.Point(4, 6); this.informationLabel.Name = "informationLabel"; this.informationLabel.Size = new System.Drawing.Size(396, 57); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsDirCache.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -31,6 +31,7 @@ using System.Drawing; using System.Text; using System.Windows.Forms; +using System.IO; using GUIProgramsAlt; using GUIProgramsAlt.Items; @@ -85,9 +86,9 @@ { conditionChecker.Clear(); conditionChecker.DoCheck(titleTextBox.Text != "", "No title entered!"); - if (applicationExeTextBox.Text == "") + if ((!File.Exists(applicationExeTextBox.Text) && (!this.shellexecuteCheckBox.Checked))) { - conditionChecker.DoCheck(shellexecuteCheckBox.Checked, "No launching filename entered!"); + conditionChecker.DoCheck(shellexecuteCheckBox.Checked, "No valid launching executable entered!"); } if (!conditionChecker.IsOk) @@ -104,14 +105,17 @@ public override void LoadFromAppItem(ApplicationItem applicationItem) { + informationLabel.Text = applicationItem.Title; titleTextBox.Text = applicationItem.Title; applicationExeTextBox.Text = applicationItem.Executable; - + + applicationArgumentsTextBox.Text = applicationItem.Arguments; startupDirComboBox.Text = applicationItem.StartupDir; shellexecuteCheckBox.Checked = applicationItem.UseShellExecute; quoteCheckBox.Checked = applicationItem.UseQuotes; waitExitCheckBox.Checked = applicationItem.WaitForExit; + platformComboBox.SelectedValue = applicationItem.PlatformId; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -65,9 +65,9 @@ conditionChecker.DoCheck(titleTextBox.Text != "", "No title entered!"); - if (this.applicationExeTextBox.Text == "") + if (!File.Exists(applicationExeTextBox.Text)) { - conditionChecker.DoCheck(shellexecuteCheckBox.Checked, "No launching filename entered!"); + conditionChecker.DoCheck(shellexecuteCheckBox.Checked, "No valid mame.executable entered!"); } if (!conditionChecker.IsOk) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -51,7 +51,7 @@ this.titleTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.titleTextBox.Location = new System.Drawing.Point(88, 23); this.titleTextBox.Name = "titleTextBox"; - this.titleTextBox.Size = new System.Drawing.Size(316, 21); + this.titleTextBox.Size = new System.Drawing.Size(316, 20); this.titleTextBox.TabIndex = 46; // // titleLabel @@ -59,7 +59,7 @@ this.titleLabel.AutoSize = true; this.titleLabel.Location = new System.Drawing.Point(6, 28); this.titleLabel.Name = "titleLabel"; - this.titleLabel.Size = new System.Drawing.Size(31, 13); + this.titleLabel.Size = new System.Drawing.Size(30, 13); this.titleLabel.TabIndex = 45; this.titleLabel.Text = "Title:"; this.titleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -69,9 +69,9 @@ this.checkBoxUseThumbsDir.AutoSize = true; this.checkBoxUseThumbsDir.Location = new System.Drawing.Point(9, 20); this.checkBoxUseThumbsDir.Name = "checkBoxUseThumbsDir"; - this.checkBoxUseThumbsDir.Size = new System.Drawing.Size(129, 17); + this.checkBoxUseThumbsDir.Size = new System.Drawing.Size(182, 17); this.checkBoxUseThumbsDir.TabIndex = 44; - this.checkBoxUseThumbsDir.Text = "usw thumbs directory"; + this.checkBoxUseThumbsDir.Text = "Only use default thumbs directory"; this.checkBoxUseThumbsDir.UseVisualStyleBackColor = true; // // titleGroupBox @@ -128,7 +128,7 @@ this.sleepTimeLabel.AutoSize = true; this.sleepTimeLabel.Location = new System.Drawing.Point(6, 25); this.sleepTimeLabel.Name = "sleepTimeLabel"; - this.sleepTimeLabel.Size = new System.Drawing.Size(68, 13); + this.sleepTimeLabel.Size = new System.Drawing.Size(66, 13); this.sleepTimeLabel.TabIndex = 2; this.sleepTimeLabel.Text = "Time (in ms):"; // @@ -159,7 +159,7 @@ 0, 0}); this.sleepTimeNumericUpDown.Name = "sleepTimeNumericUpDown"; - this.sleepTimeNumericUpDown.Size = new System.Drawing.Size(316, 21); + this.sleepTimeNumericUpDown.Size = new System.Drawing.Size(316, 20); this.sleepTimeNumericUpDown.TabIndex = 0; this.sleepTimeNumericUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.sleepTimeNumericUpDown.Value = new decimal(new int[] { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -28,7 +28,7 @@ /// </summary> private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Applications"); + System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Applications"); this.menuStrip = new System.Windows.Forms.MenuStrip(); this.addDeleteApplicationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -178,10 +178,10 @@ this.treeView.LabelEdit = true; this.treeView.Location = new System.Drawing.Point(0, 27); this.treeView.Name = "treeView"; - treeNode1.Name = "applicationNode"; - treeNode1.Text = "Applications"; + treeNode2.Name = "applicationNode"; + treeNode2.Text = "Applications"; this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode1}); + treeNode2}); this.treeView.Size = new System.Drawing.Size(224, 586); this.treeView.TabIndex = 8; this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); @@ -206,9 +206,10 @@ this.tabControl.ShowToolTips = true; this.tabControl.Size = new System.Drawing.Size(517, 586); this.tabControl.TabIndex = 2; + this.tabControl.Click += new System.EventHandler(this.dbOptionsTabPage_Click); this.tabControl.Deselecting += new System.Windows.Forms.TabControlCancelEventHandler(this.tabControl_Deselecting); - // + // // detailsTabPage // this.detailsTabPage.BackColor = System.Drawing.SystemColors.Control; @@ -225,7 +226,7 @@ this.directoryTabPage.Location = new System.Drawing.Point(4, 22); this.directoryTabPage.Name = "directoryTabPage"; this.directoryTabPage.Padding = new System.Windows.Forms.Padding(3); - this.directoryTabPage.Size = new System.Drawing.Size(497, 551); + this.directoryTabPage.Size = new System.Drawing.Size(509, 560); this.directoryTabPage.TabIndex = 1; this.directoryTabPage.Text = "Files"; // @@ -235,7 +236,7 @@ this.viewTabPage.Location = new System.Drawing.Point(4, 22); this.viewTabPage.Name = "viewTabPage"; this.viewTabPage.Padding = new System.Windows.Forms.Padding(3); - this.viewTabPage.Size = new System.Drawing.Size(497, 551); + this.viewTabPage.Size = new System.Drawing.Size(509, 560); this.viewTabPage.TabIndex = 2; this.viewTabPage.Text = "Views"; // @@ -245,7 +246,7 @@ this.dbOptionsTabPage.Location = new System.Drawing.Point(4, 22); this.dbOptionsTabPage.Name = "dbOptionsTabPage"; this.dbOptionsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.dbOptionsTabPage.Size = new System.Drawing.Size(497, 551); + this.dbOptionsTabPage.Size = new System.Drawing.Size(509, 560); this.dbOptionsTabPage.TabIndex = 3; this.dbOptionsTabPage.Text = "DB options"; this.dbOptionsTabPage.UseVisualStyleBackColor = true; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -17,6 +17,7 @@ using GUIProgramsAlt.Database; using GUIProgramsAlt; using GUIProgramsAlt.Items; +using GUIProgramsAlt.Imports; #endregion @@ -59,6 +60,7 @@ appSettingsFileEditView.OnRefreshClick += new EventHandler(this.RefreshClick); //when imagefolder was clicked on filesview... appSettingsFileEditView.OnImageFolderSearch += new EventHandler(this.ImageSearchClick); + } #endregion @@ -335,6 +337,7 @@ { this.tabControl.TabPages["directoryTabPage"].Controls.Clear(); this.tabControl.TabPages["directoryTabPage"].Controls.Add(filesProgress); + } @@ -608,7 +611,7 @@ ApplicationItemDirectoryCache tempApp = new ApplicationItemDirectoryCache(); tempApp.LoadFromXmlProfile(node); appSettingsPage.LoadFromAppItem(tempApp); - // appSettingsFileEditView.FileExtensionsText = tempApp.ValidExtensions; + appSettingsFileEditView.FileExtensionsText = tempApp.ValidExtensions; } } @@ -923,6 +926,7 @@ { bool DoIt = false; ApplicationItem currentApplication = GetTreeNodeApplicationItem(treeView.SelectedNode); + if (currentApplication != null) { if (currentApplication.ItemList.Count > 0) @@ -937,23 +941,31 @@ if (DoIt) { - try - { + AttachImportRunningView(); BlockControls(); appSettingsFileEditView.FillApplicationItem(currentApplication); + currentApplication.RefreshInfoEvent += new ApplicationItem.RefreshInfoEventHandler(currentApplication_RefreshInfoEvent); + currentApplication.ImportFinishedEvent += new ApplicationItem.ImportFinishedEventHandler(currentApplication_ImportFinishedEvent); + filesProgress.CurApp = currentApplication; filesProgress.RunImport(); - } - finally - { - AttachFilesView(); - UnblockControls(); - } + } } } + void currentApplication_RefreshInfoEvent(object sender, FileReadEventArgs e) + { + filesProgress.RefreshInfo(e.message, e.ctr); + } + + void currentApplication_ImportFinishedEvent(object sender, EventArgs e) + { + AttachFilesView(); + UnblockControls(); + } + private void RefreshClick(object sender, EventArgs e) { DoRefresh(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -66,6 +66,8 @@ private void ImportFile(string dirPath) { + + string[] validExtensionsArr = applicationItem.ValidExtensions.Split(';'); double total = 0; FileInfo fileInDir = null; if (Directory.Exists(dirPath)) @@ -81,30 +83,42 @@ if (allUnderLyingFiles[i] is FileInfo) { - Boolean FileExists = false; - + bool FileExists = false; + bool isValidExtension = false; fileInDir = (FileInfo)allUnderLyingFiles[i]; - for (int j = 0; j < applicationItem.ItemList.Count; j++) + + for (int z = 0; z < validExtensionsArr.Length;z++) { - FileItem fileItem = null; + if (validExtensionsArr[z].Equals(fileInDir.Extension)) + { + isValidExtension = true; + } + } + if (isValidExtension) + { + for (int j = 0; j < applicationItem.ItemList.Count; j++) + { + FileItem fileItem = null; - if (applicationItem.ItemList[j] is FileItem) + if (applicationItem.ItemList[j] is FileItem) + { + fileItem = (FileItem)applicationItem.ItemList[j]; + if (fileItem.Filename == fileInDir.FullName) + { + + FileExists = true; + break;//ugly + } + } + } + if (!FileExists) { - fileItem = (FileItem)applicationItem.ItemList[j]; - if(fileItem.Filename == fileInDir.FullName) - { - FileExists = true; - break;//ugly - } + ImportFileItem(fileInDir); + //UpdateProgressDialog(fileInDir, mpGuiMode); } } - if (!FileExists) - { - ImportFileItem(fileInDir); - //UpdateProgressDialog(fileInDir, mpGuiMode); - } }//if dir found,, recurse else if (allUnderLyingFiles[i] is DirectoryInfo) { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-16 10:45:58 UTC (rev 931) @@ -60,7 +60,7 @@ // event: read new file public delegate void RefreshInfoEventHandler(object sender ,FileReadEventArgs e) ; - public event RefreshInfoEventHandler OnRefreshInfoEvent = null; + public event RefreshInfoEventHandler RefreshInfoEvent = null; public delegate void ImportFinishedEventHandler(object sender,EventArgs e); @@ -72,6 +72,12 @@ protected void Import_ReadNewFileEvent(object sender, FileReadEventArgs e) { this.SetGUIProgressDialog(e.message, e.ctr); + + if (RefreshInfoEvent != null) + { + RefreshInfoEvent(this, e); + } + } public virtual void OnImportFinished(object sender, EventArgs e) @@ -94,7 +100,7 @@ { progressDialog.Close(); progressDialog.ShowWaitCursor = false; - + } } @@ -386,19 +392,26 @@ public void SetGUIProgressDialog(string informationMessage, int progressBarCtr) { - + //mpgui if (progressDialog != null) { - + progressDialog.ShowProgressBar(true); progressDialog.ShowWaitCursor = true; progressDialog.SetLine(2, String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage)); // "last imported file {0}" progressDialog.SetPercentage(progressBarCtr); progressDialog.Progress(); - - + + } + else + { + + + + + } // SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage), progressBarCtr); } @@ -470,11 +483,6 @@ protected virtual void Import(bool mpGUIMode) { - - - if (!File.Exists(this.Executable)) // no "mame.exe" - return; - importBase.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(Import_ReadNewFileEvent); importDelegate = new ImportDelegate(importBase.StartImport); @@ -754,6 +762,18 @@ { this.ValidExtensions = fileExtensioneNode.InnerText; } + + XmlNode platformNode = node.SelectSingleNode("platform"); + if (platformNode != null) + { + this.PlatformId = dbHandlerInstance.LexiconDataExists("tblPlatform", "platform", platformNode.InnerText); + + } + else + { + PlatformId = 1; + + } } #endregion Public Methods Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltPreconfiguration.xml =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltPreconfiguration.xml 2007-09-16 07:51:59 UTC (rev 930) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/MetaData/myProgramsAltPreconfiguration.xml 2007-09-16 10:45:58 UTC (rev 931) @@ -79,7 +79,7 @@ </profile> <profile id="60"> <section>Emulator Profiles</section> - <title>Kega Fusion (for Sega Master System)</title> + <title>Kega Fusion (Sega Master System)</title> <launchingApplication>...yourKEGApathhere...\fusion.exe</launchingApplication> <useShellExecute>F</useShellExecute> <arguments>%FILE% -sms -fullscreen</arguments> @@ -87,6 +87,7 @@ <startupDir>%FILEDIR%</startupDir> <useQuotes>T</useQuotes> <fileextensions>.sms</fileextensions> + <platform>Sega Master System</platform> </profile> <profile id="170"> <section>Emulator Profiles</section> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-09-23 11:09:42
|
Revision: 953 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=953&view=rev Author: northern_sky Date: 2007-09-23 04:09:35 -0700 (Sun, 23 Sep 2007) Log Message: ----------- made catver,historydat selectable from fileoptions Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseHandler.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -501,7 +501,10 @@ platformId INTEGER, waitForExit BOOL, preLaunch TEXT, - postLaunch TEXT + postLaunch TEXT, + mameCatVerIniPath TEXT, + mameHistoryDatPath TEXT + )"; ExecuteStmtNonQuery(sqlStmt); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -52,6 +52,8 @@ TextBox imageDirsTextBox = null; TextBox gamebaseDBTextBox = null; TextBox fileExtensionsTextBox = null; + TextBox mameHistoryDatTextBox = null; + TextBox mameCatverTextBox = null; @@ -218,6 +220,14 @@ { gamebaseDBTextBox.Text = currentApplicationItem.ApplicationItemSource; } + if (mameHistoryDatTextBox != null) + { + mameHistoryDatTextBox.Text = currentApplicationItem.mameHistoryDatPath; + } + if (mameCatverTextBox != null) + { + mameCatverTextBox.Text = currentApplicationItem.mameCatVerIniPath; + } //filePathsLabel.Text = currentApplicationItem.CurrentFilePath().Replace("&", "&&"); } @@ -624,15 +634,19 @@ applicationItem.ValidExtensions = (fileExtensionsTextBox == null) ? "" : fileExtensionsTextBox.Text; applicationItem.ApplicationItemSource = (gamebaseDBTextBox == null) ? "" : gamebaseDBTextBox.Text; + applicationItem.ImportValidImagesOnly = IsItemChecked(ImportOptionToString(ImportOption.OnlyImportValidImages)); if ((currentApplicationItem is ApplicationItemMame)) { - ((ApplicationItemMame)applicationItem).ImportOriginalsOnly = IsItemChecked(ImportOptionToString(ImportOption.OnlyImportOriginals)); - applicationItem.ImportMameMahjong = IsItemChecked(ImportOptionToString(ImportOption.ImportMahjongGames)); - applicationItem.ImportMamePlaychoice10 = IsItemChecked(ImportOptionToString(ImportOption.ImportPlaychoiceGames)); + ApplicationItemMame applicationItemMame = (ApplicationItemMame)applicationItem; + applicationItemMame.ImportOriginalsOnly = IsItemChecked(ImportOptionToString(ImportOption.OnlyImportOriginals)); + applicationItemMame.ImportMameMahjong = IsItemChecked(ImportOptionToString(ImportOption.ImportMahjongGames)); + applicationItemMame.ImportMamePlaychoice10 = IsItemChecked(ImportOptionToString(ImportOption.ImportPlaychoiceGames)); + applicationItemMame.mameCatVerIniPath = (mameCatverTextBox == null) ? "" : mameCatverTextBox.Text; + applicationItemMame.mameHistoryDatPath = (mameHistoryDatTextBox == null) ? "" : mameHistoryDatTextBox.Text; } @@ -672,6 +686,22 @@ } + protected void selectFileButton_Click(object sender, EventArgs e) + { + FileSettingsBox fileSettingsBox =(FileSettingsBox) ((Button)sender).Parent; + + if (fileSettingsBox.TextBox.Text != "") + { + openFileDialog.FileName = fileSettingsBox.TextBox.Text; + } + if (openFileDialog.ShowDialog(null) == DialogResult.OK) + { + fileSettingsBox.TextBox.Text = openFileDialog.FileName; + } + + } + + protected void fileExtensionsbutton_Click(object sender, EventArgs e) { fileExtensionsTextBox.Text = ProgramUtils.GetAvailableExtensions(this.fileDirTextBox.Text); @@ -775,6 +805,14 @@ imageDirsTextBox = fileSettingBox.TextBox; fileSettingBox.Button.Click += new EventHandler(this.imageDirButton_Click); break; + case "CatVer.ini" + "Button": + mameCatverTextBox = fileSettingBox.TextBox; + fileSettingBox.Button.Click += new EventHandler(this.selectFileButton_Click); + break; + case "History.dat" + "Button": + mameHistoryDatTextBox = fileSettingBox.TextBox; + fileSettingBox.Button.Click += new EventHandler(this.selectFileButton_Click); + break; default: break; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.Designer.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -67,7 +67,7 @@ this.Controls.Add(this.Label); this.Controls.Add(this.Button); this.Name = "FileSettingsBox"; - this.Size = new System.Drawing.Size(475, 30); + this.Size = new System.Drawing.Size(462, 30); this.ResumeLayout(false); this.PerformLayout(); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileSettingsBox.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -38,6 +38,10 @@ return "Gamebase DB"; case FileSettingOption.ImageDirectoryPaths: return "Imagefolder(s)"; + case FileSettingOption.MameCategoryData: + return "CatVer.ini"; + case FileSettingOption.MameHistoryData: + return "History.dat"; default: return ""; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/MameImport.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -61,6 +61,7 @@ string mameDir; string catverIniFile; string historyDatFile; + private ApplicationItemMame applicationItemMame; Dictionary<string, MameHistoryContainer> romHistoryDictionary = new Dictionary<string, MameHistoryContainer>(); @@ -72,7 +73,7 @@ public MameImport(ApplicationItem applicationItem) { - this.applicationItem = applicationItem; + this.applicationItemMame =(ApplicationItemMame) applicationItem; } void ReadListFull() @@ -80,11 +81,11 @@ fullRomListDictionary.Clear(); string line = string.Empty; - OnReadNewFileEvent(this,new FileReadEventArgs(10,"generating mame list (full)")); + OnReadNewFileEvent(this, new FileReadEventArgs(10, "generating mame list (full)")); using (Process process = new Process()) { - ProcessStartInfo processStartInfo = new ProcessStartInfo(applicationItem.Executable); + ProcessStartInfo processStartInfo = new ProcessStartInfo(applicationItemMame.Executable); processStartInfo.Arguments = "-listfull"; processStartInfo.UseShellExecute = false; processStartInfo.RedirectStandardOutput = true; @@ -111,13 +112,13 @@ void ReadListClones() { string line; - if (((ApplicationItemMame)applicationItem).ImportOriginalsOnly) + if (applicationItemMame.ImportOriginalsOnly) { - OnReadNewFileEvent(this,new FileReadEventArgs(20,"generating mame list (clones)")); + OnReadNewFileEvent(this, new FileReadEventArgs(20, "generating mame list (clones)")); using (Process process = new Process()) { - ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(applicationItem.Executable); + ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(applicationItemMame.Executable); myProcessStartInfo.Arguments = "-listclones"; myProcessStartInfo.UseShellExecute = false; myProcessStartInfo.RedirectStandardOutput = true; @@ -233,29 +234,29 @@ { char separator = ';'; conditionChecker.Clear(); - string[] fileDirs = applicationItem.FileDirectory.Split(separator); + string[] fileDirs = applicationItemMame.FileDirectory.Split(separator); - if (conditionChecker.DoCheck(System.IO.File.Exists(applicationItem.Executable), "mame-application not found!")) + if (conditionChecker.DoCheck(System.IO.File.Exists(applicationItemMame.Executable), "mame-application not found!")) { - mameDir = Path.GetDirectoryName(applicationItem.Executable); - catverIniFile = mameDir + "\\catver.ini"; - historyDatFile = mameDir + "\\history.dat"; + mameDir = Path.GetDirectoryName(applicationItemMame.Executable); + catverIniFile = applicationItemMame.mameCatVerIniPath; + historyDatFile = applicationItemMame.mameHistoryDatPath; } if (conditionChecker.IsOk) { - OnReadNewFileEvent(this,new FileReadEventArgs(0,"Generating lists...")); + OnReadNewFileEvent(this, new FileReadEventArgs(0, "Generating lists...")); ReadListFull(); - OnReadNewFileEvent(this,new FileReadEventArgs(0,"Generating lists.....")); + OnReadNewFileEvent(this, new FileReadEventArgs(0, "Generating lists.....")); ReadListClones(); if (System.IO.File.Exists(catverIniFile)) { - OnReadNewFileEvent(this,new FileReadEventArgs(0,"Reading catver.ini.......")); + OnReadNewFileEvent(this, new FileReadEventArgs(0, "Reading catver.ini.......")); ReadCatverIni(); } if (System.IO.File.Exists(historyDatFile)) { - OnReadNewFileEvent(this,new FileReadEventArgs(0,"Reading history.dat............")); + OnReadNewFileEvent(this, new FileReadEventArgs(0, "Reading history.dat............")); ReadHistoryDat(); } @@ -263,10 +264,18 @@ { for (int i = 0; i < fileDirs.Length; i++) { - string[] tmp = System.IO.Directory.GetFiles(fileDirs[i], "*.zip"); - for (int x = 0; x < tmp.Length; x++) + + string[] validExtensionsArr = applicationItemMame.ValidExtensions.Split(';'); + + for (int z = 0; z < validExtensionsArr.Length; z++) { - localRomNames.Add(tmp[x]); + + string[] tmp = System.IO.Directory.GetFiles(fileDirs[i],"*"+ validExtensionsArr[z]); + for (int x = 0; x < tmp.Length; x++) + { + localRomNames.Add(tmp[x]); + } + } } } @@ -279,7 +288,7 @@ { if (!CheckPrerequisites()) { - OnReadNewFileEvent(this,new FileReadEventArgs(0,conditionChecker.Problems)); + OnReadNewFileEvent(this, new FileReadEventArgs(0, conditionChecker.Problems)); Log.Info("MameImporter: import failed! Details: {0}", conditionChecker.Problems); return; } @@ -297,7 +306,7 @@ transaction.Commit(); } - OnReadNewFileEvent(this,new FileReadEventArgs(100,"Import done...................")); + OnReadNewFileEvent(this, new FileReadEventArgs(100, "Import done...................")); } @@ -328,9 +337,9 @@ string fullEntry = ""; string genreEntry = ""; string versionEntry = ""; - bool onlyOriginals = ((ApplicationItemMame)applicationItem).ImportOriginalsOnly; - bool importMahjongGames = applicationItem.ImportMameMahjong; - bool importPlaychoiceGames = applicationItem.ImportMamePlaychoice10; + bool onlyOriginals = applicationItemMame.ImportOriginalsOnly; + bool importMahjongGames = applicationItemMame.ImportMameMahjong; + bool importPlaychoiceGames = applicationItemMame.ImportMamePlaychoice10; bool shouldImport = true; MameHistoryContainer mameHistoryNode = null; @@ -341,13 +350,13 @@ { FileItem curFile = new FileItem(); - curFile.ApplicationItemId = applicationItem.ApplicationItemId; + curFile.ApplicationItemId = applicationItemMame.ApplicationItemId; curFile.Filename = fullRomname; - curFile.Imagefile = ImportImageFiles(curFile.Filename, curFile.Title, applicationItem); + curFile.Imagefile = ImportImageFiles(curFile.Filename, curFile.Title, applicationItemMame); - if ((curFile.Imagefile == "") && (applicationItem.ImportValidImagesOnly)) + if ((curFile.Imagefile == "") && (applicationItemMame.ImportValidImagesOnly)) { - OnReadNewFileEvent(this,new FileReadEventArgs( (int)(100 * (((double)count) / total)),"")); + OnReadNewFileEvent(this, new FileReadEventArgs((int)(100 * (((double)count) / total)), "")); return; } if (this.fullRomListDictionary.ContainsKey(curRomname)) @@ -403,7 +412,7 @@ curFile.Write(); // OnReadNewFileEvent(curFile.Title, count, localRomNames.Length); - OnReadNewFileEvent(this,new FileReadEventArgs((int)(100 * (((double)count) / total)),curFile.Title) ); + OnReadNewFileEvent(this, new FileReadEventArgs((int)(100 * (((double)count) / total)), curFile.Title)); } } @@ -411,7 +420,7 @@ } else { - OnReadNewFileEvent(this,new FileReadEventArgs((int)(100 * (((double)count) / total)),"") ); + OnReadNewFileEvent(this, new FileReadEventArgs((int)(100 * (((double)count) / total)), "")); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -139,6 +139,8 @@ public bool linksAreLoaded = false; // load on demand.... bool importMamePlaychoice10 = false; bool importMameMahjong = false; + public string mameCatVerIniPath = ""; + public string mameHistoryDatPath = ""; bool refreshGUIAllowed = false; ItemType itemType; @@ -799,7 +801,7 @@ private void Insert() { - SQLiteParameter[] parameterArray = new SQLiteParameter[23]; + SQLiteParameter[] parameterArray = new SQLiteParameter[25]; ApplicationItemId = GetNewAppID(); // important to avoid subsequent inserts! //params for question + values parameterArray[0] = dbHandlerInstance.GetParameter<int>(ApplicationItemId, "@applicationItemId", DbType.Int32); @@ -825,6 +827,8 @@ parameterArray[20] = dbHandlerInstance.GetParameter<bool>(WaitForExit, "@waitForExit", DbType.Boolean); parameterArray[21] = dbHandlerInstance.GetParameter<string>(PreLaunch, "@preLaunch", DbType.String); parameterArray[22] = dbHandlerInstance.GetParameter<string>(PostLaunch, "@postLaunch", DbType.String); + parameterArray[23] = dbHandlerInstance.GetParameter<string>(mameCatVerIniPath, "@mameCatVerIniPath", DbType.String); + parameterArray[24] = dbHandlerInstance.GetParameter<string>(mameHistoryDatPath, "@mameHistoryDatPath", DbType.String); try { @@ -855,7 +859,9 @@ platformId, waitForExit, preLaunch, - postLaunch + postLaunch, + mameCatVerIniPath, + mameHistoryDatPath ) VALUES ( @@ -881,7 +887,9 @@ @platformId, @waitForExit, @preLaunch, - @postLaunch + @postLaunch, + @mameCatVerIniPath, + @mameHistoryDatPath )"; dbHandlerInstance.ExecuteStmtNonQuery(sqlStmt, parameterArray); @@ -897,7 +905,7 @@ if (ApplicationItemId == -1) return; - SQLiteParameter[] parameterArray = new SQLiteParameter[23]; + SQLiteParameter[] parameterArray = new SQLiteParameter[25]; //params for question + values parameterArray[0] = dbHandlerInstance.GetParameter<int>(ApplicationItemId, "@applicationItemId", DbType.Int32); @@ -923,6 +931,8 @@ parameterArray[20] = dbHandlerInstance.GetParameter<bool>(WaitForExit, "@waitForExit", DbType.Boolean); parameterArray[21] = dbHandlerInstance.GetParameter<string>(PreLaunch, "@preLaunch", DbType.String); parameterArray[22] = dbHandlerInstance.GetParameter<string>(PostLaunch, "@postLaunch", DbType.String); + parameterArray[23] = dbHandlerInstance.GetParameter<string>(mameCatVerIniPath, "@mameCatVerIniPath", DbType.String); + parameterArray[24] = dbHandlerInstance.GetParameter<string>(mameHistoryDatPath, "@mameHistoryDatPath", DbType.String); try { @@ -951,7 +961,9 @@ platformId = @platformId, waitForExit = @waitForExit, preLaunch = @preLaunch, - postLaunch = @postLaunch + postLaunch = @postLaunch, + mameCatVerIniPath = @mameCatVerIniPath, + mameHistoryDatPath = @mameHistoryDatPath WHERE applicationId = @applicationItemId"; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -127,6 +127,8 @@ item.WaitForExit =(bool) dataReader["waitforexit"]; item.PreLaunch = (string) dataReader["preLaunch"]; item.PostLaunch =(string) dataReader["postLaunch"]; + item.mameCatVerIniPath = (string)dataReader["mameCatVerIniPath"]; + item.mameHistoryDatPath = (string)dataReader["mameHistoryDatPath"]; } return item; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -51,6 +51,7 @@ bool importOriginalsOnly = true; + #endregion Variables public ApplicationItemMame() @@ -71,6 +72,8 @@ FileSettingList.Add(FileSettingOption.FileDirectoryPaths); FileSettingList.Add(FileSettingOption.FileExtensionPaths); FileSettingList.Add(FileSettingOption.ImageDirectoryPaths); + FileSettingList.Add(FileSettingOption.MameCategoryData); + FileSettingList.Add(FileSettingOption.MameHistoryData); ImportOptionList = new List<ImportOption>(); ImportOptionList.Add(ImportOption.ImportMahjongGames); @@ -89,7 +92,7 @@ #endregion Public Methods - #region ApplicationItem Overloads + #region ApplicationItem Overloads public override string CurrentFilePath() { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-09-23 05:14:40 UTC (rev 952) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-09-23 11:09:35 UTC (rev 953) @@ -111,6 +111,8 @@ FileExtensionPaths = 1, ImageDirectoryPaths = 2, GameBaseDBPath = 3, + MameCategoryData = 4, + MameHistoryData = 5, } #endregion This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-09-24 19:21:06
|
Revision: 955 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=955&view=rev Author: northern_sky Date: 2007-09-24 12:20:56 -0700 (Mon, 24 Sep 2007) Log Message: ----------- recurse extensions fixed Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ClassDiagram1.cd trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ClassDiagram1.cd =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ClassDiagram1.cd 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ClassDiagram1.cd 2007-09-24 19:20:56 UTC (rev 955) @@ -8,7 +8,7 @@ <HashCode>AKIYAABCAAEaMAEwAAAAAAAAAFlAAAEACEACAABEoAA=</HashCode> </TypeIdentifier> </Class> - <Class Name="GUIProgramsAlt.Design.AppSettingsFilesImportProgress" Collapsed="true"> + <Class Name="GUIProgramsAlt.Design.AppSettingsFilesImportProgress"> <Position X="3" Y="3.5" Width="1.5" /> <TypeIdentifier> <FileName>Design\AppFilesImportProgress.cs</FileName> @@ -19,7 +19,7 @@ <Position X="16.25" Y="0.5" Width="1.5" /> <TypeIdentifier> <FileName>Design\AppFilesView.cs</FileName> - <HashCode>oAANBAJFSCBB8ECgSJCCQIRigVMQACQBQmSUgUQRCNE=</HashCode> + <HashCode>oAANBAJFSCBB8ECgSJCCQIZigVMQAjQBQmSUwUQRCNE=</HashCode> </TypeIdentifier> </Class> <Class Name="GUIProgramsAlt.Design.AppSettingsBase" Collapsed="true"> @@ -103,14 +103,14 @@ <Position X="18" Y="3.5" Width="1.5" /> <TypeIdentifier> <FileName>Design\SetupForm.cs</FileName> - <HashCode>xqnowBGYG3JKfJwlBOCIEETiVZM6QmVoVEie0NAzAXM=</HashCode> + <HashCode>xqnowBGYG3JKfJwlBOKIEETiVZM6QmVoVEie0NAzAXM=</HashCode> </TypeIdentifier> </Class> <Class Name="GUIProgramsAlt.GUIProgramsAlt" Collapsed="true" BaseTypeListCollapsed="true"> <Position X="21.5" Y="1.5" Width="1.5" /> <TypeIdentifier> <FileName>GUIProgramsAlt.cs</FileName> - <HashCode>IPJEILBSQgAlAIR4ggEgCBMAAQBFb0FBKFGCZhAAZSg=</HashCode> + <HashCode>IPJEILBSQgAlAIR4ggEgCAMAAQBFb0FBKFGCZhAAZSg=</HashCode> </TypeIdentifier> <Lollipop Position="0.2" Collapsed="true" /> </Class> @@ -118,7 +118,7 @@ <Position X="14.5" Y="2.5" Width="1.5" /> <TypeIdentifier> <FileName>GUIProgramsAltFileInfo.cs</FileName> - <HashCode>AEQIAQEBggFRANBACAgRCAgMBUAIAEBBgACLYAYEBAA=</HashCode> + <HashCode>AAQIAQEBggFRANBACAgRCAgMBUAIAEBBiACLYAYEBAA=</HashCode> </TypeIdentifier> <Lollipop Position="0.2" Collapsed="true" /> </Class> @@ -183,14 +183,14 @@ <Position X="5" Y="8.75" Width="1.5" /> <TypeIdentifier> <FileName>Imports\MameImport.cs</FileName> - <HashCode>qACAgAEAGAAAEAABAAAEAAgCgAASABAAGwAQBIEAAAA=</HashCode> + <HashCode>qACAgAEAGAAAEAABAAAEAAgCgAASABAAGwAQFIEAAAA=</HashCode> </TypeIdentifier> </Class> <Class Name="GUIProgramsAlt.Items.ApplicationItem" Collapsed="true"> <Position X="3.75" Y="4.5" Width="1.5" /> <TypeIdentifier> <FileName>Items\ApplicationItem.cs</FileName> - <HashCode>hD6AAsRiQzNHIuPwpIiN4gIAmZcqBAkYqGVmCZkEpYA=</HashCode> + <HashCode>hD6AAsTiQjNHIuPwpIiN4gIEmZcqBAkYqGVmCZkEpYA=</HashCode> </TypeIdentifier> </Class> <Class Name="GUIProgramsAlt.Items.ApplicationItemDirectoryCache" Collapsed="true"> @@ -308,7 +308,7 @@ <Position X="14.5" Y="4.75" Width="1.5" /> <TypeIdentifier> <FileName>ProgramUtils.cs</FileName> - <HashCode>AAAAAAAAAgAAAAAAAACAAAAAAAAAAAAAAAAQAAIAAAA=</HashCode> + <HashCode>AAAAAAAAAgAAAAAAAACAAAAAQAAAAAAAAAAQAQIAAAA=</HashCode> </TypeIdentifier> </Enum> </ClassDiagram> \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-24 19:20:56 UTC (rev 955) @@ -704,7 +704,25 @@ protected void fileExtensionsbutton_Click(object sender, EventArgs e) { - fileExtensionsTextBox.Text = ProgramUtils.GetAvailableExtensions(this.fileDirTextBox.Text); + char separator = ';'; + string result = string.Empty; + List<string> tmpList = new List<string>(); + ProgramUtils.GetAvailableExtensions(this.fileDirTextBox.Text, tmpList); + + foreach (string ext in tmpList) + { + if (result == "") + { + result += ext; + } + else + { + result += separator + ext; + } + } + + + fileExtensionsTextBox.Text = result; } public void SetupFileView() Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppSettingsMame.Designer.cs 2007-09-24 19:20:56 UTC (rev 955) @@ -45,9 +45,13 @@ // // shellexecuteCheckBox // - this.toolTip.SetToolTip(this.shellexecuteCheckBox, "Enable this if you want to run a program that is associated with a specific fileItem-" + - "extension.\r\nYou can omit the \"Launching Application\" in this case."); + this.toolTip.SetToolTip(this.shellexecuteCheckBox, "Enable this if you want to run a program that is associated with a specific fileI" + + "tem-extension.\r\nYou can omit the \"Launching Application\" in this case."); // + // waitExitCheckBox + // + this.toolTip.SetToolTip(this.waitExitCheckBox, "If you want mediaportal to wait for exit while running application."); + // // applicationArgumentsLabel // this.toolTip.SetToolTip(this.applicationArgumentsLabel, "Optional arguments that are needed to launch the program \r\n\r\n(advanced hint: Use " + @@ -92,7 +96,7 @@ // historyDatLink // this.historyDatLink.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.historyDatLink.Location = new System.Drawing.Point(6, 61); + this.historyDatLink.Location = new System.Drawing.Point(6, 32); this.historyDatLink.Name = "historyDatLink"; this.historyDatLink.Size = new System.Drawing.Size(164, 16); this.historyDatLink.TabIndex = 81; @@ -104,7 +108,7 @@ // catverLink // this.catverLink.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.catverLink.Location = new System.Drawing.Point(6, 45); + this.catverLink.Location = new System.Drawing.Point(6, 16); this.catverLink.Name = "catverLink"; this.catverLink.Size = new System.Drawing.Size(150, 16); this.catverLink.TabIndex = 80; @@ -122,7 +126,6 @@ this.groupBox1.Size = new System.Drawing.Size(226, 87); this.groupBox1.TabIndex = 82; this.groupBox1.TabStop = false; - this.groupBox1.Text = "Add CATVER.INI and HISTORY.DAT in your mame.exe folder for full dataimport"; // // AppSettingsMame // Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-24 19:20:56 UTC (rev 955) @@ -95,13 +95,19 @@ { progressDialog.Close(); } + + OnImportFinished(this, null); + FixFileLinks(); + if (progressDialog != null) { progressDialog.Close(); progressDialog.ShowWaitCursor = false; } + + } #endregion Events/Delegates Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-24 19:20:56 UTC (rev 955) @@ -79,7 +79,6 @@ public override void Refresh(bool mpGuiMode) { Import(mpGuiMode); - FixFileLinks(); } protected override void Import(bool mpGUIMode) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-24 19:20:56 UTC (rev 955) @@ -78,7 +78,6 @@ { DeleteFiles(); Import(bGUIMode); - FixFileLinks(); } #endregion ApplicationItem Overloads } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-24 19:20:56 UTC (rev 955) @@ -105,7 +105,6 @@ { DeleteFiles(); Import(bGUIMode); - FixFileLinks(); } protected override void Import(bool mpGUIMode) @@ -115,7 +114,6 @@ { ShowProgressDialog("Importing from mame.."); } - importBase = new MameImport(this); base.Import(mpGUIMode); } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-09-24 13:59:44 UTC (rev 954) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-09-24 19:20:56 UTC (rev 955) @@ -314,53 +314,49 @@ GUIProgramsAlt.ThumbnailPath = ""; } - static public string GetAvailableExtensions(string curDirectory) + static public void GetAvailableExtensions(string curDirectory,List<string> extensionList) { char separator = ';'; string[] fileDirs = curDirectory.Split(separator); - List<string> extensionsList = new List<string>(); string extension = ""; - string result = ""; foreach (string dir in fileDirs) { + if (System.IO.Directory.Exists(dir)) { string[] fileEntries = System.IO.Directory.GetFiles(dir); if ((fileEntries != null) && (fileEntries.Length > 0)) { - - - foreach (string fileName in fileEntries) + foreach (string fileName in fileEntries) { extension = System.IO.Path.GetExtension(fileName).ToLower(); if (extension.Trim() == "") { extension = "."; // placeholder for "files without any extension } - if (!extensionsList.Contains(extension)) + if (!extensionList.Contains(extension)) { - extensionsList.Add(extension); + extensionList.Add(extension); } } } + //check if underdirs + string[] directorys = Directory.GetDirectories(dir); + if ((directorys != null) && (directorys.Length > 0)) + { + foreach (string dirName in directorys) + { + GetAvailableExtensions(dirName,extensionList); + } + } + } } - foreach (string ext in extensionsList) - { - if (result == "") - { - result += ext; - } - else - { - result += separator + ext; - } - } + - return result; } public class ListItem This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nor...@us...> - 2007-09-29 15:26:28
|
Revision: 963 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=963&view=rev Author: northern_sky Date: 2007-09-29 08:26:22 -0700 (Sat, 29 Sep 2007) Log Message: ----------- minor changes Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesImportProgress.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -95,7 +95,7 @@ { progressTextBox.Text = importStartedText; isImportRunning = true; - CurApp.Refresh(false); + CurApp.ReImport(false); } finally { Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/AppFilesView.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -316,7 +316,7 @@ FilelinkItem filelink = (FilelinkItem)listViewItem.Tag; if (filelink != null) { - filelink.Delete(); + filelink.DeleteFileItem(); } } else @@ -324,7 +324,7 @@ FileItem file = (FileItem)listViewItem.Tag; if (file != null) { - file.Delete(); + file.DeleteFileItem(); } } } @@ -603,17 +603,21 @@ { importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.OnlyImportValidImages)), true); } - if (applicationItem.ImportMameMahjong) + + + if (applicationItem is ApplicationItemMame) { - importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportMahjongGames)), true); + if (((ApplicationItemMame)applicationItem).ImportMamePlaychoice10) + { + importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportPlaychoiceGames)), true); + } - } - if (applicationItem.ImportMamePlaychoice10) - { - importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportPlaychoiceGames)), true); - } - if (applicationItem is ApplicationItemMame) - { + if (((ApplicationItemMame)applicationItem).ImportMameMahjong) + { + importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.ImportMahjongGames)), true); + + } + if (((ApplicationItemMame)applicationItem).ImportOriginalsOnly) { importOptionsCheckedListBox.SetItemChecked(importOptionsCheckedListBox.Items.IndexOf(ImportOptionToString(ImportOption.OnlyImportOriginals)), true); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -1014,7 +1014,7 @@ if (currentApplicationItem != null) { currentApplicationItem.ImportFinishedEvent += new ApplicationItem.ImportFinishedEventHandler(currentApplicationItem_ImportFinishedEvent); - currentApplicationItem.Refresh(true); + currentApplicationItem.ReImport(true); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Imports/DirectoryImport.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -57,7 +57,7 @@ fileItem = (FileItem) applicationItem.ItemList[i]; if (!File.Exists(fileItem.Filename)) { - fileItem.Delete(); + fileItem.DeleteFileItem(); } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItem.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -51,19 +51,19 @@ { public abstract class ApplicationItem { - protected ImportBase importBase = null; + protected ImportBase importBase = null; #region Events/Delegates - // public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); - // public event FilelinkLaunchEventHandler OnLaunchFilelink = null; + // public delegate void FilelinkLaunchEventHandler(FilelinkItem curLink, bool mpGuiMode); + // public event FilelinkLaunchEventHandler OnLaunchFilelink = null; // event: read new file - public delegate void RefreshInfoEventHandler(object sender ,FileReadEventArgs e) ; - public event RefreshInfoEventHandler RefreshInfoEvent = null; + public delegate void RefreshInfoEventHandler(object sender, FileReadEventArgs e); + public event RefreshInfoEventHandler RefreshInfoEvent = null; - public delegate void ImportFinishedEventHandler(object sender,EventArgs e); + public delegate void ImportFinishedEventHandler(object sender, EventArgs e); public event ImportFinishedEventHandler ImportFinishedEvent; public delegate void ImportDelegate(); @@ -77,37 +77,27 @@ { RefreshInfoEvent(this, e); } - + } public virtual void OnImportFinished(object sender, EventArgs e) { if (ImportFinishedEvent != null) { - ImportFinishedEvent(this,e); + ImportFinishedEvent(this, e); } } protected void ImportEnded(IAsyncResult result) { filesAreLoaded = false; - if (progressDialog != null) - { - progressDialog.Close(); - } - - - OnImportFinished(this, null); FixFileLinks(); - if (progressDialog != null) { progressDialog.Close(); progressDialog.ShowWaitCursor = false; - } - - + OnImportFinished(this, null); } #endregion Events/Delegates @@ -135,7 +125,6 @@ private List<ImportOption> importOptionList;//a list of options for the filesview private List<FileSettingOption> fileSettingList;//a list of which setting to use for filesview - bool enabled; int appPosition; string currentView = ""; @@ -143,8 +132,6 @@ public List<object> ItemList = new List<object>();//fileitems or links public bool filesAreLoaded = false; // load on demand.... public bool linksAreLoaded = false; // load on demand.... - bool importMamePlaychoice10 = false; - bool importMameMahjong = false; public string mameCatVerIniPath = ""; public string mameHistoryDatPath = ""; bool refreshGUIAllowed = false; @@ -155,7 +142,6 @@ string imageDirectories; // in one string for sqlite db field private string[] imageDirsSplitted; // imageDirectories splitted - string fileDirectory; string validExtensions; bool importValidImagesOnly; @@ -275,16 +261,6 @@ set { currentView = value; } } - public bool ImportMamePlaychoice10 - { - get { return importMamePlaychoice10; } - set { importMamePlaychoice10 = value; } - } - public bool ImportMameMahjong - { - get { return importMameMahjong; } - set { importMameMahjong = value; } - } // more Properties, maybe need some renaming or anything else public string FileDirectory @@ -292,14 +268,14 @@ get { return fileDirectory; } set { fileDirectory = value; } } - + public string ImageDirectory { get { return imageDirectories; } set { imageDirectories = value; - + //also do the split imageDirsSplitted = imageDirectories.Split(';'); for (int i = 0; i < imageDirsSplitted.Length; i++) @@ -355,7 +331,7 @@ public ApplicationItem() { - // .. init member variables ... + // .. init member variables ... appID = -1; fatherID = -1; title = ""; @@ -391,7 +367,7 @@ { progressDialog = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); progressDialog.SetHeading(headerText); - progressDialog.SetLine(0,headerText); + progressDialog.SetLine(0, headerText); progressDialog.SetLine(1, ""); progressDialog.SetLine(2, ""); progressDialog.StartModal(GetID); @@ -403,28 +379,17 @@ //mpgui if (progressDialog != null) { - progressDialog.ShowProgressBar(true); progressDialog.ShowWaitCursor = true; progressDialog.SetLine(2, String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage)); // "last imported file {0}" progressDialog.SetPercentage(progressBarCtr); progressDialog.Progress(); - - } - else - { - - - - - } - // SendRefreshInfo(String.Format("{0} {1}", GUILocalizeStrings.Get(13005), informationMessage), progressBarCtr); } - + protected void DoPreLaunch() { if (waitForExit && (preLaunch != "")) @@ -491,22 +456,17 @@ protected virtual void Import(bool mpGUIMode) { - + importBase.ReadNewFileEvent += new ImportBase.ReadNewFileEventHandler(Import_ReadNewFileEvent); importDelegate = new ImportDelegate(importBase.StartImport); importDelegate.BeginInvoke(new AsyncCallback(ImportEnded), null); - + } #endregion protected methods #region Public Methods - public virtual string CurrentFilePath() - { - return this.FileDirectory; - } - public void Assign(ApplicationItem sourceApp) { this.Enabled = sourceApp.Enabled; @@ -533,30 +493,6 @@ this.PlatformId = sourceApp.PlatformId; } - public FileItem PrevFile(FileItem curFile) - { - if (ItemList == null) return null; - if (ItemList.Count == 0) return null; - - int index = this.ItemList.IndexOf(curFile); - index = index - 1; - if (index < 0) - index = ItemList.Count - 1; - return (FileItem)ItemList[index]; - } - - public FileItem NextFile(FileItem curFile) - { - if (ItemList == null) return null; - if (ItemList.Count == 0) return null; - - int index = this.ItemList.IndexOf(curFile); - index = index + 1; - if (index > ItemList.Count - 1) - index = 0; - return (FileItem)ItemList[index]; - } - /// <summary> /// look for FileItem and launch it using the found object /// </summary> @@ -579,7 +515,7 @@ // use the APPLICATION launcher and add current file information if (this.Executable != "") - { + { // executable of the application procStart.FileName = this.Executable; @@ -715,9 +651,10 @@ return false; } - public virtual void Refresh(bool mpGuiMode) + public virtual void ReImport(bool mpGuiMode) { - // descendant classes do that! + DeleteFiles(); + Import(mpGuiMode); } public void LoadFromXmlProfile(XmlNode node) @@ -906,7 +843,7 @@ } } - private void Update() + private void UpdateApplicationItem() { if (ApplicationItemId == -1) return; @@ -1042,7 +979,7 @@ if (appID == -1) Insert(); else - Update(); + UpdateApplicationItem(); } protected virtual void FixFileLinks() @@ -1113,7 +1050,7 @@ if (fileItem == null) return; bool foundThumb = false; - + while (!foundThumb) { thumbFolderIndex++; @@ -1240,6 +1177,6 @@ #endregion - + } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemDirectoryCache.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -76,11 +76,8 @@ return true; } - public override void Refresh(bool mpGuiMode) - { - Import(mpGuiMode); - } + protected override void Import(bool mpGUIMode) { if (mpGUIMode) @@ -88,7 +85,6 @@ ShowProgressDialog("Importing from folders.."); } - ValidExtensions = ValidExtensions.Replace(" ", ""); importBase = new DirectoryImport(this); base.Import(mpGUIMode); Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemFactory.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -34,7 +34,7 @@ /// <summary> /// Factory like object that creates the matchin Application descendant class /// depending on the itemType parameter - /// Descendant classes differ in LOADING and REFRESHING filelists + /// </summary> public class ItemFactory { @@ -165,8 +165,7 @@ { FilterItem filterItem = new FilterItem( ); filterItem.Title = row["title"].ToString() ; - // newFile.LastTimeLaunched = ProgramUtils.GetDateDef(results, iRecord, "lastTimeLaunched", DateTime.MinValue); - //newFile.LaunchCount = ProgramUtils.GetIntDef(results, iRecord, "launchcount", 0); ; + return filterItem; } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemGameBase.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -60,25 +60,15 @@ if ((ApplicationItemSource == "") || (!File.Exists(ApplicationItemSource))) return; - if (mpGUIMode) { ShowProgressDialog("Importing from gameBase.."); } importBase = new GamebaseImport(this); - base.Import(mpGUIMode); - } - - - public override void Refresh(bool bGUIMode) - { - DeleteFiles(); - Import(bGUIMode); - } #endregion ApplicationItem Overloads } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/ApplicationItemMame.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -50,10 +50,23 @@ #region Variables bool importOriginalsOnly = true; + bool importMamePlaychoice10 = false; + bool importMameMahjong = false; - #endregion Variables + public bool ImportMamePlaychoice10 + { + get { return importMamePlaychoice10; } + set { importMamePlaychoice10 = value; } + } + public bool ImportMameMahjong + { + get { return importMameMahjong; } + set { importMameMahjong = value; } + } + + public ApplicationItemMame() { @@ -94,19 +107,6 @@ #region ApplicationItem Overloads - public override string CurrentFilePath() - { - return this.FileDirectory; - } - - - - public override void Refresh(bool bGUIMode) - { - DeleteFiles(); - Import(bGUIMode); - } - protected override void Import(bool mpGUIMode) { @@ -118,7 +118,6 @@ base.Import(mpGUIMode); } - #endregion ApplicationItem Overloads } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FileItem.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -331,17 +331,7 @@ categoryData = value; } } - /* public bool IsFolder - { - get - { - return isFolder; - } - set - { - isFolder = value; - } - }*/ + public string GameInfoURL { get { return gameInfoURL; } @@ -386,33 +376,8 @@ return nRes; } - // - // no need for these methods anymore - // + - //public string ExtractImageExtension() - //{ - // string strRes = ""; - // string[] parts = this.Imagefile.Split( '.' ); - // if ( parts.Length >= 2 ) - // { - // // there was an extension - // strRes = '.' + parts[parts.Length - 1]; - // } - // return strRes; - //} - - //public string ExtractImageFileNoPath() - //{ - // string strRes = ""; - // string[] parts = this.Imagefile.Split( '\\' ); - // if ( parts.Length >= 1 ) - // { - // strRes = parts[parts.Length - 1]; - // } - // return strRes; - //} - public void SetProperties() { /* string strThumb = MediaPortal.Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, Title);*/ @@ -440,7 +405,7 @@ GUIPropertyManager.SetProperty("#iswatched", strValue);*/ } - private void Insert() + private void InsertFileItem() { SQLiteParameter[] parameterArray = new SQLiteParameter[15]; @@ -517,7 +482,7 @@ - private void Update() + private void UpdateFileItem() { try @@ -604,15 +569,15 @@ { if ( fileID == -1 ) { - Insert(); + InsertFileItem(); } else { - Update(); + UpdateFileItem(); } } - public virtual void Delete() + public virtual void DeleteFileItem() { if ( this.FileID >= 0 ) Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-09-28 18:46:10 UTC (rev 962) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Items/FilelinkItem.cs 2007-09-29 15:26:22 UTC (rev 963) @@ -65,7 +65,7 @@ { if (Exists()) { - Update(); + } else { @@ -73,7 +73,7 @@ } } - public override void Delete() + public override void DeleteFileItem() { try @@ -131,11 +131,5 @@ Log.Info("programdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace); } } - - private void Update() - { - // nothing to update (yet) - //...... as all tblFileLinkItem fields are primary key fields... - } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |