From: <che...@us...> - 2007-11-04 18:09:43
|
Revision: 1026 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1026&view=rev Author: chef_koch Date: 2007-11-04 10:09:40 -0800 (Sun, 04 Nov 2007) Log Message: ----------- changed: remember last used application is now optional sleepTime and pluginTitle are stored now in xml, not in db anymore Modified Paths: -------------- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs trunk/plugins/myGUIProgramsAlt/README.txt trunk/plugins/myGUIProgramsAlt/myProgramsAlt.xmp Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs 2007-11-04 18:06:02 UTC (rev 1025) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.Designer.cs 2007-11-04 18:09:40 UTC (rev 1026) @@ -38,6 +38,7 @@ this.sleepTimeLabel = new System.Windows.Forms.Label(); this.sleepTimeResetButton = new System.Windows.Forms.Button(); this.sleepTimeNumericUpDown = new System.Windows.Forms.NumericUpDown(); + this.checkBoxRememberLastApp = new System.Windows.Forms.CheckBox(); this.titleGroupBox.SuspendLayout(); this.groupBoxThumbs.SuspendLayout(); this.sleepTimeGroupBox.SuspendLayout(); @@ -51,7 +52,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, 20); + this.titleTextBox.Size = new System.Drawing.Size(316, 21); this.titleTextBox.TabIndex = 46; // // titleLabel @@ -59,7 +60,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(30, 13); + this.titleLabel.Size = new System.Drawing.Size(31, 13); this.titleLabel.TabIndex = 45; this.titleLabel.Text = "Title:"; this.titleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -69,7 +70,7 @@ this.checkBoxUseThumbsDir.AutoSize = true; this.checkBoxUseThumbsDir.Location = new System.Drawing.Point(9, 20); this.checkBoxUseThumbsDir.Name = "checkBoxUseThumbsDir"; - this.checkBoxUseThumbsDir.Size = new System.Drawing.Size(182, 17); + this.checkBoxUseThumbsDir.Size = new System.Drawing.Size(189, 17); this.checkBoxUseThumbsDir.TabIndex = 44; this.checkBoxUseThumbsDir.Text = "Only use default thumbs directory"; this.checkBoxUseThumbsDir.UseVisualStyleBackColor = true; @@ -128,7 +129,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(66, 13); + this.sleepTimeLabel.Size = new System.Drawing.Size(68, 13); this.sleepTimeLabel.TabIndex = 2; this.sleepTimeLabel.Text = "Time (in ms):"; // @@ -159,7 +160,7 @@ 0, 0}); this.sleepTimeNumericUpDown.Name = "sleepTimeNumericUpDown"; - this.sleepTimeNumericUpDown.Size = new System.Drawing.Size(316, 20); + this.sleepTimeNumericUpDown.Size = new System.Drawing.Size(316, 21); this.sleepTimeNumericUpDown.TabIndex = 0; this.sleepTimeNumericUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.sleepTimeNumericUpDown.Value = new decimal(new int[] { @@ -168,10 +169,21 @@ 0, 0}); // + // checkBoxRememberLastApp + // + this.checkBoxRememberLastApp.AutoSize = true; + this.checkBoxRememberLastApp.Location = new System.Drawing.Point(12, 198); + this.checkBoxRememberLastApp.Name = "checkBoxRememberLastApp"; + this.checkBoxRememberLastApp.Size = new System.Drawing.Size(175, 17); + this.checkBoxRememberLastApp.TabIndex = 50; + this.checkBoxRememberLastApp.Text = "remember last used Application"; + this.checkBoxRememberLastApp.UseVisualStyleBackColor = true; + // // SettingsRoot // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.checkBoxRememberLastApp); this.Controls.Add(this.sleepTimeGroupBox); this.Controls.Add(this.groupBoxThumbs); this.Controls.Add(this.titleGroupBox); @@ -184,6 +196,7 @@ this.sleepTimeGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.sleepTimeNumericUpDown)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -199,5 +212,6 @@ private System.Windows.Forms.Button sleepTimeResetButton; private System.Windows.Forms.NumericUpDown sleepTimeNumericUpDown; private System.Windows.Forms.Button titleResetButton; + private System.Windows.Forms.CheckBox checkBoxRememberLastApp; } } \ No newline at end of file Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs 2007-11-04 18:06:02 UTC (rev 1025) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/Design/SettingsRoot.cs 2007-11-04 18:09:40 UTC (rev 1026) @@ -34,6 +34,8 @@ using GUIProgramsAlt; using GUIProgramsAlt.Items; using GUIProgramsAlt.Database; +using MediaPortal.Profile; +using MediaPortal.Configuration; namespace GUIProgramsAlt.Design { @@ -52,19 +54,16 @@ { base.LoadSettings(curApp); - // plugin title - titleTextBox.Text = dbHandlerInstance.ReadSetting(ProgramUtils.cPLUGINTITLE); - if (titleTextBox.Text == "") - { - titleTextBox.Text = ProgramUtils.cDefaultPluginTitle; - } - - // sleep time - sleepTimeNumericUpDown.Value = ProgramUtils.GetSleepTime(); - // use mp thumbs dir checkBoxUseThumbsDir.Checked = ProgramUtils.UseThumbsDir(); + using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + titleTextBox.Text = xmlreader.GetValueAsString("myProgramsAlt", "PluginTitle", ProgramUtils.cDefaultPluginTitle); + sleepTimeNumericUpDown.Value = xmlreader.GetValueAsInt("myProgramsAlt", "slideSpeed", ProgramUtils.cDefaultSleepTime); + checkBoxRememberLastApp.Checked = xmlreader.GetValueAsBool("myProgramsAlt", "rememberLastApp", false); + } + loaded = true; } @@ -74,17 +73,12 @@ base.SaveSettings(curApp); - // plugin title - if (titleTextBox.Text == ProgramUtils.cDefaultPluginTitle || titleTextBox.Text == "") - dbHandlerInstance.DeleteSetting(ProgramUtils.cPLUGINTITLE); - else - dbHandlerInstance.WriteSetting(ProgramUtils.cPLUGINTITLE, titleTextBox.Text); - - // sleep time - dbHandlerInstance.WriteSetting(ProgramUtils.cSLIDESPEED, sleepTimeNumericUpDown.Value.ToString()); - - // use mp thumbs dir - dbHandlerInstance.WriteSetting(ProgramUtils.cUSE_MP_THUMBS_DIR, checkBoxUseThumbsDir.Checked.ToString()); + using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValue("myProgramsAlt", "PluginTitle", titleTextBox.Text); + xmlwriter.SetValue("myProgramsAlt", "slideSpeed", sleepTimeNumericUpDown.Value); + xmlwriter.SetValueAsBool("myProgramsAlt", "rememberLastApp", checkBoxRememberLastApp.Checked); + } } Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-11-04 18:06:02 UTC (rev 1025) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/GUIProgramsAlt.cs 2007-11-04 18:09:40 UTC (rev 1026) @@ -67,7 +67,12 @@ ProgramViewHandler viewHandler = ProgramViewHandler.Instance; List<ApplicationItem> globalApplicationList;// dbHandlerInstance.ApplicationItemList; - int slideSpeed = 3000; // speed in milliseconds between two slides + //settings begin + static string pluginTitle = string.Empty; + static int slideSpeed = 3000; // speed in milliseconds between two slides + static bool rememberLastApp = false; + //settings end + long slideTime = 0; static string _thumbnailPath = string.Empty; static string _lastThumbnailPath = string.Empty; @@ -258,10 +263,12 @@ void LoadSettings() { - slideSpeed = ProgramUtils.GetSleepTime(); - using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { + pluginTitle = xmlreader.GetValueAsString("myProgramsAlt", "PluginTitle", ProgramUtils.cDefaultPluginTitle); + slideSpeed = xmlreader.GetValueAsInt("myProgramsAlt", "slideSpeed", 3000); + rememberLastApp = xmlreader.GetValueAsBool("myProgramsAlt", "rememberLastApp", false); + CurrentSortMethod = (ProgramSort.SortMethod)xmlreader.GetValueAsInt("myProgramsAlt", "sortMethod", (int)ProgramSort.SortMethod.Title); CurrentLayout = (Layout)xmlreader.GetValueAsInt("myProgramsAlt", "viewLayout", (int)Layout.List); @@ -269,7 +276,10 @@ {//create a fake tmpappitem so it's not null currentApplicationItem = new ApplicationItemGrouper(); } - currentApplicationItem.ApplicationItemId = xmlreader.GetValueAsInt("myProgramsAlt", "applicationItemId", -1); + if (rememberLastApp) + currentApplicationItem.ApplicationItemId = xmlreader.GetValueAsInt("myProgramsAlt", "applicationItemId", -1); + else + currentApplicationItem.ApplicationItemId = -1; ViewHandler.CurrentLevel = xmlreader.GetValueAsInt("myProgramsAlt", "lastViewLevel", -1); CurrentSortAsc = xmlreader.GetValueAsBool("myProgramsAlt", "sortASC", true); @@ -318,15 +328,7 @@ } else { - string strText = dbHandlerInstance.ReadSetting(ProgramUtils.cPLUGINTITLE); - if ((strText != "") && (strText != null)) - { - GUIPropertyManager.SetProperty("#curheader", strText); - } - else - { - GUIPropertyManager.SetProperty("#curheader", GUILocalizeStrings.Get(0)); - } + GUIPropertyManager.SetProperty("#curheader", pluginTitle); } btnViewAs.Label = GetViewLayoutAsText(); @@ -1112,16 +1114,10 @@ /// 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)) + using (Settings xmlreader = new Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { - strButtonText = strText; + strButtonText = xmlreader.GetValueAsString("myProgramsAlt", "PluginTitle", ProgramUtils.cDefaultPluginTitle); } - else - { - strButtonText = ProgramUtils.cDefaultPluginTitle; - } - strButtonImage = ""; strButtonImageFocus = ""; strPictureImage = ""; Modified: trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs =================================================================== --- trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-11-04 18:06:02 UTC (rev 1025) +++ trunk/plugins/myGUIProgramsAlt/GUIProgramsAlt/ProgramUtils.cs 2007-11-04 18:09:40 UTC (rev 1026) @@ -135,8 +135,6 @@ public const string cGAMEBASE = "GAMEBASE"; // Settings - public const string cPLUGINTITLE = "PLUGINTITLE"; - public const string cSLIDESPEED = "SLIDESPEED"; public const string cUSE_MP_THUMBS_DIR = "USE_MP_THUMBS_DIR"; @@ -422,16 +420,6 @@ #region Thumb/Image stuff - public static int GetSleepTime() - { - int sleepTime; - - if (int.TryParse(DatabaseHandler.DBHandlerInstance.ReadSetting(ProgramUtils.cSLIDESPEED), out sleepTime)) - return sleepTime; - else - return cDefaultSleepTime; - } - public static bool UseThumbsDir() { bool useThumbsDir; Modified: trunk/plugins/myGUIProgramsAlt/README.txt =================================================================== --- trunk/plugins/myGUIProgramsAlt/README.txt 2007-11-04 18:06:02 UTC (rev 1025) +++ trunk/plugins/myGUIProgramsAlt/README.txt 2007-11-04 18:09:40 UTC (rev 1026) @@ -30,6 +30,7 @@ --------------- -- ChangeLog -- --------------- +2007-11-04: chefkoch : changed: remember last used application is now optional 2007-11-04: chefkoch : plugin is distributed as MPI package from now on 2007-11-04: chefkoch : changed: plugin uses now it's own WindowsIDs (not Window.Files anymore) to prevent problems with old MyPrograms PluginName 2007-11-04: chefkoch : fixed: if default title "My Programs Alt." was used, "My Programs" was displayed in GUI @@ -39,10 +40,6 @@ 2007-10-09: chefkoch : fixed navigation in bluetwo skin file - - - - ---------------- -- more infos -- ---------------- @@ -86,7 +83,7 @@ -Change graphics for fileinfobackground (it says mymovies...) BUGS: - - When starting the configuration and the "myProgramsAltPreconfiguration.xml" is missing, it will throw an exception. +[fixed] When starting the configuration and the "myProgramsAltPreconfiguration.xml" is missing, it will throw an exception. - Exception when opening the plugin in GUI, something with currentapplication == null, catched it with try{}catch{}-statement Modified: trunk/plugins/myGUIProgramsAlt/myProgramsAlt.xmp =================================================================== --- trunk/plugins/myGUIProgramsAlt/myProgramsAlt.xmp 2007-11-04 18:06:02 UTC (rev 1025) +++ trunk/plugins/myGUIProgramsAlt/myProgramsAlt.xmp 2007-11-04 18:09:40 UTC (rev 1026) @@ -8,7 +8,7 @@ <Source>GUIProgramsAlt\bin\Release\GUIProgramsAlt.dll</Source> <Id>01010</Id> <Option /> - <Guid>591a053f-dbfd-42d5-8662-3e506d59c7fc</Guid> + <Guid>71910bfb-9ee2-445d-9c76-b93aba6bced3</Guid> </File> <File> <FileName>myProgramsAlt.xml</FileName> @@ -17,7 +17,7 @@ <Source>GUIProgramsAlt\skin\BlueTwo\myProgramsAlt.xml</Source> <Id>02010</Id> <Option>OutputFileName=|DefaultFile=True|</Option> - <Guid>46a7fbc9-a28e-47a1-a27b-fab318f79c05</Guid> + <Guid>062d6b00-83c7-4876-8f0b-debb2bed6c5b</Guid> </File> <File> <FileName>myProgramsAltFileInfo.xml</FileName> @@ -26,7 +26,7 @@ <Source>GUIProgramsAlt\skin\BlueTwo\myProgramsAltFileInfo.xml</Source> <Id>02010</Id> <Option>OutputFileName=|DefaultFile=True|</Option> - <Guid>1fa8dd2b-5119-4363-8600-c0a89858cd02</Guid> + <Guid>7dde964f-674f-4b41-923e-cb2c5d00c12c</Guid> </File> <File> <FileName>myProgramsAltPreconfiguration.xml</FileName> @@ -35,7 +35,7 @@ <Source>GUIProgramsAlt\MetaData\myProgramsAltPreconfiguration.xml</Source> <Id>02010</Id> <Option /> - <Guid>6b4a0879-a870-42c0-8c81-ca997efa4825</Guid> + <Guid>da68b967-88fd-4509-b0d1-16a9f6c435ab</Guid> </File> <File> <FileName>README.txt</FileName> @@ -44,7 +44,7 @@ <Source>README.txt</Source> <Id>04010</Id> <Option>OutputFileName=MyPrograms2_ReadMe|DefaultFile=False|</Option> - <Guid>475f4b9d-b611-437e-8214-4a48afcdf6c6</Guid> + <Guid>418d38f1-3fb9-4d12-b190-d9e4315f6f3a</Guid> </File> <File> <FileName>System.Data.SQLite.DLL</FileName> @@ -53,7 +53,7 @@ <Source>GUIProgramsAlt\bin\Release\System.Data.SQLite.DLL</Source> <Id>04010</Id> <Option /> - <Guid>b6192c05-5345-407e-8410-33b26a2513f6</Guid> + <Guid>b4d409d8-4fbd-43f3-81d7-5062f19ee48a</Guid> </File> </FileList> <StringList /> @@ -68,7 +68,7 @@ <ProiectName>MyPrograms2</ProiectName> <Author>chefkoch,northern</Author> <UpdateURL>http://www.team-mediaportal.com</UpdateURL> - <Version>0.1.0.8</Version> + <Version>0.1.0.9</Version> <Description>myprograms2 is a complete rewrite of weabeard's MyPrograms plugin. it's able to start apps and games.</Description> <Group>Games</Group> <Release>Test</Release> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |