From: <nor...@us...> - 2007-07-05 19:07:12
|
Revision: 673 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=673&view=rev Author: northern_sky Date: 2007-07-05 12:07:07 -0700 (Thu, 05 Jul 2007) Log Message: ----------- basic db options page for adding genre,platforms, etc.. removed databasesort class, moved needed methods to programsort.. Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.csproj trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramSort.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramViewHandler.cs Removed Paths: ------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ApplicationItems/ApplicationItem.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -97,7 +97,8 @@ string lastFilepath = ""; // cached path - private DatabaseSorter dbPc = new DatabaseSorter(); + //private DatabaseSorter dbPc = new DatabaseSorter(); + private ProgramSort dbPc = new ProgramSort(ProgramSort.SortMethod.Name, true); #endregion @@ -765,7 +766,7 @@ public virtual void OnSortToggle(GUIFacadeControl view) { - dbPc.sortAscending = (!dbPc.sortAscending); + dbPc.SortAscending = (!dbPc.SortAscending); view.Sort(dbPc); } @@ -786,12 +787,12 @@ public virtual bool GetCurrentSortIsAscending() { - return dbPc.sortAscending; + return dbPc.SortAscending; } public virtual void SetCurrentSortIsAscending(bool newValue) { - dbPc.sortAscending = newValue; + dbPc.SortAscending = newValue; } #endregion Deleted: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Database/DatabaseSorter.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -1,286 +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 MediaPortal.GUI.Library; - -using GUIPrograms.FileItems; - -namespace GUIPrograms.Database -{ - /// <summary> - /// Summary description for DatabaseSorter. - /// </summary> - public class DatabaseSorter : IComparer<GUIListItem> - { - enum SortMethod - { - SORT_NAME = 0, SORT_LAUNCHES = 1, SORT_RECENT = 2, SORT_RATING = 3 - } - - SortMethod currentSortMethod = SortMethod.SORT_NAME; - public bool sortAscending = true; - - public string CurrentSortMethodAsText - { - get - { - return GetCurrentSortMethodAsText(); - } - } - - public int CurrentSortMethodIndex - { - get - { - return (int)currentSortMethod; - } - set - { - SetCurrentSortMethodAsIndex(value); - } - } - - private string GetCurrentSortMethodAsText() - { - string strLine = ""; - SortMethod method = currentSortMethod; - switch (method) - { - case SortMethod.SORT_NAME: - strLine = GUILocalizeStrings.Get(103); - break; - case SortMethod.SORT_LAUNCHES: - strLine = GUILocalizeStrings.Get(13016); - break; - case SortMethod.SORT_RECENT: - strLine = GUILocalizeStrings.Get(13017); - break; - case SortMethod.SORT_RATING: - strLine = GUILocalizeStrings.Get(13018); - break; - } - return strLine; - } - - private void SetCurrentSortMethodAsIndex(int value) - { - try - { - currentSortMethod = (SortMethod)value; - } - catch - { - currentSortMethod = 0; - } - } - - - - public void UpdateState() - { - switch (currentSortMethod) - { - // SORT_NAME=0, - // SORT_LAUNCHES=1, - // SORT_RECENT=2, - // SORT_RATING=3 - - case SortMethod.SORT_NAME: - currentSortMethod = SortMethod.SORT_LAUNCHES; - sortAscending = false; - break; - case SortMethod.SORT_LAUNCHES: - currentSortMethod = SortMethod.SORT_RECENT; - sortAscending = false; - break; - case SortMethod.SORT_RECENT: - currentSortMethod = SortMethod.SORT_RATING; - sortAscending = false; - break; - case SortMethod.SORT_RATING: - currentSortMethod = SortMethod.SORT_NAME; - sortAscending = true; - break; - } - } - - public int Compare(GUIListItem item1, GUIListItem item2) - { - FileItem curFile1 = null; - FileItem curFile2 = null; - if (item1 == item2) - return 0; - if (item1 == null) - return -1; - if (item2 == null) - return -1; - if (item1.MusicTag == null) - return -1; - if (item2.MusicTag == null) - return -1; - if (item1.IsFolder && item1.Label == "..") - return -1; - if (item2.IsFolder && item2.Label == "..") - return -1; - if (item1.IsFolder && !item2.IsFolder) - return -1; - if (item1.IsFolder && item2.IsFolder) - return 0; - //don't sort folders! - else if (!item1.IsFolder && item2.IsFolder) - return 1; - - - if (currentSortMethod != SortMethod.SORT_NAME) - { - curFile1 = (FileItem)item1.MusicTag; - curFile2 = (FileItem)item2.MusicTag; - if (curFile1 == null) - return -1; - if (curFile2 == null) - return -1; - } - - // ok let's start sorting :-) - int temp; - switch (currentSortMethod) - { - case SortMethod.SORT_NAME: - item1.Label2 = ""; - item2.Label2 = ""; - if (sortAscending) - { - return String.Compare(item1.Label, item2.Label, true); - } - else - { - return String.Compare(item2.Label, item1.Label, true); - } - case SortMethod.SORT_LAUNCHES: - item1.Label2 = String.Format("{0}", curFile1.LaunchCount); - item2.Label2 = String.Format("{0}", curFile2.LaunchCount); - if (curFile1.LaunchCount == curFile2.LaunchCount) - { - // second sort always title ASC - return String.Compare(item1.Label, item2.Label, true); - } - else - { - if (curFile1.LaunchCount < curFile2.LaunchCount) - { - temp = -1; - } - else - { - temp = 1; - } - if (sortAscending) - { - return temp; - } - else - { - return -temp; - } - } - - case SortMethod.SORT_RATING: - item1.Label2 = String.Format("{0}", curFile1.Rating); - item2.Label2 = String.Format("{0}", curFile2.Rating); - if (curFile1.Rating == curFile2.Rating) - { - // second sort always title ASC - return String.Compare(item1.Label, item2.Label, true); - } - else - { - if (curFile1.Rating < curFile2.Rating) - { - temp = -1; - } - else - { - temp = 1; - } - if (sortAscending) - { - return temp; - } - else - { - return -temp; - } - } - - case SortMethod.SORT_RECENT: - if (curFile1.LastTimeLaunched > DateTime.MinValue) - { - item1.Label2 = curFile1.LastTimeLaunched.ToShortDateString(); - } - else - { - item1.Label2 = ""; - } - if (curFile2.LastTimeLaunched > DateTime.MinValue) - { - item2.Label2 = curFile1.LastTimeLaunched.ToShortDateString(); - } - else - { - item2.Label2 = ""; - } - - if (curFile1.LastTimeLaunched == curFile2.LastTimeLaunched) - { - // second sort always title ASC - return String.Compare(item1.Label, item2.Label, true); - } - else - { - if (curFile1.LastTimeLaunched < curFile2.LastTimeLaunched) - { - temp = -1; - } - else - { - temp = 1; - } - if (sortAscending) - { - return temp; - } - else - { - return -temp; - } - } - } - - return 0; - } - } -} \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.Designer.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -61,33 +61,11 @@ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.tcFileItemData = new MediaPortal.UserInterface.Controls.MPTabControl(); this.tabPage1 = new MediaPortal.UserInterface.Controls.MPTabPage(); - this.generalFileOptionsTab = new System.Windows.Forms.TabPage(); - this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); - this.editSystemComboBox = new System.Windows.Forms.ComboBox(); - this.removeSystemLabel = new System.Windows.Forms.Label(); - this.removeSystemButton = new System.Windows.Forms.Button(); - this.addSystemLabel = new System.Windows.Forms.Label(); - this.editSystemTextBox = new System.Windows.Forms.TextBox(); - this.addSystemButton = new System.Windows.Forms.Button(); - this.editManufacturerComboBox = new System.Windows.Forms.ComboBox(); - this.removeManufacturerLabel = new System.Windows.Forms.Label(); - this.removeManufacturerButton = new System.Windows.Forms.Button(); - this.addManufacturerLabel = new System.Windows.Forms.Label(); - this.editManufacturerTextBox = new System.Windows.Forms.TextBox(); - this.addManufacturerButton = new System.Windows.Forms.Button(); - this.editGenreComboBox = new System.Windows.Forms.ComboBox(); - this.removeGenreLabel = new System.Windows.Forms.Label(); - this.removeGenreButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.editGenreTextBox = new System.Windows.Forms.TextBox(); - this.addGenreButton = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.btnCancel = new MediaPortal.UserInterface.Controls.MPButton(); this.gbFileDetails.SuspendLayout(); this.tcFileItemData.SuspendLayout(); this.tabPage1.SuspendLayout(); - this.generalFileOptionsTab.SuspendLayout(); - this.generalFileItemOptionsGroupBox.SuspendLayout(); this.SuspendLayout(); // // gameinfoURLTextBox @@ -419,7 +397,6 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tcFileItemData.Controls.Add(this.tabPage1); - this.tcFileItemData.Controls.Add(this.generalFileOptionsTab); this.tcFileItemData.Location = new System.Drawing.Point(4, 8); this.tcFileItemData.Name = "tcFileItemData"; this.tcFileItemData.SelectedIndex = 0; @@ -436,203 +413,6 @@ this.tabPage1.Text = "Properties"; this.tabPage1.UseVisualStyleBackColor = true; // - // generalFileOptionsTab - // - this.generalFileOptionsTab.Controls.Add(this.generalFileItemOptionsGroupBox); - this.generalFileOptionsTab.Location = new System.Drawing.Point(4, 22); - this.generalFileOptionsTab.Name = "generalFileOptionsTab"; - this.generalFileOptionsTab.Padding = new System.Windows.Forms.Padding(3); - this.generalFileOptionsTab.Size = new System.Drawing.Size(521, 466); - this.generalFileOptionsTab.TabIndex = 2; - this.generalFileOptionsTab.Text = "General FileItem Options"; - this.generalFileOptionsTab.UseVisualStyleBackColor = true; - // - // generalFileItemOptionsGroupBox - // - this.generalFileItemOptionsGroupBox.Controls.Add(this.editSystemComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeSystemLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeSystemButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addSystemLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editSystemTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addSystemButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editManufacturerComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editManufacturerTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editGenreComboBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); - this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); - this.generalFileItemOptionsGroupBox.Controls.Add(this.label1); - this.generalFileItemOptionsGroupBox.Controls.Add(this.editGenreTextBox); - this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); - this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(6, 6); - this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; - this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(509, 454); - this.generalFileItemOptionsGroupBox.TabIndex = 78; - this.generalFileItemOptionsGroupBox.TabStop = false; - // - // editSystemComboBox - // - this.editSystemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.editSystemComboBox.FormattingEnabled = true; - this.editSystemComboBox.Location = new System.Drawing.Point(91, 249); - this.editSystemComboBox.Name = "editSystemComboBox"; - this.editSystemComboBox.Size = new System.Drawing.Size(312, 21); - this.editSystemComboBox.TabIndex = 92; - // - // removeSystemLabel - // - this.removeSystemLabel.AutoSize = true; - this.removeSystemLabel.Location = new System.Drawing.Point(6, 252); - this.removeSystemLabel.Name = "removeSystemLabel"; - this.removeSystemLabel.Size = new System.Drawing.Size(82, 13); - this.removeSystemLabel.TabIndex = 91; - this.removeSystemLabel.Text = "Remove platform"; - // - // removeSystemButton - // - this.removeSystemButton.Location = new System.Drawing.Point(436, 249); - this.removeSystemButton.Name = "removeSystemButton"; - this.removeSystemButton.Size = new System.Drawing.Size(62, 23); - this.removeSystemButton.TabIndex = 90; - this.removeSystemButton.Text = "Remove.."; - this.removeSystemButton.UseVisualStyleBackColor = true; - this.removeSystemButton.Click += new System.EventHandler(this.removeSystemButton_Click); - // - // addSystemLabel - // - this.addSystemLabel.AutoSize = true; - this.addSystemLabel.Location = new System.Drawing.Point(6, 216); - this.addSystemLabel.Name = "addSystemLabel"; - this.addSystemLabel.Size = new System.Drawing.Size(69, 13); - this.addSystemLabel.TabIndex = 87; - this.addSystemLabel.Text = "Add System.."; - // - // editSystemTextBox - // - this.editSystemTextBox.Location = new System.Drawing.Point(91, 213); - this.editSystemTextBox.Name = "editSystemTextBox"; - this.editSystemTextBox.Size = new System.Drawing.Size(312, 20); - this.editSystemTextBox.TabIndex = 88; - // - // addSystemButton - // - this.addSystemButton.Location = new System.Drawing.Point(436, 213); - this.addSystemButton.Name = "addSystemButton"; - this.addSystemButton.Size = new System.Drawing.Size(62, 23); - this.addSystemButton.TabIndex = 89; - this.addSystemButton.Text = "Add.."; - this.addSystemButton.UseVisualStyleBackColor = true; - this.addSystemButton.Click += new System.EventHandler(this.addSystemButton_Click); - // - // editManufacturerComboBox - // - this.editManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.editManufacturerComboBox.FormattingEnabled = true; - this.editManufacturerComboBox.Location = new System.Drawing.Point(91, 165); - this.editManufacturerComboBox.Name = "editManufacturerComboBox"; - this.editManufacturerComboBox.Size = new System.Drawing.Size(312, 21); - this.editManufacturerComboBox.TabIndex = 86; - // - // removeManufacturerLabel - // - this.removeManufacturerLabel.Location = new System.Drawing.Point(6, 157); - this.removeManufacturerLabel.Name = "removeManufacturerLabel"; - this.removeManufacturerLabel.Size = new System.Drawing.Size(82, 29); - this.removeManufacturerLabel.TabIndex = 85; - this.removeManufacturerLabel.Text = "Remove Manufacturer"; - // - // removeManufacturerButton - // - this.removeManufacturerButton.Location = new System.Drawing.Point(436, 165); - this.removeManufacturerButton.Name = "removeManufacturerButton"; - this.removeManufacturerButton.Size = new System.Drawing.Size(62, 23); - this.removeManufacturerButton.TabIndex = 84; - this.removeManufacturerButton.Text = "Remove.."; - this.removeManufacturerButton.UseVisualStyleBackColor = true; - this.removeManufacturerButton.Click += new System.EventHandler(this.removeManufacturerButton_Click); - // - // addManufacturerLabel - // - this.addManufacturerLabel.Location = new System.Drawing.Point(6, 121); - this.addManufacturerLabel.Name = "addManufacturerLabel"; - this.addManufacturerLabel.Size = new System.Drawing.Size(82, 36); - this.addManufacturerLabel.TabIndex = 81; - this.addManufacturerLabel.Text = "Add Manufacturer.."; - // - // editManufacturerTextBox - // - this.editManufacturerTextBox.Location = new System.Drawing.Point(91, 129); - this.editManufacturerTextBox.Name = "editManufacturerTextBox"; - this.editManufacturerTextBox.Size = new System.Drawing.Size(312, 20); - this.editManufacturerTextBox.TabIndex = 82; - // - // addManufacturerButton - // - this.addManufacturerButton.Location = new System.Drawing.Point(436, 129); - this.addManufacturerButton.Name = "addManufacturerButton"; - this.addManufacturerButton.Size = new System.Drawing.Size(62, 23); - this.addManufacturerButton.TabIndex = 83; - this.addManufacturerButton.Text = "Add.."; - this.addManufacturerButton.UseVisualStyleBackColor = true; - this.addManufacturerButton.Click += new System.EventHandler(this.addManufacturerButton_Click); - // - // editGenreComboBox - // - this.editGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.editGenreComboBox.FormattingEnabled = true; - this.editGenreComboBox.Location = new System.Drawing.Point(91, 70); - this.editGenreComboBox.Name = "editGenreComboBox"; - this.editGenreComboBox.Size = new System.Drawing.Size(312, 21); - this.editGenreComboBox.TabIndex = 80; - // - // removeGenreLabel - // - this.removeGenreLabel.AutoSize = true; - this.removeGenreLabel.Location = new System.Drawing.Point(6, 73); - this.removeGenreLabel.Name = "removeGenreLabel"; - this.removeGenreLabel.Size = new System.Drawing.Size(77, 13); - this.removeGenreLabel.TabIndex = 79; - this.removeGenreLabel.Text = "Remove genre"; - // - // removeGenreButton - // - this.removeGenreButton.Location = new System.Drawing.Point(436, 70); - this.removeGenreButton.Name = "removeGenreButton"; - this.removeGenreButton.Size = new System.Drawing.Size(62, 23); - this.removeGenreButton.TabIndex = 78; - this.removeGenreButton.Text = "Remove.."; - this.removeGenreButton.UseVisualStyleBackColor = true; - this.removeGenreButton.Click += new System.EventHandler(this.removeGenreButton_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 37); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(64, 13); - this.label1.TabIndex = 74; - this.label1.Text = "Add Genre.."; - // - // editGenreTextBox - // - this.editGenreTextBox.Location = new System.Drawing.Point(91, 34); - this.editGenreTextBox.Name = "editGenreTextBox"; - this.editGenreTextBox.Size = new System.Drawing.Size(312, 20); - this.editGenreTextBox.TabIndex = 75; - // - // addGenreButton - // - this.addGenreButton.Location = new System.Drawing.Point(436, 34); - this.addGenreButton.Name = "addGenreButton"; - this.addGenreButton.Size = new System.Drawing.Size(62, 23); - this.addGenreButton.TabIndex = 76; - this.addGenreButton.Text = "Add.."; - this.addGenreButton.UseVisualStyleBackColor = true; - this.addGenreButton.Click += new System.EventHandler(this.addGenreButton_Click); - // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -664,9 +444,6 @@ this.gbFileDetails.PerformLayout(); this.tcFileItemData.ResumeLayout(false); this.tabPage1.ResumeLayout(false); - this.generalFileOptionsTab.ResumeLayout(false); - this.generalFileItemOptionsGroupBox.ResumeLayout(false); - this.generalFileItemOptionsGroupBox.PerformLayout(); this.ResumeLayout(false); } @@ -705,27 +482,7 @@ private System.Windows.Forms.Label subGenreLabel; private System.Windows.Forms.ComboBox subGenreComboBox; private System.Windows.Forms.ComboBox genreComboBox; - private System.Windows.Forms.TabPage generalFileOptionsTab; - private System.Windows.Forms.GroupBox generalFileItemOptionsGroupBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox editGenreTextBox; - private System.Windows.Forms.Button addGenreButton; - private System.Windows.Forms.Label removeGenreLabel; - private System.Windows.Forms.Button removeGenreButton; - private System.Windows.Forms.ComboBox editGenreComboBox; private System.Windows.Forms.ComboBox systemComboBox; private System.Windows.Forms.ComboBox manufacturerComboBox; - private System.Windows.Forms.ComboBox editSystemComboBox; - private System.Windows.Forms.Label removeSystemLabel; - private System.Windows.Forms.Button removeSystemButton; - private System.Windows.Forms.Label addSystemLabel; - private System.Windows.Forms.TextBox editSystemTextBox; - private System.Windows.Forms.Button addSystemButton; - private System.Windows.Forms.ComboBox editManufacturerComboBox; - private System.Windows.Forms.Label removeManufacturerLabel; - private System.Windows.Forms.Button removeManufacturerButton; - private System.Windows.Forms.Label addManufacturerLabel; - private System.Windows.Forms.TextBox editManufacturerTextBox; - private System.Windows.Forms.Button addManufacturerButton; } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/FileDetailsForm.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -156,10 +156,8 @@ private void UpdateComboBoxes() { - FillComboBox("tblPlatform", "platform", editSystemComboBox); - FillComboBox("tblManufacturer", "manufacturer", editManufacturerComboBox); - FillComboBox("tblGenre", "genre", editGenreComboBox); + FillComboBox("tblPlatform", "platform", systemComboBox); FillComboBox("tblManufacturer", "manufacturer", manufacturerComboBox); FillComboBox("tblGenre", "genre",genreComboBox); @@ -284,144 +282,7 @@ } } - private void InsertData(string tableName,string column,string insertValue) - { - string sqlStmt = @" - INSERT INTO - " + tableName + @" - ( - "+ column + @" - ) - VALUES - ( - " + insertValue + @" - ) - "; + - try - { - DatabaseHandler.sqlDB.Execute(sqlStmt); - } - catch (Exception exception) - { - throw exception; - } - } - - //if something was removed that is in a fileitem - //set it to as default value (unknown) - private void UpdateFileItems(string removedField,string removedValue) - { - string sqlStmt = @" - UPDATE - tblFileItem - - SET - " + removedField + @" = 1 - - WHERE - " + removedField + @" = " + removedValue; - - try - { - // - - DatabaseHandler.sqlDB.Execute(sqlStmt); - - - } - catch (Exception exception) - { - throw exception; - } - - - } - - - private void DeleteData(string tableName, string column, string uniqueValue) - { - //never remove 1 (unknown) - string sqlStmt = @" - DELETE FROM - " + tableName + @" - - WHERE - " + column + @" = " + uniqueValue + @" - - AND - " + column + @" <> 1 "; - - - - try - { - DatabaseHandler.sqlDB.Execute(sqlStmt); - } - catch (Exception exception) - { - throw exception; - } - } - - private void addGenreButton_Click(object sender, EventArgs e) - { - InsertData("tblGenre", "genre", "'" + this.editGenreTextBox.Text + "'"); - UpdateComboBoxes(); - } - - private void removeGenreButton_Click(object sender, EventArgs e) - { - DeleteData("tblGenre", "genreId", this.editGenreComboBox.SelectedValue.ToString()); - if (CurFile.MainGenreId == (int)editGenreComboBox.SelectedValue) - { - CurFile.MainGenreId = 1; - CurFile.SubGenreId = 1; - } - UpdateFileItems("mainGenreId", this.editGenreComboBox.SelectedValue.ToString()); - UpdateFileItems("subGenreId", this.editGenreComboBox.SelectedValue.ToString()); - - - UpdateComboBoxes(); - } - - private void removeManufacturerButton_Click(object sender, EventArgs e) - { - DeleteData("tblManufacturer", "manufacturerId", this.editManufacturerComboBox.SelectedValue.ToString()); - if (CurFile.ManufacturerId == (int)this.editManufacturerComboBox.SelectedValue) - { - CurFile.ManufacturerId = 1; - } - UpdateFileItems("manufacturerId", this.editManufacturerComboBox.SelectedValue.ToString()); - - UpdateComboBoxes(); - - } - - private void addManufacturerButton_Click(object sender, EventArgs e) - { - InsertData("tblManufacturer", "manufacturer", "'" + this.editManufacturerTextBox.Text + "'"); - UpdateComboBoxes(); - - } - - private void addSystemButton_Click(object sender, EventArgs e) - { - InsertData("tblSystem", "platform", "'" + this.editSystemTextBox.Text + "'"); - UpdateComboBoxes(); - } - - private void removeSystemButton_Click(object sender, EventArgs e) - { - DeleteData("tblSystem", "systemId", this.editSystemComboBox.SelectedValue.ToString()); - if (CurFile.PlatformId == (int)this.editSystemComboBox.SelectedValue) - { - CurFile.PlatformId = 1; - } - UpdateFileItems("systemId", this.editSystemComboBox.SelectedValue.ToString()); - - UpdateComboBoxes(); - - } } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.Designer.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -28,7 +28,7 @@ /// </summary> private void InitializeComponent() { - System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Applications"); + System.Windows.Forms.TreeNode treeNode3 = 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(); @@ -46,8 +46,30 @@ this.detailsTabPage = new System.Windows.Forms.TabPage(); this.directoryTabPage = new System.Windows.Forms.TabPage(); this.viewTabPage = new System.Windows.Forms.TabPage(); + this.dbOptionsTabPage = new System.Windows.Forms.TabPage(); + this.generalFileItemOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.removePlatformComboBox = new System.Windows.Forms.ComboBox(); + this.removePlatformLabel = new System.Windows.Forms.Label(); + this.removePlatformButton = new System.Windows.Forms.Button(); + this.addPlatformLabel = new System.Windows.Forms.Label(); + this.addPlatformTextBox = new System.Windows.Forms.TextBox(); + this.addPlatformButton = new System.Windows.Forms.Button(); + this.removeManufacturerComboBox = new System.Windows.Forms.ComboBox(); + this.removeManufacturerLabel = new System.Windows.Forms.Label(); + this.removeManufacturerButton = new System.Windows.Forms.Button(); + this.addManufacturerLabel = new System.Windows.Forms.Label(); + this.addManufacturerTextBox = new System.Windows.Forms.TextBox(); + this.addManufacturerButton = new System.Windows.Forms.Button(); + this.removeGenreComboBox = new System.Windows.Forms.ComboBox(); + this.removeGenreLabel = new System.Windows.Forms.Label(); + this.removeGenreButton = new System.Windows.Forms.Button(); + this.addGenreLabel = new System.Windows.Forms.Label(); + this.addGenreTextBox = new System.Windows.Forms.TextBox(); + this.addGenreButton = new System.Windows.Forms.Button(); this.menuStrip.SuspendLayout(); this.tabControl.SuspendLayout(); + this.dbOptionsTabPage.SuspendLayout(); + this.generalFileItemOptionsGroupBox.SuspendLayout(); this.SuspendLayout(); // // menuStrip @@ -67,7 +89,7 @@ this.addApplicationToolStripMenuItem, this.deleteApplicationToolStripMenuItem}); this.addDeleteApplicationsToolStripMenuItem.Name = "addDeleteApplicationsToolStripMenuItem"; - this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size(132, 20); + this.addDeleteApplicationsToolStripMenuItem.Size = new System.Drawing.Size(146, 20); this.addDeleteApplicationsToolStripMenuItem.Text = "Add/Delete applications"; // // addApplicationToolStripMenuItem @@ -77,20 +99,20 @@ this.addGroupnodeToolStripMenuItem, this.extendedApplicationItemToolStripMenuItem}); this.addApplicationToolStripMenuItem.Name = "addApplicationToolStripMenuItem"; - this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.addApplicationToolStripMenuItem.Size = new System.Drawing.Size(169, 22); this.addApplicationToolStripMenuItem.Text = "Add application"; // // applicationWithFiledirectoryToolStripMenuItem // this.applicationWithFiledirectoryToolStripMenuItem.Name = "applicationWithFiledirectoryToolStripMenuItem"; - this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.applicationWithFiledirectoryToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.applicationWithFiledirectoryToolStripMenuItem.Text = "Applicationitem"; this.applicationWithFiledirectoryToolStripMenuItem.Click += new System.EventHandler(this.applicationWithFiledirectoryToolStripMenuItem_Click); // // addGroupnodeToolStripMenuItem // this.addGroupnodeToolStripMenuItem.Name = "addGroupnodeToolStripMenuItem"; - this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.addGroupnodeToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.addGroupnodeToolStripMenuItem.Text = "Groupingtem"; this.addGroupnodeToolStripMenuItem.Click += new System.EventHandler(this.addGroupnodeToolStripMenuItem_Click); // @@ -100,20 +122,20 @@ this.mameImportToolStripMenuItem, this.importGamebaseItemToolStripMenuItem}); this.extendedApplicationItemToolStripMenuItem.Name = "extendedApplicationItemToolStripMenuItem"; - this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.extendedApplicationItemToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.extendedApplicationItemToolStripMenuItem.Text = "Extended applicationItem"; // // mameImportToolStripMenuItem // this.mameImportToolStripMenuItem.Name = "mameImportToolStripMenuItem"; - this.mameImportToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.mameImportToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.mameImportToolStripMenuItem.Text = "Import Mame"; this.mameImportToolStripMenuItem.Click += new System.EventHandler(this.mameImportToolStripMenuItem_Click); // // importGamebaseItemToolStripMenuItem // this.importGamebaseItemToolStripMenuItem.Name = "importGamebaseItemToolStripMenuItem"; - this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.importGamebaseItemToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.importGamebaseItemToolStripMenuItem.Text = "Import Gamebase"; this.importGamebaseItemToolStripMenuItem.Click += new System.EventHandler(this.importGamebaseItemToolStripMenuItem_Click); // @@ -121,7 +143,7 @@ // this.deleteApplicationToolStripMenuItem.Image = global::GUIPrograms.Properties.Resources.deleteButton_Image; this.deleteApplicationToolStripMenuItem.Name = "deleteApplicationToolStripMenuItem"; - this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(170, 22); + this.deleteApplicationToolStripMenuItem.Size = new System.Drawing.Size(169, 22); this.deleteApplicationToolStripMenuItem.Text = "Delete application"; this.deleteApplicationToolStripMenuItem.Click += new System.EventHandler(this.deleteApplicationToolStripMenuItem_Click); // @@ -130,7 +152,7 @@ this.toolsStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.premadeConfigurationsToolStripMenuItem}); this.toolsStripMenuItem.Name = "toolsStripMenuItem"; - this.toolsStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.toolsStripMenuItem.Size = new System.Drawing.Size(48, 20); this.toolsStripMenuItem.Text = "Tools"; // // premadeConfigurationsToolStripMenuItem @@ -138,13 +160,13 @@ this.premadeConfigurationsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.emulatorSetupToolStripMenuItem}); this.premadeConfigurationsToolStripMenuItem.Name = "premadeConfigurationsToolStripMenuItem"; - this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size(155, 22); + this.premadeConfigurationsToolStripMenuItem.Size = new System.Drawing.Size(153, 22); this.premadeConfigurationsToolStripMenuItem.Text = "Configurations"; // // emulatorSetupToolStripMenuItem // this.emulatorSetupToolStripMenuItem.Name = "emulatorSetupToolStripMenuItem"; - this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size(158, 22); + this.emulatorSetupToolStripMenuItem.Size = new System.Drawing.Size(155, 22); this.emulatorSetupToolStripMenuItem.Text = "Emulator Setup"; // // treeView @@ -155,33 +177,35 @@ this.treeView.LabelEdit = true; this.treeView.Location = new System.Drawing.Point(0, 27); this.treeView.Name = "treeView"; - treeNode1.Name = "applicationNode"; - treeNode1.Text = "Applications"; + treeNode3.Name = "applicationNode"; + treeNode3.Text = "Applications"; this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode1}); + treeNode3}); this.treeView.Size = new System.Drawing.Size(224, 576); this.treeView.TabIndex = 8; + this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); + this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_DragOver); this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_AfterLabelEdit); - this.treeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop); this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); + this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); this.treeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter); - this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeView_BeforeLabelEdit); this.treeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView_BeforeSelect); this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag); - this.treeView.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_DragOver); // // tabControl // this.tabControl.Controls.Add(this.detailsTabPage); this.tabControl.Controls.Add(this.directoryTabPage); this.tabControl.Controls.Add(this.viewTabPage); + this.tabControl.Controls.Add(this.dbOptionsTabPage); this.tabControl.Location = new System.Drawing.Point(230, 27); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; this.tabControl.ShowToolTips = true; this.tabControl.Size = new System.Drawing.Size(505, 577); this.tabControl.TabIndex = 2; + this.tabControl.Click += new System.EventHandler(this.dbOptionsTabPage_Click); this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); // // detailsTabPage @@ -214,6 +238,204 @@ this.viewTabPage.TabIndex = 2; this.viewTabPage.Text = "Views"; // + // dbOptionsTabPage + // + this.dbOptionsTabPage.Controls.Add(this.generalFileItemOptionsGroupBox); + 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.TabIndex = 3; + this.dbOptionsTabPage.Text = "DB options"; + this.dbOptionsTabPage.UseVisualStyleBackColor = true; + this.dbOptionsTabPage.Click += new System.EventHandler(this.dbOptionsTabPage_Click); + // + // generalFileItemOptionsGroupBox + // + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removePlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addPlatformButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addManufacturerButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreComboBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.removeGenreButton); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreLabel); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreTextBox); + this.generalFileItemOptionsGroupBox.Controls.Add(this.addGenreButton); + this.generalFileItemOptionsGroupBox.Location = new System.Drawing.Point(3, 6); + this.generalFileItemOptionsGroupBox.Name = "generalFileItemOptionsGroupBox"; + this.generalFileItemOptionsGroupBox.Size = new System.Drawing.Size(488, 496); + this.generalFileItemOptionsGroupBox.TabIndex = 79; + this.generalFileItemOptionsGroupBox.TabStop = false; + // + // removePlatformComboBox + // + this.removePlatformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removePlatformComboBox.FormattingEnabled = true; + this.removePlatformComboBox.Location = new System.Drawing.Point(99, 249); + this.removePlatformComboBox.Name = "removePlatformComboBox"; + this.removePlatformComboBox.Size = new System.Drawing.Size(306, 21); + this.removePlatformComboBox.TabIndex = 92; + // + // removePlatformLabel + // + this.removePlatformLabel.AutoSize = true; + this.removePlatformLabel.Location = new System.Drawing.Point(6, 252); + this.removePlatformLabel.Name = "removePlatformLabel"; + this.removePlatformLabel.Size = new System.Drawing.Size(87, 13); + this.removePlatformLabel.TabIndex = 91; + this.removePlatformLabel.Text = "Remove platform"; + // + // removePlatformButton + // + this.removePlatformButton.Location = new System.Drawing.Point(411, 249); + this.removePlatformButton.Name = "removePlatformButton"; + this.removePlatformButton.Size = new System.Drawing.Size(62, 23); + this.removePlatformButton.TabIndex = 90; + this.removePlatformButton.Text = "Remove.."; + this.removePlatformButton.UseVisualStyleBackColor = true; + this.removePlatformButton.Click += new System.EventHandler(this.removePlatformButton_Click); + // + // addPlatformLabel + // + this.addPlatformLabel.AutoSize = true; + this.addPlatformLabel.Location = new System.Drawing.Point(6, 216); + this.addPlatformLabel.Name = "addPlatformLabel"; + this.addPlatformLabel.Size = new System.Drawing.Size(72, 13); + this.addPlatformLabel.TabIndex = 87; + this.addPlatformLabel.Text = "Add platform.."; + // + // addPlatformTextBox + // + this.addPlatformTextBox.Location = new System.Drawing.Point(99, 213); + this.addPlatformTextBox.Name = "addPlatformTextBox"; + this.addPlatformTextBox.Size = new System.Drawing.Size(306, 20); + this.addPlatformTextBox.TabIndex = 88; + // + // addPlatformButton + // + this.addPlatformButton.Location = new System.Drawing.Point(411, 213); + this.addPlatformButton.Name = "addPlatformButton"; + this.addPlatformButton.Size = new System.Drawing.Size(62, 23); + this.addPlatformButton.TabIndex = 89; + this.addPlatformButton.Text = "Add.."; + this.addPlatformButton.UseVisualStyleBackColor = true; + this.addPlatformButton.Click += new System.EventHandler(this.addPlatformButton_Click); + // + // removeManufacturerComboBox + // + this.removeManufacturerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removeManufacturerComboBox.FormattingEnabled = true; + this.removeManufacturerComboBox.Location = new System.Drawing.Point(99, 165); + this.removeManufacturerComboBox.Name = "removeManufacturerComboBox"; + this.removeManufacturerComboBox.Size = new System.Drawing.Size(306, 21); + this.removeManufacturerComboBox.TabIndex = 86; + // + // removeManufacturerLabel + // + this.removeManufacturerLabel.Location = new System.Drawing.Point(6, 157); + this.removeManufacturerLabel.Name = "removeManufacturerLabel"; + this.removeManufacturerLabel.Size = new System.Drawing.Size(82, 29); + this.removeManufacturerLabel.TabIndex = 85; + this.removeManufacturerLabel.Text = "Remove Manufacturer"; + // + // removeManufacturerButton + // + this.removeManufacturerButton.Location = new System.Drawing.Point(411, 165); + this.removeManufacturerButton.Name = "removeManufacturerButton"; + this.removeManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.removeManufacturerButton.TabIndex = 84; + this.removeManufacturerButton.Text = "Remove.."; + this.removeManufacturerButton.UseVisualStyleBackColor = true; + this.removeManufacturerButton.Click += new System.EventHandler(this.removeManufacturerButton_Click); + // + // addManufacturerLabel + // + this.addManufacturerLabel.Location = new System.Drawing.Point(6, 121); + this.addManufacturerLabel.Name = "addManufacturerLabel"; + this.addManufacturerLabel.Size = new System.Drawing.Size(82, 36); + this.addManufacturerLabel.TabIndex = 81; + this.addManufacturerLabel.Text = "Add Manufacturer.."; + // + // addManufacturerTextBox + // + this.addManufacturerTextBox.Location = new System.Drawing.Point(99, 129); + this.addManufacturerTextBox.Name = "addManufacturerTextBox"; + this.addManufacturerTextBox.Size = new System.Drawing.Size(306, 20); + this.addManufacturerTextBox.TabIndex = 82; + // + // addManufacturerButton + // + this.addManufacturerButton.Location = new System.Drawing.Point(411, 129); + this.addManufacturerButton.Name = "addManufacturerButton"; + this.addManufacturerButton.Size = new System.Drawing.Size(62, 23); + this.addManufacturerButton.TabIndex = 83; + this.addManufacturerButton.Text = "Add.."; + this.addManufacturerButton.UseVisualStyleBackColor = true; + this.addManufacturerButton.Click += new System.EventHandler(this.addManufacturerButton_Click); + // + // removeGenreComboBox + // + this.removeGenreComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.removeGenreComboBox.FormattingEnabled = true; + this.removeGenreComboBox.Location = new System.Drawing.Point(99, 70); + this.removeGenreComboBox.Name = "removeGenreComboBox"; + this.removeGenreComboBox.Size = new System.Drawing.Size(306, 21); + this.removeGenreComboBox.TabIndex = 80; + // + // removeGenreLabel + // + this.removeGenreLabel.AutoSize = true; + this.removeGenreLabel.Location = new System.Drawing.Point(6, 73); + this.removeGenreLabel.Name = "removeGenreLabel"; + this.removeGenreLabel.Size = new System.Drawing.Size(77, 13); + this.removeGenreLabel.TabIndex = 79; + this.removeGenreLabel.Text = "Remove genre"; + // + // removeGenreButton + // + this.removeGenreButton.Location = new System.Drawing.Point(411, 70); + this.removeGenreButton.Name = "removeGenreButton"; + this.removeGenreButton.Size = new System.Drawing.Size(62, 23); + this.removeGenreButton.TabIndex = 78; + this.removeGenreButton.Text = "Remove.."; + this.removeGenreButton.UseVisualStyleBackColor = true; + this.removeGenreButton.Click += new System.EventHandler(this.removeGenreButton_Click); + // + // addGenreLabel + // + this.addGenreLabel.AutoSize = true; + this.addGenreLabel.Location = new System.Drawing.Point(6, 37); + this.addGenreLabel.Name = "addGenreLabel"; + this.addGenreLabel.Size = new System.Drawing.Size(62, 13); + this.addGenreLabel.TabIndex = 74; + this.addGenreLabel.Text = "Add genre.."; + // + // addGenreTextBox + // + this.addGenreTextBox.Location = new System.Drawing.Point(99, 34); + this.addGenreTextBox.Name = "addGenreTextBox"; + this.addGenreTextBox.Size = new System.Drawing.Size(306, 20); + this.addGenreTextBox.TabIndex = 75; + // + // addGenreButton + // + this.addGenreButton.Location = new System.Drawing.Point(411, 34); + this.addGenreButton.Name = "addGenreButton"; + this.addGenreButton.Size = new System.Drawing.Size(62, 23); + this.addGenreButton.TabIndex = 76; + this.addGenreButton.Text = "Add.."; + this.addGenreButton.UseVisualStyleBackColor = true; + this.addGenreButton.Click += new System.EventHandler(this.addGenreButton_Click); + // // SetupForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -229,11 +451,14 @@ this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "SetupForm"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SetupForm_FormClosed); this.Load += new System.EventHandler(this.SetupForm_Load); - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SetupForm_FormClosed); this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.tabControl.ResumeLayout(false); + this.dbOptionsTabPage.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.ResumeLayout(false); + this.generalFileItemOptionsGroupBox.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -258,5 +483,25 @@ private System.Windows.Forms.ToolStripMenuItem extendedApplicationItemToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem mameImportToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importGamebaseItemToolStripMenuItem; + private System.Windows.Forms.TabPage dbOptionsTabPage; + private System.Windows.Forms.GroupBox generalFileItemOptionsGroupBox; + private System.Windows.Forms.ComboBox removePlatformComboBox; + private System.Windows.Forms.Label removePlatformLabel; + private System.Windows.Forms.Button removePlatformButton; + private System.Windows.Forms.Label addPlatformLabel; + private System.Windows.Forms.TextBox addPlatformTextBox; + private System.Windows.Forms.Button addPlatformButton; + private System.Windows.Forms.ComboBox removeManufacturerComboBox; + private System.Windows.Forms.Label removeManufacturerLabel; + private System.Windows.Forms.Button removeManufacturerButton; + private System.Windows.Forms.Label addManufacturerLabel; + private System.Windows.Forms.TextBox addManufacturerTextBox; + private System.Windows.Forms.Button addManufacturerButton; + private System.Windows.Forms.ComboBox removeGenreComboBox; + private System.Windows.Forms.Label removeGenreLabel; + private System.Windows.Forms.Button removeGenreButton; + private System.Windows.Forms.Label addGenreLabel; + private System.Windows.Forms.TextBox addGenreTextBox; + private System.Windows.Forms.Button addGenreButton; } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-07-05 05:08:40 UTC (rev 672) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SetupForm.cs 2007-07-05 19:07:07 UTC (rev 673) @@ -8,6 +8,7 @@ using System.Windows.Forms; using MediaPortal.GUI.Library; using MediaPortal.Util; +using SQLite.NET; using MediaPortal.Configuration; using System.IO; @@ -327,6 +328,15 @@ viewTabPage.Refresh(); } + private void AddDBOptionsPage() + { + if (!TabIsDisplayed(dbOptionsTabPage)) + { + tabControl.Controls.Add(dbOptionsTabPage); + } + dbOptionsTabPage.Refresh(); + } + private void RemoveFilesPage() { if (TabIsDisplayed(directoryTabPage)) @@ -343,7 +353,15 @@ } } + void RemoveDBOptionsPage() + { + if (TabIsDisplayed(this.dbOptionsTabPage)) + { + tabControl.Controls.Remove(this.dbOptionsTabPage); + } + } + private void SyncPanel(AppSettingsBase pageSettings) { this.tabControl.TabPages["detailsTabPage"].Controls.Clear(); @@ -358,6 +376,7 @@ if (currentApplication != null) { RemoveViewsPage(); + RemoveDBOptionsPage(); if (currentApplication.FileEditorAllowed()) { AddFilesPage(currentApplication); @@ -372,6 +391,7 @@ // special treatment for root node RemoveFilesPage(); AddViewsPage(); + AddDBOptionsPage(); } } } @@ -934,7 +954,83 @@ toolsStripMenuItem.Enabled = true; } } + private void UpdateComboBoxes() + { + FillComboBox("tblPlatform", "platform", removePlatformComboBox); + FillComboBox("tblManufacturer", "manufacturer", removeManufacturerComboBox); + FillComboBox("tblGenre", "genre", removeGenreComboBox); + } + + public class ListItem + { + private string text; + + public string Text + { + get { return text; } + set { text = value; } + } + private int value; + + public int Value + { + get { return this.value; } + set { this.value = value; } + } + + public ListItem(string label, int data) + { + text = label; + value = data; + } + + + } + + private void FillComboBox(string tableName, string orderBy, ComboBox comboBox) + { + + + List<ListItem> listItemList = new List<ListItem>(); + SQLiteResultSet resultSet = null; + + string sqlStmt = @" + SELECT + * + + FROM + " + tableName + @" + + ORDER BY " + orderBy; + + try + { + resultSet = DatabaseHandler.sqlDB.Execute(sqlStmt); + } + catch (Exception exception) + { + throw exception; + } + + if (resultSet.Rows.Count > 0) + { + for (int i = 0; i < resultSet.Rows.Count; i++) + { + //genreid why oh why cant the implementation offer getvalue from columname... arrghr + //maybe can use the sqlnet provider later on.. + + ListItem listItem = new ListItem(resultSet.Rows[i].fields[1].ToString(), Convert.ToInt32(resultSet.Rows[i].fields[0])); + listItemList.Add(listItem); + } + + + comboBox.DataSource = listItemList; + comboBox.ValueMember = "Value"; + comboBox.DisplayMember = "Text"; + } + } + private void mameImportToolStripMenuItem_Click(object sender, EventArgs e) { AddApplication(ApplicationType.MAMEDIRECT); @@ -949,5 +1045,136 @@ { this.tabControl.SelectedIndex = 0; } + + private void addGenreButton_Click(object sender, EventArgs e) + { + InsertData("tblGenre", "genre", "'" + this.addGenreTextBox.Text + "'"); + UpdateComboBoxes(); + } + + private void removeGenreButton_Click(object sender, EventArgs e) + { + DeleteData("tblGenre", "genreId", this.removeGenreComboBox.SelectedValue.ToString()); + UpdateFileItems("mainGenreId", this.removeGenreComboBox.SelectedValue.ToString()); + UpdateFileItems("subGenreId", this.removeGenreComboBox.SelectedValue.ToString()); + UpdateComboBoxes(); + } + + private void addManufacturerButton_Click(object sender, EventArgs e) + { + InsertData("tblManufacturer", "manufacturer", "'" + this.addManufacturerTextBox.Text + "'"); + UpdateComboBoxes(); + + } + + private void removeManufacturerButton_Click(object sender, EventArgs e) + { + DeleteData("tblManufacturer", "manufacturerId", this.removeManufacturerComboBox.SelectedValue.ToString()); + UpdateFileItems("manufacturerId", this.removeManufacturerComboBox.SelectedValue.ToString()); + + UpdateComboBoxes(); + } + + private void addPlatformButton_Click(object sender, EventArgs e) + { + InsertData("tblPlatform", "platform", "'" + this.addPlatformTextBox.Text + "'"); + UpdateComboBoxes(); + } + + private void removePlatformButton_Click(object sender, EventArgs e) + { + DeleteData("tblPlatform", "platformId", this.removePlatformComboBox.SelectedValue.ToString()); + UpdateFileItems("platformId", this.removePlatformComboBox.SelectedValue.ToString()); + UpdateComboBoxes(); + } + + private void InsertData(string tableName, string column, string insertValue) + { + string sqlStmt = @" + INSERT INTO + " + tableName + @" + ( + " + column + @" + ) + VALUES + ( + " + insertValue + @" + ) + "; + + try + { + DatabaseHandler.sqlDB.Execute(sqlStmt); + } + catch (Exception exception) + { + throw exception; + } + } + + //if something was removed that is in a fileitem + //set it to as default value (unknown) + private void UpdateFileItems(string removedField, string removedValue) + { + string sqlStmt = @" + U... [truncated message content] |