WinGui:
authorsr55 <sr55.hb@outlook.com>
Sun, 27 Mar 2011 14:29:06 +0000 (14:29 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 27 Mar 2011 14:29:06 +0000 (14:29 +0000)
- Add option for playing previews in the systems default player.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3883 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/Properties/Settings.Designer.cs
win/CS/Properties/Settings.settings
win/CS/app.config
win/CS/frmPreview.Designer.cs
win/CS/frmPreview.cs

index 9adc2577fc8ba34b9117698158b6a7e0e1a367af..4651d1303d2c06f4949ef838a261df3bf3de0c8f 100644 (file)
@@ -561,5 +561,17 @@ namespace Handbrake.Properties {
                 this["batchMaxDuration"] = value;\r
             }\r
         }\r
+        \r
+        [global::System.Configuration.UserScopedSettingAttribute()]\r
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
+        public bool defaultPlayer {\r
+            get {\r
+                return ((bool)(this["defaultPlayer"]));\r
+            }\r
+            set {\r
+                this["defaultPlayer"] = value;\r
+            }\r
+        }\r
     }\r
 }\r
index 0a2c6c7870f680d502be0c1e70743c6a8c51a84d..032e9da8ba08930ea726aa81f0296c7fb3d13ac3 100644 (file)
     <Setting Name="batchMaxDuration" Type="System.Int32" Scope="User">\r
       <Value Profile="(Default)">47</Value>\r
     </Setting>\r
+    <Setting Name="defaultPlayer" Type="System.Boolean" Scope="User">\r
+      <Value Profile="(Default)">False</Value>\r
+    </Setting>\r
   </Settings>\r
 </SettingsFile>
\ No newline at end of file
index 3b131d6ed3dbc0db5bd0174b77e99b0c139972f7..5b8f53d303d7f09b94650e5fac83b84d47ce0f9f 100644 (file)
       <setting name="batchMaxDuration" serializeAs="String">\r
         <value>47</value>\r
       </setting>\r
+      <setting name="defaultPlayer" serializeAs="String">\r
+        <value>False</value>\r
+      </setting>\r
     </Handbrake.Properties.Settings>\r
   </userSettings>\r
   \r
index 0dc245869d5df1bdbc69d52159fd214b238db908..a270ddbc4a3161f94d8421daef669bfeeff27d36 100644 (file)
@@ -39,6 +39,7 @@
             this.progressBar = new System.Windows.Forms.ProgressBar();\r
             this.lbl_progress = new System.Windows.Forms.Label();\r
             this.btn_play = new System.Windows.Forms.Button();\r
+            this.defaultPlayer = new System.Windows.Forms.CheckBox();\r
             this.SuspendLayout();\r
             // \r
             // startPoint\r
             this.btn_play.UseVisualStyleBackColor = true;\r
             this.btn_play.Click += new System.EventHandler(this.btn_play_Click);\r
             // \r
+            // defaultPlayer\r
+            // \r
+            this.defaultPlayer.AutoSize = true;\r
+            this.defaultPlayer.Location = new System.Drawing.Point(12, 62);\r
+            this.defaultPlayer.Name = "defaultPlayer";\r
+            this.defaultPlayer.Size = new System.Drawing.Size(151, 17);\r
+            this.defaultPlayer.TabIndex = 45;\r
+            this.defaultPlayer.Text = "Use system default player";\r
+            this.defaultPlayer.UseVisualStyleBackColor = true;\r
+            this.defaultPlayer.CheckedChanged += new System.EventHandler(this.DefaultPlayerCheckedChanged);\r
+            // \r
             // frmPreview\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(369, 91);\r
+            this.Controls.Add(this.defaultPlayer);\r
             this.Controls.Add(this.btn_play);\r
             this.Controls.Add(this.lbl_progress);\r
             this.Controls.Add(this.progressBar);\r
         private System.Windows.Forms.ProgressBar progressBar;\r
         private System.Windows.Forms.Label lbl_progress;\r
         private System.Windows.Forms.Button btn_play;\r
+        private System.Windows.Forms.CheckBox defaultPlayer;\r
 \r
     }\r
 }
\ No newline at end of file
index 96404e6f2f82dc8113701eb7dcac7b649693f03d..5572cda2316af3902d21896f37ce587b528d4ada 100644 (file)
@@ -77,6 +77,8 @@ namespace Handbrake
 \r
             encodeQueue.EncodeStarted += this.EncodeQueueEncodeStarted;\r
             encodeQueue.EncodeCompleted += this.EncodeQueueEncodeEnded;\r
+\r
+            defaultPlayer.Checked = Properties.Settings.Default.defaultPlayer;\r
         }\r
 \r
         #region Event Handlers\r
@@ -154,6 +156,12 @@ namespace Handbrake
             lbl_progress.Text = e.PercentComplete + "%";\r
             progressBar.Value = (int)Math.Round(e.PercentComplete);\r
         }\r
+\r
+        private void DefaultPlayerCheckedChanged(object sender, EventArgs e)\r
+        {\r
+            Properties.Settings.Default.defaultPlayer = defaultPlayer.Checked;\r
+            Properties.Settings.Default.Save();\r
+        }\r
         #endregion\r
 \r
         #region Encode Sample\r
@@ -219,37 +227,47 @@ namespace Handbrake
             {\r
                 if (File.Exists(this.currentlyPlaying))\r
                 {\r
-                    // Attempt to find VLC if it doesn't exist in the default set location.\r
-                    string vlcPath;\r
+                    string args = "\"" + this.currentlyPlaying + "\"";\r
 \r
-                    if (8 == IntPtr.Size ||\r
-                        (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))\r
-                        vlcPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");\r
+                    if (defaultPlayer.Checked)\r
+                    {\r
+                        Process.Start(args);\r
+                    }\r
                     else\r
-                        vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");\r
-\r
-     \r
-                    if (!File.Exists(Properties.Settings.Default.VLC_Path))\r
                     {\r
-                        if (File.Exists(vlcPath))\r
+\r
+                        // Attempt to find VLC if it doesn't exist in the default set location.\r
+                        string vlcPath;\r
+\r
+                        if (8 == IntPtr.Size ||\r
+                            (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")))) vlcPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");\r
+                        else vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");\r
+\r
+\r
+                        if (!File.Exists(Properties.Settings.Default.VLC_Path))\r
                         {\r
-                            Properties.Settings.Default.VLC_Path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";\r
-                            Properties.Settings.Default.Save(); // Save this new path if it does\r
+                            if (File.Exists(vlcPath))\r
+                            {\r
+                                Properties.Settings.Default.VLC_Path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";\r
+                                Properties.Settings.Default.Save(); // Save this new path if it does\r
+                            }\r
+                            else\r
+                            {\r
+                                MessageBox.Show(\r
+                                    this,\r
+                                    "Unable to detect VLC Player. \nPlease make sure VLC is installed and the directory specified in HandBrake's options is correct. (See: \"Tools Menu > Options > Picture Tab\") ",\r
+                                    "VLC",\r
+                                    MessageBoxButtons.OK,\r
+                                    MessageBoxIcon.Warning);\r
+                            }\r
                         }\r
-                        else\r
+\r
+                        if (File.Exists(Properties.Settings.Default.VLC_Path))\r
                         {\r
-                            MessageBox.Show(this,\r
-                                            "Unable to detect VLC Player. \nPlease make sure VLC is installed and the directory specified in HandBrake's options is correct. (See: \"Tools Menu > Options > Picture Tab\") ",\r
-                                            "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+                            ProcessStartInfo vlc = new ProcessStartInfo(Properties.Settings.Default.VLC_Path, args);\r
+                            Process.Start(vlc);\r
                         }\r
                     }\r
-\r
-                    if (File.Exists(Properties.Settings.Default.VLC_Path))\r
-                    {\r
-                        string args = "\"" + this.currentlyPlaying + "\"";\r
-                        ProcessStartInfo vlc = new ProcessStartInfo(Properties.Settings.Default.VLC_Path, args);\r
-                        Process.Start(vlc);\r
-                    }\r
                 }\r
                 else\r
                     MessageBox.Show(this,\r