X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=win%2FC%23%2FfrmPreview.cs;h=10bd1cf4cfbebc7f828e95a462764d8c451eb7e2;hb=3166f4bf518b12ef658ce4a249f9a265b16693bd;hp=d68841b4980e0f082417eebab2236cc86106d77b;hpb=46ef431ee18da11b72c337b0148d4d7c8fd8a52a;p=handbrake-jp%2Fhandbrake-jp-git.git
diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs
index d68841b4..10bd1cf4 100644
--- a/win/C#/frmPreview.cs
+++ b/win/C#/frmPreview.cs
@@ -10,21 +10,26 @@ namespace Handbrake
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
+ using System.Windows;
using System.Windows.Forms;
using Functions;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using QTOControlLib;
using QTOLibrary;
+ using MessageBox = System.Windows.Forms.MessageBox;
+
///
/// The Preview Window
///
public partial class frmPreview : Form
{
#region Private Variables
+
///
/// The Main Window
///
@@ -33,12 +38,12 @@ namespace Handbrake
///
/// True if QT is not installed
///
- private readonly bool noQT;
+ private readonly bool noQt;
///
/// The encode queue
///
- private readonly IQueue encodeQueue = new Queue();
+ private readonly IEncode encodeQueue = new Encode();
///
/// What is currently playing
@@ -48,13 +53,15 @@ namespace Handbrake
///
/// Play With VLC tracker
///
- private bool playWithVLC;
+ private bool playWithVlc;
///
/// A Thread for the video player
///
private Thread player;
+ #endregion
+
///
/// Initializes a new instance of the class.
///
@@ -69,21 +76,34 @@ namespace Handbrake
}
catch (Exception)
{
- this.noQT = true;
+ this.noQt = true;
+
+ int borderWidth = (this.Width - this.ClientSize.Width) / 2;
+ int titlebarAndBorder = this.Height - this.ClientSize.Height;
+
+ this.Height = toolBar.Height + titlebarAndBorder + 1;
+ btn_playQT.Enabled = false;
+ btn_playQT.Visible = false;
}
+
this.mainWindow = mw;
+
cb_preview.SelectedIndex = 0;
cb_duration.SelectedIndex = 1;
cb_preview.Items.Clear();
for (int i = 1; i <= Properties.Settings.Default.previewScanCount; i++)
+ {
cb_preview.Items.Add(i.ToString());
+ }
+
cb_preview.SelectedIndex = 0;
- encodeQueue.EncodeStarted += this.EncodeQueue_EncodeStarted;
- encodeQueue.EncodeEnded += this.EncodeQueue_EncodeEnded;
+ encodeQueue.EncodeStarted += this.EncodeQueueEncodeStarted;
+ encodeQueue.EncodeCompleted += this.EncodeQueueEncodeEnded;
}
+ #region Delegates
///
/// Update UI Delegate
///
@@ -93,15 +113,15 @@ namespace Handbrake
///
/// The e.
///
- private delegate void UpdateUIHandler(object sender, EventArgs e);
+ private delegate void UpdateUiHandler(object sender, EventArgs e);
///
/// The Open Movie Handler
///
private delegate void OpenMovieHandler();
-
#endregion
+ #region Event Handlers
///
/// The encode has started
///
@@ -111,9 +131,9 @@ namespace Handbrake
///
/// The e.
///
- private void EncodeQueue_EncodeStarted(object sender, EventArgs e)
+ private void EncodeQueueEncodeStarted(object sender, EventArgs e)
{
- encodeQueue.EncodeStatusChanged += this.EncodeQueue_EncodeStatusChanged;
+ encodeQueue.EncodeStatusChanged += this.EncodeQueueEncodeStatusChanged;
}
///
@@ -125,22 +145,22 @@ namespace Handbrake
///
/// The e.
///
- private void EncodeQueue_EncodeEnded(object sender, EventArgs e)
+ private void EncodeQueueEncodeEnded(object sender, EventArgs e)
{
- encodeQueue.EncodeStatusChanged -= this.EncodeQueue_EncodeStatusChanged;
+ encodeQueue.EncodeStatusChanged -= this.EncodeQueueEncodeStatusChanged;
try
{
if (this.InvokeRequired)
{
- this.BeginInvoke(new UpdateUIHandler(EncodeQueue_EncodeEnded), new[] { sender, e });
+ this.BeginInvoke(new UpdateUiHandler(EncodeQueueEncodeEnded), new[] { sender, e });
return;
}
ProgressBarStatus.Visible = false;
lbl_encodeStatus.Visible = false;
- if (!this.noQT)
+ if (!this.noQt)
btn_playQT.Enabled = true;
btn_playVLC.Enabled = true;
@@ -153,10 +173,10 @@ namespace Handbrake
Replace(".mkv", "_sample.mkv");
// Play back in QT or VLC
- if (!playWithVLC)
+ if (!playWithVlc)
Play();
else
- PlayVLC();
+ PlayVlc();
}
catch (Exception exc)
{
@@ -173,17 +193,18 @@ namespace Handbrake
///
/// The e.
///
- private void EncodeQueue_EncodeStatusChanged(object sender, HandBrake.ApplicationServices.EncodeProgressEventArgs e)
+ private void EncodeQueueEncodeStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs e)
{
if (this.InvokeRequired)
{
- this.BeginInvoke(new Encode.EncodeProgessStatus(this.EncodeQueue_EncodeStatusChanged), new[] { sender, e });
+ this.BeginInvoke(new EncodeProgessStatus(this.EncodeQueueEncodeStatusChanged), new[] { sender, e });
return;
}
lbl_encodeStatus.Text = e.PercentComplete + "%";
ProgressBarStatus.Value = (int)Math.Round(e.PercentComplete);
}
+ #endregion
#region Encode Sample
@@ -196,16 +217,17 @@ namespace Handbrake
///
/// The e.
///
- private void PlayVLC_Click(object sender, EventArgs e)
+ private void PlayVlcClick(object sender, EventArgs e)
{
ProgressBarStatus.Visible = true;
ProgressBarStatus.Value = 0;
lbl_encodeStatus.Visible = true;
- playWithVLC = true;
-
+ playWithVlc = true;
+ this.panel1.Visible = false;
+
try
{
- if (!this.noQT)
+ if (!this.noQt)
QTControl.URL = string.Empty;
if (File.Exists(this.currentlyPlaying))
@@ -235,10 +257,11 @@ namespace Handbrake
///
/// The e.
///
- private void PlayQT_Click(object sender, EventArgs e)
+ private void PlayQtClick(object sender, EventArgs e)
{
- playWithVLC = false;
- if (this.noQT)
+ playWithVlc = false;
+ this.panel1.Visible = true;
+ if (this.noQt)
{
MessageBox.Show(this,
"It would appear QuickTime 7 is not installed or not accessible. Please (re)install QuickTime.",
@@ -248,7 +271,7 @@ namespace Handbrake
if (this.mainWindow.text_destination.Text.Contains(".mkv"))
{
MessageBox.Show(this,
- "The QuickTime Control does not support MKV files, It is recommended you use VLC option instead.",
+ "The QuickTime Control does not support MKV files, It is recommended you use the VLC option instead.",
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
@@ -294,14 +317,15 @@ namespace Handbrake
MessageBox.Show(
this,
"Handbrake is already encoding a video!",
- "Status",
+ "Warning",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return;
}
- encodeQueue.CreatePreviewSample((string)state);
+ QueueTask task = new QueueTask((string)state);
+ encodeQueue.Start(task, false);
}
#endregion
@@ -320,7 +344,7 @@ namespace Handbrake
///
/// Play the video back in an external VLC Player
///
- private void PlayVLC()
+ private void PlayVlc()
{
// Launch VLC and Play video.
if (this.currentlyPlaying != string.Empty)
@@ -388,7 +412,7 @@ namespace Handbrake
QTControl.Show();
this.ClientSize = QTControl.Size;
- this.Height += 25;
+ this.Height += toolBar.Height;
}
catch (COMException ex)
{
@@ -411,8 +435,8 @@ namespace Handbrake
///
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
- encodeQueue.EncodeStarted -= this.EncodeQueue_EncodeStarted;
- encodeQueue.EncodeEnded -= this.EncodeQueue_EncodeEnded;
+ encodeQueue.EncodeStarted -= this.EncodeQueueEncodeStarted;
+ encodeQueue.EncodeCompleted -= this.EncodeQueueEncodeEnded;
base.OnClosing(e);
}
}