OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 31 Jan 2009 00:04:36 +0000 (00:04 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 31 Jan 2009 00:04:36 +0000 (00:04 +0000)
- QueryParser: Add support for values to be attached to deinterlace, decomb, detelecine and denoise (second element of deblock still be done)
- Added a debug menu + a Query Parser Testing window
- Fixed small bug on the preset bar where it would crash if you left clicked on open white space.

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

win/C#/Functions/QueryParser.cs
win/C#/Functions/QueryParserTester.Designer.cs [new file with mode: 0644]
win/C#/Functions/QueryParserTester.cs [new file with mode: 0644]
win/C#/Functions/QueryParserTester.resx [new file with mode: 0644]
win/C#/HandBrakeCS.csproj
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmMain.resx
win/C#/frmMain/PresetLoader.cs

index f189e1b..c255e6d 100644 (file)
@@ -8,6 +8,7 @@ using System;
 using System.Globalization;\r
 using System.Text.RegularExpressions;\r
 using System.Windows.Forms;\r
+using System.Collections;\r
 \r
 namespace Handbrake.Functions\r
 {\r
@@ -87,10 +88,10 @@ namespace Handbrake.Functions
         private string q_croptop;\r
         private string q_cropValues;\r
         private int q_deBlock;\r
-        private Boolean q_decomb;\r
+        private string q_decomb;\r
         private string q_deinterlace;\r
         private string q_denoise;\r
-        private Boolean q_detelecine;\r
+        private string q_detelecine;\r
         private Boolean q_looseAnamorphic;\r
         private int q_maxHeight;\r
         private int q_maxWidth;\r
@@ -181,7 +182,7 @@ namespace Handbrake.Functions
         /// <summary>\r
         /// Returns a boolean to indicate wither DeTelecine is on or off\r
         /// </summary>\r
-        public Boolean DeTelecine\r
+        public string DeTelecine\r
         {\r
             get { return q_detelecine; }\r
         }\r
@@ -213,7 +214,7 @@ namespace Handbrake.Functions
         /// <summary>\r
         /// Returns a string with the DeNoise option used.\r
         /// </summary>\r
-        public Boolean Decomb\r
+        public string Decomb\r
         {\r
             get { return q_decomb; }\r
         }\r
@@ -609,7 +610,6 @@ namespace Handbrake.Functions
         #endregion\r
 \r
         // All the Main Window GUI options\r
-\r
         /// <summary>\r
         /// Takes in a query which can be in any order and parses it. \r
         /// All varibles are then set so they can be used elsewhere.\r
@@ -629,37 +629,39 @@ namespace Handbrake.Functions
             //Source\r
             Match title = Regex.Match(input, @"-t ([0-9]*)");\r
             Match chapters = Regex.Match(input, @"-c ([0-9-]*)");\r
+           \r
+            //Output Settings\r
             Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)");\r
-\r
-            //Destination\r
-            Match videoEncoder = Regex.Match(input, @"-e ([a-zA-Z0-9]*)");\r
+            Match grayscale = Regex.Match(input, @" -g");\r
+            Match largerMp4 = Regex.Match(input, @" -4");\r
+            Match ipodAtom = Regex.Match(input, @" -I");\r
 \r
             //Picture Settings Tab\r
             Match width = Regex.Match(input, @"-w ([0-9]*)");\r
             Match height = Regex.Match(input, @"-l ([0-9]*)");\r
             Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");\r
             Match maxHeight = Regex.Match(input, @"-Y ([0-9]*)");\r
-            Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z]*)\""");\r
-            Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z]*)\""");\r
-            Match deblock = Regex.Match(input, @"--deblock=([0-9]*)");\r
-            Match detelecine = Regex.Match(input, @"--detelecine");\r
-            Match anamorphic = Regex.Match(input, @" -p ");\r
-            Match chapterMarkers = Regex.Match(input, @" -m");\r
-            Match chapterMarkersFileMode = Regex.Match(input, @"--markers");\r
             Match crop = Regex.Match(input, @"--crop ([0-9]*):([0-9]*):([0-9]*):([0-9]*)");\r
             Match lanamorphic = Regex.Match(input, @" -P");\r
+            Match anamorphic = Regex.Match(input, @" -p ");\r
+\r
+            // Picture Settings - Filters\r
             Match decomb = Regex.Match(input, @" --decomb");\r
+            Match decombValue = Regex.Match(input, @" --decomb=\""([a-zA-Z0-9.:]*)\""");\r
+            Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z0-9.:]*)\""");\r
+            Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z0-9.:]*)\""");\r
+            Match deblock = Regex.Match(input, @"--deblock=([0-9:]*)");\r
+            Match detelecine = Regex.Match(input, @"--detelecine");\r
+            Match detelecineValue = Regex.Match(input, @" --detelecine=\""([a-zA-Z0-9.:]*)\""");\r
 \r
             //Video Settings Tab\r
+            Match videoEncoder = Regex.Match(input, @"-e ([a-zA-Z0-9]*)");\r
             Match videoFramerate = Regex.Match(input, @"-r ([0-9]*)");\r
             Match videoBitrate = Regex.Match(input, @"-b ([0-9]*)");\r
             Match videoQuality = Regex.Match(input, @"-q ([0-9.]*)");\r
             Match videoFilesize = Regex.Match(input, @"-S ([0-9.]*)");\r
             Match twoPass = Regex.Match(input, @" -2");\r
             Match turboFirstPass = Regex.Match(input, @" -T");\r
-            Match grayscale = Regex.Match(input, @" -g");\r
-            Match largerMp4 = Regex.Match(input, @" -4");\r
-            Match ipodAtom = Regex.Match(input, @" -I");\r
             Match optimizeMP4 = Regex.Match(input, @" -O");\r
 \r
             //Audio Settings Tab\r
@@ -677,8 +679,7 @@ namespace Handbrake.Functions
             Match audioEncoder1 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*)");\r
             Match audioEncoder2 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");\r
             Match audioEncoder3 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");\r
-            Match audioEncoder4 = Regex.Match(input,\r
-                                              @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");\r
+            Match audioEncoder4 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");\r
 \r
             Match audioBitrate1 = Regex.Match(input, @"-B ([0-9auto]*)");\r
             Match audioBitrate2 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*)");\r
@@ -699,6 +700,10 @@ namespace Handbrake.Functions
             Match subScan = Regex.Match(input, @" -U");\r
             Match forcedSubtitles = Regex.Match(input, @" -F");\r
 \r
+            // Chapters Tab\r
+            Match chapterMarkers = Regex.Match(input, @" -m");\r
+            Match chapterMarkersFileMode = Regex.Match(input, @"--markers");\r
+\r
             //H264 Tab\r
             Match x264 = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");\r
 \r
@@ -728,34 +733,15 @@ namespace Handbrake.Functions
                     if ((thisQuery.q_chaptersStart == 1) && (thisQuery.q_chaptersFinish == 0))\r
                         thisQuery.q_chaptersFinish = thisQuery.q_chaptersStart;\r
                 }\r
-\r
-                if (format.Success)\r
-                    thisQuery.q_format = format.ToString().Replace("-f ", "");\r
-\r
                 #endregion\r
 \r
-                #region Destination\r
+                #region Output Settings\r
 \r
-                string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");\r
-                switch (videoEncoderConvertion)\r
-                {\r
-                    case "ffmpeg":\r
-                        videoEncoderConvertion = "MPEG-4 (FFmpeg)";\r
-                        break;\r
-                    case "xvid":\r
-                        videoEncoderConvertion = "MPEG-4 (XviD)";\r
-                        break;\r
-                    case "x264":\r
-                        videoEncoderConvertion = "H.264 (x264)";\r
-                        break;\r
-                    case "theora":\r
-                        videoEncoderConvertion = "VP3 (Theora)";\r
-                        break;\r
-                    default:\r
-                        videoEncoderConvertion = "MPEG-4 (FFmpeg)";\r
-                        break;\r
-                }\r
-                thisQuery.q_videoEncoder = videoEncoderConvertion;\r
+                if (format.Success)\r
+                    thisQuery.q_format = format.ToString().Replace("-f ", "");\r
+                thisQuery.q_largeMp4 = largerMp4.Success;\r
+                thisQuery.q_ipodAtom = ipodAtom.Success;\r
+                thisQuery.q_optimizeMp4 = optimizeMP4.Success;\r
 \r
                 #endregion\r
 \r
@@ -782,77 +768,81 @@ namespace Handbrake.Functions
                     thisQuery.q_cropLeft = actCropValues[2];\r
                     thisQuery.q_cropRight = actCropValues[3];\r
                 }\r
+                \r
+                thisQuery.q_anamorphic = anamorphic.Success;\r
+                thisQuery.q_looseAnamorphic = lanamorphic.Success;\r
 \r
-                // Deblock Slider\r
-                string deblockValue = "";\r
-                thisQuery.q_deBlock = 0;\r
-                if (deblock.Success)\r
-                    deblockValue = deblock.ToString().Replace("--deblock=", "");\r
+                #endregion\r
 \r
-                if (deblockValue != "")\r
-                    int.TryParse(deblockValue, out thisQuery.q_deBlock);\r
+                #region Picture Tab - Filters\r
 \r
-                thisQuery.q_detelecine = detelecine.Success;\r
-                thisQuery.q_decomb = decomb.Success;\r
+                if (decomb.Success)\r
+                {\r
+                    thisQuery.q_decomb = "True";\r
+                    if (decombValue.Success)\r
+                        thisQuery.q_decomb = decombValue.ToString().Replace("--decomb=", "").Replace("\"", "");\r
+                } else\r
+                    thisQuery.q_decomb = "False";\r
 \r
                 thisQuery.q_deinterlace = "None";\r
                 if (deinterlace.Success)\r
                 {\r
-                    switch (deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", ""))\r
-                    {\r
-                        case "fast":\r
-                            thisQuery.q_deinterlace = "Fast";\r
-                            break;\r
-                        case "slow":\r
-                            thisQuery.q_deinterlace = "Slow";\r
-                            break;\r
-                        case "slower":\r
-                            thisQuery.q_deinterlace = "Slower";\r
-                            break;\r
-                        case "slowest":\r
-                            thisQuery.q_deinterlace = "Slowest";\r
-                            break;\r
-                        default:\r
-                            thisQuery.q_deinterlace = "None";\r
-                            break;\r
-                    }\r
+                    thisQuery.q_deinterlace = deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", "");\r
+                    thisQuery.q_deinterlace = thisQuery.q_deinterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");\r
+                    thisQuery.q_deinterlace = thisQuery.q_deinterlace.Replace("slowest", "Slowest");\r
                 }\r
 \r
                 thisQuery.q_denoise = "None";\r
                 if (denoise.Success)\r
                 {\r
-                    switch (denoise.ToString().Replace("--denoise=", "").Replace("\"", ""))\r
-                    {\r
-                        case "weak":\r
-                            thisQuery.q_denoise = "Weak";\r
-                            break;\r
-                        case "medium":\r
-                            thisQuery.q_denoise = "Medium";\r
-                            break;\r
-                        case "strong":\r
-                            thisQuery.q_denoise = "Strong";\r
-                            break;\r
-                        default:\r
-                            thisQuery.q_denoise = "None";\r
-                            break;\r
-                    }\r
+                    thisQuery.q_denoise = denoise.ToString().Replace("--denoise=", "").Replace("\"", "");\r
+                    thisQuery.q_denoise = thisQuery.q_denoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");\r
                 }\r
-                thisQuery.q_anamorphic = anamorphic.Success;\r
-                if (chapterMarkersFileMode.Success || chapterMarkers.Success)\r
-                    thisQuery.q_chapterMarkers = true;\r
 \r
-                thisQuery.q_looseAnamorphic = lanamorphic.Success;\r
+                string deblockValue = "";\r
+                thisQuery.q_deBlock = 0;\r
+                if (deblock.Success)\r
+                    deblockValue = deblock.ToString().Replace("--deblock=", "");\r
+                if (deblockValue != "")\r
+                    int.TryParse(deblockValue, out thisQuery.q_deBlock);\r
 \r
+                if (detelecine.Success)\r
+                {\r
+                    thisQuery.q_detelecine = "True";\r
+                    if (detelecineValue.Success)\r
+                        thisQuery.q_detelecine = detelecineValue.ToString().Replace("--detelecine=", "").Replace("\"", "");\r
+                }\r
+                else\r
+                    thisQuery.q_detelecine = "False";\r
                 #endregion\r
 \r
                 #region Video Settings Tab\r
 \r
+                string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");\r
+                switch (videoEncoderConvertion)\r
+                {\r
+                    case "ffmpeg":\r
+                        videoEncoderConvertion = "MPEG-4 (FFmpeg)";\r
+                        break;\r
+                    case "xvid":\r
+                        videoEncoderConvertion = "MPEG-4 (XviD)";\r
+                        break;\r
+                    case "x264":\r
+                        videoEncoderConvertion = "H.264 (x264)";\r
+                        break;\r
+                    case "theora":\r
+                        videoEncoderConvertion = "VP3 (Theora)";\r
+                        break;\r
+                    default:\r
+                        videoEncoderConvertion = "MPEG-4 (FFmpeg)";\r
+                        break;\r
+                }\r
+                thisQuery.q_videoEncoder = videoEncoderConvertion;\r
+                thisQuery.q_videoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source";\r
                 thisQuery.q_grayscale = grayscale.Success;\r
                 thisQuery.q_twoPass = twoPass.Success;\r
                 thisQuery.q_turboFirst = turboFirstPass.Success;\r
-                thisQuery.q_largeMp4 = largerMp4.Success;\r
-                thisQuery.q_videoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source";\r
-\r
+                \r
                 if (videoBitrate.Success)\r
                     thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");\r
                 if (videoFilesize.Success)\r
@@ -865,9 +855,6 @@ namespace Handbrake.Functions
                     qConvert = Math.Ceiling(qConvert);\r
                     thisQuery.q_videoQuality = int.Parse(qConvert.ToString());\r
                 }\r
-                thisQuery.q_ipodAtom = ipodAtom.Success;\r
-                thisQuery.q_optimizeMp4 = optimizeMP4.Success;\r
-\r
                 #endregion\r
 \r
                 #region Audio Tab\r
@@ -1068,6 +1055,11 @@ namespace Handbrake.Functions
 \r
                 #endregion\r
 \r
+                #region Chapters Tab\r
+                if (chapterMarkersFileMode.Success || chapterMarkers.Success)\r
+                    thisQuery.q_chapterMarkers = true;\r
+                #endregion\r
+\r
                 #region H.264 and other\r
 \r
                 //\r
diff --git a/win/C#/Functions/QueryParserTester.Designer.cs b/win/C#/Functions/QueryParserTester.Designer.cs
new file mode 100644 (file)
index 0000000..9a3691c
--- /dev/null
@@ -0,0 +1,107 @@
+namespace Handbrake.Functions\r
+{\r
+    partial class QueryParserTester\r
+    {\r
+        /// <summary>\r
+        /// Required designer variable.\r
+        /// </summary>\r
+        private System.ComponentModel.IContainer components = null;\r
+\r
+        /// <summary>\r
+        /// Clean up any resources being used.\r
+        /// </summary>\r
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>\r
+        protected override void Dispose(bool disposing)\r
+        {\r
+            if (disposing && (components != null))\r
+            {\r
+                components.Dispose();\r
+            }\r
+            base.Dispose(disposing);\r
+        }\r
+\r
+        #region Windows Form Designer generated code\r
+\r
+        /// <summary>\r
+        /// Required method for Designer support - do not modify\r
+        /// the contents of this method with the code editor.\r
+        /// </summary>\r
+        private void InitializeComponent()\r
+        {\r
+            this.rtf_testContent = new System.Windows.Forms.RichTextBox();\r
+            this.btn_test = new System.Windows.Forms.Button();\r
+            this.rtf_query = new System.Windows.Forms.RichTextBox();\r
+            this.label1 = new System.Windows.Forms.Label();\r
+            this.label2 = new System.Windows.Forms.Label();\r
+            this.SuspendLayout();\r
+            // \r
+            // rtf_testContent\r
+            // \r
+            this.rtf_testContent.Location = new System.Drawing.Point(111, 164);\r
+            this.rtf_testContent.Name = "rtf_testContent";\r
+            this.rtf_testContent.Size = new System.Drawing.Size(641, 420);\r
+            this.rtf_testContent.TabIndex = 0;\r
+            this.rtf_testContent.Text = "";\r
+            // \r
+            // btn_test\r
+            // \r
+            this.btn_test.Location = new System.Drawing.Point(405, 115);\r
+            this.btn_test.Name = "btn_test";\r
+            this.btn_test.Size = new System.Drawing.Size(75, 23);\r
+            this.btn_test.TabIndex = 1;\r
+            this.btn_test.Text = "Test";\r
+            this.btn_test.UseVisualStyleBackColor = true;\r
+            this.btn_test.Click += new System.EventHandler(this.btn_test_Click);\r
+            // \r
+            // rtf_query\r
+            // \r
+            this.rtf_query.Location = new System.Drawing.Point(111, 12);\r
+            this.rtf_query.Name = "rtf_query";\r
+            this.rtf_query.Size = new System.Drawing.Size(641, 77);\r
+            this.rtf_query.TabIndex = 2;\r
+            this.rtf_query.Text = "";\r
+            // \r
+            // label1\r
+            // \r
+            this.label1.AutoSize = true;\r
+            this.label1.Location = new System.Drawing.Point(37, 43);\r
+            this.label1.Name = "label1";\r
+            this.label1.Size = new System.Drawing.Size(38, 13);\r
+            this.label1.TabIndex = 3;\r
+            this.label1.Text = "Query:";\r
+            // \r
+            // label2\r
+            // \r
+            this.label2.AutoSize = true;\r
+            this.label2.Location = new System.Drawing.Point(37, 327);\r
+            this.label2.Name = "label2";\r
+            this.label2.Size = new System.Drawing.Size(40, 13);\r
+            this.label2.TabIndex = 4;\r
+            this.label2.Text = "Result:";\r
+            // \r
+            // QueryParserTester\r
+            // \r
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
+            this.ClientSize = new System.Drawing.Size(780, 625);\r
+            this.Controls.Add(this.label2);\r
+            this.Controls.Add(this.label1);\r
+            this.Controls.Add(this.rtf_query);\r
+            this.Controls.Add(this.btn_test);\r
+            this.Controls.Add(this.rtf_testContent);\r
+            this.Name = "QueryParserTester";\r
+            this.Text = "QueryParserTester";\r
+            this.ResumeLayout(false);\r
+            this.PerformLayout();\r
+\r
+        }\r
+\r
+        #endregion\r
+\r
+        private System.Windows.Forms.RichTextBox rtf_testContent;\r
+        private System.Windows.Forms.Button btn_test;\r
+        private System.Windows.Forms.RichTextBox rtf_query;\r
+        private System.Windows.Forms.Label label1;\r
+        private System.Windows.Forms.Label label2;\r
+    }\r
+}
\ No newline at end of file
diff --git a/win/C#/Functions/QueryParserTester.cs b/win/C#/Functions/QueryParserTester.cs
new file mode 100644 (file)
index 0000000..75d8c30
--- /dev/null
@@ -0,0 +1,106 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.ComponentModel;\r
+using System.Data;\r
+using System.Drawing;\r
+using System.Text;\r
+using System.Windows.Forms;\r
+\r
+namespace Handbrake.Functions\r
+{\r
+    public partial class QueryParserTester : Form\r
+    {\r
+        public QueryParserTester()\r
+        {\r
+            InitializeComponent();\r
+\r
+        }\r
+\r
+        private void btn_test_Click(object sender, EventArgs e)\r
+        {\r
+            QueryParser parsed = QueryParser.Parse(rtf_query.Text);\r
+\r
+            rtf_testContent.Clear();\r
+\r
+            //Source\r
+            rtf_testContent.Text += "## Source " + Environment.NewLine;\r
+            if (parsed.DVDTitle != 0)\r
+                rtf_testContent.Text += "Title: " + parsed.DVDTitle + Environment.NewLine;\r
+            if (parsed.DVDChapterStart != 0)\r
+                rtf_testContent.Text += "Start Chapter: " + parsed.DVDChapterStart + Environment.NewLine;\r
+            if (parsed.DVDChapterFinish != 0)\r
+                rtf_testContent.Text += "End Chapter: " + parsed.DVDChapterFinish + Environment.NewLine;\r
+\r
+            //Output Settings\r
+            rtf_testContent.Text += Environment.NewLine + "## Output Settings " + Environment.NewLine;\r
+            if (parsed.Format != null)\r
+                rtf_testContent.Text += "Format: " + parsed.Format + Environment.NewLine;\r
+            if (parsed.LargeMP4)\r
+                rtf_testContent.Text += "Large File Size: " + parsed.LargeMP4 + Environment.NewLine;\r
+            if (parsed.OptimizeMP4)\r
+                rtf_testContent.Text += "Web Optimized: " + parsed.OptimizeMP4 + Environment.NewLine;\r
+            if (parsed.IpodAtom)\r
+                rtf_testContent.Text += "iPod 5G Support " + parsed.IpodAtom + Environment.NewLine;\r
+\r
+            //Picture Settings\r
+            rtf_testContent.Text += Environment.NewLine + "## Picture Settings " + Environment.NewLine;\r
+            if (parsed.CropValues != null)\r
+                rtf_testContent.Text += "Cropping: " + parsed.CropValues + Environment.NewLine;\r
+            if (parsed.Width != 0)\r
+                rtf_testContent.Text += "Width: " + parsed.Width + Environment.NewLine;\r
+            if (parsed.Height != 0)\r
+                rtf_testContent.Text += "Height: " + parsed.Height + Environment.NewLine;\r
+            if (parsed.MaxWidth != 0)\r
+                rtf_testContent.Text += "Max Width: " + parsed.MaxWidth + Environment.NewLine;\r
+            if (parsed.MaxHeight != 0)\r
+                rtf_testContent.Text += "Max Height: " + parsed.MaxHeight + Environment.NewLine;\r
+            if (parsed.Anamorphic)\r
+                rtf_testContent.Text += "Anamorphic: " + parsed.Anamorphic + Environment.NewLine;\r
+            if (parsed.LooseAnamorphic)\r
+                rtf_testContent.Text += "Loose Anamorphic: " + parsed.LooseAnamorphic + Environment.NewLine;\r
+\r
+            //Picture Settings - Filters\r
+            rtf_testContent.Text += Environment.NewLine + "## Filters " + Environment.NewLine;\r
+            rtf_testContent.Text += "Detelecine: " + parsed.DeTelecine + Environment.NewLine;\r
+            rtf_testContent.Text += "Decomb: " + parsed.Decomb + Environment.NewLine;\r
+            rtf_testContent.Text += "Deinterlace: " + parsed.DeInterlace + Environment.NewLine;\r
+            rtf_testContent.Text += "Denoise: " + parsed.DeNoise + Environment.NewLine;\r
+            rtf_testContent.Text += "Deblock: " + parsed.DeBlock + Environment.NewLine;\r
+\r
+            //Video\r
+            rtf_testContent.Text += Environment.NewLine + "## Video " + Environment.NewLine;\r
+            rtf_testContent.Text += "Video Codec: " + parsed.VideoEncoder + Environment.NewLine;\r
+            rtf_testContent.Text += "Video Framerate: " + parsed.VideoFramerate + Environment.NewLine;\r
+            if (parsed.Grayscale)\r
+                rtf_testContent.Text += "Grayscale: " + parsed.Grayscale + Environment.NewLine;\r
+            if (parsed.TwoPass)\r
+                rtf_testContent.Text += "2-Pass Encoding: " + parsed.TwoPass + Environment.NewLine;\r
+            if (parsed.TurboFirstPass)\r
+                rtf_testContent.Text += "Turbo first pass: " + parsed.TurboFirstPass + Environment.NewLine;\r
+            if (parsed.VideoTargetSize != null)\r
+                rtf_testContent.Text += "Target Size: " + parsed.VideoTargetSize + Environment.NewLine;\r
+            if (parsed.AverageVideoBitrate != null)\r
+                rtf_testContent.Text += "Avg Bitrate: " + parsed.AverageVideoBitrate + Environment.NewLine;\r
+            if (parsed.VideoQuality != 0)\r
+                rtf_testContent.Text += "Constant Quality: " + parsed.VideoQuality + Environment.NewLine;\r
+\r
+            //Audio\r
+            // TODO\r
+\r
+            //Chapters\r
+            if (parsed.ChapterMarkers)\r
+            {\r
+                rtf_testContent.Text += Environment.NewLine + "## Chapers " + Environment.NewLine;\r
+                rtf_testContent.Text += "Chapters: " + parsed.ChapterMarkers + Environment.NewLine;\r
+            }\r
+\r
+            //Advanced\r
+            if (parsed.H264Query != null)\r
+            {\r
+                rtf_testContent.Text += Environment.NewLine + "## x264 " + Environment.NewLine;\r
+                rtf_testContent.Text += "x264: " + parsed.H264Query + Environment.NewLine;\r
+            }\r
+        }\r
+\r
+    }\r
+}\r
diff --git a/win/C#/Functions/QueryParserTester.resx b/win/C#/Functions/QueryParserTester.resx
new file mode 100644 (file)
index 0000000..ff31a6d
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<root>\r
+  <!-- \r
+    Microsoft ResX Schema \r
+    \r
+    Version 2.0\r
+    \r
+    The primary goals of this format is to allow a simple XML format \r
+    that is mostly human readable. The generation and parsing of the \r
+    various data types are done through the TypeConverter classes \r
+    associated with the data types.\r
+    \r
+    Example:\r
+    \r
+    ... ado.net/XML headers & schema ...\r
+    <resheader name="resmimetype">text/microsoft-resx</resheader>\r
+    <resheader name="version">2.0</resheader>\r
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\r
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\r
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>\r
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>\r
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">\r
+        <value>[base64 mime encoded serialized .NET Framework object]</value>\r
+    </data>\r
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\r
+        <comment>This is a comment</comment>\r
+    </data>\r
+                \r
+    There are any number of "resheader" rows that contain simple \r
+    name/value pairs.\r
+    \r
+    Each data row contains a name, and value. The row also contains a \r
+    type or mimetype. Type corresponds to a .NET class that support \r
+    text/value conversion through the TypeConverter architecture. \r
+    Classes that don't support this are serialized and stored with the \r
+    mimetype set.\r
+    \r
+    The mimetype is used for serialized objects, and tells the \r
+    ResXResourceReader how to depersist the object. This is currently not \r
+    extensible. For a given mimetype the value must be set accordingly:\r
+    \r
+    Note - application/x-microsoft.net.object.binary.base64 is the format \r
+    that the ResXResourceWriter will generate, however the reader can \r
+    read any of the formats listed below.\r
+    \r
+    mimetype: application/x-microsoft.net.object.binary.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\r
+            : and then encoded with base64 encoding.\r
+    \r
+    mimetype: application/x-microsoft.net.object.soap.base64\r
+    value   : The object must be serialized with \r
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\r
+            : and then encoded with base64 encoding.\r
+\r
+    mimetype: application/x-microsoft.net.object.bytearray.base64\r
+    value   : The object must be serialized into a byte array \r
+            : using a System.ComponentModel.TypeConverter\r
+            : and then encoded with base64 encoding.\r
+    -->\r
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">\r
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />\r
+    <xsd:element name="root" msdata:IsDataSet="true">\r
+      <xsd:complexType>\r
+        <xsd:choice maxOccurs="unbounded">\r
+          <xsd:element name="metadata">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" use="required" type="xsd:string" />\r
+              <xsd:attribute name="type" type="xsd:string" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="assembly">\r
+            <xsd:complexType>\r
+              <xsd:attribute name="alias" type="xsd:string" />\r
+              <xsd:attribute name="name" type="xsd:string" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="data">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />\r
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />\r
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />\r
+              <xsd:attribute ref="xml:space" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+          <xsd:element name="resheader">\r
+            <xsd:complexType>\r
+              <xsd:sequence>\r
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />\r
+              </xsd:sequence>\r
+              <xsd:attribute name="name" type="xsd:string" use="required" />\r
+            </xsd:complexType>\r
+          </xsd:element>\r
+        </xsd:choice>\r
+      </xsd:complexType>\r
+    </xsd:element>\r
+  </xsd:schema>\r
+  <resheader name="resmimetype">\r
+    <value>text/microsoft-resx</value>\r
+  </resheader>\r
+  <resheader name="version">\r
+    <value>2.0</value>\r
+  </resheader>\r
+  <resheader name="reader">\r
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+  <resheader name="writer">\r
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+  </resheader>\r
+</root>
\ No newline at end of file
index 4899db2..d93d90a 100644 (file)
     <Compile Include="frmMain\PresetLoader.cs" />\r
     <Compile Include="frmMain\QueryGenerator.cs" />\r
     <Compile Include="Functions\Main.cs" />\r
+    <Compile Include="Functions\QueryParserTester.cs">\r
+      <SubType>Form</SubType>\r
+    </Compile>\r
+    <Compile Include="Functions\QueryParserTester.Designer.cs">\r
+      <DependentUpon>QueryParserTester.cs</DependentUpon>\r
+    </Compile>\r
     <Compile Include="Presets\preset.cs" />\r
     <Compile Include="Presets\PresetsHandler.cs" />\r
     <Compile Include="Queue\QueueHandler.cs" />\r
       <DependentUpon>frmUpdater.cs</DependentUpon>\r
       <SubType>Designer</SubType>\r
     </EmbeddedResource>\r
+    <EmbeddedResource Include="Functions\QueryParserTester.resx">\r
+      <DependentUpon>QueryParserTester.cs</DependentUpon>\r
+      <SubType>Designer</SubType>\r
+    </EmbeddedResource>\r
     <EmbeddedResource Include="Properties\Resources.resx">\r
       <Generator>ResXFileCodeGenerator</Generator>\r
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>\r
index d290de5..63674ea 100644 (file)
@@ -38,7 +38,7 @@ namespace Handbrake
             System.Windows.Forms.Label Label38;\r
             System.Windows.Forms.ContextMenuStrip notifyIconMenu;\r
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));\r
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();\r
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
             this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();\r
             this.DVD_Save = new System.Windows.Forms.SaveFileDialog();\r
             this.File_Save = new System.Windows.Forms.SaveFileDialog();\r
@@ -253,6 +253,8 @@ namespace Handbrake
             this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);\r
             this.StatusStrip = new System.Windows.Forms.StatusStrip();\r
             this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel();\r
+            this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();\r
+            this.mnu_qptest = new System.Windows.Forms.ToolStripMenuItem();\r
             Label38 = new System.Windows.Forms.Label();\r
             notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
             notifyIconMenu.SuspendLayout();\r
@@ -648,9 +650,9 @@ namespace Handbrake
             // \r
             // number\r
             // \r
-            dataGridViewCellStyle3.Format = "N0";\r
-            dataGridViewCellStyle3.NullValue = null;\r
-            this.number.DefaultCellStyle = dataGridViewCellStyle3;\r
+            dataGridViewCellStyle1.Format = "N0";\r
+            dataGridViewCellStyle1.NullValue = null;\r
+            this.number.DefaultCellStyle = dataGridViewCellStyle1;\r
             this.number.HeaderText = "Chapter Number";\r
             this.number.MaxInputLength = 3;\r
             this.number.Name = "number";\r
@@ -1405,7 +1407,8 @@ namespace Handbrake
             this.FileToolStripMenuItem,\r
             this.ToolsToolStripMenuItem,\r
             this.PresetsToolStripMenuItem,\r
-            this.HelpToolStripMenuItem});\r
+            this.HelpToolStripMenuItem,\r
+            this.debugToolStripMenuItem});\r
             this.frmMainMenu.Location = new System.Drawing.Point(0, 0);\r
             this.frmMainMenu.Name = "frmMainMenu";\r
             this.frmMainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;\r
@@ -2932,6 +2935,21 @@ namespace Handbrake
             this.lbl_encode.Size = new System.Drawing.Size(31, 17);\r
             this.lbl_encode.Text = "{0}";\r
             // \r
+            // debugToolStripMenuItem\r
+            // \r
+            this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
+            this.mnu_qptest});\r
+            this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";\r
+            this.debugToolStripMenuItem.Size = new System.Drawing.Size(56, 20);\r
+            this.debugToolStripMenuItem.Text = "Debug";\r
+            // \r
+            // mnu_qptest\r
+            // \r
+            this.mnu_qptest.Name = "mnu_qptest";\r
+            this.mnu_qptest.Size = new System.Drawing.Size(201, 22);\r
+            this.mnu_qptest.Text = "Query Parser Tester";\r
+            this.mnu_qptest.Click += new System.EventHandler(this.mnu_qptest_Click);\r
+            // \r
             // frmMain\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
@@ -3212,6 +3230,8 @@ namespace Handbrake
         private System.Windows.Forms.ToolStripMenuItem mnu_killCLI;\r
         private System.Windows.Forms.DataGridViewTextBoxColumn number;\r
         private System.Windows.Forms.DataGridViewTextBoxColumn name;\r
+        private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;\r
+        private System.Windows.Forms.ToolStripMenuItem mnu_qptest;\r
 \r
     }\r
 }
\ No newline at end of file
index 44c7ac2..00e5515 100644 (file)
@@ -12,6 +12,7 @@ using System.Windows.Forms;
 using System.IO;\r
 using System.Diagnostics;\r
 using System.Threading;\r
+using Handbrake.Functions;\r
 \r
 namespace Handbrake\r
 {\r
@@ -426,8 +427,11 @@ namespace Handbrake
                 treeView_presets.SelectedNode = treeView_presets.GetNodeAt(e.Location);\r
             else if (e.Button == MouseButtons.Left)\r
             {\r
-                if (groupBox_output.Text.Contains(treeView_presets.GetNodeAt(e.Location).Text))\r
-                    selectPreset();\r
+                if (treeView_presets.GetNodeAt(e.Location) != null)\r
+                {\r
+                    if (groupBox_output.Text.Contains(treeView_presets.GetNodeAt(e.Location).Text))\r
+                        selectPreset();\r
+                }\r
             }\r
 \r
             treeView_presets.Select();\r
@@ -783,7 +787,6 @@ namespace Handbrake
 \r
             lbl_encode.Text = "";\r
         }\r
-\r
         private void drp_dvdtitle_Click(object sender, EventArgs e)\r
         {\r
             if ((drp_dvdtitle.Items.Count == 1) && (drp_dvdtitle.Items[0].ToString() == "Automatic"))\r
@@ -1656,7 +1659,6 @@ namespace Handbrake
                 MessageBox.Show("frmMain.cs - enableGUI " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             }\r
         }\r
-\r
         private static void killCLI()\r
         {\r
             // This may seem like a long way of killing HandBrakeCLI, but for whatever reason,\r
@@ -2066,6 +2068,13 @@ namespace Handbrake
 \r
         #endregion\r
 \r
+        private void mnu_qptest_Click(object sender, EventArgs e)\r
+        {\r
+            QueryParserTester qptest = new QueryParserTester();\r
+            qptest.Show();\r
+\r
+        }\r
+\r
         // This is the END of the road ------------------------------------------------------------------------------\r
     }\r
 }
\ No newline at end of file
index 0039ebd..d6bf08e 100644 (file)
@@ -155,12 +155,6 @@ Make sure you have selected a "Title" from the "Source" box above otherwise
 the list will not be populated with the correct amount of chapters.\r
 Note: Do not change any of the chapter numbers!</value>\r
   </data>\r
-  <metadata name="number.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
-    <value>True</value>\r
-  </metadata>\r
-  <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
-    <value>True</value>\r
-  </metadata>\r
   <data name="check_Cabac.ToolTip" xml:space="preserve">\r
     <value>CABAC, or context adaptive binary arithmetic coding, is used by x264 to reduce the bitrate needed for a given quality by 15%. \r
 This makes it very cool and very useful, and it should be left on whenever possible. However, it is incompatible with the iPod 5.5G, and makes the AppleTV struggle. \r
index c486247..7080f92 100644 (file)
@@ -110,12 +110,12 @@ namespace Handbrake
             mainWindow.drp_deInterlace_option.Text = presetQuery.DeInterlace;\r
             mainWindow.drp_deNoise.Text = presetQuery.DeNoise;\r
 \r
-            if (presetQuery.Decomb)\r
+            if (presetQuery.Decomb != "False")\r
                 mainWindow.check_decomb.CheckState = CheckState.Checked;\r
             else\r
                 mainWindow.check_decomb.CheckState = CheckState.Unchecked;\r
 \r
-            if (presetQuery.DeTelecine)\r
+            if (presetQuery.DeTelecine != "False")\r
                 mainWindow.check_detelecine.CheckState = CheckState.Checked;\r
             else\r
                 mainWindow.check_detelecine.CheckState = CheckState.Unchecked;\r