]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Sun, 8 May 2011 11:00:16 +0000 (11:00 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 8 May 2011 11:00:16 +0000 (11:00 +0000)
- Add Elapsed Encode Time the main window.
- Add Elapsed Queue Time to the queue window. (Note, Pausing the queue resets this currently)
- Fixed an issue with disabled controls on the audio panel after removing the last track which was passthru.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3973 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/Controls/AudioPanel.cs
win/CS/HandBrake.ApplicationServices/EventArgs/EncodeProgressEventArgs.cs
win/CS/HandBrake.ApplicationServices/Functions/Win7.cs
win/CS/HandBrake.ApplicationServices/Services/Encode.cs
win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
win/CS/frmMain.Designer.cs
win/CS/frmMain.cs
win/CS/frmQueue.Designer.cs
win/CS/frmQueue.cs

index ff56a1330ce20cce2694ab79ac1b8f46feab9a4d..7a63f7803730aeafd0c58b51389de8eec4e40d12 100644 (file)
@@ -412,6 +412,12 @@ namespace Handbrake.Controls
         private void RemoveAudioTrack_Click(object sender, EventArgs e)\r
         {\r
             RemoveTrack();\r
+\r
+            if (this.AudioTracks.Count == 0)\r
+            {\r
+                drp_audioMix.Enabled =\r
+                    drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = true;\r
+            }\r
         }\r
 \r
         #endregion\r
index b4d6b9a6401ec579a22fe1d3227f072af976a1d5..8ef8ceb3954d6d0b9bf934a2399608bb4946dd91 100644 (file)
@@ -41,5 +41,10 @@ namespace HandBrake.ApplicationServices.EventArgs
         /// Gets or sets TaskCount.\r
         /// </summary>\r
         public int TaskCount { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets ElapsedTime.\r
+        /// </summary>\r
+        public TimeSpan ElapsedTime { get; set; }\r
     }\r
 }\r
index 8d694d2f810f26fe74806a69f452e554c12e3e2a..b2262f147ad60078c49eaf0a2c9833b2c7edc223 100644 (file)
@@ -23,9 +23,10 @@ namespace HandBrake.ApplicationServices.Functions
         /// </summary>\r
         public Win7()\r
         {\r
-            if (IsWindowsSeven)\r
+            if (this.IsWindowsSeven)\r
             {\r
-                windowsTaskbar = TaskbarManager.Instance;\r
+                this.windowsTaskbar = TaskbarManager.Instance;\r
+                this.windowsTaskbar.ApplicationId = "HandBrake";\r
             }\r
         }\r
 \r
@@ -36,8 +37,7 @@ namespace HandBrake.ApplicationServices.Functions
         {\r
             get\r
             {\r
-                OperatingSystem os = Environment.OSVersion;\r
-                return os.Version.Major >= 6 && os.Version.Minor >= 1;\r
+                return TaskbarManager.IsPlatformSupported;\r
             }\r
         }\r
 \r
@@ -49,12 +49,13 @@ namespace HandBrake.ApplicationServices.Functions
         /// </param>\r
         public void SetTaskBarProgress(int percentage)\r
         {\r
-            if (!IsWindowsSeven)\r
+            if (!this.IsWindowsSeven)\r
             {\r
                 return;\r
             }\r
-            windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal);\r
-            windowsTaskbar.SetProgressValue(percentage, 100);\r
+\r
+            this.windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal);\r
+            this.windowsTaskbar.SetProgressValue(percentage, 100);\r
         }\r
 \r
         /// <summary>\r
@@ -62,12 +63,12 @@ namespace HandBrake.ApplicationServices.Functions
         /// </summary>\r
         public void SetTaskBarProgressToNoProgress()\r
         {\r
-            if (!IsWindowsSeven)\r
+            if (!this.IsWindowsSeven)\r
             {\r
                 return;\r
             }\r
 \r
-            windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress);\r
+            this.windowsTaskbar.SetProgressState(TaskbarProgressBarState.NoProgress);\r
         }\r
     }\r
 }
\ No newline at end of file
index 9232ea95e4d26033238458db7bbc49d78cae912a..5787ab8a8ab054043d75ec60a043b20aa1cea140 100644 (file)
@@ -27,11 +27,6 @@ namespace HandBrake.ApplicationServices.Services
     {\r
         #region Private Variables\r
 \r
-        /// <summary>\r
-        /// The User Setting Service\r
-        /// </summary>\r
-        private IUserSettingService userSettingService = new UserSettingService();\r
-\r
         /// <summary>\r
         /// The Log Buffer\r
         /// </summary>\r
@@ -67,6 +62,11 @@ namespace HandBrake.ApplicationServices.Services
         /// </summary>\r
         StringBuilder header = GeneralUtilities.CreateCliLogHeader(null);\r
 \r
+        /// <summary>\r
+        /// The Start time of the current Encode;\r
+        /// </summary>\r
+        private DateTime startTime;\r
+\r
         #endregion\r
 \r
         /// <summary>\r
@@ -99,11 +99,6 @@ namespace HandBrake.ApplicationServices.Services
 \r
         #region Properties\r
 \r
-        /// <summary>\r
-        /// Gets or sets The HB Process\r
-        /// </summary>\r
-        protected Process HbProcess { get; set; }\r
-\r
         /// <summary>\r
         /// Gets a value indicating whether IsEncoding.\r
         /// </summary>\r
@@ -115,11 +110,16 @@ namespace HandBrake.ApplicationServices.Services
         public string ActivityLog\r
         {\r
             get\r
-            {   \r
+            {\r
                 return string.IsNullOrEmpty(this.logBuffer.ToString()) ? header + "No log data available..." : header + this.logBuffer.ToString();\r
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets or sets The HB Process\r
+        /// </summary>\r
+        protected Process HbProcess { get; set; }\r
+\r
         #endregion\r
 \r
         #region Public Methods\r
@@ -190,6 +190,8 @@ namespace HandBrake.ApplicationServices.Services
 \r
                 this.HbProcess.Start();\r
 \r
+                this.startTime = DateTime.Now;\r
+\r
                 if (enableLogging)\r
                 {\r
                     this.HbProcess.ErrorDataReceived += HbProcErrorDataReceived;\r
@@ -529,18 +531,21 @@ namespace HandBrake.ApplicationServices.Services
                 EstimatedTimeLeft = Converters.EncodeToTimespan(timeRemaining),\r
                 PercentComplete = percentComplete,\r
                 Task = currentTask,\r
-                TaskCount = taskCount\r
+                TaskCount = taskCount,\r
+                ElapsedTime = DateTime.Now - this.startTime,\r
             };\r
 \r
             if (this.EncodeStatusChanged != null)\r
+            {\r
                 this.EncodeStatusChanged(this, eventArgs);\r
+            }\r
 \r
-            if (windowsSeven.IsWindowsSeven)\r
+            if (this.windowsSeven.IsWindowsSeven)\r
             {\r
                 int percent;\r
                 int.TryParse(Math.Round(percentComplete).ToString(), out percent);\r
 \r
-                windowsSeven.SetTaskBarProgress(percent);\r
+                this.windowsSeven.SetTaskBarProgress(percent);\r
             }\r
         }\r
 \r
index e4f67b7dbfbb37838552478426aeffb2e48ad3ba..da5f10e944ceb0688556aef6fa18fa8f136582ad 100644 (file)
@@ -12,6 +12,7 @@ namespace HandBrake.ApplicationServices.Services
     using System.IO;\r
     using System.Linq;\r
     using System.Text.RegularExpressions;\r
+    using System.Windows;\r
     using System.Xml.Serialization;\r
 \r
     using HandBrake.ApplicationServices.Model;\r
@@ -253,6 +254,7 @@ namespace HandBrake.ApplicationServices.Services
                                 Description = string.Empty, // Maybe one day we will populate this.\r
                                 IsBuildIn = true\r
                             };\r
+\r
                         this.presets.Add(newPreset);\r
                     }\r
                 }\r
@@ -321,15 +323,22 @@ namespace HandBrake.ApplicationServices.Services
         /// </param>\r
         private static void RecoverFromCorruptedPresetFile(string file)\r
         {\r
-            // Recover from Error.\r
-            if (File.Exists(file))\r
+            try\r
             {\r
-                string disabledFile = file + ".old";\r
-                File.Move(file, disabledFile);\r
+                // Recover from Error.\r
                 if (File.Exists(file))\r
                 {\r
-                    File.Delete(file);\r
+                    string disabledFile = file + ".old";\r
+                    File.Move(file, disabledFile);\r
+                    if (File.Exists(file))\r
+                    {\r
+                        File.Delete(file);\r
+                    }\r
                 }\r
+            } \r
+            catch(IOException)\r
+            {\r
+                // Give up\r
             }\r
         }\r
 \r
@@ -341,7 +350,7 @@ namespace HandBrake.ApplicationServices.Services
             // First clear the Presets arraylists\r
             this.presets.Clear();\r
 \r
-            // Load in the users Presets from UserPresets.xml\r
+            // Load in the Presets from Presets.xml\r
             try\r
             {\r
                 if (File.Exists(this.builtInPresetFile))\r
index ef95b638834354c70e9017c502f1f87c5d5971d7..f2ca04c6dee625763a3fefb99b34a67843b46eeb 100644 (file)
@@ -265,7 +265,9 @@ namespace HandBrake.ApplicationServices.Services
         {\r
             // Growl\r
             if (Properties.Settings.Default.GrowlQueue)\r
+            {\r
                 GrowlCommunicator.Notify("Queue Completed", "Put down that cocktail...\nyour Handbrake queue is done.");\r
+            }\r
 \r
             // Do something whent he encode ends.\r
             switch (Properties.Settings.Default.WhenCompleteAction)\r
index 066f7f68ea03e89f28d9bd08f488133c43ad056e..7e3d61e57a5ff56e5221aa1e04a60bbfa1579241 100644 (file)
@@ -673,7 +673,7 @@ namespace Handbrake
             // \r
             // DVD_Open\r
             // \r
-            this.DVD_Open.Description = "Select the \"VIDEO_TS\" folder from your DVD Drive.";\r
+            this.DVD_Open.Description = "Select a VIDEO_TS folder or a folder which contains a collection of video files.";\r
             // \r
             // File_Open\r
             // \r
index 1b053150c44265f8e05cfa67dc249d6bf23c53f4..5177f69837a541e8d873519db08eca806b081fb2 100644 (file)
@@ -2373,13 +2373,15 @@ namespace Handbrake
                 return;\r
             }\r
 \r
+\r
             lbl_encode.Text =\r
                 string.Format(\r
-                "{0:00.00}%,  FPS: {1:000.0},  Avg FPS: {2:000.0},  Time Remaining: {3},  Encode(s) Pending {4}",\r
+                "{0:00.00}%,  FPS: {1:000.0},  Avg FPS: {2:000.0},  Time Remaining: {3},  Elapsed: {4:hh\\:mm\\:ss},  Pending Jobs {5}",\r
                 e.PercentComplete,\r
                 e.CurrentFrameRate,\r
                 e.AverageFrameRate,\r
                 e.EstimatedTimeLeft,\r
+                e.ElapsedTime,\r
                 this.queueProcessor.QueueManager.Count);\r
 \r
             ProgressBarStatus.Value = (int)Math.Round(e.PercentComplete);\r
index 61e6df6d75af64975d093098584c5914eccff7fe..a1dcb886cf0d0b979f50f1566d26a5e3765eb33b 100644 (file)
@@ -376,6 +376,9 @@ namespace Handbrake
             this.lbl_encodesPending.Name = "lbl_encodesPending";\r
             this.lbl_encodesPending.Size = new System.Drawing.Size(115, 17);\r
             this.lbl_encodesPending.Text = "0 encode(s) pending";\r
+            this.lbl_encodesPending.ToolTipText = "- Displays the number of jobs remaining to process.\r\n- Displays the time for the " +\r
+                "current processing session. \r\n  (Note, this is reset every time you press encode" +\r
+                ", including after a pause)";\r
             // \r
             // OpenFile\r
             // \r
index ee9dae04f9ddf77872de3bf6928bb1c99b457cfd..20ce68259e4bebca06137590b4bedb814cfbf009 100644 (file)
@@ -46,6 +46,8 @@ namespace Handbrake
 \r
         private readonly IUserSettingService userSettingService = new UserSettingService();\r
 \r
+        private DateTime startTime;\r
+    \r
         /// <summary>\r
         /// Initializes a new instance of the <see cref="frmQueue"/> class.\r
         /// </summary>\r
@@ -136,11 +138,14 @@ namespace Handbrake
 \r
             lbl_encodeStatus.Text =\r
                 string.Format(\r
-                "Encoding: Pass {0} of {1}, {2:00.00}% Time Remaining: {3}",\r
+                "Encoding: Pass {0} of {1},  {2:00.00}%,  Time Remaining: {3},  Elapsed: {4:hh\\:mm\\:ss}",\r
                 e.Task,\r
                 e.TaskCount,\r
                 e.PercentComplete,\r
-                e.EstimatedTimeLeft);\r
+                e.EstimatedTimeLeft,\r
+                e.ElapsedTime);\r
+\r
+            UpdateStatusLabel();\r
         }\r
 \r
         /// <summary>\r
@@ -224,6 +229,7 @@ namespace Handbrake
             if (!queue.IsProcessing)\r
             {\r
                 SetUiEncodeStarted();\r
+                startTime = DateTime.Now;\r
             }\r
 \r
             lbl_encodeStatus.Text = "Encoding ...";\r
@@ -242,6 +248,7 @@ namespace Handbrake
         private void BtnPauseClick(object sender, EventArgs e)\r
         {\r
             queue.Pause();\r
+       \r
             MessageBox.Show(\r
                 "No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode' when you wish to continue encoding the queue.",\r
                 "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
@@ -309,7 +316,7 @@ namespace Handbrake
             lbl_dest.Text = "-";\r
             lbl_encodeOptions.Text = "-";\r
 \r
-            lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";\r
+            UpdateStatusLabel();\r
         }\r
 \r
         /// <summary>\r
@@ -348,22 +355,7 @@ namespace Handbrake
                 item.SubItems.Add(chapters); // Chapters\r
                 item.SubItems.Add(queueItem.Source); // Source\r
                 item.SubItems.Add(queueItem.Destination); // Destination\r
-\r
-                switch (parsed.VideoEncoder)\r
-                {\r
-                    case VideoEncoder.FFMpeg:\r
-                        item.SubItems.Add("MPEG-4 (FFmpeg)");\r
-                        break;\r
-                    default:\r
-                    case VideoEncoder.X264:\r
-                        item.SubItems.Add("H.264 (x264)");\r
-                        break;\r
-                    case VideoEncoder.Theora:\r
-                        item.SubItems.Add("VP3 (Theroa)");\r
-                        break;\r
-                }\r
-\r
-                 // Video\r
+                item.SubItems.Add(EnumHelper<VideoEncoder>.GetDescription(parsed.VideoEncoder));\r
 \r
                 // Display The Audio Track Information\r
                 string audio = string.Empty;\r
@@ -392,7 +384,28 @@ namespace Handbrake
             }\r
 \r
             RedrawQueue();\r
-            lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";\r
+            UpdateStatusLabel();\r
+        }\r
+\r
+        private void UpdateStatusLabel()\r
+        {\r
+            if (InvokeRequired)\r
+            {\r
+                BeginInvoke(new UpdateHandler(UpdateStatusLabel));\r
+                return;\r
+            }\r
+            TimeSpan span = DateTime.Now - startTime;\r
+\r
+            if (queue.IsProcessing)\r
+            {\r
+                lbl_encodesPending.Text = string.Format(\r
+                "{0} encodes(s) pending, Time Elasped {1:hh\\:mm\\:ss}", list_queue.Items.Count, span);\r
+            } \r
+            else\r
+            {\r
+                lbl_encodesPending.Text = string.Format(\r
+                "{0} encodes(s) pending", list_queue.Items.Count);\r
+            }\r
         }\r
 \r
         /// <summary>\r