X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=win%2FC%23%2FfrmQueue.cs;h=e110a470e51232d0af2fc8261c4ab9590352ba43;hb=2157ff283ee677c229c017d13a84805b0ab24fd3;hp=13c0e1f3ed6aee2f24fcbb5efca3a8abdd774197;hpb=dd81e75c737198c25fb915a1ba62c287f4156750;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 13c0e1f3..e110a470 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -9,34 +9,35 @@ using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using Handbrake.EncodeQueue; +using System.Collections.ObjectModel; namespace Handbrake { public partial class frmQueue : Form { private delegate void UpdateHandler(); - QueueHandler queue; + private EncodeAndQueueHandler queue; - public frmQueue(QueueHandler q) + public frmQueue(EncodeAndQueueHandler q) { InitializeComponent(); this.queue = q; - queue.OnEncodeStart += new EventHandler(queue_OnEncodeStart); - queue.OnQueueFinished += new EventHandler(queue_OnQueueFinished); - queue.OnPaused += new EventHandler(queue_OnPaused); + queue.NewJobStarted += new EventHandler(queueOnEncodeStart); + queue.QueueCompleted += new EventHandler(queueOnQueueFinished); + queue.QueuePauseRequested += new EventHandler(queueOnPaused); } - void queue_OnPaused(object sender, EventArgs e) + void queueOnPaused(object sender, EventArgs e) { setUIEncodeFinished(); updateUIElements(); } - void queue_OnQueueFinished(object sender, EventArgs e) + void queueOnQueueFinished(object sender, EventArgs e) { setUIEncodeFinished(); resetQueue(); // Reset the Queue Window } - void queue_OnEncodeStart(object sender, EventArgs e) + void queueOnEncodeStart(object sender, EventArgs e) { setUIEncodeStarted(); // make sure the UI is set correctly setCurrentEncodeInformation(); @@ -56,7 +57,7 @@ namespace Handbrake /// public new void Show() { - Show(true); + Show(true); } /// @@ -67,25 +68,26 @@ namespace Handbrake { if (doSetQueue) setQueue(); base.Show(); - Activate(); + + //Activate(); } // Start and Stop Controls private void btn_encode_Click(object sender, EventArgs e) { - if (queue.isPaused) + if (queue.PauseRequested) { setUIEncodeStarted(); MessageBox.Show("Encoding restarted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } - if (!queue.isEncodeStarted) - queue.startEncode(); + if (!queue.isEncoding) + queue.StartEncodeQueue(); } private void btn_pause_Click(object sender, EventArgs e) { - queue.pauseEncodeQueue(); + queue.RequestPause(); setUIEncodeFinished(); resetQueue(); MessageBox.Show("No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode' when you wish to continue encoding the queue.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); @@ -140,7 +142,7 @@ namespace Handbrake } list_queue.Items.Clear(); - List theQueue = queue.getQueue(); + ReadOnlyCollection theQueue = queue.CurrentQueue; foreach (Job queue_item in theQueue) { string q_item = queue_item.Query; @@ -202,9 +204,9 @@ namespace Handbrake } // found query is a global varible - Functions.QueryParser parsed = Functions.QueryParser.Parse(queue.lastQueueItem.Query); - lbl_source.Text = queue.lastQueueItem.Source; - lbl_dest.Text = queue.lastQueueItem.Destination; + Functions.QueryParser parsed = Functions.QueryParser.Parse(queue.LastEncode.Query); + lbl_source.Text = queue.LastEncode.Source; + lbl_dest.Text = queue.LastEncode.Destination; lbl_title.Text = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString(); @@ -253,7 +255,7 @@ namespace Handbrake // Remove each selected item foreach (int selectedIndex in selectedIndices) - queue.remove(selectedIndex); + queue.RemoveJob(selectedIndex); updateUIElements(); @@ -307,7 +309,7 @@ namespace Handbrake // Move up each selected item foreach (int selectedIndex in selectedIndices) - queue.moveUp(selectedIndex); + queue.MoveUp(selectedIndex); updateUIElements(); @@ -335,7 +337,7 @@ namespace Handbrake // Move down each selected item foreach (int selectedIndex in selectedIndices) - queue.moveDown(selectedIndex); + queue.MoveDown(selectedIndex); updateUIElements(); @@ -355,7 +357,7 @@ namespace Handbrake SaveFile.Filter = "Batch|.bat"; SaveFile.ShowDialog(); if (SaveFile.FileName != String.Empty) - queue.writeBatchScript(SaveFile.FileName); + queue.WriteBatchScriptToFile(SaveFile.FileName); } private void mnu_export_Click(object sender, EventArgs e) { @@ -363,21 +365,21 @@ namespace Handbrake SaveFile.Filter = "HandBrake Queue|*.queue"; SaveFile.ShowDialog(); if (SaveFile.FileName != String.Empty) - queue.updateQueueRecoveryFile(SaveFile.FileName); + queue.WriteQueueStateToFile(SaveFile.FileName); } private void mnu_import_Click(object sender, EventArgs e) { OpenFile.FileName = ""; OpenFile.ShowDialog(); if (OpenFile.FileName != String.Empty) - queue.recoverQueue(OpenFile.FileName); + queue.LoadQueueFromFile(OpenFile.FileName); updateUIElements(); } private void mnu_readd_Click(object sender, EventArgs e) { - if (queue.lastQueueItem != null) + if (!queue.LastEncode.IsEmpty) { - queue.add(queue.lastQueueItem.Query, queue.lastQueueItem.Source, queue.lastQueueItem.Destination); + queue.AddJob(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination); updateUIElements(); } }