From 43b29fa60d2d30aa1802a7b913436f86cfe3d73f Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 13 May 2009 19:50:47 +0000 Subject: WinGui: - The CLI status information can now optionally be displayed in the encode status bar in the GUI. - Fixed Scan and Encode cancel functions with a hack. It was killing CMD.exe, not HandBrakeCLI.exe git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2416 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/Encode.cs | 36 +++++++++++++++--- win/C#/Functions/Main.cs | 48 ++++++++++++++++++++++++ win/C#/Parsing/Parser.cs | 49 ++++++++++++++++++++++++- win/C#/Properties/Settings.Designer.cs | 12 ++++++ win/C#/Properties/Settings.settings | 3 ++ win/C#/Queue/QueueHandler.cs | 16 +++++--- win/C#/app.config | 3 ++ win/C#/frmMain.cs | 58 ++++++++++++++++++++++------- win/C#/frmOptions.Designer.cs | 67 +++++++++++++++++++++------------- win/C#/frmOptions.cs | 13 ++++++- 10 files changed, 252 insertions(+), 53 deletions(-) diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index 044fad359..a6bfd263a 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -19,29 +19,33 @@ namespace Handbrake.Functions private static extern void LockWorkStation(); [DllImport("user32.dll")] private static extern int ExitWindowsEx(int uFlags, int dwReason); - - // Declarations - Process hbProc = new Process(); - + /// /// Execute a HandBrakeCLI process. /// /// The CLI Query public Process runCli(string query) { + Process hbProc = new Process(); try { string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe"); string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; string logPath = Path.Combine(logDir, "last_encode_log.txt"); - string strCmdLine = String.Format(@" CMD /c """"{0}"" {1} 2>""{2}"" """, handbrakeCLIPath, query, logPath); ProcessStartInfo cliStart = new ProcessStartInfo("CMD.exe", strCmdLine); + if (Properties.Settings.Default.enocdeStatusInGui == "Checked") + { + cliStart.RedirectStandardOutput = true; + cliStart.UseShellExecute = false; + } if (Properties.Settings.Default.cli_minimized == "Checked") cliStart.WindowStyle = ProcessWindowStyle.Minimized; + + Process[] before = Process.GetProcesses(); // Get a list of running processes before starting. hbProc = Process.Start(cliStart); - processID = hbProc.Id; + processID = Main.getCliProcess(before); isEncoding = true; currentQuery = query; @@ -73,9 +77,29 @@ namespace Handbrake.Functions { MessageBox.Show("An error occured in runCli()\n Error Information: \n\n" + exc); } + return hbProc; } + /// + /// Kill the CLI process + /// + public void closeCLI() + { + Process[] prs = Process.GetProcesses(); + foreach (Process process in prs) + { + if (process.Id == processID) + { + process.Refresh(); + if (!process.HasExited) + process.Kill(); + + process.WaitForExit(); + } + } + } + /// /// Perform an action after an encode. e.g a shutdown, standby, restart etc. /// diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index d7161205f..a95f5e144 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -11,6 +11,7 @@ using System.Diagnostics; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Xml.Serialization; +using System.Threading; namespace Handbrake.Functions { @@ -371,5 +372,52 @@ namespace Handbrake.Functions } } + /// + /// Get the Process ID of HandBrakeCLI for the current instance. + /// + /// List of processes before the new process was started + /// Int - Process ID + public static int getCliProcess(Process[] before) + { + // This is a bit of a cludge. Maybe someone has a better idea on how to impliment this. + // Since we used CMD to start HandBrakeCLI, we don't get the process ID from hbProc. + // Instead we take the processes before and after, and get the ID of HandBrakeCLI.exe + // avoiding any previous instances of HandBrakeCLI.exe in before. + // Kill the current process. + + Process[] hbProcesses = Process.GetProcessesByName("HandBrakeCLI"); + + // Another hack. We maybe need to wait a few seconds for HandBrakeCLI to launch + if (hbProcesses.Length == 0) + { + Thread.Sleep(2000); + hbProcesses = Process.GetProcessesByName("HandBrakeCLI"); + } + + Process hbProcess = null; + if (hbProcesses.Length > 0) + foreach (Process process in hbProcesses) + { + Boolean found = false; + // Check if the current CLI instance was running before we started the current one + foreach (Process bprocess in before) + { + if (process.Id == bprocess.Id) + found = true; + } + + // If it wasn't running before, we found the process we want. + if (!found) + { + hbProcess = process; + break; + } + } + if (hbProcess != null) + return hbProcess.Id; + + return -1; + } + } } diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs index c15275030..9b0e6459e 100644 --- a/win/C#/Parsing/Parser.cs +++ b/win/C#/Parsing/Parser.cs @@ -6,6 +6,8 @@ using System.IO; using System.Text.RegularExpressions; +using System; +using System.Globalization; namespace Handbrake.Parsing { @@ -24,6 +26,19 @@ namespace Handbrake.Parsing /// The total number of titiles to be processed public delegate void ScanProgressEventHandler(object Sender, int CurrentTitle, int TitleCount); + /// + /// A delegate to handle encode progress updates // EXPERIMENTAL + /// + /// The object which raised the event + /// The current task being processed from the queue + /// The total number of tasks in queue + /// The percentage this task is complete + /// The current encoding fps + /// The average encoding fps for this task + /// The estimated time remaining for this task to complete + public delegate void EncodeProgressEventHandler(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining); + + /// /// A simple wrapper around a StreamReader to keep track of the entire output from a cli process /// @@ -56,13 +71,18 @@ namespace Handbrake.Parsing /// public event ScanProgressEventHandler OnScanProgress; + #region Experimetnal Code + /// + /// Raised upon the catching of a "Scanning title # of #..." in the stream + /// + public event EncodeProgressEventHandler OnEncodeProgress; + #endregion /// /// Default constructor for this object /// /// The stream to parse from - public Parser(Stream baseStream) - : base(baseStream) + public Parser(Stream baseStream) : base(baseStream) { m_buffer = string.Empty; } @@ -92,5 +112,30 @@ namespace Handbrake.Parsing return tmp; } + + /// + /// Pase the CLI status output (from standard output) + /// + public void readEncodeStatus() + { + CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); + string tmp = base.ReadLine(); + + Match m = Regex.Match(tmp, @"^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\.[0-9]*) %( \(([0-9]*\.[0-9]*) fps, avg ([0-9]*\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\))?"); + if (m.Success && OnEncodeProgress != null) + { + int currentTask = int.Parse(m.Groups[1].Value); + int totalTasks = int.Parse(m.Groups[2].Value); + float percent = float.Parse(m.Groups[3].Value, culture); + float currentFps = m.Groups[5].Value == string.Empty ? 0.0F : float.Parse(m.Groups[5].Value, culture); + float avgFps = m.Groups[6].Value == string.Empty ? 0.0F : float.Parse(m.Groups[6].Value, culture); + TimeSpan remaining = TimeSpan.Zero; + if (m.Groups[7].Value != string.Empty) + { + remaining = TimeSpan.Parse(m.Groups[7].Value + ":" + m.Groups[8].Value + ":" + m.Groups[9].Value); + } + OnEncodeProgress(this, currentTask, totalTasks, percent, currentFps, avgFps, remaining); + } + } } } diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index 4b8fffbea..3df9d6ba3 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -358,5 +358,17 @@ namespace Handbrake.Properties { this["presetNotification"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string enocdeStatusInGui { + get { + return ((string)(this["enocdeStatusInGui"])); + } + set { + this["enocdeStatusInGui"] = value; + } + } } } diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index a5766339d..f4f00c1fb 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -86,5 +86,8 @@ + + + \ No newline at end of file diff --git a/win/C#/Queue/QueueHandler.cs b/win/C#/Queue/QueueHandler.cs index f5f3460c0..2473b3868 100644 --- a/win/C#/Queue/QueueHandler.cs +++ b/win/C#/Queue/QueueHandler.cs @@ -17,7 +17,7 @@ namespace Handbrake.Queue { public class QueueHandler { - readonly Encode encodeHandler = new Encode(); + Encode encodeHandler = new Encode(); private static XmlSerializer ser = new XmlSerializer(typeof(List)); List queue = new List(); int id; // Unique identifer number for each job @@ -45,7 +45,7 @@ namespace Handbrake.Queue /// Get the last query that was returned by getNextItemForEncoding() /// /// - public QueueItem lastQueueItem { get; set; } + public QueueItem lastQueueItem { get; set; } /// /// Add's a new item to the queue @@ -55,7 +55,7 @@ namespace Handbrake.Queue /// public void add(string query, string source, string destination) { - QueueItem newJob = new QueueItem {Id = id, Query = query, Source = source, Destination = destination}; + QueueItem newJob = new QueueItem { Id = id, Query = query, Source = source, Destination = destination }; id++; queue.Add(newJob); @@ -224,6 +224,7 @@ namespace Handbrake.Queue public Boolean isEncodeStarted { get; private set; } public Boolean isPaused { get; private set; } public Boolean isEncoding { get; private set; } + public Process hbProc { get; set; } public void startEncode() { @@ -237,7 +238,7 @@ namespace Handbrake.Queue isPaused = false; try { - theQueue = new Thread(startProc) {IsBackground = true}; + theQueue = new Thread(startProc) { IsBackground = true }; theQueue.Start(); } catch (Exception exc) @@ -252,10 +253,13 @@ namespace Handbrake.Queue isPaused = true; EncodePaused(null); } + public void endEncode() + { + encodeHandler.closeCLI(); + } private void startProc(object state) { - Process hbProc; try { // Run through each item on the queue @@ -264,8 +268,8 @@ namespace Handbrake.Queue string query = getNextItemForEncoding(); write2disk("hb_queue_recovery.xml"); // Update the queue recovery file - EncodeStarted(null); hbProc = encodeHandler.runCli(query); + EncodeStarted(null); hbProc.WaitForExit(); encodeHandler.addCLIQueryToLog(query); diff --git a/win/C#/app.config b/win/C#/app.config index f095d50d4..ef6471be5 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -91,6 +91,9 @@ + + + diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index edea6c54f..02fe25a1e 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -214,6 +214,14 @@ namespace Handbrake { lastAction = "encode"; setEncodeStarted(); + + // Experimental HBProc Process Monitoring. + if (Properties.Settings.Default.enocdeStatusInGui == "Checked") + { + HBProcess = encodeQueue.hbProc; + Thread EncodeMon = new Thread(encodeMonitorThread); + EncodeMon.Start(); + } } private void encodeEnded(object sender, EventArgs e) { @@ -597,15 +605,7 @@ namespace Handbrake { // Pause The Queue encodeQueue.pauseEncode(); - - // Kill the current process. - Process[] aProc = Process.GetProcessesByName("HandBrakeCLI"); - Process HandBrakeCLI; - if (aProc.Length > 0) - { - HandBrakeCLI = aProc[0]; - HandBrakeCLI.Kill(); - } + encodeQueue.endEncode(); // Update the GUI setEncodeFinished(); @@ -632,11 +632,9 @@ namespace Handbrake setEncodeStarted(); // Encode is running, so setup the GUI appropriately encodeQueue.startEncode(); // Start The Queue Encoding Process - } 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); - } } private void btn_add2Queue_Click(object sender, EventArgs e) @@ -1666,7 +1664,8 @@ namespace Handbrake Boolean cleanExit = true; using (hbproc = Process.Start(hbParseDvd)) { - scanProcessID = hbproc.Id; + Process[] before = Process.GetProcesses(); // Get a list of running processes before starting. + scanProcessID = Main.getCliProcess(before); hbproc.WaitForExit(); if (hbproc.ExitCode != 0) cleanExit = false; @@ -1770,7 +1769,7 @@ namespace Handbrake { enableGUI(); resetGUI(); - + Process[] prs = Process.GetProcesses(); foreach (Process process in prs) { @@ -2071,6 +2070,39 @@ 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; + while (!encode.EndOfStream) + { + encode.readEncodeStatus(); + } + } + catch (Exception exc) + { + MessageBox.Show(exc.ToString()); + } + } + + private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining) + { + if (this.InvokeRequired) + { + this.BeginInvoke(new EncodeProgressEventHandler(encode_OnEncodeProgress), + new object[] { Sender, CurrentTask, TaskCount, PercentComplete, CurrentFps, AverageFps, TimeRemaining }); + return; + } + lbl_encode.Text = string.Format("Encode Progress: {0}%, FPS: {1}, Avg FPS: {2}, Time Remaining: {3} ", PercentComplete, CurrentFps, AverageFps, TimeRemaining); + } + #endregion + + // This is the END of the road **************************************** } } \ No newline at end of file diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs index 14cc9c731..c05ba9faf 100644 --- a/win/C#/frmOptions.Designer.cs +++ b/win/C#/frmOptions.Designer.cs @@ -73,6 +73,7 @@ namespace Handbrake this.drp_processors = new System.Windows.Forms.ComboBox(); this.Label4 = new System.Windows.Forms.Label(); this.tab_advanced = new System.Windows.Forms.TabPage(); + this.check_disablePresetNotification = new System.Windows.Forms.CheckBox(); this.check_dvdnav = new System.Windows.Forms.CheckBox(); this.label32 = new System.Windows.Forms.Label(); this.label30 = new System.Windows.Forms.Label(); @@ -117,7 +118,7 @@ namespace Handbrake this.label26 = new System.Windows.Forms.Label(); this.label27 = new System.Windows.Forms.Label(); this.openFile_vlc = new System.Windows.Forms.OpenFileDialog(); - this.check_disablePresetNotification = new System.Windows.Forms.CheckBox(); + this.check_inGuiStatus = new System.Windows.Forms.CheckBox(); this.tab_options.SuspendLayout(); this.tab_general.SuspendLayout(); this.tab_picture.SuspendLayout(); @@ -132,7 +133,7 @@ namespace Handbrake this.btn_close.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btn_close.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_close.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_close.Location = new System.Drawing.Point(430, 370); + this.btn_close.Location = new System.Drawing.Point(430, 382); this.btn_close.Name = "btn_close"; this.btn_close.Size = new System.Drawing.Size(72, 22); this.btn_close.TabIndex = 53; @@ -169,7 +170,7 @@ namespace Handbrake this.tab_options.Location = new System.Drawing.Point(12, 55); this.tab_options.Name = "tab_options"; this.tab_options.SelectedIndex = 0; - this.tab_options.Size = new System.Drawing.Size(490, 309); + this.tab_options.Size = new System.Drawing.Size(490, 321); this.tab_options.TabIndex = 58; // // tab_general @@ -598,6 +599,7 @@ namespace Handbrake // // tab_advanced // + this.tab_advanced.Controls.Add(this.check_inGuiStatus); this.tab_advanced.Controls.Add(this.check_disablePresetNotification); this.tab_advanced.Controls.Add(this.check_dvdnav); this.tab_advanced.Controls.Add(this.label32); @@ -613,17 +615,32 @@ namespace Handbrake this.tab_advanced.Location = new System.Drawing.Point(4, 22); this.tab_advanced.Name = "tab_advanced"; this.tab_advanced.Padding = new System.Windows.Forms.Padding(3); - this.tab_advanced.Size = new System.Drawing.Size(482, 283); + this.tab_advanced.Size = new System.Drawing.Size(482, 295); this.tab_advanced.TabIndex = 4; this.tab_advanced.Text = "Advanced / Other"; this.tab_advanced.UseVisualStyleBackColor = true; // + // check_disablePresetNotification + // + this.check_disablePresetNotification.AutoSize = true; + this.check_disablePresetNotification.BackColor = System.Drawing.Color.Transparent; + this.check_disablePresetNotification.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.check_disablePresetNotification.Location = new System.Drawing.Point(76, 87); + this.check_disablePresetNotification.Name = "check_disablePresetNotification"; + this.check_disablePresetNotification.Size = new System.Drawing.Size(261, 17); + this.check_disablePresetNotification.TabIndex = 91; + this.check_disablePresetNotification.Text = "Disable Built-in preset update notification"; + this.ToolTip.SetToolTip(this.check_disablePresetNotification, "Disables the notification you recieve when presets are updated when a new version" + + " of HandBrake is installed."); + this.check_disablePresetNotification.UseVisualStyleBackColor = false; + this.check_disablePresetNotification.CheckedChanged += new System.EventHandler(this.check_disablePresetNotification_CheckedChanged); + // // check_dvdnav // this.check_dvdnav.AutoSize = true; this.check_dvdnav.BackColor = System.Drawing.Color.Transparent; this.check_dvdnav.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.check_dvdnav.Location = new System.Drawing.Point(76, 209); + this.check_dvdnav.Location = new System.Drawing.Point(76, 232); this.check_dvdnav.Name = "check_dvdnav"; this.check_dvdnav.Size = new System.Drawing.Size(297, 17); this.check_dvdnav.TabIndex = 90; @@ -635,7 +652,7 @@ namespace Handbrake // this.label32.AutoSize = true; this.label32.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label32.Location = new System.Drawing.Point(38, 209); + this.label32.Location = new System.Drawing.Point(38, 232); this.label32.Name = "label32"; this.label32.Size = new System.Drawing.Size(32, 13); this.label32.TabIndex = 89; @@ -644,7 +661,7 @@ namespace Handbrake // label30 // this.label30.AutoSize = true; - this.label30.Location = new System.Drawing.Point(73, 167); + this.label30.Location = new System.Drawing.Point(73, 190); this.label30.Name = "label30"; this.label30.Size = new System.Drawing.Size(230, 13); this.label30.TabIndex = 87; @@ -660,7 +677,7 @@ namespace Handbrake "0.50", "0.25", "0.20"}); - this.drop_x264step.Location = new System.Drawing.Point(312, 164); + this.drop_x264step.Location = new System.Drawing.Point(312, 187); this.drop_x264step.Name = "drop_x264step"; this.drop_x264step.Size = new System.Drawing.Size(111, 21); this.drop_x264step.TabIndex = 86; @@ -672,7 +689,7 @@ namespace Handbrake // this.label28.AutoSize = true; this.label28.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label28.Location = new System.Drawing.Point(27, 167); + this.label28.Location = new System.Drawing.Point(27, 190); this.label28.Name = "label28"; this.label28.Size = new System.Drawing.Size(43, 13); this.label28.TabIndex = 85; @@ -697,7 +714,7 @@ namespace Handbrake // this.lbl_appcastUnstable.AutoSize = true; this.lbl_appcastUnstable.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_appcastUnstable.Location = new System.Drawing.Point(6, 130); + this.lbl_appcastUnstable.Location = new System.Drawing.Point(6, 153); this.lbl_appcastUnstable.Name = "lbl_appcastUnstable"; this.lbl_appcastUnstable.Size = new System.Drawing.Size(64, 13); this.lbl_appcastUnstable.TabIndex = 83; @@ -724,7 +741,7 @@ namespace Handbrake this.check_snapshot.AutoSize = true; this.check_snapshot.BackColor = System.Drawing.Color.Transparent; this.check_snapshot.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.check_snapshot.Location = new System.Drawing.Point(76, 129); + this.check_snapshot.Location = new System.Drawing.Point(76, 152); this.check_snapshot.Name = "check_snapshot"; this.check_snapshot.Size = new System.Drawing.Size(273, 17); this.check_snapshot.TabIndex = 80; @@ -1113,24 +1130,23 @@ namespace Handbrake this.openFile_vlc.DefaultExt = "exe"; this.openFile_vlc.Filter = "exe|*.exe"; // - // check_disablePresetNotification + // check_inGuiStatus // - this.check_disablePresetNotification.AutoSize = true; - this.check_disablePresetNotification.BackColor = System.Drawing.Color.Transparent; - this.check_disablePresetNotification.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.check_disablePresetNotification.Location = new System.Drawing.Point(76, 87); - this.check_disablePresetNotification.Name = "check_disablePresetNotification"; - this.check_disablePresetNotification.Size = new System.Drawing.Size(261, 17); - this.check_disablePresetNotification.TabIndex = 91; - this.check_disablePresetNotification.Text = "Disable Built-in preset update notification"; - this.ToolTip.SetToolTip(this.check_disablePresetNotification, "Disables the notification you recieve when presets are updated when a new version" + - " of HandBrake is installed."); - this.check_disablePresetNotification.UseVisualStyleBackColor = false; - this.check_disablePresetNotification.CheckedChanged += new System.EventHandler(this.check_disablePresetNotification_CheckedChanged); + this.check_inGuiStatus.AutoSize = true; + this.check_inGuiStatus.BackColor = System.Drawing.Color.Transparent; + this.check_inGuiStatus.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.check_inGuiStatus.Location = new System.Drawing.Point(76, 110); + this.check_inGuiStatus.Name = "check_inGuiStatus"; + this.check_inGuiStatus.Size = new System.Drawing.Size(281, 17); + this.check_inGuiStatus.TabIndex = 92; + this.check_inGuiStatus.Text = "Enable in-GUI Encode status. (Experimental)"; + this.ToolTip.SetToolTip(this.check_inGuiStatus, "Displays the CLI status in the GUI windows instead of the CLI window."); + this.check_inGuiStatus.UseVisualStyleBackColor = false; + this.check_inGuiStatus.CheckedChanged += new System.EventHandler(this.check_inGuiStatus_CheckedChanged); // // frmOptions // - this.ClientSize = new System.Drawing.Size(514, 402); + this.ClientSize = new System.Drawing.Size(514, 413); this.Controls.Add(this.label8); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.tab_options); @@ -1242,5 +1258,6 @@ namespace Handbrake private System.Windows.Forms.Label label32; internal System.Windows.Forms.CheckBox check_logsInSpecifiedLocation; internal System.Windows.Forms.CheckBox check_disablePresetNotification; + internal System.Windows.Forms.CheckBox check_inGuiStatus; } } \ No newline at end of file diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index 289fdb798..0feae4cbb 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -109,9 +109,14 @@ namespace Handbrake if (Properties.Settings.Default.QueryEditorTab == "Checked") check_queryEditorTab.CheckState = CheckState.Checked; + // Preset update notification if (Properties.Settings.Default.presetNotification == "Checked") check_disablePresetNotification.CheckState = CheckState.Checked; + // Experimental In-GUI encode status indicator. + if (Properties.Settings.Default.enocdeStatusInGui == "Checked") + check_inGuiStatus.CheckState = CheckState.Checked; + // Enable snapshot updating if (Properties.Settings.Default.MainWindowMinimize == "Checked") check_mainMinimize.CheckState = CheckState.Checked; @@ -251,6 +256,11 @@ namespace Handbrake Properties.Settings.Default.presetNotification = check_disablePresetNotification.CheckState.ToString(); } + private void check_inGuiStatus_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.enocdeStatusInGui = check_inGuiStatus.CheckState.ToString(); + } + private void check_snapshot_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.checkSnapshot = check_snapshot.CheckState.ToString(); @@ -271,6 +281,7 @@ namespace Handbrake { Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this this.Close(); - } + } + } } \ No newline at end of file -- cgit v1.2.3