OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 7 May 2009 20:29:25 +0000 (20:29 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 7 May 2009 20:29:25 +0000 (20:29 +0000)
- Built-in presets get automatically re-generated if a newer build number is detected. This is required since the installer no longer installs presets. (overwrite older versions on install of new version) (As of a few builds ago, presets are automatically generated on first launch)

git-svn-id: svn://localhost/HandBrake/trunk@2399 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Presets/PresetsHandler.cs
win/C#/Presets/preset.cs
win/C#/frmMain.Designer.cs

index 064d4f3..cbd6545 100644 (file)
@@ -12,7 +12,7 @@ namespace Handbrake.Presets
 {\r
     public class PresetsHandler\r
     {\r
-        List<Preset> presets = new List<Preset>();  \r
+        List<Preset> presets = new List<Preset>();\r
         List<Preset> user_presets = new List<Preset>();\r
         private static readonly XmlSerializer ser = new XmlSerializer(typeof(List<Preset>));\r
         String userPresetFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\user_presets.xml";\r
@@ -28,7 +28,7 @@ namespace Handbrake.Presets
         {\r
             if (checkIfPresetExists(presetName) == false)\r
             {\r
-                Preset newPreset = new Preset { Name = presetName, Query = query, PictureSettings = pictureSettings };\r
+                Preset newPreset = new Preset { Name = presetName, Query = query, PictureSettings = pictureSettings, Version = Properties.Settings.Default.hb_version};\r
                 user_presets.Add(newPreset);\r
                 updateUserPresetsFile();\r
                 return true;\r
@@ -138,7 +138,7 @@ namespace Handbrake.Presets
             // Clear the current built in presets and now parse the tempory presets file.\r
             presets.Clear();\r
             string filePath = Path.Combine(Path.GetTempPath(), "temp_presets.dat");\r
-            \r
+\r
             if (File.Exists(filePath))\r
             {\r
                 StreamReader presetInput = new StreamReader(filePath);\r
@@ -180,7 +180,8 @@ namespace Handbrake.Presets
                                                    Category = category,\r
                                                    TopCategory = level_1_category,\r
                                                    Name = presetName[0].Replace("+", "").Trim(),\r
-                                                   Query = presetName[2]\r
+                                                   Query = presetName[2],\r
+                                                   Version = Properties.Settings.Default.hb_version\r
                                                };\r
                         presets.Add(newPreset);\r
                     }\r
@@ -219,6 +220,11 @@ namespace Handbrake.Presets
                 }\r
             }\r
 \r
+            // Update built-in presets if the built-in presets belong to an older version.\r
+            if (presets.Count != 0)\r
+                if (presets[0].Version != Properties.Settings.Default.hb_version)\r
+                    updateBuiltInPresets();\r
+\r
             // Load in the users presets from user_presets.xml\r
 \r
             if (File.Exists(userPresetFile))\r
@@ -290,7 +296,7 @@ namespace Handbrake.Presets
             foreach (Preset preset in user_presets)\r
             {\r
                 TreeNode preset_treeview = new TreeNode(preset.Name) { ForeColor = Color.Black };\r
-                presetPanel.Nodes.Add(preset_treeview);  \r
+                presetPanel.Nodes.Add(preset_treeview);\r
             }\r
         }\r
 \r
index 2a54d44..8582379 100644 (file)
@@ -33,5 +33,10 @@ namespace Handbrake.Presets
         /// Get or set the usage of Picture Settings in presets.\r
         /// </summary>\r
         public Boolean PictureSettings { get; set; }\r
+\r
+        /// <summary>\r
+        /// The version number which associates this preset with a HB build\r
+        /// </summary>\r
+        public string Version { get; set; }\r
     }\r
 }
\ No newline at end of file
index b03d929..6cab7ba 100644 (file)
@@ -75,6 +75,7 @@ namespace Handbrake
             this.check_customCrop = new System.Windows.Forms.RadioButton();\r
             this.check_autoCrop = new System.Windows.Forms.RadioButton();\r
             this.text_source = new System.Windows.Forms.TextBox();\r
+            this.drop_angle = new System.Windows.Forms.ComboBox();\r
             this.lbl_src_res = new System.Windows.Forms.Label();\r
             this.lbl_duration = new System.Windows.Forms.Label();\r
             this.label_duration = new System.Windows.Forms.Label();\r
@@ -109,6 +110,7 @@ namespace Handbrake
             this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
             this.mnu_qptest = new System.Windows.Forms.ToolStripMenuItem();\r
             this.gb_source = new System.Windows.Forms.GroupBox();\r
+            this.label4 = new System.Windows.Forms.Label();\r
             this.Label13 = new System.Windows.Forms.Label();\r
             this.Label17 = new System.Windows.Forms.Label();\r
             this.Label9 = new System.Windows.Forms.Label();\r
@@ -136,8 +138,6 @@ namespace Handbrake
             this.lbl_drc = new System.Windows.Forms.Label();\r
             this.label16 = new System.Windows.Forms.Label();\r
             this.tb_drc = new System.Windows.Forms.TrackBar();\r
-            this.groupBox5 = new System.Windows.Forms.GroupBox();\r
-            this.groupBox3 = new System.Windows.Forms.GroupBox();\r
             this.label68 = new System.Windows.Forms.Label();\r
             this.label67 = new System.Windows.Forms.Label();\r
             this.label66 = new System.Windows.Forms.Label();\r
@@ -183,9 +183,14 @@ namespace Handbrake
             this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox();\r
             this.tabs_panel = new System.Windows.Forms.TabControl();\r
             this.tab_Filters = new System.Windows.Forms.TabPage();\r
+            this.ctl_deinterlace = new Handbrake.Deinterlace();\r
+            this.ctl_denoise = new Handbrake.Denoise();\r
+            this.ctl_decomb = new Handbrake.Decomb();\r
+            this.ctl_detelecine = new Handbrake.Detelecine();\r
             this.tab_chapters = new System.Windows.Forms.TabPage();\r
             this.label31 = new System.Windows.Forms.Label();\r
             this.h264Tab = new System.Windows.Forms.TabPage();\r
+            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             this.tab_query = new System.Windows.Forms.TabPage();\r
             this.btn_clear = new System.Windows.Forms.Button();\r
             this.label34 = new System.Windows.Forms.Label();\r
@@ -220,13 +225,6 @@ namespace Handbrake
             this.StatusStrip = new System.Windows.Forms.StatusStrip();\r
             this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel();\r
             this.hbproc = new System.Diagnostics.Process();\r
-            this.drop_angle = new System.Windows.Forms.ComboBox();\r
-            this.label4 = new System.Windows.Forms.Label();\r
-            this.ctl_deinterlace = new Handbrake.Deinterlace();\r
-            this.ctl_denoise = new Handbrake.Denoise();\r
-            this.ctl_decomb = new Handbrake.Decomb();\r
-            this.ctl_detelecine = new Handbrake.Detelecine();\r
-            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
             notifyIconMenu.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();\r
@@ -716,6 +714,17 @@ namespace Handbrake
             this.text_source.Text = "Click \'Source\' to continue";\r
             this.ToolTip.SetToolTip(this.text_source, "Location of the source input file, folder or dvd.");\r
             // \r
+            // drop_angle\r
+            // \r
+            this.drop_angle.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.drop_angle.FormattingEnabled = true;\r
+            this.drop_angle.Location = new System.Drawing.Point(250, 52);\r
+            this.drop_angle.Name = "drop_angle";\r
+            this.drop_angle.Size = new System.Drawing.Size(45, 21);\r
+            this.drop_angle.TabIndex = 45;\r
+            this.drop_angle.Text = "1";\r
+            this.ToolTip.SetToolTip(this.drop_angle, "Select the chapter range you would like to enocde. (default: All Chapters)");\r
+            // \r
             // lbl_src_res\r
             // \r
             this.lbl_src_res.AutoSize = true;\r
@@ -1009,6 +1018,17 @@ namespace Handbrake
             this.gb_source.TabStop = false;\r
             this.gb_source.Text = "Source";\r
             // \r
+            // label4\r
+            // \r
+            this.label4.AutoSize = true;\r
+            this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label4.ForeColor = System.Drawing.Color.Black;\r
+            this.label4.Location = new System.Drawing.Point(200, 55);\r
+            this.label4.Name = "label4";\r
+            this.label4.Size = new System.Drawing.Size(44, 13);\r
+            this.label4.TabIndex = 44;\r
+            this.label4.Text = "Angle:";\r
+            // \r
             // Label13\r
             // \r
             this.Label13.AutoSize = true;\r
@@ -1110,8 +1130,6 @@ namespace Handbrake
             this.TabPage2.Controls.Add(this.lbl_drc);\r
             this.TabPage2.Controls.Add(this.label16);\r
             this.TabPage2.Controls.Add(this.tb_drc);\r
-            this.TabPage2.Controls.Add(this.groupBox5);\r
-            this.TabPage2.Controls.Add(this.groupBox3);\r
             this.TabPage2.Controls.Add(this.label68);\r
             this.TabPage2.Controls.Add(this.label67);\r
             this.TabPage2.Controls.Add(this.label66);\r
@@ -1291,22 +1309,6 @@ namespace Handbrake
             this.tb_drc.TickFrequency = 10;\r
             this.tb_drc.ValueChanged += new System.EventHandler(this.tb_drc_Scroll);\r
             // \r
-            // groupBox5\r
-            // \r
-            this.groupBox5.Location = new System.Drawing.Point(107, 13);\r
-            this.groupBox5.Name = "groupBox5";\r
-            this.groupBox5.Size = new System.Drawing.Size(577, 10);\r
-            this.groupBox5.TabIndex = 1;\r
-            this.groupBox5.TabStop = false;\r
-            // \r
-            // groupBox3\r
-            // \r
-            this.groupBox3.Location = new System.Drawing.Point(83, 260);\r
-            this.groupBox3.Name = "groupBox3";\r
-            this.groupBox3.Size = new System.Drawing.Size(601, 10);\r
-            this.groupBox3.TabIndex = 41;\r
-            this.groupBox3.TabStop = false;\r
-            // \r
             // label68\r
             // \r
             this.label68.AutoSize = true;\r
@@ -1875,6 +1877,48 @@ namespace Handbrake
             this.tab_Filters.Text = "Video Filters";\r
             this.tab_Filters.UseVisualStyleBackColor = true;\r
             // \r
+            // ctl_deinterlace\r
+            // \r
+            this.ctl_deinterlace.AutoSize = true;\r
+            this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95);\r
+            this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_deinterlace.Name = "ctl_deinterlace";\r
+            this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_deinterlace.TabIndex = 41;\r
+            this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed);\r
+            // \r
+            // ctl_denoise\r
+            // \r
+            this.ctl_denoise.AutoSize = true;\r
+            this.ctl_denoise.Location = new System.Drawing.Point(19, 123);\r
+            this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_denoise.Name = "ctl_denoise";\r
+            this.ctl_denoise.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_denoise.TabIndex = 40;\r
+            // \r
+            // ctl_decomb\r
+            // \r
+            this.ctl_decomb.AutoSize = true;\r
+            this.ctl_decomb.Location = new System.Drawing.Point(19, 66);\r
+            this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_decomb.Name = "ctl_decomb";\r
+            this.ctl_decomb.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_decomb.TabIndex = 39;\r
+            this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed);\r
+            // \r
+            // ctl_detelecine\r
+            // \r
+            this.ctl_detelecine.AutoSize = true;\r
+            this.ctl_detelecine.Location = new System.Drawing.Point(19, 38);\r
+            this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0);\r
+            this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30);\r
+            this.ctl_detelecine.Name = "ctl_detelecine";\r
+            this.ctl_detelecine.Size = new System.Drawing.Size(275, 28);\r
+            this.ctl_detelecine.TabIndex = 38;\r
+            // \r
             // tab_chapters\r
             // \r
             this.tab_chapters.BackColor = System.Drawing.Color.Transparent;\r
@@ -1912,6 +1956,14 @@ namespace Handbrake
             this.h264Tab.Text = "Advanced";\r
             this.h264Tab.UseVisualStyleBackColor = true;\r
             // \r
+            // x264Panel\r
+            // \r
+            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
+            this.x264Panel.Name = "x264Panel";\r
+            this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
+            this.x264Panel.TabIndex = 0;\r
+            this.x264Panel.x264Query = "";\r
+            // \r
             // tab_query\r
             // \r
             this.tab_query.Controls.Add(this.btn_clear);\r
@@ -2271,78 +2323,6 @@ namespace Handbrake
             this.hbproc.StartInfo.UserName = "";\r
             this.hbproc.SynchronizingObject = this;\r
             // \r
-            // drop_angle\r
-            // \r
-            this.drop_angle.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.drop_angle.FormattingEnabled = true;\r
-            this.drop_angle.Location = new System.Drawing.Point(250, 52);\r
-            this.drop_angle.Name = "drop_angle";\r
-            this.drop_angle.Size = new System.Drawing.Size(45, 21);\r
-            this.drop_angle.TabIndex = 45;\r
-            this.drop_angle.Text = "1";\r
-            this.ToolTip.SetToolTip(this.drop_angle, "Select the chapter range you would like to enocde. (default: All Chapters)");\r
-            // \r
-            // label4\r
-            // \r
-            this.label4.AutoSize = true;\r
-            this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label4.ForeColor = System.Drawing.Color.Black;\r
-            this.label4.Location = new System.Drawing.Point(200, 55);\r
-            this.label4.Name = "label4";\r
-            this.label4.Size = new System.Drawing.Size(44, 13);\r
-            this.label4.TabIndex = 44;\r
-            this.label4.Text = "Angle:";\r
-            // \r
-            // ctl_deinterlace\r
-            // \r
-            this.ctl_deinterlace.AutoSize = true;\r
-            this.ctl_deinterlace.Location = new System.Drawing.Point(19, 95);\r
-            this.ctl_deinterlace.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_deinterlace.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_deinterlace.Name = "ctl_deinterlace";\r
-            this.ctl_deinterlace.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_deinterlace.TabIndex = 41;\r
-            this.ctl_deinterlace.onChange += new System.EventHandler(this.ctl_deinterlace_changed);\r
-            // \r
-            // ctl_denoise\r
-            // \r
-            this.ctl_denoise.AutoSize = true;\r
-            this.ctl_denoise.Location = new System.Drawing.Point(19, 123);\r
-            this.ctl_denoise.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_denoise.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_denoise.Name = "ctl_denoise";\r
-            this.ctl_denoise.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_denoise.TabIndex = 40;\r
-            // \r
-            // ctl_decomb\r
-            // \r
-            this.ctl_decomb.AutoSize = true;\r
-            this.ctl_decomb.Location = new System.Drawing.Point(19, 66);\r
-            this.ctl_decomb.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_decomb.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_decomb.Name = "ctl_decomb";\r
-            this.ctl_decomb.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_decomb.TabIndex = 39;\r
-            this.ctl_decomb.onChange += new System.EventHandler(this.ctl_decomb_changed);\r
-            // \r
-            // ctl_detelecine\r
-            // \r
-            this.ctl_detelecine.AutoSize = true;\r
-            this.ctl_detelecine.Location = new System.Drawing.Point(19, 38);\r
-            this.ctl_detelecine.Margin = new System.Windows.Forms.Padding(0);\r
-            this.ctl_detelecine.MaximumSize = new System.Drawing.Size(400, 30);\r
-            this.ctl_detelecine.Name = "ctl_detelecine";\r
-            this.ctl_detelecine.Size = new System.Drawing.Size(275, 28);\r
-            this.ctl_detelecine.TabIndex = 38;\r
-            // \r
-            // x264Panel\r
-            // \r
-            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
-            this.x264Panel.Name = "x264Panel";\r
-            this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
-            this.x264Panel.TabIndex = 0;\r
-            this.x264Panel.x264Query = "";\r
-            // \r
             // frmMain\r
             // \r
             this.AllowDrop = true;\r
@@ -2519,8 +2499,6 @@ namespace Handbrake
         internal System.Windows.Forms.Label label66;\r
         internal System.Windows.Forms.Label label67;\r
         internal System.Windows.Forms.Label label68;\r
-        private System.Windows.Forms.GroupBox groupBox3;\r
-        private System.Windows.Forms.GroupBox groupBox5;\r
         private System.Windows.Forms.Button btn_destBrowse;\r
         internal System.Windows.Forms.TrackBar tb_drc;\r
         internal System.Windows.Forms.Label label16;\r