OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 13 Jul 2010 22:02:00 +0000 (22:02 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 13 Jul 2010 22:02:00 +0000 (22:02 +0000)
- Major rework of the Encode Service. This allows previews to be generated while an encode is running. I've left in a bunch of debug code for the moment so it may be a bit noisy at times if something goes a bit wrong. Will remove later when the code is known to work.
- The windows 7 Encode Progress Bar on the Task bar is working again.

git-svn-id: svn://localhost/HandBrake/trunk@3436 b64f7644-9d1e-0410-96f1-a4d463321fa5

16 files changed:
win/C#/HandBrake.ApplicationServices/Functions/Win7.cs
win/C#/HandBrake.ApplicationServices/Init.cs
win/C#/HandBrake.ApplicationServices/Properties/Settings.Designer.cs
win/C#/HandBrake.ApplicationServices/Properties/Settings.settings
win/C#/HandBrake.ApplicationServices/Services/Encode.cs
win/C#/HandBrake.ApplicationServices/Services/Queue.cs
win/C#/HandBrake.ApplicationServices/app.config
win/C#/Program.cs
win/C#/Properties/Settings.Designer.cs
win/C#/Properties/Settings.settings
win/C#/app.config
win/C#/frmMain.cs
win/C#/frmOptions.Designer.cs
win/C#/frmOptions.cs
win/C#/frmOptions.resx
win/C#/frmPreview.cs

index d8f522f..0123139 100644 (file)
@@ -6,8 +6,6 @@
 namespace HandBrake.ApplicationServices.Functions\r
 {\r
     using System;\r
-\r
-    using Microsoft.WindowsAPICodePack;\r
     using Microsoft.WindowsAPICodePack.Taskbar;\r
 \r
     /// <summary>\r
@@ -55,7 +53,7 @@ namespace HandBrake.ApplicationServices.Functions
             {\r
                 return;\r
             }\r
-\r
+            windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal); // todo CHECK THIS\r
             windowsTaskbar.SetProgressValue(percentage, 100);\r
         }\r
 \r
index 7fb0e90..c8f15c3 100644 (file)
@@ -52,14 +52,12 @@ namespace HandBrake.ApplicationServices
         /// <param name="preventSleep">\r
         /// Prevent the system from sleeping\r
         /// </param>\r
-        public static void SetupSettings(bool cli_minimized, string completionOption, bool disableDvdNav, bool enocdeStatusInGui,\r
+        public static void SetupSettings(string completionOption, bool disableDvdNav,\r
                                   bool growlEncode, bool growlQueue, string processPriority, string saveLogPath, bool saveLogToSpecifiedPath,\r
                                   bool saveLogWithVideo, bool showCliForInGuiEncodeStatus, bool preventSleep)\r
         {\r
-            Properties.Settings.Default.cli_minimized = cli_minimized;\r
             Properties.Settings.Default.CompletionOption = completionOption;\r
             Properties.Settings.Default.disableDvdNav = disableDvdNav;\r
-            Properties.Settings.Default.enocdeStatusInGui = enocdeStatusInGui;\r
             Properties.Settings.Default.growlEncode = growlEncode;\r
             Properties.Settings.Default.growlQueue = growlQueue;\r
             Properties.Settings.Default.processPriority = processPriority;\r
index d835524..42083c5 100644 (file)
@@ -110,18 +110,6 @@ namespace HandBrake.ApplicationServices.Properties {
         [global::System.Configuration.UserScopedSettingAttribute()]\r
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
         [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool cli_minimized {\r
-            get {\r
-                return ((bool)(this["cli_minimized"]));\r
-            }\r
-            set {\r
-                this["cli_minimized"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
         public bool showCliForInGuiEncodeStatus {\r
             get {\r
                 return ((bool)(this["showCliForInGuiEncodeStatus"]));\r
@@ -134,18 +122,6 @@ namespace HandBrake.ApplicationServices.Properties {
         [global::System.Configuration.UserScopedSettingAttribute()]\r
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
         [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool enocdeStatusInGui {\r
-            get {\r
-                return ((bool)(this["enocdeStatusInGui"]));\r
-            }\r
-            set {\r
-                this["enocdeStatusInGui"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
         public bool growlEncode {\r
             get {\r
                 return ((bool)(this["growlEncode"]));\r
index 96d2de8..581684d 100644 (file)
     <Setting Name="processPriority" Type="System.String" Scope="User">\r
       <Value Profile="(Default)" />\r
     </Setting>\r
-    <Setting Name="cli_minimized" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
     <Setting Name="showCliForInGuiEncodeStatus" Type="System.Boolean" Scope="User">\r
       <Value Profile="(Default)">False</Value>\r
     </Setting>\r
-    <Setting Name="enocdeStatusInGui" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
     <Setting Name="growlEncode" Type="System.Boolean" Scope="User">\r
       <Value Profile="(Default)">False</Value>\r
     </Setting>\r
index 1731d48..79b82a2 100644 (file)
@@ -25,7 +25,7 @@ namespace HandBrake.ApplicationServices.Services
     /// </summary>\r
     public class Encode : IEncode\r
     {\r
-        /* Private Variables */\r
+        #region Private Variables\r
 \r
         /// <summary>\r
         /// An Encode Job\r
@@ -38,14 +38,9 @@ namespace HandBrake.ApplicationServices.Services
         private StringBuilder logBuffer;\r
 \r
         /// <summary>\r
-        /// The line number thats been read to in the log file\r
+        /// The Log file writer\r
         /// </summary>\r
-        private int logFilePosition;\r
-\r
-        /// <summary>\r
-        /// A Timer for this window\r
-        /// </summary>\r
-        private Timer windowTimer;\r
+        private StreamWriter fileWriter;\r
 \r
         /// <summary>\r
         /// Gets The Process Handle\r
@@ -62,6 +57,8 @@ namespace HandBrake.ApplicationServices.Services
         /// </summary>\r
         private Win7 windowsSeven = new Win7();\r
 \r
+        #endregion\r
+\r
         /* Constructor */\r
 \r
         /// <summary>\r
@@ -72,7 +69,7 @@ namespace HandBrake.ApplicationServices.Services
             this.EncodeStarted += Encode_EncodeStarted;\r
         }\r
 \r
-        /* Delegates */\r
+        #region Delegates and Event Handlers\r
 \r
         /// <summary>\r
         /// Encode Progess Status\r
@@ -101,6 +98,7 @@ namespace HandBrake.ApplicationServices.Services
         /// Encode process has progressed\r
         /// </summary>\r
         public event EncodeProgessStatus EncodeStatusChanged;\r
+        #endregion\r
 \r
         /* Properties */\r
 \r
@@ -114,8 +112,6 @@ namespace HandBrake.ApplicationServices.Services
         /// </summary>\r
         public bool IsEncoding { get; private set; }\r
 \r
-        /* Public Methods */\r
-\r
         /// <summary>\r
         /// Gets ActivityLog.\r
         /// </summary>\r
@@ -123,16 +119,17 @@ namespace HandBrake.ApplicationServices.Services
         {\r
             get\r
             {\r
-                if (logBuffer == null)\r
+                if (this.IsEncoding == false)\r
                 {\r
-                    ResetLogReader();\r
-                    ReadFile(null);\r
+                    ReadFile(); // Read the last log file back in if it exists\r
                 }\r
 \r
-                return logBuffer != null ? logBuffer.ToString() : string.Empty;\r
+                return string.IsNullOrEmpty(this.logBuffer.ToString()) ? "No log data available..." : this.logBuffer.ToString();\r
             }\r
         }\r
 \r
+        /* Public Methods */\r
+\r
         /// <summary>\r
         /// Create a preview sample video\r
         /// </summary>\r
@@ -141,42 +138,7 @@ namespace HandBrake.ApplicationServices.Services
         /// </param>\r
         public void CreatePreviewSample(string query)\r
         {\r
-            this.Run(new Job { Query = query }, true);\r
-        }\r
-\r
-        /// <summary>\r
-        /// Kill the CLI process\r
-        /// </summary>\r
-        public void Stop()\r
-        {\r
-            if (this.HbProcess != null)\r
-                this.HbProcess.Kill();\r
-\r
-            Process[] list = Process.GetProcessesByName("HandBrakeCLI");\r
-            foreach (Process process in list)\r
-                process.Kill();\r
-\r
-            if (this.EncodeEnded != null)\r
-                this.EncodeEnded(this, new EventArgs());\r
-        }\r
-\r
-        /// <summary>\r
-        /// Attempt to Safely kill a DirectRun() CLI\r
-        /// NOTE: This will not work with a MinGW CLI\r
-        /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html\r
-        /// </summary>\r
-        public void SafelyClose()\r
-        {\r
-            if ((int)this.processHandle == 0)\r
-                return;\r
-\r
-            // Allow the CLI to exit cleanly\r
-            Win32.SetForegroundWindow((int)this.processHandle);\r
-            SendKeys.Send("^C");\r
-            SendKeys.Flush();\r
-\r
-            // HbProcess.StandardInput.AutoFlush = true;\r
-            // HbProcess.StandardInput.WriteLine("^C");\r
+            this.Run(new Job { Query = query }, false);\r
         }\r
 \r
         /// <summary>\r
@@ -185,77 +147,73 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="encJob">\r
         /// The enc Job.\r
         /// </param>\r
-        /// <param name="requireStandardOuput">\r
-        /// Set to True to show no window and force standard output redirect\r
+        /// <param name="enableLogging">\r
+        /// Enable Logging. When Disabled we onlt parse Standard Ouput for progress info. Standard Error log data is ignored.\r
         /// </param>\r
-        protected void Run(Job encJob, bool requireStandardOuput)\r
+        protected void Run(Job encJob, bool enableLogging)\r
         {\r
             this.job = encJob;\r
             try\r
             {\r
-                if (Properties.Settings.Default.preventSleep)\r
+                IsEncoding = true;\r
+\r
+                if (enableLogging)\r
+                    SetupLogging(encJob);\r
+\r
+                if (Settings.Default.preventSleep)\r
                 {\r
                     Win32.PreventSleep();\r
                 }\r
 \r
-                ResetLogReader();\r
-                IsEncoding = true;\r
-\r
                 string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
-                string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs", "last_encode_log.txt");\r
-                string strCmdLine = String.Format(@" /C """"{0}"" {1} 2>""{2}"" """, handbrakeCLIPath, encJob.Query, logPath);\r
-                var cliStart = new ProcessStartInfo("CMD.exe", strCmdLine);\r
+                ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, encJob.Query)\r
+                { \r
+                    RedirectStandardOutput = true,\r
+                    RedirectStandardError = enableLogging ? true : false,\r
+                    UseShellExecute = false,\r
+                    CreateNoWindow = !Settings.Default.showCliForInGuiEncodeStatus ? true : false\r
+                };\r
+              \r
+                this.HbProcess = Process.Start(cliStart);\r
 \r
-                if (Settings.Default.enocdeStatusInGui || requireStandardOuput)\r
+                if (enableLogging)\r
                 {\r
-                    cliStart.RedirectStandardOutput = true;\r
-                    cliStart.UseShellExecute = false;\r
-                    if (!Settings.Default.showCliForInGuiEncodeStatus || requireStandardOuput)\r
-                        cliStart.CreateNoWindow = true;\r
+                    this.HbProcess.ErrorDataReceived += HbProcErrorDataReceived;\r
+                    this.HbProcess.BeginErrorReadLine();\r
                 }\r
-                if (Settings.Default.cli_minimized)\r
-                    cliStart.WindowStyle = ProcessWindowStyle.Minimized;\r
 \r
-                Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
-                HbProcess = Process.Start(cliStart);\r
-                this.processID = Main.GetCliProcess(before);\r
-\r
-                this.processHandle = HbProcess.MainWindowHandle; // Set the process Handle\r
-\r
-                // Start the Log Monitor\r
-                windowTimer = new Timer(new TimerCallback(ReadFile), null, 1000, 1000);\r
+                this.processID = HbProcess.Id;\r
+                this.processHandle = HbProcess.MainWindowHandle;\r
 \r
                 // Set the process Priority\r
-                Process hbCliProcess = null;\r
                 if (this.processID != -1)\r
                 {\r
-                    hbCliProcess = Process.GetProcessById(this.processID);\r
-                    hbCliProcess.EnableRaisingEvents = true;\r
-                    hbCliProcess.Exited += new EventHandler(HbProcess_Exited);\r
+                    this.HbProcess.EnableRaisingEvents = true;\r
+                    this.HbProcess.Exited += HbProcess_Exited;\r
                 }\r
 \r
-                if (hbCliProcess != null)\r
-                    switch (Settings.Default.processPriority)\r
-                    {\r
-                        case "Realtime":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.RealTime;\r
-                            break;\r
-                        case "High":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.High;\r
-                            break;\r
-                        case "Above Normal":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.AboveNormal;\r
-                            break;\r
-                        case "Normal":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.Normal;\r
-                            break;\r
-                        case "Low":\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.Idle;\r
-                            break;\r
-                        default:\r
-                            hbCliProcess.PriorityClass = ProcessPriorityClass.BelowNormal;\r
-                            break;\r
-                    }\r
+                // Set the Process Priority\r
+                switch (Settings.Default.processPriority)\r
+                {\r
+                    case "Realtime":\r
+                        this.HbProcess.PriorityClass = ProcessPriorityClass.RealTime;\r
+                        break;\r
+                    case "High":\r
+                        this.HbProcess.PriorityClass = ProcessPriorityClass.High;\r
+                        break;\r
+                    case "Above Normal":\r
+                        this.HbProcess.PriorityClass = ProcessPriorityClass.AboveNormal;\r
+                        break;\r
+                    case "Normal":\r
+                        this.HbProcess.PriorityClass = ProcessPriorityClass.Normal;\r
+                        break;\r
+                    case "Low":\r
+                        this.HbProcess.PriorityClass = ProcessPriorityClass.Idle;\r
+                        break;\r
+                    default:\r
+                        this.HbProcess.PriorityClass = ProcessPriorityClass.BelowNormal;\r
+                        break;\r
+                }\r
 \r
                 // Fire the Encode Started Event\r
                 if (this.EncodeStarted != null)\r
@@ -263,150 +221,94 @@ namespace HandBrake.ApplicationServices.Services
             }\r
             catch (Exception exc)\r
             {\r
-                Main.ShowExceptiowWindow("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\nDetailed Error Information: error occured in runCli()", exc.ToString());\r
+                Main.ShowExceptiowWindow("It would appear that HandBrakeCLI has not started correctly."+ \r
+                "You should take a look at the Activity log as it may indicate the reason why.\n\nDetailed Error Information: error occured in runCli()", \r
+                exc.ToString());\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// The HandBrakeCLI process has exited.\r
+        /// Kill the CLI process\r
         /// </summary>\r
-        /// <param name="sender">\r
-        /// The sender.\r
-        /// </param>\r
-        /// <param name="e">\r
-        /// The EventArgs.\r
-        /// </param>\r
-        private void HbProcess_Exited(object sender, EventArgs e)\r
+        public void Stop()\r
         {\r
-            IsEncoding = false;\r
-\r
-            windowTimer.Dispose();\r
-            ReadFile(null);\r
-\r
-            if (this.EncodeEnded != null)\r
-                this.EncodeEnded(this, new EventArgs());\r
-\r
-            if (windowsSeven.IsWindowsSeven)\r
+            try\r
             {\r
-                windowsSeven.SetTaskBarProgressToNoProgress();\r
-            }\r
+                if (this.HbProcess != null) this.HbProcess.Kill();\r
 \r
-            if (Properties.Settings.Default.preventSleep)\r
+                Process[] list = Process.GetProcessesByName("HandBrakeCLI");\r
+                foreach (Process process in list)\r
+                    process.Kill();\r
+            } \r
+            catch (Exception exc)\r
             {\r
-                Win32.AllowSleep();\r
+                Main.ShowExceptiowWindow("Unable to stop HandBrakeCLI. It may not be running.", exc.ToString());\r
             }\r
+\r
+            if (this.EncodeEnded != null)\r
+                this.EncodeEnded(this, new EventArgs());\r
         }\r
 \r
         /// <summary>\r
-        /// Function to run the CLI directly rather than via CMD\r
-        /// TODO: Code to handle the Log data has yet to be written.\r
-        /// TODO: Code to handle the % / ETA info has to be written.\r
+        /// Attempt to Safely kill a DirectRun() CLI\r
+        /// NOTE: This will not work with a MinGW CLI\r
+        /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html\r
         /// </summary>\r
-        /// <param name="query">\r
-        /// The query.\r
-        /// </param>\r
-        protected void DirectRun(string query)\r
+        public void SafelyClose()\r
         {\r
-            try\r
-            {\r
-                if (this.EncodeStarted != null)\r
-                    this.EncodeStarted(this, new EventArgs());\r
-\r
-                IsEncoding = true;\r
+            if ((int)this.processHandle == 0)\r
+                return;\r
 \r
-                ResetLogReader();\r
-\r
-                // Setup the job\r
-                string handbrakeCLIPath = Path.Combine(Environment.CurrentDirectory, "HandBrakeCLI.exe");\r
-                HbProcess = new Process\r
-                                {\r
-                                    StartInfo =\r
-                                        {\r
-                                            FileName = handbrakeCLIPath,\r
-                                            Arguments = query,\r
-                                            UseShellExecute = false,\r
-                                            RedirectStandardOutput = true,\r
-                                            RedirectStandardError = true,\r
-                                            RedirectStandardInput = true,\r
-                                            CreateNoWindow = false,\r
-                                            WindowStyle = ProcessWindowStyle.Minimized\r
-                                        }\r
-                                };\r
-\r
-                // Setup event handlers for rediected data\r
-                HbProcess.ErrorDataReceived += new DataReceivedEventHandler(HbProcErrorDataReceived);\r
-                HbProcess.OutputDataReceived += new DataReceivedEventHandler(HbProcOutputDataReceived);\r
-\r
-                // Start the process\r
-                HbProcess.Start();\r
-\r
-                // Setup the asynchronous reading of stdin and stderr\r
-                HbProcess.BeginErrorReadLine();\r
-                HbProcess.BeginOutputReadLine();\r
-\r
-                // Set the Process Priority);\r
-                switch (Settings.Default.processPriority)\r
-                {\r
-                    case "Realtime":\r
-                        HbProcess.PriorityClass = ProcessPriorityClass.RealTime;\r
-                        break;\r
-                    case "High":\r
-                        HbProcess.PriorityClass = ProcessPriorityClass.High;\r
-                        break;\r
-                    case "Above Normal":\r
-                        HbProcess.PriorityClass = ProcessPriorityClass.AboveNormal;\r
-                        break;\r
-                    case "Normal":\r
-                        HbProcess.PriorityClass = ProcessPriorityClass.Normal;\r
-                        break;\r
-                    case "Low":\r
-                        HbProcess.PriorityClass = ProcessPriorityClass.Idle;\r
-                        break;\r
-                    default:\r
-                        HbProcess.PriorityClass = ProcessPriorityClass.BelowNormal;\r
-                        break;\r
-                }\r
+            // Allow the CLI to exit cleanly\r
+            Win32.SetForegroundWindow((int)this.processHandle);\r
+            SendKeys.Send("^C");\r
+            SendKeys.Flush();\r
 \r
-                // Set the class items\r
-                this.processID = HbProcess.Id;\r
-                this.processHandle = HbProcess.Handle;\r
-            }\r
-            catch (Exception exc)\r
+            if (HbProcess != null)\r
             {\r
-                Console.WriteLine(exc);\r
+                HbProcess.StandardInput.AutoFlush = true;\r
+                HbProcess.StandardInput.WriteLine("^C");\r
             }\r
         }\r
 \r
+        /* Helpers */\r
         /// <summary>\r
         /// Add the CLI Query to the Log File.\r
         /// </summary>\r
         /// <param name="encJob">\r
         /// The Encode Job Object\r
         /// </param>\r
-        protected void AddCLIQueryToLog(Job encJob)\r
+        private static string CreateCliLogHeader(Job encJob)\r
         {\r
             try\r
             {\r
-                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +\r
-                                "\\HandBrake\\logs";\r
-                string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
+                //string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +\r
+                //                "\\HandBrake\\logs";\r
+                //string logPath = Path.Combine(logDir, "last_encode_log.txt");\r
+\r
+                //var reader = new StreamReader(File.Open(logPath, FileMode.Open, FileAccess.Read, FileShare.Read));\r
+                //string log = reader.ReadToEnd();\r
+                //reader.Close();\r
+\r
+                //var writer = new StreamWriter(File.Create(logPath));\r
 \r
-                var reader = new StreamReader(File.Open(logPath, FileMode.Open, FileAccess.Read, FileShare.Read));\r
-                string log = reader.ReadToEnd();\r
-                reader.Close();\r
 \r
-                var writer = new StreamWriter(File.Create(logPath));\r
+                //writer.WriteLine("### CLI Query: " + encJob.Query);\r
+                //writer.WriteLine("### User Query: " + encJob.CustomQuery);\r
+                //writer.WriteLine("#########################################");\r
+                //writer.WriteLine(log);\r
+                //writer.Flush();\r
+                //writer.Close();\r
+                StringBuilder logHeader = new StringBuilder();\r
+                logHeader.AppendLine("### CLI Query: " + encJob.Query);\r
+                logHeader.AppendLine("### User Query: " + encJob.CustomQuery);\r
+                logHeader.AppendLine("#########################################");\r
 \r
-                writer.WriteLine("### CLI Query: " + encJob.Query);\r
-                writer.WriteLine("### User Query: " + encJob.CustomQuery);\r
-                writer.WriteLine("#########################################");\r
-                writer.WriteLine(log);\r
-                writer.Flush();\r
-                writer.Close();\r
+                return logHeader.ToString();\r
             }\r
             catch (Exception)\r
             {\r
-                return;\r
+                return string.Empty;\r
             }\r
         }\r
 \r
@@ -453,21 +355,61 @@ namespace HandBrake.ApplicationServices.Services
         }\r
 \r
         /// <summary>\r
+        /// The HandBrakeCLI process has exited.\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The EventArgs.\r
+        /// </param>\r
+        private void HbProcess_Exited(object sender, EventArgs e)\r
+        {\r
+            IsEncoding = false;\r
+\r
+            //   ReadFile(null);\r
+\r
+            if (this.EncodeEnded != null)\r
+                this.EncodeEnded(this, new EventArgs());\r
+\r
+            if (windowsSeven.IsWindowsSeven)\r
+            {\r
+                windowsSeven.SetTaskBarProgressToNoProgress();\r
+            }\r
+\r
+            if (Properties.Settings.Default.preventSleep)\r
+            {\r
+                Win32.AllowSleep();\r
+            }\r
+\r
+            try\r
+            {\r
+                if (fileWriter != null)\r
+                    fileWriter.Close();\r
+            } \r
+            catch(Exception exc)\r
+            {\r
+                Main.ShowExceptiowWindow("Unable to close the log file wrtier", exc.ToString());\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
         /// Read the log file\r
         /// </summary>\r
         /// <param name="n">\r
         /// The object.\r
         /// </param>\r
-        private void ReadFile(object n)\r
+        private void ReadFile()\r
         {\r
+            logBuffer = new StringBuilder();\r
             lock (logBuffer)\r
             {\r
                 // last_encode_log.txt is the primary log file. Since .NET can't read this file whilst the CLI is outputing to it (Not even in read only mode),\r
                 // we'll need to make a copy of it.\r
-                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +\r
-                                "\\HandBrake\\logs";\r
+                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
                 string logFile = Path.Combine(logDir, "last_encode_log.txt");\r
                 string logFile2 = Path.Combine(logDir, "tmp_appReadable_log.txt");\r
+                int logFilePosition = 0;\r
 \r
                 try\r
                 {\r
@@ -479,19 +421,8 @@ namespace HandBrake.ApplicationServices.Services
                     if (File.Exists(logFile))\r
                         File.Copy(logFile, logFile2, true);\r
                     else\r
-                    {\r
-                        ResetLogReader();\r
                         return;\r
-                    }\r
-\r
-                    // Put the Query and User Generated Query Flag on the log.\r
-                    if (logFilePosition == 0 && job.Query != null)\r
-                    {\r
-                        logBuffer.AppendLine("### CLI Query: " + job.Query);\r
-                        logBuffer.AppendLine("### User Query: " + job.CustomQuery);\r
-                        logBuffer.AppendLine("#########################################");\r
-                    }\r
-\r
\r
                     // Start the Reader\r
                     // Only use text which continues on from the last read line\r
                     StreamReader sr = new StreamReader(logFile2);\r
@@ -509,42 +440,45 @@ namespace HandBrake.ApplicationServices.Services
                     sr.Close();\r
                     sr.Dispose();\r
                 }\r
-                catch (Exception)\r
+                catch (Exception exc)\r
                 {\r
-                    ResetLogReader();\r
+                    Main.ShowExceptiowWindow("Unable to read log file", exc.ToString());\r
                 }\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Reset the Log Reader\r
+        /// Setup the logging.\r
         /// </summary>\r
-        private void ResetLogReader()\r
+        private void SetupLogging(Job encodeJob)\r
         {\r
-            logFilePosition = 0;\r
-            logBuffer = new StringBuilder();\r
-        }\r
+            string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+            string logFile = Path.Combine(logDir, "last_encode_log.txt");\r
+            string logFile2 = Path.Combine(logDir, "tmp_appReadable_log.txt");\r
 \r
-        /// <summary>\r
-        /// Recieve the Standard Error information and process it\r
-        /// </summary>\r
-        /// <param name="sender">\r
-        /// The Sender Object\r
-        /// </param>\r
-        /// <param name="e">\r
-        /// DataReceived EventArgs\r
-        /// </param>\r
-        private void HbProcErrorDataReceived(object sender, DataReceivedEventArgs e)\r
-        {\r
-            if (!String.IsNullOrEmpty(e.Data))\r
+            try\r
             {\r
-                lock (logBuffer)\r
-                    logBuffer.AppendLine(e.Data);\r
+                logBuffer = new StringBuilder();\r
+\r
+                // Clear the current Encode Logs\r
+                if (File.Exists(logFile)) File.Delete(logFile);\r
+                if (File.Exists(logFile2)) File.Delete(logFile2);\r
+\r
+                fileWriter = new StreamWriter(logFile) { AutoFlush = true };\r
+\r
+                fileWriter.WriteLine(CreateCliLogHeader(encodeJob));\r
+                logBuffer.AppendLine(CreateCliLogHeader(encodeJob));\r
+            }\r
+            catch (Exception exc)\r
+            {\r
+                if (fileWriter != null)\r
+                    fileWriter.Close();\r
+                Main.ShowExceptiowWindow("Error", exc.ToString());\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Standard Input Data Recieved from the CLI\r
+        /// Recieve the Standard Error information and process it\r
         /// </summary>\r
         /// <param name="sender">\r
         /// The Sender Object\r
@@ -552,15 +486,27 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="e">\r
         /// DataReceived EventArgs\r
         /// </param>\r
-        private void HbProcOutputDataReceived(object sender, DataReceivedEventArgs e)\r
+        private void HbProcErrorDataReceived(object sender, DataReceivedEventArgs e)\r
         {\r
             if (!String.IsNullOrEmpty(e.Data))\r
             {\r
                 lock (logBuffer)\r
                     logBuffer.AppendLine(e.Data);\r
+\r
+                try\r
+                {\r
+                    if (fileWriter != null)\r
+                        fileWriter.WriteLine(e.Data);\r
+                }\r
+                catch (Exception exc)\r
+                {\r
+                    Main.ShowExceptiowWindow("Unable to write log data...", exc.ToString());\r
+                }         \r
             }\r
         }\r
 \r
+        #region Encode Status from Standard Output\r
+\r
         /// <summary>\r
         /// Encode Started\r
         /// </summary>\r
@@ -587,8 +533,6 @@ namespace HandBrake.ApplicationServices.Services
                 encode.OnEncodeProgress += EncodeOnEncodeProgress;\r
                 while (!encode.EndOfStream)\r
                     encode.ReadEncodeStatus();\r
-\r
-                // Main.ShowExceptiowWindow("Encode Monitor Stopped", "Stopped");\r
             }\r
             catch (Exception exc)\r
             {\r
@@ -629,5 +573,7 @@ namespace HandBrake.ApplicationServices.Services
                 windowsSeven.SetTaskBarProgress(percent);\r
             }\r
         }\r
+\r
+        #endregion\r
     }\r
 }
\ No newline at end of file
index 5b6904f..da32d25 100644 (file)
@@ -380,7 +380,7 @@ namespace HandBrake.ApplicationServices.Services
                 Job encJob = this.GetNextJob();\r
                 this.WriteQueueStateToFile("hb_queue_recovery.xml"); // Update the queue recovery file\r
 \r
-                Run(encJob, false);\r
+                Run(encJob, true);\r
 \r
                 if (HbProcess == null)\r
                 {\r
@@ -388,7 +388,6 @@ namespace HandBrake.ApplicationServices.Services
                 }\r
                 HbProcess.WaitForExit();\r
 \r
-                AddCLIQueryToLog(encJob);\r
                 this.CopyLog(this.LastEncode.Destination);\r
 \r
                 HbProcess.Close();\r
index 29ee489..4bb66af 100644 (file)
             <setting name="processPriority" serializeAs="String">\r
                 <value />\r
             </setting>\r
-            <setting name="cli_minimized" serializeAs="String">\r
-                <value>False</value>\r
-            </setting>\r
             <setting name="showCliForInGuiEncodeStatus" serializeAs="String">\r
                 <value>False</value>\r
             </setting>\r
-            <setting name="enocdeStatusInGui" serializeAs="String">\r
-                <value>False</value>\r
-            </setting>\r
             <setting name="growlEncode" serializeAs="String">\r
                 <value>False</value>\r
             </setting>\r
index dde4a1a..6480b50 100644 (file)
@@ -88,8 +88,8 @@ namespace Handbrake
         /// </summary>\r
         private static void InitializeApplicationServices()\r
         {\r
-            Init.SetupSettings(Settings.Default.cli_minimized, Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
-                               Settings.Default.enocdeStatusInGui, Settings.Default.growlEncode, Settings.Default.growlQueue,\r
+            Init.SetupSettings(Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
+                               Settings.Default.growlEncode, Settings.Default.growlQueue,\r
                                Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,\r
                                Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);\r
         }\r
index a6e909f..1055f87 100644 (file)
@@ -169,18 +169,6 @@ namespace Handbrake.Properties {
         \r
         [global::System.Configuration.UserScopedSettingAttribute()]\r
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
-        public bool cli_minimized {\r
-            get {\r
-                return ((bool)(this["cli_minimized"]));\r
-            }\r
-            set {\r
-                this["cli_minimized"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
         [global::System.Configuration.DefaultSettingValueAttribute("{source}-{title}")]\r
         public string autoNameFormat {\r
             get {\r
@@ -314,18 +302,6 @@ namespace Handbrake.Properties {
         [global::System.Configuration.UserScopedSettingAttribute()]\r
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
         [global::System.Configuration.DefaultSettingValueAttribute("True")]\r
-        public bool enocdeStatusInGui {\r
-            get {\r
-                return ((bool)(this["enocdeStatusInGui"]));\r
-            }\r
-            set {\r
-                this["enocdeStatusInGui"] = value;\r
-            }\r
-        }\r
-        \r
-        [global::System.Configuration.UserScopedSettingAttribute()]\r
-        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("True")]\r
         public bool trayIconAlerts {\r
             get {\r
                 return ((bool)(this["trayIconAlerts"]));\r
index 770a6fb..c7e001d 100644 (file)
@@ -38,9 +38,6 @@
     <Setting Name="appcast_unstable" Type="System.String" Scope="User">\r
       <Value Profile="(Default)">http://handbrake.fr/appcast_unstable.xml</Value>\r
     </Setting>\r
-    <Setting Name="cli_minimized" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">False</Value>\r
-    </Setting>\r
     <Setting Name="autoNameFormat" Type="System.String" Scope="User">\r
       <Value Profile="(Default)">{source}-{title}</Value>\r
     </Setting>\r
@@ -74,9 +71,6 @@
     <Setting Name="presetNotification" Type="System.Boolean" Scope="User">\r
       <Value Profile="(Default)">False</Value>\r
     </Setting>\r
-    <Setting Name="enocdeStatusInGui" Type="System.Boolean" Scope="User">\r
-      <Value Profile="(Default)">True</Value>\r
-    </Setting>\r
     <Setting Name="trayIconAlerts" Type="System.Boolean" Scope="User">\r
       <Value Profile="(Default)">True</Value>\r
     </Setting>\r
index d8e0ef4..a51c09d 100644 (file)
@@ -44,9 +44,6 @@
       <setting name="appcast_unstable" serializeAs="String">\r
         <value>http://handbrake.fr/appcast_unstable.xml</value>\r
       </setting>\r
-      <setting name="cli_minimized" serializeAs="String">\r
-        <value>False</value>\r
-      </setting>\r
       <setting name="autoNameFormat" serializeAs="String">\r
         <value>{source}-{title}</value>\r
       </setting>\r
@@ -80,9 +77,6 @@
       <setting name="presetNotification" serializeAs="String">\r
         <value>False</value>\r
       </setting>\r
-      <setting name="enocdeStatusInGui" serializeAs="String">\r
-        <value>True</value>\r
-      </setting>\r
       <setting name="trayIconAlerts" serializeAs="String">\r
         <value>True</value>\r
       </setting>\r
index 6937c59..7f46139 100644 (file)
@@ -1022,33 +1022,27 @@ namespace Handbrake
         {\r
             if (btn_start.Text == "Stop")\r
             {\r
-                DialogResult result;\r
-                if (Properties.Settings.Default.enocdeStatusInGui &&\r
-                    !Properties.Settings.Default.showCliForInGuiEncodeStatus)\r
-                {\r
-                    result = MessageBox.Show(\r
-                        "Are you sure you wish to cancel the encode?\n\nPlease note, when 'Enable in-GUI encode status' is enabled, stopping this encode will render the file unplayable. ",\r
-                        "Cancel Encode?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
-                }\r
-                else\r
-                {\r
-                    result = MessageBox.Show("Are you sure you wish to cancel the encode?", "Cancel Encode?",\r
-                                             MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
-                }\r
+                DialogResult result = !Properties.Settings.Default.showCliForInGuiEncodeStatus\r
+                             ? MessageBox.Show(\r
+                                 "Are you sure you wish to cancel the encode?\n\nPlease note: Stopping this encode will render the file unplayable. ",\r
+                                 "Cancel Encode?",\r
+                                 MessageBoxButtons.YesNo,\r
+                                 MessageBoxIcon.Question)\r
+                             : MessageBox.Show(\r
+                                 "Are you sure you wish to cancel the encode?",\r
+                                 "Cancel Encode?",\r
+                                 MessageBoxButtons.YesNo,\r
+                                 MessageBoxIcon.Question);\r
 \r
                 if (result == DialogResult.Yes)\r
                 {\r
                     // Pause The Queue\r
                     encodeQueue.Pause();\r
 \r
-                    if (Settings.Default.enocdeStatusInGui && !Settings.Default.showCliForInGuiEncodeStatus)\r
-                    {\r
-                        encodeQueue.Stop();\r
-                    }\r
-                    else\r
-                    {\r
+                    if (Settings.Default.showCliForInGuiEncodeStatus)\r
                         encodeQueue.SafelyClose();\r
-                    }\r
+                    else\r
+                        encodeQueue.Stop();\r
                 }\r
             }\r
             else\r
@@ -2482,7 +2476,7 @@ namespace Handbrake
                 }\r
 \r
                 // Try to safely close out if we can, or kill the cli if using in-gui status\r
-                if (Settings.Default.enocdeStatusInGui)\r
+                if (!Settings.Default.showCliForInGuiEncodeStatus)\r
                     encodeQueue.Stop();\r
                 else\r
                     encodeQueue.SafelyClose();\r
index 71aa2e4..53d5ef9 100644 (file)
@@ -69,10 +69,10 @@ namespace Handbrake
             this.drop_preferredLang = new System.Windows.Forms.ComboBox();\r
             this.radio_dub = new System.Windows.Forms.RadioButton();\r
             this.tab_cli = new System.Windows.Forms.TabPage();\r
+            this.label11 = new System.Windows.Forms.Label();\r
             this.check_preventSleep = new System.Windows.Forms.CheckBox();\r
             this.check_clearOldLogs = new System.Windows.Forms.CheckBox();\r
             this.label12 = new System.Windows.Forms.Label();\r
-            this.check_cli_minimized = new System.Windows.Forms.CheckBox();\r
             this.btn_viewLogs = new System.Windows.Forms.Button();\r
             this.label9 = new System.Windows.Forms.Label();\r
             this.Label4 = new System.Windows.Forms.Label();\r
@@ -100,7 +100,6 @@ namespace Handbrake
             this.label30 = new System.Windows.Forms.Label();\r
             this.check_disablePresetNotification = new System.Windows.Forms.CheckBox();\r
             this.label28 = new System.Windows.Forms.Label();\r
-            this.check_inGuiStatus = new System.Windows.Forms.CheckBox();\r
             this.tab_debug = new System.Windows.Forms.TabPage();\r
             this.check_disableResCalc = new System.Windows.Forms.CheckBox();\r
             this.label8 = new System.Windows.Forms.Label();\r
@@ -137,7 +136,6 @@ namespace Handbrake
             this.label27 = new System.Windows.Forms.Label();\r
             this.openFile_vlc = new System.Windows.Forms.OpenFileDialog();\r
             this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();\r
-            this.label11 = new System.Windows.Forms.Label();\r
             this.tab_options.SuspendLayout();\r
             this.tab_general.SuspendLayout();\r
             this.tab_picture.SuspendLayout();\r
@@ -612,7 +610,6 @@ namespace Handbrake
             this.tab_cli.Controls.Add(this.check_preventSleep);\r
             this.tab_cli.Controls.Add(this.check_clearOldLogs);\r
             this.tab_cli.Controls.Add(this.label12);\r
-            this.tab_cli.Controls.Add(this.check_cli_minimized);\r
             this.tab_cli.Controls.Add(this.btn_viewLogs);\r
             this.tab_cli.Controls.Add(this.label9);\r
             this.tab_cli.Controls.Add(this.Label4);\r
@@ -633,11 +630,23 @@ namespace Handbrake
             this.tab_cli.Text = "CLI / System / Logging";\r
             this.tab_cli.UseVisualStyleBackColor = true;\r
             // \r
+            // label11\r
+            // \r
+            this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.label11.AutoSize = true;\r
+            this.label11.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label11.Location = new System.Drawing.Point(7, 46);\r
+            this.label11.Margin = new System.Windows.Forms.Padding(3, 5, 3, 0);\r
+            this.label11.Name = "label11";\r
+            this.label11.Size = new System.Drawing.Size(53, 13);\r
+            this.label11.TabIndex = 92;\r
+            this.label11.Text = "System:";\r
+            // \r
             // check_preventSleep\r
             // \r
             this.check_preventSleep.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.check_preventSleep.AutoSize = true;\r
-            this.check_preventSleep.Location = new System.Drawing.Point(73, 71);\r
+            this.check_preventSleep.Location = new System.Drawing.Point(73, 45);\r
             this.check_preventSleep.Name = "check_preventSleep";\r
             this.check_preventSleep.Size = new System.Drawing.Size(272, 17);\r
             this.check_preventSleep.TabIndex = 91;\r
@@ -650,7 +659,7 @@ namespace Handbrake
             // \r
             this.check_clearOldLogs.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.check_clearOldLogs.AutoSize = true;\r
-            this.check_clearOldLogs.Location = new System.Drawing.Point(73, 260);\r
+            this.check_clearOldLogs.Location = new System.Drawing.Point(73, 234);\r
             this.check_clearOldLogs.Name = "check_clearOldLogs";\r
             this.check_clearOldLogs.Size = new System.Drawing.Size(166, 17);\r
             this.check_clearOldLogs.TabIndex = 90;\r
@@ -672,25 +681,12 @@ namespace Handbrake
             this.label12.TabIndex = 75;\r
             this.label12.Text = "CLI:";\r
             // \r
-            // check_cli_minimized\r
-            // \r
-            this.check_cli_minimized.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
-            this.check_cli_minimized.AutoSize = true;\r
-            this.check_cli_minimized.Location = new System.Drawing.Point(73, 14);\r
-            this.check_cli_minimized.Name = "check_cli_minimized";\r
-            this.check_cli_minimized.Size = new System.Drawing.Size(137, 17);\r
-            this.check_cli_minimized.TabIndex = 76;\r
-            this.check_cli_minimized.Text = "Start window minimized";\r
-            this.ToolTip.SetToolTip(this.check_cli_minimized, "Starts a CLI window minimized.");\r
-            this.check_cli_minimized.UseVisualStyleBackColor = true;\r
-            this.check_cli_minimized.CheckedChanged += new System.EventHandler(this.check_cli_minimized_CheckedChanged);\r
-            // \r
             // btn_viewLogs\r
             // \r
             this.btn_viewLogs.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.btn_viewLogs.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_viewLogs.ForeColor = System.Drawing.Color.DarkOrange;\r
-            this.btn_viewLogs.Location = new System.Drawing.Point(129, 222);\r
+            this.btn_viewLogs.Location = new System.Drawing.Point(129, 196);\r
             this.btn_viewLogs.Name = "btn_viewLogs";\r
             this.btn_viewLogs.Size = new System.Drawing.Size(139, 23);\r
             this.btn_viewLogs.TabIndex = 89;\r
@@ -703,7 +699,7 @@ namespace Handbrake
             this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
             this.label9.AutoSize = true;\r
             this.label9.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label9.Location = new System.Drawing.Point(7, 118);\r
+            this.label9.Location = new System.Drawing.Point(7, 92);\r
             this.label9.Margin = new System.Windows.Forms.Padding(3, 5, 3, 0);\r
             this.label9.Name = "label9";\r
             this.label9.Size = new System.Drawing.Size(36, 13);\r
@@ -715,7 +711,7 @@ namespace Handbrake
             this.Label4.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.Label4.AutoSize = true;\r
             this.Label4.BackColor = System.Drawing.Color.Transparent;\r
-            this.Label4.Location = new System.Drawing.Point(70, 34);\r
+            this.Label4.Location = new System.Drawing.Point(70, 15);\r
             this.Label4.Name = "Label4";\r
             this.Label4.Size = new System.Drawing.Size(70, 13);\r
             this.Label4.TabIndex = 42;\r
@@ -726,7 +722,7 @@ namespace Handbrake
             this.btn_clearLogs.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.btn_clearLogs.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_clearLogs.ForeColor = System.Drawing.Color.DarkOrange;\r
-            this.btn_clearLogs.Location = new System.Drawing.Point(274, 222);\r
+            this.btn_clearLogs.Location = new System.Drawing.Point(274, 196);\r
             this.btn_clearLogs.Name = "btn_clearLogs";\r
             this.btn_clearLogs.Size = new System.Drawing.Size(135, 23);\r
             this.btn_clearLogs.TabIndex = 88;\r
@@ -746,7 +742,7 @@ namespace Handbrake
             "Normal",\r
             "Below Normal",\r
             "Low"});\r
-            this.drp_Priority.Location = new System.Drawing.Point(177, 31);\r
+            this.drp_Priority.Location = new System.Drawing.Point(177, 12);\r
             this.drp_Priority.Name = "drp_Priority";\r
             this.drp_Priority.Size = new System.Drawing.Size(111, 21);\r
             this.drp_Priority.TabIndex = 43;\r
@@ -758,7 +754,7 @@ namespace Handbrake
             // \r
             this.check_logsInSpecifiedLocation.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.check_logsInSpecifiedLocation.AutoSize = true;\r
-            this.check_logsInSpecifiedLocation.Location = new System.Drawing.Point(73, 165);\r
+            this.check_logsInSpecifiedLocation.Location = new System.Drawing.Point(73, 139);\r
             this.check_logsInSpecifiedLocation.Name = "check_logsInSpecifiedLocation";\r
             this.check_logsInSpecifiedLocation.Size = new System.Drawing.Size(306, 17);\r
             this.check_logsInSpecifiedLocation.TabIndex = 87;\r
@@ -771,7 +767,7 @@ namespace Handbrake
             // \r
             this.check_saveLogWithVideo.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.check_saveLogWithVideo.AutoSize = true;\r
-            this.check_saveLogWithVideo.Location = new System.Drawing.Point(73, 142);\r
+            this.check_saveLogWithVideo.Location = new System.Drawing.Point(73, 116);\r
             this.check_saveLogWithVideo.Name = "check_saveLogWithVideo";\r
             this.check_saveLogWithVideo.Size = new System.Drawing.Size(382, 17);\r
             this.check_saveLogWithVideo.TabIndex = 83;\r
@@ -785,7 +781,7 @@ namespace Handbrake
             this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.label3.AutoSize = true;\r
             this.label3.BackColor = System.Drawing.Color.Transparent;\r
-            this.label3.Location = new System.Drawing.Point(70, 118);\r
+            this.label3.Location = new System.Drawing.Point(70, 92);\r
             this.label3.Name = "label3";\r
             this.label3.Size = new System.Drawing.Size(101, 13);\r
             this.label3.TabIndex = 85;\r
@@ -797,7 +793,7 @@ namespace Handbrake
             this.btn_saveLog.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
             this.btn_saveLog.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.btn_saveLog.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
-            this.btn_saveLog.Location = new System.Drawing.Point(437, 195);\r
+            this.btn_saveLog.Location = new System.Drawing.Point(437, 169);\r
             this.btn_saveLog.Name = "btn_saveLog";\r
             this.btn_saveLog.Size = new System.Drawing.Size(77, 22);\r
             this.btn_saveLog.TabIndex = 82;\r
@@ -814,7 +810,7 @@ namespace Handbrake
             "0",\r
             "1",\r
             "2"});\r
-            this.cb_logVerboseLvl.Location = new System.Drawing.Point(177, 115);\r
+            this.cb_logVerboseLvl.Location = new System.Drawing.Point(177, 89);\r
             this.cb_logVerboseLvl.Name = "cb_logVerboseLvl";\r
             this.cb_logVerboseLvl.Size = new System.Drawing.Size(111, 21);\r
             this.cb_logVerboseLvl.TabIndex = 86;\r
@@ -824,7 +820,7 @@ namespace Handbrake
             // text_logPath\r
             // \r
             this.text_logPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));\r
-            this.text_logPath.Location = new System.Drawing.Point(129, 195);\r
+            this.text_logPath.Location = new System.Drawing.Point(129, 169);\r
             this.text_logPath.Name = "text_logPath";\r
             this.text_logPath.Size = new System.Drawing.Size(302, 21);\r
             this.text_logPath.TabIndex = 80;\r
@@ -835,7 +831,7 @@ namespace Handbrake
             // \r
             this.label14.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.label14.AutoSize = true;\r
-            this.label14.Location = new System.Drawing.Point(70, 198);\r
+            this.label14.Location = new System.Drawing.Point(70, 172);\r
             this.label14.Name = "label14";\r
             this.label14.Size = new System.Drawing.Size(53, 13);\r
             this.label14.TabIndex = 81;\r
@@ -857,7 +853,6 @@ namespace Handbrake
             this.tab_advanced.Controls.Add(this.label30);\r
             this.tab_advanced.Controls.Add(this.check_disablePresetNotification);\r
             this.tab_advanced.Controls.Add(this.label28);\r
-            this.tab_advanced.Controls.Add(this.check_inGuiStatus);\r
             this.tab_advanced.Location = new System.Drawing.Point(4, 22);\r
             this.tab_advanced.Name = "tab_advanced";\r
             this.tab_advanced.Padding = new System.Windows.Forms.Padding(10);\r
@@ -871,7 +866,7 @@ namespace Handbrake
             this.check_showCliForInGUIEncode.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
             this.check_showCliForInGUIEncode.AutoSize = true;\r
             this.check_showCliForInGUIEncode.BackColor = System.Drawing.Color.Transparent;\r
-            this.check_showCliForInGUIEncode.Location = new System.Drawing.Point(100, 152);\r
+            this.check_showCliForInGUIEncode.Location = new System.Drawing.Point(81, 129);\r
             this.check_showCliForInGUIEncode.Name = "check_showCliForInGUIEncode";\r
             this.check_showCliForInGUIEncode.Size = new System.Drawing.Size(330, 17);\r
             this.check_showCliForInGUIEncode.TabIndex = 96;\r
@@ -1054,20 +1049,6 @@ namespace Handbrake
             this.label28.TabIndex = 85;\r
             this.label28.Text = "x264:";\r
             // \r
-            // check_inGuiStatus\r
-            // \r
-            this.check_inGuiStatus.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
-            this.check_inGuiStatus.AutoSize = true;\r
-            this.check_inGuiStatus.BackColor = System.Drawing.Color.Transparent;\r
-            this.check_inGuiStatus.Location = new System.Drawing.Point(81, 129);\r
-            this.check_inGuiStatus.Name = "check_inGuiStatus";\r
-            this.check_inGuiStatus.Size = new System.Drawing.Size(162, 17);\r
-            this.check_inGuiStatus.TabIndex = 92;\r
-            this.check_inGuiStatus.Text = "Enable in-GUI encode status";\r
-            this.ToolTip.SetToolTip(this.check_inGuiStatus, "Displays the CLI status in the GUI windows instead of the CLI window.");\r
-            this.check_inGuiStatus.UseVisualStyleBackColor = false;\r
-            this.check_inGuiStatus.CheckedChanged += new System.EventHandler(this.check_inGuiStatus_CheckedChanged);\r
-            // \r
             // tab_debug\r
             // \r
             this.tab_debug.Controls.Add(this.check_disableResCalc);\r
@@ -1471,18 +1452,6 @@ namespace Handbrake
             this.tableLayoutPanel5.Size = new System.Drawing.Size(594, 429);\r
             this.tableLayoutPanel5.TabIndex = 62;\r
             // \r
-            // label11\r
-            // \r
-            this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
-            this.label11.AutoSize = true;\r
-            this.label11.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label11.Location = new System.Drawing.Point(7, 72);\r
-            this.label11.Margin = new System.Windows.Forms.Padding(3, 5, 3, 0);\r
-            this.label11.Name = "label11";\r
-            this.label11.Size = new System.Drawing.Size(53, 13);\r
-            this.label11.TabIndex = 92;\r
-            this.label11.Text = "System:";\r
-            // \r
             // frmOptions\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);\r
@@ -1546,7 +1515,6 @@ namespace Handbrake
         internal System.Windows.Forms.Label label10;\r
         private System.Windows.Forms.TextBox text_an_path;\r
         internal System.Windows.Forms.CheckBox check_autoNaming;\r
-        internal System.Windows.Forms.CheckBox check_cli_minimized;\r
         private System.Windows.Forms.Label label12;\r
         internal System.Windows.Forms.ToolTip ToolTip;\r
         private System.Windows.Forms.TabPage tab_picture;\r
@@ -1601,7 +1569,6 @@ namespace Handbrake
         private System.Windows.Forms.Label label32;\r
         internal System.Windows.Forms.CheckBox check_logsInSpecifiedLocation;\r
         internal System.Windows.Forms.CheckBox check_disablePresetNotification;\r
-        internal System.Windows.Forms.CheckBox check_inGuiStatus;\r
         internal System.Windows.Forms.CheckBox check_trayStatusAlerts;\r
         private System.Windows.Forms.Button btn_viewLogs;\r
         private System.Windows.Forms.Button btn_clearLogs;\r
index 3ca0298..492ee35 100644 (file)
@@ -112,10 +112,6 @@ namespace Handbrake
             // CLI\r
             // #############################\r
 \r
-            // Enable Start CLI minimized\r
-            if (Properties.Settings.Default.cli_minimized)\r
-                check_cli_minimized.CheckState = CheckState.Checked;\r
-\r
             // Priority level for encodes\r
             drp_Priority.Text = Properties.Settings.Default.processPriority;\r
 \r
@@ -161,12 +157,8 @@ namespace Handbrake
             if (Properties.Settings.Default.presetNotification)\r
                 check_disablePresetNotification.CheckState = CheckState.Checked;\r
 \r
-            // Experimental In-GUI encode status indicator.\r
-            if (Properties.Settings.Default.enocdeStatusInGui)\r
-                check_inGuiStatus.CheckState = CheckState.Checked;\r
-\r
+            // Show CLI Window\r
             check_showCliForInGUIEncode.Checked = Properties.Settings.Default.showCliForInGuiEncodeStatus;\r
-            check_showCliForInGUIEncode.Enabled = check_inGuiStatus.Checked;\r
 \r
             // Set the preview count\r
             drop_previewScanCount.SelectedItem = Properties.Settings.Default.previewScanCount.ToString();\r
@@ -326,11 +318,6 @@ namespace Handbrake
 \r
         #region CLI\r
 \r
-        private void check_cli_minimized_CheckedChanged(object sender, EventArgs e)\r
-        {\r
-            Properties.Settings.Default.cli_minimized = check_cli_minimized.Checked;\r
-        }\r
-\r
         private void drp_Priority_SelectedIndexChanged(object sender, EventArgs e)\r
         {\r
             Properties.Settings.Default.processPriority = drp_Priority.Text;\r
@@ -427,24 +414,6 @@ namespace Handbrake
             Properties.Settings.Default.presetNotification = check_disablePresetNotification.Checked;\r
         }\r
 \r
-        private void check_inGuiStatus_CheckedChanged(object sender, EventArgs e)\r
-        {\r
-            Properties.Settings.Default.enocdeStatusInGui = check_inGuiStatus.Checked;\r
-\r
-            check_showCliForInGUIEncode.Enabled = check_inGuiStatus.Checked;\r
-\r
-            if (this.IsHandleCreated)\r
-                if (check_inGuiStatus.Checked)\r
-                {\r
-                    MessageBox.Show(\r
-                        "This feature is experimental!\n\n You will not be able to \91Stop\92 an encode mid-process.\n"\r
-                        + "Doing so will render the file unplayable.\n" +\r
-                        "If you enable 'Show CLI Window', you'll be ablt to hit ctrl-c in the encode window to cleanly exit the CLI. This will give you a playable file.\n\n" +\r
-                        "You are also limited to 1 instance of HandBrakeCLI on your system.", \r
-                        "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
-                }\r
-        }\r
-\r
         private void check_showCliForInGUIEncode_CheckedChanged(object sender, EventArgs e)\r
         {\r
             Properties.Settings.Default.showCliForInGuiEncodeStatus = check_showCliForInGUIEncode.Checked;\r
@@ -504,8 +473,8 @@ namespace Handbrake
         /// </summary>\r
         private static void UpdateApplicationServicesSettings()\r
         {\r
-            Init.SetupSettings(Settings.Default.cli_minimized, Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
-                               Settings.Default.enocdeStatusInGui, Settings.Default.growlEncode, Settings.Default.growlQueue,\r
+            Init.SetupSettings(Settings.Default.CompletionOption, Settings.Default.noDvdNav,\r
+                               Settings.Default.growlEncode, Settings.Default.growlQueue,\r
                                Settings.Default.processPriority, Settings.Default.saveLogPath, Settings.Default.saveLogToSpecifiedPath,\r
                                Settings.Default.saveLogWithVideo, Settings.Default.showCliForInGuiEncodeStatus, Settings.Default.preventSleep);\r
         }\r
index a697821..02f2ee7 100644 (file)
   <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>132, 18</value>\r
   </metadata>\r
-  <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>132, 18</value>\r
-  </metadata>\r
-  <data name="check_showCliForInGUIEncode.ToolTip" xml:space="preserve">\r
-    <value>Shows the CLI window when "Encode In-Gui encode status" is enabled.\r
-You may wish to enable this as you'll be able to cleanly exit the CLI using ctrl-c\r
-meaing you'll have playable files if you choose to end the encode early.</value>\r
-  </data>\r
-  <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>132, 18</value>\r
-  </metadata>\r
   <data name="check_m4v.ToolTip" xml:space="preserve">\r
     <value>Use .m4v instead of .mp4 for MP4 files\r
 \r
@@ -138,6 +127,11 @@ Chapter Markers, AC3 Audio and SRT Subtitles will require the m4v extension if y
 When this option is disabled, Chapter Markers, AC3 audio and SRT subtitiles will still automatically change the file extension to m4v.\r
 </value>\r
   </data>\r
+  <data name="check_showCliForInGUIEncode.ToolTip" xml:space="preserve">\r
+    <value>Shows the CLI window when "Encode In-Gui encode status" is enabled.\r
+You may wish to enable this as you'll be able to cleanly exit the CLI using ctrl-c\r
+meaing you'll have playable files if you choose to end the encode early.</value>\r
+  </data>\r
   <data name="check_disableResCalc.ToolTip" xml:space="preserve">\r
     <value>If the new Picture Settings panel is causing you problems, enable this option.\r
 It disables some of the resolution calcuation code for None and Custom modes.\r
index a5bf331..d68841b 100644 (file)
@@ -24,6 +24,7 @@ namespace Handbrake
     /// </summary>\r
     public partial class frmPreview : Form\r
     {\r
+        #region Private Variables\r
         /// <summary>\r
         /// The Main Window\r
         /// </summary>\r
@@ -99,6 +100,8 @@ namespace Handbrake
         /// </summary>\r
         private delegate void OpenMovieHandler();\r
 \r
+        #endregion\r
+\r
         /// <summary>\r
         /// The encode has started\r
         /// </summary>\r