From: <chr...@us...> - 2007-05-06 18:24:40
|
Revision: 382 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=382&view=rev Author: chreekar Date: 2007-05-06 11:24:35 -0700 (Sun, 06 May 2007) Log Message: ----------- Support for translation strings Modified Paths: -------------- trunk/plugins/MyEmulators/myEmulators/Class1.cs trunk/plugins/MyEmulators/myEmulators/DB.cs trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs trunk/plugins/MyEmulators/myEmulators/setupForm.cs Added Paths: ----------- trunk/plugins/MyEmulators/Readme.txt Added: trunk/plugins/MyEmulators/Readme.txt =================================================================== --- trunk/plugins/MyEmulators/Readme.txt (rev 0) +++ trunk/plugins/MyEmulators/Readme.txt 2007-05-06 18:24:35 UTC (rev 382) @@ -0,0 +1,127 @@ +My Emulators plugin for Media Portal + + +Readme +=========================================== + +CHANGELOG +------------------------------------------- +v1.6 +-Added support for translations, see below + +v1.5.1 +-Fixed compability issues with MP + +v1.5 +-A ROM Database accessed from the + configuration that lets the user: + -Change the name of each game + -Write a description + -Set a grade that is displayed in the + plugin (can also be set from the + context menu inside MP) + -Change and view a play count and the + latest date the game has been launched. +-Buttons to sort the ROMs according to grade, + number of times played or the latest date + launched. +-Thumbnail support! After the first run, + directories will be created in the thumbs- + directory. Name the image exactly the same + as the emulator or game to make it visible. +-An option to change the label of the plugin +-Switched to rar file format for the + distribution file, and included source code. + Most of the comments are in Swedish though. +-Loads of GUI improvements to the setup... +-...and a much better looking skin... +-...with animations and different views. + +v1.0.2 +-Option to not use quotes on ROM paths, + which should solve some compability + issues +-All settings are now stored in a + database (which means the plugin + must be reconfigured) +-Tabbed configuration layout +-New header logo + +v1.0.1 +-Added an option to not close MediaPortal + after launching a game + +PURPOSE +------------------------------------------- +This plugin lets the user in a quick and +easy way list and launch the ROMs on the +harddrive in an installed emulator. + +It also features a database function that +can hold information about how many times +a game has been played, a grade and more. + +REQUIREMENTS +------------------------------------------- +The plugin has been build from and tested +to work with MediaPortal version 0.2.2.0, +but it may work just fine for older +versions too (if the animations in the skin +file is commented). No guarantee though. + +INSTALLATION +------------------------------------------- +Extract all the files in the archive to +the folder where Mediaportal.exe is located. +Remember to keep the directory structure. + +(Alternatively, you can extract only the +neccesary files: +-myEmulators.dll to plugins\windows folder, +-myEmulators.xml to current skin folder. +-myEmulators_logo.png to the Media folder +in current skin folder +-hover_myEmulators.png to the same folder). + +USAGE +-------------------------------------------- +Before first use, enter Mediaportal configur- +ation and activate and setup the plugin. In +the setup, you should enter a path to the +emulator that is to load the ROMs, a folder +where all the ROMs are stored, and a name +and filter for which files will be shown. +When you run the plugin in Media Portal you +will be presented with a list of the ROMs. +By pressing a ROM, that one is loaded in +the correct emulator. + +Whenever something is changed in the setup, +a star in the title bar appears. After pres- +sing Apply, the ROM database will be updated. +This tab makes it easy to edit the name of +the games shown in MP all well as other +fields, such as a grade and description. + +TRANSLATION +-------------------------------------------- +To translate myEmulators into another lang- +uage, create a file named myEmulators.txt +in the appropriate dir in Mediaportal\ +language. The file MUST contain the fol- +lowing lines: + +Line 1 - View: List +Line 2 - View: Large Icons +Line 3 - View: Icons +Line 4 - Most played +Line 5 - Recently played +Line 6 - Top graded + +Note that the setup is not translated, only +the buttons in the main program. + +============================================ + +Christer Carlsund +www.carlsund.se, chr...@ho... \ No newline at end of file Modified: trunk/plugins/MyEmulators/myEmulators/Class1.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/Class1.cs 2007-05-06 15:08:52 UTC (rev 381) +++ trunk/plugins/MyEmulators/myEmulators/Class1.cs 2007-05-06 18:24:35 UTC (rev 382) @@ -18,6 +18,8 @@ private int indexOfEmulator; //To compare with the current marked private int previouslySelectedIndex; + //Translation strings + private String[] translation = { "View: List", "View: Large Icons", "View: Icons", "Most played", "Recently played", "Top graded" }; //The emulator/rom list control [SkinControlAttribute(50)] protected GUIFacadeControl lstEmulators = null; //The buttons in the menu to the left @@ -128,6 +130,22 @@ } _autoHideTopbar = true; _autoHideTopbarType = AutoHideTopBar.Yes; + //Loads the translation strings + try + { + if (Options.getStringOption("language") != "English") + { + StreamReader translationFile = new StreamReader("language\\" + Options.getStringOption("language") + "\\myEmulators.txt"); + for (int i = 0; i < 6; i++) + { + String line = translationFile.ReadLine(); + if (line == null) { break; } + translation[i] = line; + } + translationFile.Close(); + } + } + catch (Exception) { } //Loads the skin return Load(GUIGraphicsContext.Skin+@"\myEmulators.xml"); } @@ -141,12 +159,15 @@ displayStars(0); text_description.Label = String.Empty; + button_mostPlayed.Label = translation[3]; + button_recentlyPlayed.Label = translation[4]; + button_topGraded.Label = translation[5]; switch (Options.getIntOption("default_view")) { - case (0): { lstEmulators.View = GUIFacadeControl.ViewMode.LargeIcons; button_viewAs.Label = "View: Large Icons"; break; } - case (1): { lstEmulators.View = GUIFacadeControl.ViewMode.SmallIcons; button_viewAs.Label = "View: Icons"; break; } - case (2): { lstEmulators.View = GUIFacadeControl.ViewMode.List; button_viewAs.Label = "View: List"; break; } + case (0): { lstEmulators.View = GUIFacadeControl.ViewMode.LargeIcons; button_viewAs.Label = translation[1]; break; } + case (1): { lstEmulators.View = GUIFacadeControl.ViewMode.SmallIcons; button_viewAs.Label = translation[2]; break; } + case (2): { lstEmulators.View = GUIFacadeControl.ViewMode.List; button_viewAs.Label = translation[0]; break; } } if (lstEmulators == null) { @@ -324,9 +345,9 @@ indexOfEmulator = ((GUIFacadeControl)control).SelectedListItemIndex; switch (emulators[indexOfEmulator].View) { - case (0): { lstEmulators.View = GUIFacadeControl.ViewMode.LargeIcons; button_viewAs.Label = "View: Large Icons"; break; } - case (1): { lstEmulators.View = GUIFacadeControl.ViewMode.SmallIcons; button_viewAs.Label = "View: Icons"; break; } - case (2): { lstEmulators.View = GUIFacadeControl.ViewMode.List; button_viewAs.Label = "View: List"; break; } + case (0): { lstEmulators.View = GUIFacadeControl.ViewMode.LargeIcons; button_viewAs.Label = translation[1]; break; } + case (1): { lstEmulators.View = GUIFacadeControl.ViewMode.SmallIcons; button_viewAs.Label = translation[2]; break; } + case (2): { lstEmulators.View = GUIFacadeControl.ViewMode.List; button_viewAs.Label = translation[0]; break; } } isInFolder = true; //Fills the list with files from the directory @@ -340,7 +361,7 @@ { case (GUIFacadeControl.ViewMode.LargeIcons): { - button_viewAs.Label = "View: Icons"; + button_viewAs.Label = translation[2]; lstEmulators.View = GUIFacadeControl.ViewMode.SmallIcons; if (!isInFolder) { @@ -357,7 +378,7 @@ } case (GUIFacadeControl.ViewMode.SmallIcons): { - button_viewAs.Label = "View: List"; + button_viewAs.Label = translation[0]; lstEmulators.View = GUIFacadeControl.ViewMode.List; if (!isInFolder) { @@ -374,7 +395,7 @@ } case (GUIFacadeControl.ViewMode.List): { - button_viewAs.Label = "View: Large Icons"; + button_viewAs.Label = translation[1]; lstEmulators.View = GUIFacadeControl.ViewMode.LargeIcons; if (!isInFolder) { @@ -421,7 +442,7 @@ emulators[i].readROMs(); } } - button_viewAs.Label = "View: List"; + button_viewAs.Label = translation[0]; lstEmulators.View = GUIFacadeControl.ViewMode.List; } else Modified: trunk/plugins/MyEmulators/myEmulators/DB.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/DB.cs 2007-05-06 15:08:52 UTC (rev 381) +++ trunk/plugins/MyEmulators/myEmulators/DB.cs 2007-05-06 18:24:35 UTC (rev 382) @@ -34,7 +34,7 @@ } //TODO: REMEMBER to put the correct version number! - private static int current_version = 151; + private static int current_version = 160; public static void launch() { @@ -66,6 +66,7 @@ Options.addBoolOption("setup_maximized", "False"); Options.addBoolOption("display_stars", "True"); Options.addBoolOption("display_desc", "True"); + Options.addStringOption("language", "English"); //Updates to correct version of DB if (Options.getIntOption("version") <= 102) Modified: trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs 2007-05-06 15:08:52 UTC (rev 381) +++ trunk/plugins/MyEmulators/myEmulators/setupForm.Designer.cs 2007-05-06 18:24:35 UTC (rev 382) @@ -48,13 +48,15 @@ this.Dateplayed = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ROM_DB_List_Description = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabPage3 = new System.Windows.Forms.TabPage(); + this.display_desc = new System.Windows.Forms.CheckBox(); + this.display_stars = new System.Windows.Forms.CheckBox(); this.shown_name = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.shutdownonload = new System.Windows.Forms.CheckBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.apply = new System.Windows.Forms.Button(); - this.display_stars = new System.Windows.Forms.CheckBox(); - this.display_desc = new System.Windows.Forms.CheckBox(); + this.label3 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -242,6 +244,8 @@ // // tabPage3 // + this.tabPage3.Controls.Add(this.comboBox1); + this.tabPage3.Controls.Add(this.label3); this.tabPage3.Controls.Add(this.display_desc); this.tabPage3.Controls.Add(this.display_stars); this.tabPage3.Controls.Add(this.shown_name); @@ -255,6 +259,26 @@ this.tabPage3.Text = "Options"; this.tabPage3.UseVisualStyleBackColor = true; // + // display_desc + // + this.display_desc.AutoSize = true; + this.display_desc.Location = new System.Drawing.Point(8, 89); + this.display_desc.Name = "display_desc"; + this.display_desc.Size = new System.Drawing.Size(212, 17); + this.display_desc.TabIndex = 7; + this.display_desc.Text = "Display ROM description in MediaPortal"; + this.display_desc.UseVisualStyleBackColor = true; + // + // display_stars + // + this.display_stars.AutoSize = true; + this.display_stars.Location = new System.Drawing.Point(8, 62); + this.display_stars.Name = "display_stars"; + this.display_stars.Size = new System.Drawing.Size(188, 17); + this.display_stars.TabIndex = 6; + this.display_stars.Text = "Display ROM grade in MediaPortal"; + this.display_stars.UseVisualStyleBackColor = true; + // // shown_name // this.shown_name.Location = new System.Drawing.Point(156, 32); @@ -304,25 +328,24 @@ this.apply.UseVisualStyleBackColor = true; this.apply.Click += new System.EventHandler(this.apply_Click); // - // display_stars + // label3 // - this.display_stars.AutoSize = true; - this.display_stars.Location = new System.Drawing.Point(8, 62); - this.display_stars.Name = "display_stars"; - this.display_stars.Size = new System.Drawing.Size(188, 17); - this.display_stars.TabIndex = 6; - this.display_stars.Text = "Display ROM grade in MediaPortal"; - this.display_stars.UseVisualStyleBackColor = true; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(8, 116); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(58, 13); + this.label3.TabIndex = 8; + this.label3.Text = "Language:"; // - // display_desc + // comboBox1 // - this.display_desc.AutoSize = true; - this.display_desc.Location = new System.Drawing.Point(8, 89); - this.display_desc.Name = "display_desc"; - this.display_desc.Size = new System.Drawing.Size(212, 17); - this.display_desc.TabIndex = 7; - this.display_desc.Text = "Display ROM description in MediaPortal"; - this.display_desc.UseVisualStyleBackColor = true; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "English (default)"}); + this.comboBox1.Location = new System.Drawing.Point(72, 112); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(121, 21); + this.comboBox1.TabIndex = 9; // // setupForm // @@ -380,5 +403,7 @@ private System.Windows.Forms.CheckBox display_desc; private System.Windows.Forms.CheckBox display_stars; private static System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox comboBox1; } } \ No newline at end of file Modified: trunk/plugins/MyEmulators/myEmulators/setupForm.cs =================================================================== --- trunk/plugins/MyEmulators/myEmulators/setupForm.cs 2007-05-06 15:08:52 UTC (rev 381) +++ trunk/plugins/MyEmulators/myEmulators/setupForm.cs 2007-05-06 18:24:35 UTC (rev 382) @@ -5,6 +5,7 @@ using System.Drawing; using System.Text; using System.Windows.Forms; +using System.IO; namespace myEmulators { @@ -41,6 +42,15 @@ Options.updateStringOption("shown_name", shown_name.Text); Options.updateBoolOption("display_stars", display_stars.Checked); Options.updateBoolOption("display_desc", display_desc.Checked); + //Save language + if (comboBox1.SelectedIndex != 0) + { + Options.updateStringOption("language", comboBox1.SelectedItem.ToString()); + } + else + { + Options.updateStringOption("language", "English"); + } DB.saveOptions(); //Save emulators @@ -147,6 +157,35 @@ shown_name.Text = Options.getStringOption("shown_name"); display_stars.Checked = Options.getBoolOption("display_stars"); display_desc.Checked = Options.getBoolOption("display_desc"); + //Load language + try + { + String[] langDirs = Directory.GetDirectories("language"); + for (int i = 0; i < langDirs.Length; i++) + { + String[] files = Directory.GetFiles(langDirs[i]); + for (int a = 0; a < files.Length; a++) + { + if (files[a].Substring(files[a].LastIndexOf("\\")+1) == "myEmulators.txt") + { + comboBox1.Items.Add(langDirs[i].Substring(langDirs[i].LastIndexOf("\\")+1)); + } + } + } + } + catch (Exception) { } + comboBox1.SelectedIndex = 0; //Default-English + if (comboBox1.Items.Count > 1 && Options.getStringOption("language") != "English") + { + for (int i = 1; i < comboBox1.Items.Count; i++) //Skip first, since it is English + { + if (comboBox1.Items[i].ToString() == Options.getStringOption("language")) + { + comboBox1.SelectedIndex = i; + break; + } + } + } //Load remembered window setting if (Options.getBoolOption("setup_maximized") == true) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |