]> granicus.if.org Git - handbrake/commitdiff
WinGui: Some Audio Panel refactoring and an additional method to the scan service...
authorsr55 <sr55.hb@outlook.com>
Tue, 20 Dec 2011 20:42:07 +0000 (20:42 +0000)
committersr55 <sr55.hb@outlook.com>
Tue, 20 Dec 2011 20:42:07 +0000 (20:42 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4377 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/Controls/AudioPanel.cs
win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
win/CS/HandBrake.ApplicationServices/Services/ScanService.cs

index 0f46ed1c1a8112d5e6d31f049358ddae2b7ac010..61b908299e846f47cf9196ab64b224ac91e61d7a 100644 (file)
@@ -174,6 +174,7 @@ namespace Handbrake.Controls
                 this.audioTracks.Add(track);\r
             }\r
 \r
+            // It's a Preset, if the TrackNumber is 0, so allow the Automatic Track Selection to run after we've setup the presets audio settings.\r
             if (tracks.Count == 0 || tracks[0].ScannedTrack.TrackNumber == 0)\r
             {\r
                 this.AutomaticTrackSelection();\r
@@ -203,14 +204,14 @@ namespace Handbrake.Controls
             }\r
 \r
             // Setup the Audio track source dropdown with the new audio tracks.\r
-           // this.ScannedTracks.Clear();\r
             this.drp_audioTrack.SelectedItem = null;\r
-            this.ScannedTracks = new BindingList<Audio>(selectedTitle.AudioTracks.ToList());\r
-            drp_audioTrack.DataSource = this.ScannedTracks;\r
+            foreach (Audio track in selectedTitle.AudioTracks)\r
+            {\r
+                this.ScannedTracks.Add(track);\r
+            }\r
 \r
             drp_audioTrack.SelectedItem = this.ScannedTracks.FirstOrDefault();\r
-            this.drp_audioTrack.Refresh();\r
-\r
+       \r
             // Add any tracks the preset has, if there is a preset and no audio tracks in the list currently\r
             if (audioList.Rows.Count == 0 && preset != null)\r
             {\r
@@ -255,7 +256,6 @@ namespace Handbrake.Controls
             AudioTrack track = audioList.SelectedRows[0].DataBoundItem as AudioTrack;\r
             if (track == null)\r
             {\r
-                drp_audioMix.Enabled = drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = false;\r
                 return;\r
             }\r
 \r
@@ -283,14 +283,11 @@ namespace Handbrake.Controls
                     // Configure the widgets with values\r
                     if (drp_audioEncoder.Text.Contains("Passthru"))\r
                     {\r
-                        drp_audioMix.Enabled = drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = false;\r
                         track.Gain = 0;\r
                         track.DRC = 0;\r
                     }\r
-                    else\r
-                    {\r
-                        drp_audioMix.Enabled = drp_audioBitrate.Enabled = drp_audioSample.Enabled = btn_AdvancedAudio.Enabled = true;\r
-                    }\r
+\r
+                    this.RefreshEnabledControls();\r
 \r
                     if (drp_audioEncoder.Text.Contains("Flac"))\r
                     {\r
index fbbebfe27d4be816c22600ef88dc7e7b7e6fa271..b992dc8eb732f0fae3221f9feb85c7f900828818 100644 (file)
@@ -86,5 +86,13 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
         /// Kill the scan\r
         /// </summary>\r
         void Stop();\r
+\r
+        /// <summary>\r
+        /// Take a Scan Log file, and process it as if it were from the CLI.\r
+        /// </summary>\r
+        /// <param name="path">\r
+        /// The path to the log file.\r
+        /// </param>\r
+        void DebugScanLog(string path);\r
     }\r
 }
\ No newline at end of file
index 033f160183075a08dc3e8f6ab61f0d9c73e86673..2a5726ef0710a9e02f90f5330062d89df51fe688 100644 (file)
@@ -151,6 +151,20 @@ namespace HandBrake.ApplicationServices.Services
             instance.StopScan();\r
         }\r
 \r
+        /// <summary>\r
+        /// Debug a Scan Log (Only Available for CLI Mode, not LIBHB)\r
+        /// </summary>\r
+        /// <param name="path">\r
+        /// The path.\r
+        /// </param>\r
+        /// <exception cref="NotImplementedException">\r
+        /// (Only Available for CLI Mode, not LIBHB)\r
+        /// </exception>\r
+        public void DebugScanLog(string path)\r
+        {\r
+            throw new NotImplementedException("Only Available when using the CLI mode. Not LibHB");\r
+        }\r
+\r
         #endregion\r
 \r
         #region Private Methods\r
index 781aa40ec9b95065a082d88ee2e653da45e6a53d..b3470d63eefa88198b128b6f0982cc939e575e5a 100644 (file)
@@ -13,6 +13,7 @@ namespace HandBrake.ApplicationServices.Services
     using System.Windows.Forms;\r
 \r
     using HandBrake.ApplicationServices.EventArgs;\r
+    using HandBrake.ApplicationServices.Exceptions;\r
     using HandBrake.ApplicationServices.Parsing;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
     using HandBrake.ApplicationServices.Utilities;\r
@@ -147,6 +148,32 @@ namespace HandBrake.ApplicationServices.Services
                 // We don't really need to notify the user of any errors here.\r
             }\r
         }\r
+\r
+        /// <summary>\r
+        /// Take a Scan Log file, and process it as if it were from the CLI.\r
+        /// </summary>\r
+        /// <param name="path">\r
+        /// The path to the log file.\r
+        /// </param>\r
+        public void DebugScanLog(string path)\r
+        {\r
+            try\r
+            {\r
+                StreamReader parseLog = new StreamReader(path);\r
+                this.readData = new Parser(parseLog.BaseStream);\r
+                this.SouceData = Source.Parse(this.readData);\r
+                this.SouceData.ScanPath = path;\r
+\r
+                if (this.ScanCompleted != null)\r
+                {\r
+                    this.ScanCompleted(this, new ScanCompletedEventArgs(true, null, string.Empty));\r
+                }\r
+            }\r
+            catch (Exception e)\r
+            {\r
+                throw new GeneralApplicationException("Debug Run Failed", string.Empty, e);\r
+            }\r
+        }\r
         #endregion\r
 \r
         #region Private Methods\r
@@ -268,7 +295,7 @@ namespace HandBrake.ApplicationServices.Services
                     this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()"));\r
             }\r
         }\r
-\r
+        \r
         /// <summary>\r
         /// Fire an event when the scan process progresses\r
         /// </summary>\r