OSDN Git Service

LinGui: make Help->Guide work on windows/mingw
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / QueryGenerator.cs
index 7775b8c..e4557df 100644 (file)
@@ -69,16 +69,14 @@ namespace Handbrake.Functions
                     int.TryParse(mainWindow.drop_chapterFinish.Text, out end);\r
                     int calculatedDuration = end - start;\r
 \r
-                    query += string.Format(" --start-at duration:{0} --stop-at duration:{1}",\r
-                                           mainWindow.drop_chapterStart.Text, calculatedDuration);\r
+                    query += string.Format(" --start-at duration:{0} --stop-at duration:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);\r
                     break;\r
                 case 2: // Frames\r
                     int.TryParse(mainWindow.drop_chapterStart.Text, out start);\r
                     int.TryParse(mainWindow.drop_chapterFinish.Text, out end);\r
                     calculatedDuration = end - start;\r
 \r
-                    query += string.Format(" --start-at frame:{0} --stop-at frame:{1}",\r
-                                           mainWindow.drop_chapterStart.Text, calculatedDuration);\r
+                    query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);\r
                     break;\r
                 case 3: // Preview\r
                     query += " --previews " + Properties.Settings.Default.previewScanCount + " ";\r
@@ -86,8 +84,7 @@ namespace Handbrake.Functions
                     query += " --stop-at duration:" + duration + " ";\r
 \r
                     if (mainWindow.text_destination.Text != string.Empty)\r
-                        query += string.Format(" -o \"{0}\" ",\r
-                                               mainWindow.text_destination.Text.Replace(".m", "_sample.m"));\r
+                        query += string.Format(" -o \"{0}\" ", mainWindow.text_destination.Text.Replace(".m", "_sample.m"));\r
                     break;\r
                 default:\r
                     break;\r
@@ -231,7 +228,7 @@ namespace Handbrake.Functions
                         break;\r
                     case "H.264 (x264)":\r
                         CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-                        value = 51 - mainWindow.slider_videoQuality.Value * cqStep;\r
+                        value = 51 - (mainWindow.slider_videoQuality.Value * cqStep);\r
                         value = Math.Round(value, 2);\r
                         query += " -q " + value.ToString(culture);\r
                         break;\r
@@ -255,7 +252,7 @@ namespace Handbrake.Functions
 \r
             #region Audio Settings Tab\r
 \r
-            ListView audioTracks = mainWindow.AudioSettings.GetAudioPanel();\r
+            DataGridView audioTracks = mainWindow.AudioSettings.GetAudioPanel();\r
             List<string> tracks = new List<string>();\r
             List<string> codecs = new List<string>();\r
             List<string> mixdowns = new List<string>();\r
@@ -264,40 +261,40 @@ namespace Handbrake.Functions
             List<string> drcs = new List<string>();\r
 \r
             // No Audio\r
-            if (audioTracks.Items.Count == 0)\r
+            if (audioTracks.Rows.Count == 0)\r
                 query += " -a none ";\r
 \r
             // Gather information about each audio track and store them in the declared lists.\r
-            foreach (ListViewItem row in audioTracks.Items)\r
+            foreach (DataGridViewRow row in audioTracks.Rows)\r
             {\r
                 // Audio Track (-a)\r
-                if (row.SubItems[1].Text == "Automatic")\r
+                if (row.Cells[1].Value.ToString() == "Automatic")\r
                     tracks.Add("1");\r
-                else if (row.Text != "None")\r
+                else if (row.Cells[1].Value.ToString() != "None")\r
                 {\r
-                    string[] tempSub = row.SubItems[1].Text.Split(' ');\r
+                    string[] tempSub = row.Cells[1].Value.ToString().Split(' ');\r
                     tracks.Add(tempSub[0]);\r
                 }\r
 \r
                 // Audio Codec (-E)\r
-                if (row.SubItems[2].Text != String.Empty)\r
-                    codecs.Add(GetAudioEncoder(row.SubItems[2].Text));\r
+                if (row.Cells[2].Value.ToString() != String.Empty)\r
+                    codecs.Add(GetAudioEncoder(row.Cells[2].Value.ToString()));\r
 \r
                 // Audio Mixdown (-6)\r
-                if (row.SubItems[3].Text != String.Empty)\r
-                    mixdowns.Add(GetMixDown(row.SubItems[3].Text));\r
+                if (row.Cells[3].Value.ToString() != String.Empty)\r
+                    mixdowns.Add(GetMixDown(row.Cells[3].Value.ToString()));\r
 \r
                 // Sample Rate (-R)\r
-                if (row.SubItems[4].Text != String.Empty)\r
-                    samplerates.Add(row.SubItems[4].Text);\r
+                if (row.Cells[4].Value.ToString() != String.Empty)\r
+                    samplerates.Add(row.Cells[4].Value.ToString());\r
 \r
                 // Audio Bitrate (-B)\r
-                if (row.SubItems[5].Text != String.Empty)\r
-                    bitrates.Add(row.SubItems[5].Text.Replace("Auto", "auto"));\r
+                if (row.Cells[5].Value.ToString() != String.Empty)\r
+                    bitrates.Add(row.Cells[5].Value.ToString().Replace("Auto", "auto"));\r
 \r
                 // DRC (-D)\r
-                if (row.SubItems[6].Text != String.Empty)\r
-                    drcs.Add(row.SubItems[6].Text);\r
+                if (row.Cells[6].Value.ToString() != String.Empty)\r
+                    drcs.Add(row.Cells[6].Value.ToString());\r
             }\r
 \r
             // Audio Track (-a)\r
@@ -407,10 +404,10 @@ namespace Handbrake.Functions
 \r
             // Attach Source name and dvd title to the start of the chapters.csv filename.\r
             // This is for the queue. It allows different chapter name files for each title.\r
-            string[] destName = mainWindow.text_destination.Text.Split('\\');\r
-            string dest_name = destName[destName.Length - 1];\r
-            dest_name = dest_name.Replace("\"", string.Empty);\r
-            dest_name = dest_name.Replace(".mp4", string.Empty).Replace(".m4v", string.Empty).Replace(".mkv", string.Empty);\r
+            string[] destNameSplit = mainWindow.text_destination.Text.Split('\\');\r
+            string destName = destNameSplit[destNameSplit.Length - 1];\r
+            destName = destName.Replace("\"", string.Empty);\r
+            destName = destName.Replace(".mp4", string.Empty).Replace(".m4v", string.Empty).Replace(".mkv", string.Empty);\r
 \r
             string sourceTitle = mainWindow.drp_dvdtitle.Text;\r
             string[] titlesplit = sourceTitle.Split(' ');\r
@@ -418,11 +415,11 @@ namespace Handbrake.Functions
 \r
             if (mainWindow.Check_ChapterMarkers.Checked && mainWindow.Check_ChapterMarkers.Enabled)\r
             {\r
-                if (dest_name.Trim() != String.Empty)\r
+                if (destName.Trim() != String.Empty)\r
                 {\r
                     string path = sourceTitle != "Automatic"\r
-                                      ? Path.Combine(Path.GetTempPath(), dest_name + "-" + sourceTitle + "-chapters.csv")\r
-                                      : Path.Combine(Path.GetTempPath(), dest_name + "-chapters.csv");\r
+                                      ? Path.Combine(Path.GetTempPath(), destName + "-" + sourceTitle + "-chapters.csv")\r
+                                      : Path.Combine(Path.GetTempPath(), destName + "-chapters.csv");\r
 \r
                     if (ChapterCsvSave(mainWindow, path) == false)\r
                         query += " -m ";\r
@@ -438,19 +435,13 @@ namespace Handbrake.Functions
             // X264 Panel\r
             query += " -x " + mainWindow.x264Panel.X264Query;\r
 \r
-            #region Processors / Other\r
-\r
-            string processors = Properties.Settings.Default.Processors;\r
-            if (processors != "Automatic")\r
-                query += " -C " + processors + " ";\r
-\r
+            // Verbosity Level\r
             query += " -v " + Properties.Settings.Default.verboseLevel;\r
 \r
+            // LibDVDNav\r
             if (Properties.Settings.Default.noDvdNav)\r
                 query += " --no-dvdnav";\r
 \r
-            #endregion\r
-\r
             return query;\r
         }\r
 \r
@@ -535,9 +526,7 @@ namespace Handbrake.Functions
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show(\r
-                    "Unable to save Chapter Makrers file! \nChapter marker names will NOT be saved in your encode \n\n" +\r
-                    exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+                MessageBox.Show("Unable to save Chapter Makrers file! \nChapter marker names will NOT be saved in your encode \n\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
                 return false;\r
             }\r
         }\r