diff options
author | sr55 <[email protected]> | 2011-03-27 14:29:06 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-03-27 14:29:06 +0000 |
commit | 7a57526a05a0bf9b23bfe921c9b19df7afd59af8 (patch) | |
tree | e7658f00a1a849374007b1e9201120a5438dd67e /win | |
parent | cb05e46863daec1a73f6b53bc6092d16e40c98a6 (diff) |
WinGui:
- 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
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/Properties/Settings.Designer.cs | 12 | ||||
-rw-r--r-- | win/CS/Properties/Settings.settings | 3 | ||||
-rw-r--r-- | win/CS/app.config | 3 | ||||
-rw-r--r-- | win/CS/frmPreview.Designer.cs | 14 | ||||
-rw-r--r-- | win/CS/frmPreview.cs | 64 |
5 files changed, 73 insertions, 23 deletions
diff --git a/win/CS/Properties/Settings.Designer.cs b/win/CS/Properties/Settings.Designer.cs index 9adc2577f..4651d1303 100644 --- a/win/CS/Properties/Settings.Designer.cs +++ b/win/CS/Properties/Settings.Designer.cs @@ -561,5 +561,17 @@ namespace Handbrake.Properties { this["batchMaxDuration"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool defaultPlayer {
+ get {
+ return ((bool)(this["defaultPlayer"]));
+ }
+ set {
+ this["defaultPlayer"] = value;
+ }
+ }
}
}
diff --git a/win/CS/Properties/Settings.settings b/win/CS/Properties/Settings.settings index 0a2c6c787..032e9da8b 100644 --- a/win/CS/Properties/Settings.settings +++ b/win/CS/Properties/Settings.settings @@ -137,5 +137,8 @@ <Setting Name="batchMaxDuration" Type="System.Int32" Scope="User">
<Value Profile="(Default)">47</Value>
</Setting>
+ <Setting Name="defaultPlayer" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">False</Value>
+ </Setting>
</Settings>
</SettingsFile>
\ No newline at end of file diff --git a/win/CS/app.config b/win/CS/app.config index 3b131d6ed..5b8f53d30 100644 --- a/win/CS/app.config +++ b/win/CS/app.config @@ -145,6 +145,9 @@ <setting name="batchMaxDuration" serializeAs="String">
<value>47</value>
</setting>
+ <setting name="defaultPlayer" serializeAs="String">
+ <value>False</value>
+ </setting>
</Handbrake.Properties.Settings>
</userSettings>
diff --git a/win/CS/frmPreview.Designer.cs b/win/CS/frmPreview.Designer.cs index 0dc245869..a270ddbc4 100644 --- a/win/CS/frmPreview.Designer.cs +++ b/win/CS/frmPreview.Designer.cs @@ -39,6 +39,7 @@ this.progressBar = new System.Windows.Forms.ProgressBar();
this.lbl_progress = new System.Windows.Forms.Label();
this.btn_play = new System.Windows.Forms.Button();
+ this.defaultPlayer = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// startPoint
@@ -127,11 +128,23 @@ this.btn_play.UseVisualStyleBackColor = true;
this.btn_play.Click += new System.EventHandler(this.btn_play_Click);
//
+ // defaultPlayer
+ //
+ this.defaultPlayer.AutoSize = true;
+ this.defaultPlayer.Location = new System.Drawing.Point(12, 62);
+ this.defaultPlayer.Name = "defaultPlayer";
+ this.defaultPlayer.Size = new System.Drawing.Size(151, 17);
+ this.defaultPlayer.TabIndex = 45;
+ this.defaultPlayer.Text = "Use system default player";
+ this.defaultPlayer.UseVisualStyleBackColor = true;
+ this.defaultPlayer.CheckedChanged += new System.EventHandler(this.DefaultPlayerCheckedChanged);
+ //
// frmPreview
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(369, 91);
+ this.Controls.Add(this.defaultPlayer);
this.Controls.Add(this.btn_play);
this.Controls.Add(this.lbl_progress);
this.Controls.Add(this.progressBar);
@@ -161,6 +174,7 @@ private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label lbl_progress;
private System.Windows.Forms.Button btn_play;
+ private System.Windows.Forms.CheckBox defaultPlayer;
}
}
\ No newline at end of file diff --git a/win/CS/frmPreview.cs b/win/CS/frmPreview.cs index 96404e6f2..5572cda23 100644 --- a/win/CS/frmPreview.cs +++ b/win/CS/frmPreview.cs @@ -77,6 +77,8 @@ namespace Handbrake encodeQueue.EncodeStarted += this.EncodeQueueEncodeStarted;
encodeQueue.EncodeCompleted += this.EncodeQueueEncodeEnded;
+
+ defaultPlayer.Checked = Properties.Settings.Default.defaultPlayer;
}
#region Event Handlers
@@ -154,6 +156,12 @@ namespace Handbrake lbl_progress.Text = e.PercentComplete + "%";
progressBar.Value = (int)Math.Round(e.PercentComplete);
}
+
+ private void DefaultPlayerCheckedChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.defaultPlayer = defaultPlayer.Checked;
+ Properties.Settings.Default.Save();
+ }
#endregion
#region Encode Sample
@@ -219,37 +227,47 @@ namespace Handbrake {
if (File.Exists(this.currentlyPlaying))
{
- // Attempt to find VLC if it doesn't exist in the default set location.
- string vlcPath;
+ string args = "\"" + this.currentlyPlaying + "\"";
- if (8 == IntPtr.Size ||
- (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
- vlcPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
+ if (defaultPlayer.Checked)
+ {
+ Process.Start(args);
+ }
else
- vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");
-
-
- if (!File.Exists(Properties.Settings.Default.VLC_Path))
{
- if (File.Exists(vlcPath))
+
+ // Attempt to find VLC if it doesn't exist in the default set location.
+ string vlcPath;
+
+ if (8 == IntPtr.Size ||
+ (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")))) vlcPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
+ else vlcPath = Environment.GetEnvironmentVariable("ProgramFiles");
+
+
+ if (!File.Exists(Properties.Settings.Default.VLC_Path))
{
- Properties.Settings.Default.VLC_Path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";
- Properties.Settings.Default.Save(); // Save this new path if it does
+ if (File.Exists(vlcPath))
+ {
+ Properties.Settings.Default.VLC_Path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe";
+ Properties.Settings.Default.Save(); // Save this new path if it does
+ }
+ else
+ {
+ MessageBox.Show(
+ this,
+ "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\") ",
+ "VLC",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Warning);
+ }
}
- else
+
+ if (File.Exists(Properties.Settings.Default.VLC_Path))
{
- MessageBox.Show(this,
- "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\") ",
- "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ ProcessStartInfo vlc = new ProcessStartInfo(Properties.Settings.Default.VLC_Path, args);
+ Process.Start(vlc);
}
}
-
- if (File.Exists(Properties.Settings.Default.VLC_Path))
- {
- string args = "\"" + this.currentlyPlaying + "\"";
- ProcessStartInfo vlc = new ProcessStartInfo(Properties.Settings.Default.VLC_Path, args);
- Process.Start(vlc);
- }
}
else
MessageBox.Show(this,
|