summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-05-13 20:07:52 +0000
committersr55 <[email protected]>2009-05-13 20:07:52 +0000
commit8e57aaf22e7b27ea5c56b1a689a6226b858b8c2a (patch)
tree18ed9535195b8a02622d88540d9b16c6e00a4a56 /win
parent43b29fa60d2d30aa1802a7b913436f86cfe3d73f (diff)
WinGui:
- Fix Activity Log window not updating for scan log - Fix Process Affinity not being set for encodes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2417 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/C#/Functions/Encode.cs20
-rw-r--r--win/C#/frmActivityWindow.cs6
-rw-r--r--win/C#/frmMain.cs8
3 files changed, 22 insertions, 12 deletions
diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs
index a6bfd263a..d5c6577e5 100644
--- a/win/C#/Functions/Encode.cs
+++ b/win/C#/Functions/Encode.cs
@@ -49,27 +49,31 @@ namespace Handbrake.Functions
isEncoding = true;
currentQuery = query;
- // Set the process Priority
- if (hbProc != null)
+ // Set the process Priority
+ Process hbCliProcess = null;
+ if (processID != -1)
+ hbCliProcess = Process.GetProcessById(processID);
+
+ if (hbCliProcess != null)
switch (Properties.Settings.Default.processPriority)
{
case "Realtime":
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.RealTime;
break;
case "High":
- hbProc.PriorityClass = ProcessPriorityClass.High;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.High;
break;
case "Above Normal":
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
break;
case "Normal":
- hbProc.PriorityClass = ProcessPriorityClass.Normal;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.Normal;
break;
case "Low":
- hbProc.PriorityClass = ProcessPriorityClass.Idle;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.Idle;
break;
default:
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
+ hbCliProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
break;
}
}
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs
index d2d1ff17a..dc979f28e 100644
--- a/win/C#/frmActivityWindow.cs
+++ b/win/C#/frmActivityWindow.cs
@@ -22,11 +22,12 @@ namespace Handbrake
Queue.QueueHandler encodeQueue;
int position; // Position in the arraylist reached by the current log output in the rtf box.
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ private frmMain mainWin;
/// <summary>
/// This window should be used to display the RAW output of the handbrake CLI which is produced during an encode.
/// </summary>
- public frmActivityWindow(string file, Queue.QueueHandler eh)
+ public frmActivityWindow(string file, Queue.QueueHandler eh, frmMain mw)
{
InitializeComponent();
@@ -34,6 +35,7 @@ namespace Handbrake
encodeQueue = eh;
read_file = file;
position = 0;
+ mainWin = mw;
// When the window closes, we want to abort the monitor thread.
this.Disposed += new EventHandler(forceQuit);
@@ -111,7 +113,7 @@ namespace Handbrake
updateTextFromThread();
while (true)
{
- if (encodeQueue.isEncoding)
+ if (encodeQueue.isEncoding || mainWin.isScanning)
updateTextFromThread();
else
{
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 02fe25a1e..fa004ea4c 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -256,7 +256,7 @@ namespace Handbrake
String file;
file = lastAction == "scan" ? "last_scan_log.txt" : "last_encode_log.txt";
- frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, encodeQueue);
+ frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, encodeQueue, this);
dvdInfoWindow.Show();
}
private void mnu_options_Click(object sender, EventArgs e)
@@ -632,6 +632,7 @@ namespace Handbrake
setEncodeStarted(); // Encode is running, so setup the GUI appropriately
encodeQueue.startEncode(); // Start The Queue Encoding Process
+ this.Focus();
}
else if (text_source.Text == string.Empty || text_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -692,7 +693,7 @@ namespace Handbrake
{
String file = lastAction == "scan" ? "last_scan_log.txt" : "last_encode_log.txt";
- frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeQueue);
+ frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeQueue, this);
ActivityWindow.Show();
}
#endregion
@@ -1608,6 +1609,7 @@ namespace Handbrake
// MainWindow Components, Actions and Functions ***********************
#region Source Scan
+ public Boolean isScanning { get; set; }
private static int scanProcessID { get; set; }
private void setupGUIforScan(String filename)
{
@@ -1634,6 +1636,7 @@ namespace Handbrake
{
lbl_encode.Visible = true;
lbl_encode.Text = "Scanning...";
+ isScanning = true;
ThreadPool.QueueUserWorkItem(scanProcess, filename);
}
catch (Exception exc)
@@ -1801,6 +1804,7 @@ namespace Handbrake
text_destination.Text = "";
thisDVD = null;
selectedTitle = null;
+ isScanning = false;
}
#endregion