OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / frmOptions.cs
index 492ee35..c6519e1 100644 (file)
@@ -10,15 +10,20 @@ namespace Handbrake
     using System.Diagnostics;\r
     using System.Globalization;\r
     using System.Windows.Forms;\r
-    using Functions;\r
 \r
     using HandBrake.ApplicationServices;\r
 \r
+    using Handbrake.Functions;\r
+    using Handbrake.Model;\r
     using Handbrake.Properties;\r
 \r
+    /// <summary>\r
+    /// The Options Window\r
+    /// </summary>\r
     public partial class frmOptions : Form\r
     {\r
         private frmMain mainWindow;\r
+        private bool optionsWindowLoading = true;\r
 \r
         public frmOptions(frmMain mw)\r
         {\r
@@ -103,10 +108,20 @@ namespace Handbrake
 \r
             drop_preferredLang.SelectedItem = Properties.Settings.Default.NativeLanguage;\r
 \r
-            if (Properties.Settings.Default.DubAudio)\r
-                radio_dub.Checked = true;\r
-            else\r
-                radio_foreignAndSubs.Checked = true;\r
+            switch (Settings.Default.DubMode)\r
+            {\r
+                case 1:\r
+                    radio_dub.Checked = true;\r
+                    break;\r
+                case 2:\r
+                    radio_foreignAndSubs.Checked = true;\r
+                    break;\r
+                case 3:\r
+                    radio_preferredAudioAndSubs.Checked = true;\r
+                    break;\r
+            }\r
+\r
+            check_AddCCTracks.Checked = Properties.Settings.Default.useClosedCaption;\r
 \r
             // #############################\r
             // CLI\r
@@ -115,7 +130,7 @@ namespace Handbrake
             // Priority level for encodes\r
             drp_Priority.Text = Properties.Settings.Default.processPriority;\r
 \r
-            check_preventSleep.Checked = Properties.Settings.Default.preventSleep; \r
+            check_preventSleep.Checked = Properties.Settings.Default.preventSleep;\r
 \r
             // Log Verbosity Level\r
             cb_logVerboseLvl.SelectedIndex = Properties.Settings.Default.verboseLevel;\r
@@ -185,11 +200,7 @@ namespace Handbrake
             if (Properties.Settings.Default.noDvdNav)\r
                 check_dvdnav.CheckState = CheckState.Checked;\r
 \r
-            // #############################\r
-            // Debug\r
-            // #############################\r
-            if (Properties.Settings.Default.disableResCalc)\r
-                check_disableResCalc.Checked = true;\r
+            optionsWindowLoading = false;\r
         }\r
 \r
         #region General\r
@@ -260,6 +271,13 @@ namespace Handbrake
             }\r
             else\r
                 Properties.Settings.Default.autoNamePath = text_an_path.Text;\r
+\r
+            if (text_an_path.Text == "{source}" && !optionsWindowLoading)\r
+            {\r
+                MessageBox.Show(\r
+                    "Be careful with this feature. Make sure you can write to the same folder as the source! \n\n If you are encoding from a DVD, do not use this feature as HandBrake will not be able to write to the DVD!",\r
+                    "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+            }\r
         }\r
 \r
         private void check_m4v_CheckedChanged(object sender, EventArgs e)\r
@@ -305,13 +323,24 @@ namespace Handbrake
         private void radio_dub_CheckedChanged(object sender, EventArgs e)\r
         {\r
             if (radio_dub.Checked)\r
-                Properties.Settings.Default.DubAudio = true;\r
+                Properties.Settings.Default.DubMode = 1;\r
         }\r
 \r
         private void radio_foreignAndSubs_CheckedChanged(object sender, EventArgs e)\r
         {\r
             if (radio_foreignAndSubs.Checked)\r
-                Properties.Settings.Default.DubAudio = false;\r
+                Properties.Settings.Default.DubMode = 2;\r
+        }\r
+\r
+        private void radio_preferredAudioAndSubs_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            if (radio_preferredAudioAndSubs.Checked)\r
+                Properties.Settings.Default.DubMode = 3;\r
+        }\r
+\r
+        private void check_AddCCTracks_CheckedChanged(object sender, EventArgs e)\r
+        {\r
+            Settings.Default.useClosedCaption = check_AddCCTracks.Checked;\r
         }\r
 \r
         #endregion\r
@@ -368,12 +397,12 @@ namespace Handbrake
 \r
         private void btn_clearLogs_Click(object sender, EventArgs e)\r
         {\r
-            DialogResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", \r
+            DialogResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs",\r
                                                   MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);\r
             if (result == DialogResult.Yes)\r
             {\r
                 Main.ClearLogs();\r
-                MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK, \r
+                MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK,\r
                                 MessageBoxIcon.Information);\r
             }\r
         }\r
@@ -451,15 +480,6 @@ namespace Handbrake
 \r
         #endregion\r
 \r
-        #region Debug\r
-\r
-        private void check_disableResCalc_CheckedChanged(object sender, EventArgs e)\r
-        {\r
-            Properties.Settings.Default.disableResCalc = check_disableResCalc.Checked;\r
-        }\r
-\r
-        #endregion\r
-\r
         private void btn_close_Click(object sender, EventArgs e)\r
         {\r
             Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this\r
@@ -473,10 +493,21 @@ namespace Handbrake
         /// </summary>\r
         private static void UpdateApplicationServicesSettings()\r
         {\r
-            Init.SetupSettings(Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
-                               Settings.Default.growlEncode, Settings.Default.growlQueue,\r
-                               Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,\r
-                               Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);\r
+            string versionId = String.Format(\r
+                "Windows GUI {1} {0}", Settings.Default.hb_build, Settings.Default.hb_version);\r
+            Init.SetupSettings(\r
+                versionId,\r
+                Program.InstanceId,\r
+                Settings.Default.CompletionOption,\r
+                Settings.Default.noDvdNav,\r
+                Settings.Default.growlEncode,\r
+                Settings.Default.growlQueue,\r
+                Settings.Default.processPriority,\r
+                Settings.Default.saveLogPath,\r
+                Settings.Default.saveLogToSpecifiedPath,\r
+                Settings.Default.saveLogWithVideo,\r
+                Settings.Default.showCliForInGuiEncodeStatus,\r
+                Settings.Default.preventSleep);\r
         }\r
     }\r
 }
\ No newline at end of file