OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 3 Jul 2010 14:58:53 +0000 (14:58 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 3 Jul 2010 14:58:53 +0000 (14:58 +0000)
- Few extra tweaks to improve how user custom queries are handled.

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

win/C#/frmMain.cs

index 1827ddd..7074f11 100644 (file)
@@ -35,7 +35,7 @@ namespace Handbrake
         // Windows ************************************************************\r
         private frmQueue queueWindow;\r
         private frmPreview qtpreview;\r
-        private frmActivityWindow ActivityWindow;\r
+        private frmActivityWindow activityWindow;\r
         private frmSplashScreen splash = new frmSplashScreen();\r
 \r
         // Globals: Mainly used for tracking. *********************************\r
@@ -44,7 +44,7 @@ namespace Handbrake
         private SourceType selectedSourceType;\r
         private string dvdDrivePath;\r
         private string dvdDriveLabel;\r
-        private Preset CurrentlySelectedPreset;\r
+        private Preset currentlySelectedPreset;\r
         private DVD currentSource;\r
         private IScan SourceScan = new ScanService();\r
         private List<DriveInformation> drives;\r
@@ -322,7 +322,7 @@ namespace Handbrake
         private void changePresetLabel(object sender, EventArgs e)\r
         {\r
             labelPreset.Text = "Output Settings (Preset: Custom)";\r
-            CurrentlySelectedPreset = null;\r
+            this.currentlySelectedPreset = null;\r
         }\r
 \r
         private static void frmMain_DragEnter(object sender, DragEventArgs e)\r
@@ -882,7 +882,7 @@ namespace Handbrake
                         x264Panel.SetCurrentSettingsInPanel();\r
 \r
                         // Finally, let this window have a copy of the preset settings.\r
-                        CurrentlySelectedPreset = preset;\r
+                        this.currentlySelectedPreset = preset;\r
                         PictureSettings.SetPresetCropWarningLabel(preset);\r
                     }\r
                 }\r
@@ -1033,8 +1033,7 @@ namespace Handbrake
                     // Pause The Queue\r
                     encodeQueue.Pause();\r
 \r
-                    if (Properties.Settings.Default.enocdeStatusInGui &&\r
-                        !Properties.Settings.Default.showCliForInGuiEncodeStatus)\r
+                    if (Settings.Default.enocdeStatusInGui && !Settings.Default.showCliForInGuiEncodeStatus)\r
                     {\r
                         encodeQueue.Stop();\r
                     }\r
@@ -1046,8 +1045,11 @@ namespace Handbrake
             }\r
             else\r
             {\r
-                if (encodeQueue.Count != 0 ||\r
-                    (!string.IsNullOrEmpty(sourcePath) && !string.IsNullOrEmpty(text_destination.Text)))\r
+                // If we have a custom query, then we'll want to figure out what the new source and destination is, otherwise we'll just use the gui components.\r
+                string jobSourcePath = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetSourceFromQuery(rtf_query.Text) : sourcePath;\r
+                string jobDestination = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetDestinationFromQuery(rtf_query.Text) : text_destination.Text;\r
+\r
+                if (encodeQueue.Count != 0 || (!string.IsNullOrEmpty(jobSourcePath) && !string.IsNullOrEmpty(jobDestination)))\r
                 {\r
                     string generatedQuery = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null);\r
                     string specifiedQuery = rtf_query.Text != string.Empty\r
@@ -1091,17 +1093,19 @@ namespace Handbrake
                     }\r
 \r
                     DialogResult overwrite = DialogResult.Yes;\r
-                    if (text_destination.Text != string.Empty)\r
-                        if (File.Exists(text_destination.Text))\r
-                            overwrite =\r
-                                MessageBox.Show(\r
-                                    "The destination file already exists. Are you sure you want to overwrite it?",\r
-                                    "Overwrite File?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
+                    if (!string.IsNullOrEmpty(jobDestination) && File.Exists(jobDestination))\r
+                    {\r
+                        overwrite = MessageBox.Show(\r
+                                "The destination file already exists. Are you sure you want to overwrite it?",\r
+                                "Overwrite File?",\r
+                                MessageBoxButtons.YesNo,\r
+                                MessageBoxIcon.Question);\r
+                    }\r
 \r
                     if (overwrite == DialogResult.Yes)\r
                     {\r
                         if (encodeQueue.Count == 0)\r
-                            encodeQueue.Add(query, this.GetTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
+                            encodeQueue.Add(query, this.GetTitle(), jobSourcePath, jobDestination, (rtf_query.Text != string.Empty));\r
 \r
                         queueWindow.SetQueue();\r
                         if (encodeQueue.Count > 1)\r
@@ -1130,30 +1134,29 @@ namespace Handbrake
         /// </param>\r
         private void btn_add2Queue_Click(object sender, EventArgs e)\r
         {\r
-            // Note, don't currently do checks for custom queries. Only GUI components.\r
+            // Get the CLI query or use the query editor if it's not empty.\r
+            string query = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null);\r
+            if (!string.IsNullOrEmpty(rtf_query.Text))\r
+                query = rtf_query.Text;\r
+\r
+            // If we have a custom query, then we'll want to figure out what the new source and destination is, otherwise we'll just use the gui components.\r
+            string jobSourcePath = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetSourceFromQuery(rtf_query.Text) : sourcePath;\r
+            string jobDestination = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetDestinationFromQuery(rtf_query.Text) : text_destination.Text;\r
+\r
             // Make sure we have a Source and Destination.\r
-            if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))\r
+            if (string.IsNullOrEmpty(jobSourcePath) || string.IsNullOrEmpty(jobDestination))\r
             {\r
                 MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
                 return;\r
             }\r
 \r
             // Make sure the destination path exists.\r
-            if (!Directory.Exists(Path.GetDirectoryName(text_destination.Text)))\r
+            if (!Directory.Exists(Path.GetDirectoryName(jobDestination)))\r
             {\r
                 MessageBox.Show("Destination Path does not exist.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
                 return;\r
             }\r
 \r
-            // Get the CLI query or use the query editor if it's not empty.\r
-            string query = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null);\r
-            if (!string.IsNullOrEmpty(rtf_query.Text )) \r
-                query = rtf_query.Text;\r
-\r
-            // If we have a custom query, then we'll want to figure out what the new source and destination is, otherwise we'll just use the gui components.\r
-            string jobSourcePath = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetSourceFromQuery(rtf_query.Text) : sourcePath;\r
-            string jobDestination = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetDestinationFromQuery(rtf_query.Text): text_destination.Text;\r
-\r
             // Make sure we don't have a duplciate on the queue.\r
             if (encodeQueue.CheckForDestinationDuplicate(jobDestination))\r
             {\r
@@ -1231,11 +1234,11 @@ namespace Handbrake
         /// </param>\r
         private void btn_ActivityWindow_Click(object sender, EventArgs e)\r
         {\r
-            if (ActivityWindow == null || !ActivityWindow.IsHandleCreated)\r
-                ActivityWindow = new frmActivityWindow(encodeQueue, SourceScan);\r
+            if (this.activityWindow == null || !this.activityWindow.IsHandleCreated)\r
+                this.activityWindow = new frmActivityWindow(encodeQueue, SourceScan);\r
 \r
-            ActivityWindow.Show();\r
-            ActivityWindow.Activate();\r
+            this.activityWindow.Show();\r
+            this.activityWindow.Activate();\r
         }\r
 \r
         #endregion\r
@@ -1380,7 +1383,7 @@ namespace Handbrake
             {\r
                 selectedTitle = drp_dvdtitle.SelectedItem as Title;\r
                 lbl_duration.Text = selectedTitle.Duration.ToString();\r
-                PictureSettings.CurrentlySelectedPreset = CurrentlySelectedPreset;\r
+                PictureSettings.CurrentlySelectedPreset = this.currentlySelectedPreset;\r
                 PictureSettings.Source = selectedTitle; // Setup Picture Settings Tab Control\r
 \r
                 // Populate the Angles dropdown\r
@@ -1415,7 +1418,7 @@ namespace Handbrake
                     drop_chapterFinish.Text = drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString();\r
 \r
                 // Populate the Audio Channels Dropdown\r
-                AudioSettings.SetTrackList(selectedTitle, CurrentlySelectedPreset);\r
+                AudioSettings.SetTrackList(selectedTitle, this.currentlySelectedPreset);\r
 \r
                 // Populate the Subtitles dropdown\r
                 Subtitles.SetSubtitleTrackAuto(selectedTitle.Subtitles.ToArray());\r
@@ -2218,7 +2221,7 @@ namespace Handbrake
                 x264Panel.SetCurrentSettingsInPanel();\r
 \r
                 // Finally, let this window have a copy of the preset settings.\r
-                CurrentlySelectedPreset = null;\r
+                this.currentlySelectedPreset = null;\r
                 PictureSettings.SetPresetCropWarningLabel(null);\r
             }\r
         }\r