summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-06-14 13:31:24 +0000
committersr55 <[email protected]>2009-06-14 13:31:24 +0000
commitb023bb532c17e1284230172b660baa32b5750318 (patch)
tree33a5bfe14b29a2ed932e782b94469956cea5874d
parent729ff4e83ad9c402fd322922e38c6b75f55508e0 (diff)
WinGui:
- Small tweaks to Encode.cs - write2disk queue recovery feature is now completely handled in QueueHandler - Auto naming is on by default. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2533 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/C#/EncodeQueue/Encode.cs7
-rw-r--r--win/C#/EncodeQueue/QueueHandler.cs24
-rw-r--r--win/C#/Properties/Settings.Designer.cs6
-rw-r--r--win/C#/Properties/Settings.settings4
-rw-r--r--win/C#/app.config4
-rw-r--r--win/C#/frmMain.cs26
-rw-r--r--win/C#/frmQueue.cs6
7 files changed, 35 insertions, 42 deletions
diff --git a/win/C#/EncodeQueue/Encode.cs b/win/C#/EncodeQueue/Encode.cs
index c0e0b7c3e..80125fc30 100644
--- a/win/C#/EncodeQueue/Encode.cs
+++ b/win/C#/EncodeQueue/Encode.cs
@@ -33,7 +33,7 @@ namespace Handbrake.EncodeQueue
{
cliStart.RedirectStandardOutput = true;
cliStart.UseShellExecute = false;
-
+
}
if (Properties.Settings.Default.cli_minimized == "Checked")
cliStart.WindowStyle = ProcessWindowStyle.Minimized;
@@ -43,7 +43,8 @@ namespace Handbrake.EncodeQueue
currentEncode.processID = Main.getCliProcess(before);
currentEncode.isEncoding = true;
currentEncode.currentQuery = query;
- currentEncode.processHandle = (int)currentEncode.hbProcProcess.MainWindowHandle; // Set the process Handle
+ if (currentEncode.hbProcProcess != null)
+ currentEncode.processHandle = (int)currentEncode.hbProcProcess.MainWindowHandle; // Set the process Handle
// Set the process Priority
Process hbCliProcess = null;
@@ -75,7 +76,7 @@ namespace Handbrake.EncodeQueue
}
catch (Exception exc)
{
- MessageBox.Show("An error occured in runCli()\n Error Information: \n\n" + exc);
+ MessageBox.Show("It would appear that HandBrakeCLI has not started correctly. You should take a look at the Activity log as it may indicate the reason why.\n\n Detailed Error Information: error occured in runCli()\n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return currentEncode;
diff --git a/win/C#/EncodeQueue/QueueHandler.cs b/win/C#/EncodeQueue/QueueHandler.cs
index d16f10ffb..68cfe306a 100644
--- a/win/C#/EncodeQueue/QueueHandler.cs
+++ b/win/C#/EncodeQueue/QueueHandler.cs
@@ -36,6 +36,9 @@ namespace Handbrake.EncodeQueue
String query = job.Query;
lastQueueItem = job;
remove(0); // Remove the item which we are about to pass out.
+
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
+
return query;
}
@@ -57,6 +60,7 @@ namespace Handbrake.EncodeQueue
id++;
queue.Add(newJob);
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
}
/// <summary>
@@ -82,6 +86,7 @@ namespace Handbrake.EncodeQueue
public void remove(int index)
{
queue.RemoveAt(index);
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
}
/// <summary>
@@ -106,6 +111,7 @@ namespace Handbrake.EncodeQueue
queue.RemoveAt(index);
queue.Insert((index - 1), item);
}
+ updateQueueRecoveryFile("hb_queue_recovery.xml"); // Update the queue recovery file
}
/// <summary>
@@ -121,13 +127,14 @@ namespace Handbrake.EncodeQueue
queue.RemoveAt(index);
queue.Insert((index + 1), item);
}
+ updateQueueRecoveryFile("hb_queue_recovery.xml"); // Update the queue recovery file
}
/// <summary>
/// Writes the current queue to disk. hb_queue_recovery.xml
/// This function is called after getNextItemForEncoding()
/// </summary>
- public void write2disk(string file)
+ public void updateQueueRecoveryFile(string file)
{
string tempPath = file == "hb_queue_recovery.xml" ? Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml") : file;
@@ -191,11 +198,7 @@ namespace Handbrake.EncodeQueue
/// </summary>
public void recoverQueue(string file)
{
- string tempPath;
- if (file == "hb_queue_recovery.xml")
- tempPath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml");
- else
- tempPath = file;
+ string tempPath = file == "hb_queue_recovery.xml" ? Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml") : file;
if (File.Exists(tempPath))
{
@@ -210,7 +213,7 @@ namespace Handbrake.EncodeQueue
queue.Add(item);
if (file != "hb_queue_recovery.xml")
- write2disk("hb_queue_recovery.xml");
+ updateQueueRecoveryFile("hb_queue_recovery.xml");
}
}
}
@@ -226,7 +229,6 @@ namespace Handbrake.EncodeQueue
public void startEncode()
{
- Thread theQueue;
if (this.count() != 0)
{
if (isPaused)
@@ -236,7 +238,7 @@ namespace Handbrake.EncodeQueue
isPaused = false;
try
{
- theQueue = new Thread(startProc) { IsBackground = true };
+ Thread theQueue = new Thread(startProcess) { IsBackground = true };
theQueue.Start();
}
catch (Exception exc)
@@ -256,7 +258,7 @@ namespace Handbrake.EncodeQueue
encodeHandler.closeCLI(encodeProcess);
}
- private void startProc(object state)
+ private void startProcess(object state)
{
try
{
@@ -264,7 +266,7 @@ namespace Handbrake.EncodeQueue
while (this.count() != 0)
{
string query = getNextItemForEncoding();
- write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
+ updateQueueRecoveryFile("hb_queue_recovery.xml"); // Update the queue recovery file
encodeProcess = encodeHandler.runCli(query);
EncodeStarted(null);
diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs
index f4cb2bd33..d03a34de7 100644
--- a/win/C#/Properties/Settings.Designer.cs
+++ b/win/C#/Properties/Settings.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
+// Runtime Version:2.0.50727.3082
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -145,7 +145,7 @@ namespace Handbrake.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
+ [global::System.Configuration.DefaultSettingValueAttribute("Checked")]
public string autoNaming {
get {
return ((string)(this["autoNaming"]));
@@ -229,7 +229,7 @@ namespace Handbrake.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("{source}-{title}-{chapters}")]
+ [global::System.Configuration.DefaultSettingValueAttribute("{source}-{title}")]
public string autoNameFormat {
get {
return ((string)(this["autoNameFormat"]));
diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings
index 6a94bff03..d8d2a1c6f 100644
--- a/win/C#/Properties/Settings.settings
+++ b/win/C#/Properties/Settings.settings
@@ -33,7 +33,7 @@
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="autoNaming" Type="System.String" Scope="User">
- <Value Profile="(Default)" />
+ <Value Profile="(Default)">Checked</Value>
</Setting>
<Setting Name="autoNamePath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
@@ -54,7 +54,7 @@
<Value Profile="(Default)" />
</Setting>
<Setting Name="autoNameFormat" Type="System.String" Scope="User">
- <Value Profile="(Default)">{source}-{title}-{chapters}</Value>
+ <Value Profile="(Default)">{source}-{title}</Value>
</Setting>
<Setting Name="saveLogToSpecifiedPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
diff --git a/win/C#/app.config b/win/C#/app.config
index d4c74e98a..344c8dd04 100644
--- a/win/C#/app.config
+++ b/win/C#/app.config
@@ -38,7 +38,7 @@
<value>0</value>
</setting>
<setting name="autoNaming" serializeAs="String">
- <value />
+ <value>Checked</value>
</setting>
<setting name="autoNamePath" serializeAs="String">
<value />
@@ -59,7 +59,7 @@
<value />
</setting>
<setting name="autoNameFormat" serializeAs="String">
- <value>{source}-{title}-{chapters}</value>
+ <value>{source}-{title}</value>
</setting>
<setting name="saveLogToSpecifiedPath" serializeAs="String">
<value />
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index b74499ef3..bad59d7b8 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -26,8 +26,8 @@ namespace Handbrake
QueryGenerator queryGen = new QueryGenerator();
// Globals: Mainly used for tracking. *********************************
- Title selectedTitle;
- DVD thisDVD;
+ private Title selectedTitle;
+ private DVD thisDVD;
private frmQueue queueWindow;
private frmPreview qtpreview;
private Form splash;
@@ -215,9 +215,8 @@ namespace Handbrake
// Experimental HBProc Process Monitoring.
if (Properties.Settings.Default.enocdeStatusInGui == "Checked")
{
- HBProcess = encodeQueue.encodeProcess.hbProcProcess;
- Thread EncodeMon = new Thread(encodeMonitorThread);
- EncodeMon.Start();
+ Thread encodeMon = new Thread(encodeMonitorThread);
+ encodeMon.Start();
}
}
private void encodeEnded(object sender, EventArgs e)
@@ -544,10 +543,8 @@ namespace Handbrake
String query = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateTheQuery(this);
if (encodeQueue.count() == 0)
- {
encodeQueue.add(query, text_source.Text, text_destination.Text);
- encodeQueue.write2disk("hb_queue_recovery.xml");
- }
+
queueWindow.setQueue();
if (encodeQueue.count() > 1)
queueWindow.Show(false);
@@ -582,7 +579,6 @@ namespace Handbrake
else
encodeQueue.add(query, text_source.Text, text_destination.Text);
- encodeQueue.write2disk("hb_queue_recovery.xml"); // Writes the queue to the recovery file, just incase the GUI crashes.
queueWindow.Show();
}
}
@@ -1560,14 +1556,13 @@ namespace Handbrake
#endregion
#region In-GUI Encode Status (Experimental)
- private Process HBProcess { get; set; }
-
+
private void encodeMonitorThread()
{
try
{
- Parser encode = new Parser(HBProcess.StandardOutput.BaseStream);
- encode.OnEncodeProgress += encode_OnEncodeProgress;
+ Parser encode = new Parser(encodeQueue.encodeProcess.hbProcProcess.StandardOutput.BaseStream);
+ encode.OnEncodeProgress += encodeOnEncodeProgress;
while (!encode.EndOfStream)
{
encode.readEncodeStatus();
@@ -1578,12 +1573,11 @@ namespace Handbrake
MessageBox.Show(exc.ToString());
}
}
-
- private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
+ private void encodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
{
if (this.InvokeRequired)
{
- this.BeginInvoke(new EncodeProgressEventHandler(encode_OnEncodeProgress),
+ this.BeginInvoke(new EncodeProgressEventHandler(encodeOnEncodeProgress),
new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining });
return;
}
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index 88da988ba..1672ae3f5 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -255,7 +255,6 @@ namespace Handbrake
foreach (int selectedIndex in selectedIndices)
queue.remove(selectedIndex);
- queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
updateUIElements();
// Select the item where the first deleted item was previously
@@ -310,7 +309,6 @@ namespace Handbrake
foreach (int selectedIndex in selectedIndices)
queue.moveUp(selectedIndex);
- queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
updateUIElements();
// Keep the selected item(s) selected, now moved up one index
@@ -339,7 +337,6 @@ namespace Handbrake
foreach (int selectedIndex in selectedIndices)
queue.moveDown(selectedIndex);
- queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
updateUIElements();
// Keep the selected item(s) selected, now moved down one index
@@ -366,7 +363,7 @@ namespace Handbrake
SaveFile.Filter = "HandBrake Queue|*.queue";
SaveFile.ShowDialog();
if (SaveFile.FileName != String.Empty)
- queue.write2disk(SaveFile.FileName);
+ queue.updateQueueRecoveryFile(SaveFile.FileName);
}
private void mnu_import_Click(object sender, EventArgs e)
{
@@ -381,7 +378,6 @@ namespace Handbrake
if (queue.lastQueueItem != null)
{
queue.add(queue.lastQueueItem.Query, queue.lastQueueItem.Source, queue.lastQueueItem.Destination);
- queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
updateUIElements();
}
}