From: sr55 Date: Wed, 22 Apr 2009 12:27:37 +0000 (+0000) Subject: WinGui: X-Git-Tag: 0.9.4~613 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93f6c9c22d8d3ac46980a012511046b1f4202bc6;p=handbrake WinGui: - Queue: Can now store unlimited number of audio tracks in presets. It is no longer limited to 4. - Activity Window: Fixed a bug where it was looking at the wrong class for checking the status of encoding. - Activity Window: Improved update / display performance dramatically by removing a List data structure. - Misc: Old code removed / code tweaks git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2349 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/win/C#/Controls/x264Panel.Designer.cs b/win/C#/Controls/x264Panel.Designer.cs index 5f08ed70c..3e3c4a2c7 100644 --- a/win/C#/Controls/x264Panel.Designer.cs +++ b/win/C#/Controls/x264Panel.Designer.cs @@ -145,7 +145,7 @@ this.label43.AutoSize = true; this.label43.BackColor = System.Drawing.Color.Transparent; this.label43.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label43.Location = new System.Drawing.Point(13, 18); + this.label43.Location = new System.Drawing.Point(13, 13); this.label43.Name = "label43"; this.label43.Size = new System.Drawing.Size(165, 13); this.label43.TabIndex = 49; diff --git a/win/C#/Controls/x264Panel.resx b/win/C#/Controls/x264Panel.resx index 8dca4f1d7..dbd32d12a 100644 --- a/win/C#/Controls/x264Panel.resx +++ b/win/C#/Controls/x264Panel.resx @@ -120,9 +120,6 @@ 17, 17 - - 17, 17 - Psychovisual Rate Distortion Optimization sure is a mouthful, isn't it? Basically, it means x264 tries to retain detail, for better quality to the human eye, as opposed to trying to maximize quality the way a computer understands it, through signal-to-noise ratios that have trouble telling apart fine detail and noise. diff --git a/win/C#/Functions/Encode.cs b/win/C#/Functions/Encode.cs index 1cd3de4ae..6c30828c2 100644 --- a/win/C#/Functions/Encode.cs +++ b/win/C#/Functions/Encode.cs @@ -16,20 +16,18 @@ namespace Handbrake.Functions { // DLL Imports [DllImport("user32.dll")] - public static extern void LockWorkStation(); + private static extern void LockWorkStation(); [DllImport("user32.dll")] - public static extern int ExitWindowsEx(int uFlags, int dwReason); + private static extern int ExitWindowsEx(int uFlags, int dwReason); // Declarations Process hbProc = new Process(); - Boolean encoding; /// /// Execute a HandBrakeCLI process. /// - /// /// The CLI Query - public Process runCli(object s, string query) + public Process runCli(string query) { try { @@ -42,7 +40,8 @@ namespace Handbrake.Functions if (Properties.Settings.Default.cli_minimized == "Checked") cliStart.WindowStyle = ProcessWindowStyle.Minimized; hbProc = Process.Start(cliStart); - encoding = true; + isEncoding = true; + currentQuery = query; // Set the process Priority if (hbProc != null) @@ -80,7 +79,8 @@ namespace Handbrake.Functions /// public void afterEncodeAction() { - encoding = false; + isEncoding = false; + currentQuery = String.Empty; // Do something whent he encode ends. switch (Properties.Settings.Default.CompletionOption) { @@ -132,9 +132,8 @@ namespace Handbrake.Functions /// Save a copy of the log to the users desired location or a default location /// if this feature is enabled in options. /// - /// /// - public void copyLog(string query, string destination) + public void copyLog(string destination) { // The user may wish to do something with the log. if (Properties.Settings.Default.saveLog == "Checked") @@ -169,10 +168,12 @@ namespace Handbrake.Functions /// /// Returns whether HandBrake is currently encoding or not. /// - public Boolean isEncoding - { - get { return encoding; } - } + public Boolean isEncoding { get; set; } + + /// + /// Returns the currently encoding query string + /// + public String currentQuery { get; set; } } } diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 93b29399c..acca7e797 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -1,11 +1,10 @@ -/* Common.cs $ +/* Main.cs $ This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ using System; -using System.Collections; using System.Windows.Forms; using System.IO; using System.Diagnostics; @@ -23,7 +22,7 @@ namespace Handbrake.Functions /// /// Calculate the duration of the selected title and chapters /// - public TimeSpan calculateDuration(string chapter_start, string chapter_end, Parsing.Title selectedTitle) + public static TimeSpan calculateDuration(string chapter_start, string chapter_end, Parsing.Title selectedTitle) { TimeSpan Duration = TimeSpan.FromSeconds(0.0); @@ -62,7 +61,7 @@ namespace Handbrake.Functions /// /// /// - public int cacluateNonAnamorphicHeight(int width, decimal top, decimal bottom, decimal left, decimal right, Parsing.Title selectedTitle) + public static int cacluateNonAnamorphicHeight(int width, decimal top, decimal bottom, decimal left, decimal right, Parsing.Title selectedTitle) { float aspect = selectedTitle.AspectRatio; int aw = 0; @@ -111,7 +110,7 @@ namespace Handbrake.Functions /// /// Select the longest title in the DVD title dropdown menu on frmMain /// - public Parsing.Title selectLongestTitle(ComboBox drp_dvdtitle) + public static Parsing.Title selectLongestTitle(ComboBox drp_dvdtitle) { int current_largest = 0; Parsing.Title title2Select; @@ -161,7 +160,7 @@ namespace Handbrake.Functions /// /// Set's up the DataGridView on the Chapters tab (frmMain) /// - public DataGridView chapterNaming(DataGridView data_chpt, string chapter_end) + public static DataGridView chapterNaming(DataGridView data_chpt, string chapter_end) { int i = 0, finish = 0; @@ -185,7 +184,7 @@ namespace Handbrake.Functions /// Function which generates the filename and path automatically based on /// the Source Name, DVD title and DVD Chapters /// - public string autoName(ComboBox drp_dvdtitle, string chapter_start, string chatper_end, string source, string dest, int format) + public static string autoName(ComboBox drp_dvdtitle, string chapter_start, string chatper_end, string source, string dest, int format) { string AutoNamePath = string.Empty; if (drp_dvdtitle.Text != "Automatic") @@ -227,7 +226,7 @@ namespace Handbrake.Functions if (!dest.Contains(Path.DirectorySeparatorChar.ToString())) { // If there is an auto name path, use it... - if (Properties.Settings.Default.autoNamePath.Trim() != "" && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location") + if (Properties.Settings.Default.autoNamePath.Trim() != "" && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location") AutoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destination_filename); else // ...otherwise, output to the source directory AutoNamePath = null; @@ -248,7 +247,7 @@ namespace Handbrake.Functions /// /// Turns on debug mode. Don't use on program startup /// Boolean True = Update available - public Boolean updateCheck(Boolean debug) + public static Boolean updateCheck(Boolean debug) { try { @@ -262,7 +261,7 @@ namespace Handbrake.Functions if (latest == skip) return false; - + Boolean update = (latest > current); return update; } @@ -278,7 +277,7 @@ namespace Handbrake.Functions /// Get's HandBrakes version data from the CLI. /// /// Arraylist of Version Data. 0 = hb_version 1 = hb_build - public void setCliVersionData() + public static void setCliVersionData() { String line; @@ -324,6 +323,10 @@ namespace Handbrake.Functions MessageBox.Show("Unable to retrieve version information from the CLI. \nError:\n" + e); } } + + /// + /// Search through the running processes on the system and kill HandBrakeCLI + /// private static void killCLI() { string AppName = "HandBrakeCLI"; @@ -346,7 +349,7 @@ namespace Handbrake.Functions /// If it does, it means the last queue did not complete before HandBrake closed. /// So, return a boolean if true. /// - public Boolean check_queue_recovery() + public static Boolean check_queue_recovery() { try { diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index 53cc363aa..8fabbe61e 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -1,6 +1,5 @@ using System; using System.Windows.Forms; -using System.Drawing; namespace Handbrake.Functions { @@ -20,7 +19,7 @@ namespace Handbrake.Functions // Setup the GUI // --------------------------- - #region source + #region Source // Reset some vaules to stock first to prevent errors. mainWindow.check_iPodAtom.CheckState = CheckState.Unchecked; @@ -36,9 +35,7 @@ namespace Handbrake.Functions #endregion - #region destination - - mainWindow.drp_videoEncoder.Text = presetQuery.VideoEncoder; + #region Destination and Output Settings if (presetQuery.Format != null) { @@ -148,6 +145,8 @@ namespace Handbrake.Functions #endregion #region Video + mainWindow.drp_videoEncoder.Text = presetQuery.VideoEncoder; + if (presetQuery.AverageVideoBitrate != null) { mainWindow.radio_avgBitrate.Checked = true; @@ -186,7 +185,7 @@ namespace Handbrake.Functions // with a different granularity, so, round and try again. if (value == 0) { - double val = Math.Round(calculated, 0); + double val = Math.Round(calculated, 0); int.TryParse(val.ToString(), out value); } @@ -226,51 +225,17 @@ namespace Handbrake.Functions // Clear the audio listing mainWindow.lv_audioList.Items.Clear(); - // Create a new row for the Audio list based on the currently selected items in the dropdown. - ListViewItem newTrack; - if (presetQuery.AudioTrack1 != "None") - { - newTrack = new ListViewItem("Automatic"); - newTrack.SubItems.Add(presetQuery.AudioEncoder1); - newTrack.SubItems.Add(presetQuery.AudioTrackMix1); - newTrack.SubItems.Add(presetQuery.AudioSamplerate1); - newTrack.SubItems.Add(presetQuery.AudioBitrate1); - newTrack.SubItems.Add(presetQuery.DRC1.ToString()); - mainWindow.lv_audioList.Items.Add(newTrack); - } - - if (presetQuery.AudioTrack2 != "None") - { - newTrack = new ListViewItem("Automatic"); - newTrack.SubItems.Add(presetQuery.AudioEncoder2); - newTrack.SubItems.Add(presetQuery.AudioTrackMix2); - newTrack.SubItems.Add(presetQuery.AudioSamplerate2); - newTrack.SubItems.Add(presetQuery.AudioBitrate2); - newTrack.SubItems.Add(presetQuery.DRC2.ToString()); - mainWindow.lv_audioList.Items.Add(newTrack); - } - - if (presetQuery.AudioTrack3 != "None") - { - newTrack = new ListViewItem("Automatic"); - newTrack.SubItems.Add(presetQuery.AudioEncoder3); - newTrack.SubItems.Add(presetQuery.AudioTrackMix3); - newTrack.SubItems.Add(presetQuery.AudioSamplerate3); - newTrack.SubItems.Add(presetQuery.AudioBitrate3); - newTrack.SubItems.Add(presetQuery.DRC3.ToString()); - mainWindow.lv_audioList.Items.Add(newTrack); - } - - if (presetQuery.AudioTrack4 != "None") - { - newTrack = new ListViewItem("Automatic"); - newTrack.SubItems.Add(presetQuery.AudioEncoder4); - newTrack.SubItems.Add(presetQuery.AudioTrackMix4); - newTrack.SubItems.Add(presetQuery.AudioSamplerate4); - newTrack.SubItems.Add(presetQuery.AudioBitrate4); - newTrack.SubItems.Add(presetQuery.DRC4.ToString()); - mainWindow.lv_audioList.Items.Add(newTrack); - } + if (presetQuery.AudioInformation != null) + foreach (AudioTrack track in presetQuery.AudioInformation) + { + ListViewItem newTrack = new ListViewItem("Automatic"); + newTrack.SubItems.Add(track.Encoder); + newTrack.SubItems.Add(track.MixDown); + newTrack.SubItems.Add(track.SampleRate); + newTrack.SubItems.Add(track.Bitrate); + newTrack.SubItems.Add(track.DRC); + mainWindow.lv_audioList.Items.Add(newTrack); + } // Subtitle Stuff mainWindow.drp_subtitle.Text = presetQuery.Subtitles; diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs index c3f66fc21..a78ce2dfa 100644 --- a/win/C#/Functions/QueryGenerator.cs +++ b/win/C#/Functions/QueryGenerator.cs @@ -90,7 +90,7 @@ namespace Handbrake.Functions /// /// /// - public string generateTabbedComponentsQuery(frmMain mainWindow) + public static string generateTabbedComponentsQuery(frmMain mainWindow) { string query = ""; @@ -274,11 +274,11 @@ namespace Handbrake.Functions // Sample Rate (-R) if (row.SubItems[3].Text != String.Empty) - samplerates.Add(row.SubItems[3].Text.Replace("Auto", "0")); + samplerates.Add(row.SubItems[3].Text.Replace("Auto", "Auto")); // Audio Bitrate (-B) if (row.SubItems[4].Text != String.Empty) - bitrates.Add(row.SubItems[4].Text.Replace("Auto", "0")); + bitrates.Add(row.SubItems[4].Text.Replace("Auto", "auto")); // DRC (-D) if (row.SubItems[5].Text != String.Empty) diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 2e1f470d3..5557b51be 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -8,6 +8,7 @@ using System; using System.Globalization; using System.Text.RegularExpressions; using System.Windows.Forms; +using System.Collections; namespace Handbrake.Functions { @@ -50,7 +51,7 @@ namespace Handbrake.Functions public string DeInterlace { get; private set; } public string DeNoise { get; private set; } public string Decomb { get; private set; } - #endregion + #endregion #region Video Settings public string VideoEncoder { get; private set; } @@ -64,30 +65,7 @@ namespace Handbrake.Functions #endregion #region Audio Settings - public string AudioTrack1 { get; private set; } - public string AudioTrack2 { get; private set; } - public string AudioTrack3 { get; private set; } - public string AudioTrack4 { get; private set; } - public string AudioTrackMix1 { get; private set; } - public string AudioTrackMix2 { get; private set; } - public string AudioTrackMix3 { get; private set; } - public string AudioTrackMix4 { get; private set; } - public string AudioEncoder1 { get; private set; } - public string AudioEncoder2 { get; private set; } - public string AudioEncoder3 { get; private set; } - public string AudioEncoder4 { get; private set; } - public string AudioBitrate1 { get; private set; } - public string AudioBitrate2 { get; private set; } - public string AudioBitrate3 { get; private set; } - public string AudioBitrate4 { get; private set; } - public string AudioSamplerate1 { get; private set; } - public string AudioSamplerate2 { get; private set; } - public string AudioSamplerate3 { get; private set; } - public string AudioSamplerate4 { get; private set; } - public double DRC1 { get; private set; } - public double DRC2 { get; private set; } - public double DRC3 { get; private set; } - public double DRC4 { get; private set; } + public ArrayList AudioInformation { get; private set; } public string Subtitles { get; private set; } public Boolean ForcedSubtitles { get; private set; } #endregion @@ -103,7 +81,6 @@ namespace Handbrake.Functions #endregion - // All the Main Window GUI options /// /// Takes in a query which can be in any order and parses it. /// All varibles are then set so they can be used elsewhere. @@ -123,7 +100,7 @@ namespace Handbrake.Functions //Source Match title = Regex.Match(input, @"-t ([0-9]*)"); Match chapters = Regex.Match(input, @"-c ([0-9-]*)"); - + //Output Settings Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)"); Match grayscale = Regex.Match(input, @" -g"); @@ -160,35 +137,12 @@ namespace Handbrake.Functions //Audio Settings Tab Match noAudio = Regex.Match(input, @"-a none"); - Match audioTrack1 = Regex.Match(input, @"-a ([0-9]*)"); - Match audioTrack2 = Regex.Match(input, @"-a ([0-9]*),([0-9]*)"); - Match audioTrack3 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*)"); - Match audioTrack4 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*),([0-9]*)"); - - Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z]*)"); - Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z]*),([0-9a-z]*)"); - Match audioTrack3Mix = Regex.Match(input, @"-6 ([0-9a-z]*),([0-9a-z]*),([0-9a-z]*)"); - Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z]*),([0-9a-z]*),([0-9a-z]*),([0-9a-z]*)"); - - Match audioEncoder1 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*)"); - Match audioEncoder2 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)"); - Match audioEncoder3 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)"); - Match audioEncoder4 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)"); - - Match audioBitrate1 = Regex.Match(input, @"-B ([0-9auto]*)"); - Match audioBitrate2 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*)"); - Match audioBitrate3 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*),([0-9auto]*)"); - Match audioBitrate4 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*),([0-9auto]*),([0-9auto]*)"); - - Match audioSampleRate1 = Regex.Match(input, @"-R ([0-9Auto.]*)"); - Match audioSampleRate2 = Regex.Match(input, @"-R ([0-9Auto.]*),([0-9Auto.]*)"); - Match audioSampleRate3 = Regex.Match(input, @"-R ([0-9Auto.]*),([0-9Auto.]*),([0-9Auto.]*)"); - Match audioSampleRate4 = Regex.Match(input, @"-R ([0-9Auto.]*),([0-9Auto.]*),([0-9Auto.]*),([0-9Auto.]*)"); - - Match drc1 = Regex.Match(input, @"-D ([0-9.]*)"); - Match drc2 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*)"); - Match drc3 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*)"); - Match drc4 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*),([0-9.]*)"); + Match audioTracks = Regex.Match(input, @"-a ([0-9,]*)"); + Match audioTrackMixes = Regex.Match(input, @"-6 ([0-9a-zA-Z,]*)"); + Match audioEncoders = Regex.Match(input, @"-E ([a-zA-Z0-9+,]*)"); + Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z + Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z + Match drcValues = Regex.Match(input, @"-D ([0-9.,]*)"); Match subtitles = Regex.Match(input, @"-s ([0-9a-zA-Z]*)"); Match subScan = Regex.Match(input, @" -U"); @@ -262,7 +216,7 @@ namespace Handbrake.Functions thisQuery.CropLeft = actCropValues[2]; thisQuery.CropRight = actCropValues[3]; } - + thisQuery.Anamorphic = anamorphic.Success; thisQuery.LooseAnamorphic = lanamorphic.Success; @@ -336,7 +290,7 @@ namespace Handbrake.Functions thisQuery.Grayscale = grayscale.Success; thisQuery.TwoPass = twoPass.Success; thisQuery.TurboFirstPass = turboFirstPass.Success; - + if (videoBitrate.Success) thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", ""); if (videoFilesize.Success) @@ -344,194 +298,74 @@ namespace Handbrake.Functions if (videoQuality.Success) { - float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture); + float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture); //qConvert = Math.Ceiling(qConvert); thisQuery.VideoQuality = qConvert; } #endregion #region Audio Tab - - // Tracks - if (noAudio.Success) - thisQuery.AudioTrack1 = "None"; - else if (audioTrack1.Success) - thisQuery.AudioTrack1 = "Automatic"; - - if (audioTrack2.Success) - { - string[] audioChan = audioTrack2.ToString().Split(','); - thisQuery.AudioTrack2 = audioChan[1]; - } - else - thisQuery.AudioTrack2 = "None"; - - if (audioTrack3.Success) - { - string[] audioChan = audioTrack3.ToString().Split(','); - thisQuery.AudioTrack3 = audioChan[2]; - } - else - thisQuery.AudioTrack3 = "None"; - - if (audioTrack4.Success) - { - string[] audioChan = audioTrack4.ToString().Split(','); - thisQuery.AudioTrack4 = audioChan[3]; - } - else - thisQuery.AudioTrack4 = "None"; - - - // Mixdowns - thisQuery.AudioTrackMix1 = "Automatic"; - if (audioTrack1Mix.Success) - thisQuery.AudioTrackMix1 = - getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", "")); - - thisQuery.AudioTrackMix2 = "Automatic"; - if (audioTrack2Mix.Success) - { - string[] audio2mix = audioTrack2Mix.ToString().Split(','); - thisQuery.AudioTrackMix2 = getMixDown(audio2mix[1].Trim()); - } - - thisQuery.AudioTrackMix3 = "Automatic"; - if (audioTrack3Mix.Success) - { - string[] audio3mix = audioTrack3Mix.ToString().Split(','); - thisQuery.AudioTrackMix3 = getMixDown(audio3mix[2].Trim()); - } - - thisQuery.AudioTrackMix4 = "Automatic"; - if (audioTrack4Mix.Success) - { - string[] audio4mix = audioTrack4Mix.ToString().Split(','); - thisQuery.AudioTrackMix4 = getMixDown(audio4mix[3].Trim()); - } - - - // Audio Encoders - if (audioEncoder1.Success) - thisQuery.AudioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", "")); - - if (audioEncoder2.Success) - { - string[] audio2enc = audioEncoder2.ToString().Split(','); - thisQuery.AudioEncoder2 = getAudioEncoder(audio2enc[1].Trim()); - } - - if (audioEncoder3.Success) - { - string[] audio3enc = audioEncoder3.ToString().Split(','); - thisQuery.AudioEncoder3 = getAudioEncoder(audio3enc[2].Trim()); - } - - if (audioEncoder4.Success) + // Find out how many tracks we need to add by checking how many encoders or audio tracks are selected. + int encoderCount = 0; + if (audioEncoders.Success) { - string[] audio4enc = audioEncoder4.ToString().Split(','); - thisQuery.AudioEncoder4 = getAudioEncoder(audio4enc[3].Trim()); + string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", "").Split(','); + encoderCount = audioDataCounters.Length; } - - // Audio Bitrate - thisQuery.AudioBitrate1 = ""; - if (audioBitrate1.Success) + // Get the data from the regular expression results + string[] trackData = null; + string[] trackMixes = null; + string[] trackEncoders = null; + string[] trackBitrates = null; + string[] trackSamplerates = null; + string[] trackDRCvalues = null; + + if (audioTracks.Success) + trackData = audioTracks.ToString().Replace("-a ", "").Split(','); + if (audioTrackMixes.Success) + trackMixes = audioTrackMixes.ToString().Replace("-6 ", "").Split(','); + if (audioEncoders.Success) + trackEncoders = audioEncoders.ToString().Replace("-E ", "").Split(','); + if (audioBitrates.Success) + trackBitrates = audioBitrates.ToString().Replace("-B ", "").Split(','); + if (audioSampleRates.Success) + trackSamplerates = audioSampleRates.ToString().Replace("-R ", "").Split(','); + if (drcValues.Success) + trackDRCvalues = drcValues.ToString().Replace("-D ", "").Split(','); + + // Create new Audio Track Classes and store them in the ArrayList + ArrayList AllAudioTrackInfo = new ArrayList(); + for (int x = 0; x < encoderCount; x++) { - thisQuery.AudioBitrate1 = audioBitrate1.ToString().Replace("-B ", "").Trim(); - if (audioBitrate1.ToString().Replace("-B ", "").Trim() == "0") thisQuery.AudioBitrate1 = "Auto"; - } + AudioTrack track = new AudioTrack(); + if (trackData != null) + if (trackData.Length >= (x + 1)) // Audio Track + track.Track = trackData[x].Trim(); - thisQuery.AudioBitrate2 = ""; - if (audioBitrate2.Success && audioTrack2.Success) - { - string[] audioBitrateSelect = audioBitrate2.ToString().Split(','); - if (audioBitrateSelect[1].Trim() == "0") audioBitrateSelect[1] = "Auto"; - thisQuery.AudioBitrate2 = audioBitrateSelect[1].Trim(); - } + if (trackMixes != null) + if (trackMixes.Length >= (x + 1)) // Audio Mix + track.MixDown = getMixDown(trackMixes[x].Trim()); - thisQuery.AudioBitrate3 = ""; - if (audioBitrate3.Success && audioTrack3.Success) - { - string[] audioBitrateSelect = audioBitrate3.ToString().Split(','); - if (audioBitrateSelect[2].Trim() == "0") audioBitrateSelect[2] = "Auto"; - thisQuery.AudioBitrate3 = audioBitrateSelect[2].Trim(); - } + if (trackEncoders != null) + if (trackEncoders.Length >= (x + 1)) // Audio Mix + track.Encoder = getAudioEncoder(trackEncoders[x].Trim()); - thisQuery.AudioBitrate4 = ""; - if (audioBitrate4.Success) - { - string[] audioBitrateSelect = audioBitrate4.ToString().Split(','); - if (audioBitrateSelect[3].Trim() == "0") audioBitrateSelect[3] = "Auto"; - thisQuery.AudioBitrate4 = audioBitrateSelect[3].Trim(); - } + if (trackBitrates != null) + if (trackBitrates.Length >= (x + 1)) // Audio Encoder + track.Bitrate = trackBitrates[x].Trim() == "auto" ? "Auto" : trackBitrates[x].Trim(); + if (trackSamplerates != null) + if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate + track.SampleRate = trackSamplerates[x].Trim() == "0" ? "Auto" : trackSamplerates[x].Trim(); - // Audio Sample Rate - // Make sure to change 0 to Auto - thisQuery.AudioSamplerate1 = "Auto"; - if (audioSampleRate1.Success) - { - thisQuery.AudioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim(); - if (thisQuery.AudioSamplerate1 == "0") thisQuery.AudioSamplerate1 = "Auto"; - } + if (trackDRCvalues != null) + if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values + track.DRC = trackDRCvalues[x].Trim(); - - if (audioSampleRate2.Success) - { - string[] audioSRSelect = audioSampleRate2.ToString().Split(','); - if (audioSRSelect[1] == "0") audioSRSelect[1] = "Auto"; - thisQuery.AudioSamplerate2 = audioSRSelect[1].Trim(); - } - - if (audioSampleRate3.Success) - { - string[] audioSRSelect = audioSampleRate3.ToString().Split(','); - if (audioSRSelect[2] == "0") audioSRSelect[2] = "Auto"; - thisQuery.AudioSamplerate3 = audioSRSelect[2].Trim(); - } - - if (audioSampleRate4.Success) - { - string[] audioSRSelect = audioSampleRate4.ToString().Split(','); - if (audioSRSelect[3] == "0") audioSRSelect[3] = "Auto"; - thisQuery.AudioSamplerate4 = audioSRSelect[3].Trim(); - } - - // DRC - float drcValue; - - thisQuery.DRC1 = 1; - if (drc1.Success) - { - string value = drc1.ToString().Replace("-D ", ""); - float.TryParse(value, out drcValue); - thisQuery.DRC1 = drcValue; - } - - thisQuery.DRC2 = 1; - if (drc2.Success) - { - string[] drcPoint = drc2.ToString().Split(','); - float.TryParse(drcPoint[1], out drcValue); - thisQuery.DRC2 = drcValue; - } - - thisQuery.DRC3 = 1; - if (drc3.Success) - { - string[] drcPoint = drc3.ToString().Split(','); - float.TryParse(drcPoint[2], out drcValue); - thisQuery.DRC3 = drcValue; - } - - thisQuery.DRC4 = 1; - if (drc4.Success) - { - string[] drcPoint = drc4.ToString().Split(','); - float.TryParse(drcPoint[3], out drcValue); - thisQuery.DRC4 = drcValue; + AllAudioTrackInfo.Add(track); } + thisQuery.AudioInformation = AllAudioTrackInfo; // Subtitle Stuff if (subtitles.Success) @@ -540,7 +374,6 @@ namespace Handbrake.Functions thisQuery.Subtitles = subScan.Success ? "Autoselect" : "None"; thisQuery.ForcedSubtitles = forcedSubtitles.Success; - #endregion #region Chapters Tab @@ -604,4 +437,23 @@ namespace Handbrake.Functions } } } + + public class AudioTrack + { + public AudioTrack() + { + // Default Values + Track = "Automatic"; + MixDown = "Automatic"; + SampleRate = "Auto"; + Bitrate = "Auto"; + DRC = "1"; + } + public string Track { get; set; } + public string MixDown { get; set; } + public string Encoder { get; set; } + public string Bitrate { get; set; } + public string SampleRate { get; set; } + public string DRC { get; set; } + } } \ No newline at end of file diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 9d50b94e3..e8bba46bf 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -18,7 +18,7 @@ 2.0 - v2.0 + v3.5 false false publish\ @@ -90,7 +90,10 @@ x86 + + + @@ -98,6 +101,9 @@ + + + diff --git a/win/C#/Installer/Installer.nsi b/win/C#/Installer/Installer.nsi index bb24dd5e9..4b1e7dee2 100644 --- a/win/C#/Installer/Installer.nsi +++ b/win/C#/Installer/Installer.nsi @@ -8,11 +8,13 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "Handbrake" -!define PRODUCT_VERSION "0.9.1" +!define PRODUCT_VERSION "0.9.4" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Handbrake.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" +SetCompressor lzma + ; MUI 1.67 compatible ------ !include "MUI.nsh" @@ -53,7 +55,7 @@ Function .onInit Call GetDotNETVersion Pop $0 ${If} $0 == "not found" - MessageBox MB_OK|MB_ICONSTOP ".NET runtime library is not installed. $\r$\n You can download .Net Framework 2 from the microsoft website. $\r$\n Alternatively you can use google for a direct download URL" + MessageBox MB_OK|MB_ICONSTOP ".NET runtime library is not installed. $\r$\n You can download .Net Framework 3.5 from the microsoft website. $\r$\n Alternatively you can use google for a direct download URL" Abort ${EndIf} @@ -61,7 +63,7 @@ Function .onInit ${VersionCompare} $0 "2.0" $1 ${If} $1 == 2 - MessageBox MB_OK|MB_ICONSTOP ".NET runtime library v2.0 or newer is required. You have $0. $\r$\n You can download .Net Framework 2 from the microsoft website. $\r$\n Alternatively you can use google for a direct download URL" + MessageBox MB_OK|MB_ICONSTOP ".NET runtime library v3.5 or newer is required. You have $0. $\r$\n You can download .Net Framework 3.5 from the Microsoft website. $\r$\n Alternatively you can use google for a direct download URL" Abort ${EndIf} FunctionEnd @@ -91,11 +93,14 @@ Section "Handbrake" SEC01 CreateDirectory "$SMPROGRAMS\Handbrake" CreateShortCut "$SMPROGRAMS\Handbrake\Handbrake.lnk" "$INSTDIR\Handbrake.exe" CreateShortCut "$DESKTOP\Handbrake.lnk" "$INSTDIR\Handbrake.exe" - File "dvdinfo.dat" - File "cygwin1.dll" - File "hbcli.exe" + File "Interop.QTOLibrary.dll" + File "Interop.QTOControlLib.dll" + File "AxInterop.QTOControlLib.dll" + File "HandBrakeCLI.exe" File "Handbrake.exe.config" File "handbrakepineapple.ico" + File "presets.xml" + File "user_presets.xml" SetOutPath "$INSTDIR\doc" SetOverwrite ifnewer @@ -134,12 +139,16 @@ FunctionEnd Section Uninstall Delete "$INSTDIR\uninst.exe" + + Delete "$INSTDIR\Interop.QTOLibrary.dll" + Delete "$INSTDIR\Interop.QTOControlLib.dll" + Delete "$INSTDIR\AxInterop.QTOControlLib.dll" + Delete "$INSTDIR\HandBrakeCLI.exe" Delete "$INSTDIR\handbrakepineapple.ico" - Delete "$INSTDIR\hbcli.exe" - Delete "$INSTDIR\cygwin1.dll" - Delete "$INSTDIR\dvdinfo.dat" Delete "$INSTDIR\Handbrake.exe" Delete "$INSTDIR\Handbrake.exe.config" + Delete "$INSTDIR\presets.xml" + Delete "$INSTDIR\user_presets.xml" Delete "$INSTDIR\doc\AUTHORS" Delete "$INSTDIR\doc\BUILD" Delete "$INSTDIR\doc\COPYING" @@ -147,12 +156,12 @@ Section Uninstall Delete "$INSTDIR\doc\NEWS" Delete "$INSTDIR\doc\THANKS" Delete "$INSTDIR\doc\TRANSLATIONS" - + RMDir "$INSTDIR" Delete "$SMPROGRAMS\Handbrake\Uninstall.lnk" Delete "$DESKTOP\Handbrake.lnk" Delete "$SMPROGRAMS\Handbrake\Handbrake.lnk" - RMDir "$SMPROGRAMS\Handbrake" - RMDir "$INSTDIR" + RMDir "$SMPROGRAMS\Handbrake" + RMDir "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" diff --git a/win/C#/Program.cs b/win/C#/Program.cs index cee6dfa4d..885a36988 100644 --- a/win/C#/Program.cs +++ b/win/C#/Program.cs @@ -22,10 +22,10 @@ namespace Handbrake try { // Make sure the screen resolution is not below 1024x768 - System.Windows.Forms.Screen scr = Screen.PrimaryScreen; + Screen scr = Screen.PrimaryScreen; if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 720)) { - MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n" + "Your screen is running at: " + scr.Bounds.Width + "x" + scr.Bounds.Height.ToString() + " \nScreen resolution is too Low. Must be 1024x720 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n" + "Your screen is running at: " + scr.Bounds.Width + "x" + scr.Bounds.Height + " \nScreen resolution is too Low. Must be 1024x720 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); launch = false; } } diff --git a/win/C#/Queue/QueueHandler.cs b/win/C#/Queue/QueueHandler.cs index 945a2ae4d..f5f3460c0 100644 --- a/win/C#/Queue/QueueHandler.cs +++ b/win/C#/Queue/QueueHandler.cs @@ -11,15 +11,16 @@ using System.Windows.Forms; using System.Xml.Serialization; using System.Threading; using System.Diagnostics; +using Handbrake.Functions; namespace Handbrake.Queue { public class QueueHandler { + readonly Encode encodeHandler = new Encode(); private static XmlSerializer ser = new XmlSerializer(typeof(List)); List queue = new List(); int id; // Unique identifer number for each job - private QueueItem lastItem; #region Queue Handling public List getQueue() @@ -31,11 +32,11 @@ namespace Handbrake.Queue /// Get's the next CLI query for encoding /// /// String - public string getNextItemForEncoding() + private string getNextItemForEncoding() { QueueItem job = queue[0]; String query = job.Query; - lastItem = job; + lastQueueItem = job; remove(0); // Remove the item which we are about to pass out. return query; } @@ -44,10 +45,7 @@ namespace Handbrake.Queue /// Get the last query that was returned by getNextItemForEncoding() /// /// - public QueueItem getLastQueryItem() - { - return lastItem; - } + public QueueItem lastQueueItem { get; set; } /// /// Add's a new item to the queue @@ -72,7 +70,6 @@ namespace Handbrake.Queue { foreach (QueueItem checkItem in queue) { - if (checkItem.Destination.Contains(destination.Replace("\\\\", "\\"))) return true; } @@ -84,10 +81,9 @@ namespace Handbrake.Queue /// /// Index /// Bolean true if successful - public Boolean remove(int index) + public void remove(int index) { queue.RemoveAt(index); - return true; } /// @@ -135,11 +131,7 @@ namespace Handbrake.Queue /// public void write2disk(string file) { - string tempPath; - if (file == "hb_queue_recovery.xml") - tempPath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml"); - else - tempPath = file; + string tempPath = file == "hb_queue_recovery.xml" ? Path.Combine(Path.GetTempPath(), "hb_queue_recovery.xml") : file; try { @@ -227,37 +219,22 @@ namespace Handbrake.Queue } #endregion - //------------------------------------------------------------------------ - Functions.Encode encodeHandler = new Functions.Encode(); - private Boolean started = false; - private Boolean paused; - private Boolean encoding; - #region Encoding - public Boolean isEncodeStarted - { - get { return started; } - } - public Boolean isPaused - { - get { return paused; } - } - public Boolean isEncoding - { - get { return encoding; } - } + public Boolean isEncodeStarted { get; private set; } + public Boolean isPaused { get; private set; } + public Boolean isEncoding { get; private set; } public void startEncode() { Thread theQueue; if (this.count() != 0) { - if (paused) - paused = false; + if (isPaused) + isPaused = false; else { - paused = false; + isPaused = false; try { theQueue = new Thread(startProc) {IsBackground = true}; @@ -272,7 +249,7 @@ namespace Handbrake.Queue } public void pauseEncode() { - paused = true; + isPaused = true; EncodePaused(null); } @@ -288,17 +265,17 @@ namespace Handbrake.Queue write2disk("hb_queue_recovery.xml"); // Update the queue recovery file EncodeStarted(null); - hbProc = encodeHandler.runCli(this, query); + hbProc = encodeHandler.runCli(query); hbProc.WaitForExit(); encodeHandler.addCLIQueryToLog(query); - encodeHandler.copyLog(query, getLastQueryItem().Destination); + encodeHandler.copyLog(lastQueueItem.Destination); hbProc.Close(); hbProc.Dispose(); EncodeFinished(null); - while (paused) // Need to find a better way of doing this. + while (isPaused) // Need to find a better way of doing this. { Thread.Sleep(10000); } @@ -327,7 +304,7 @@ namespace Handbrake.Queue if (OnEncodeStart != null) OnEncodeStart(this, e); - encoding = true; + isEncoding = true; } protected virtual void EncodePaused(EventArgs e) { @@ -339,7 +316,7 @@ namespace Handbrake.Queue if (OnEncodeEnded != null) OnEncodeEnded(this, e); - encoding = false; + isEncoding = false; } protected virtual void EncodeQueueFinished(EventArgs e) { diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index 5c14e4137..b1fa0dafe 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -20,23 +20,23 @@ namespace Handbrake delegate void SetTextCallback(string text); String read_file; Thread monitor; - Functions.Encode encodeHandler; + Queue.QueueHandler encodeQueue; int position; // Position in the arraylist reached by the current log output in the rtf box. /// /// This window should be used to display the RAW output of the handbrake CLI which is produced during an encode. /// - public frmActivityWindow(string file, Functions.Encode eh) + public frmActivityWindow(string file, Queue.QueueHandler eh) { InitializeComponent(); - this.rtf_actLog.Text = string.Empty; - // When the window closes, we want to abort the monitor thread. - this.Disposed += new EventHandler(forceQuit); - - encodeHandler = eh; + rtf_actLog.Text = string.Empty; + encodeQueue = eh; read_file = file; position = 0; + + // When the window closes, we want to abort the monitor thread. + this.Disposed += new EventHandler(forceQuit); // Print the Log header in the Rich text box. displayLogHeader(); @@ -47,7 +47,7 @@ namespace Handbrake txt_log.Text = "Encode Log"; // Start a new thread which will montior and keep the log window up to date if required/ - startLogThread(read_file); + startLogThread(read_file); } /// @@ -65,6 +65,11 @@ namespace Handbrake rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath)); rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath)); rtf_actLog.AppendText("#########################################\n\n"); + if (encodeQueue.isEncoding && encodeQueue.lastQueueItem.Query != String.Empty) + { + rtf_actLog.AppendText("### CLI Query: " + encodeQueue.lastQueueItem.Query + "\n\n"); + rtf_actLog.AppendText("#########################################\n\n"); + } } /// @@ -93,54 +98,6 @@ namespace Handbrake } } - /// - /// Change the log file to be displayed to hb_encode_log.dat - /// - /// - /// - private void btn_scan_log_Click(object sender, EventArgs e) - { - if (monitor != null) - monitor.Abort(); - - rtf_actLog.Clear(); - read_file = "dvdinfo.dat"; - displayLogHeader(); - startLogThread(read_file); - txt_log.Text = "Scan Log"; - } - - /// - /// Change the log file to be displayed to dvdinfo.dat - /// - /// - /// - private void btn_encode_log_Click(object sender, EventArgs e) - { - if (monitor != null) - monitor.Abort(); - - rtf_actLog.Clear(); - read_file = "hb_encode_log.dat"; - position = 0; - displayLogHeader(); - startLogThread(read_file); - txt_log.Text = "Encode Log"; - } - - /// - /// Copy to Clipboard - /// - /// - /// - private void btn_copy_Click(object sender, EventArgs e) - { - if (rtf_actLog.SelectedText != "") - Clipboard.SetDataObject(rtf_actLog.SelectedText, true); - else - Clipboard.SetDataObject(rtf_actLog.Text, true); - } - /// /// Updates the log window with any new data which is in the log file. /// This is done every 5 seconds. @@ -154,7 +111,7 @@ namespace Handbrake updateTextFromThread(); while (true) { - if (encodeHandler.isEncoding) + if (encodeQueue.isEncoding) updateTextFromThread(); else { @@ -186,19 +143,11 @@ namespace Handbrake { try { - string text; - List data = readFile(); - int count = data.Count; + String info = readFile(); + if (info.Contains("has exited")) + info += "\n ############ End of Log ############## \n"; - while (position < count) - { - text = data[position]; - if (data[position].Contains("has exited")) - text = "\n ############ End of Log ############## \n"; - position++; - - SetText(text); - } + SetText(info); } catch (Exception exc) { @@ -238,12 +187,9 @@ namespace Handbrake /// Read the log file, and store the data in a List. /// /// - private List readFile() + private String readFile() { - // Ok, the task here is to, Get an arraylist of log data. - // And update some global varibles which are pointers to the last displayed log line. - List logData = new List(); - + String appendText = String.Empty; try { // hb_encode_log.dat 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), @@ -260,18 +206,21 @@ namespace Handbrake // Open the copied log file for reading StreamReader sr = new StreamReader(logFile2); - string line = sr.ReadLine(); - while (line != null) + string line; + int i = 1; + while ((line = sr.ReadLine()) != null) { - if (line.Trim() != "") - logData.Add(line + Environment.NewLine); - - line = sr.ReadLine(); + if (i > position) + { + appendText += line + Environment.NewLine; + position++; + } + i++; } sr.Close(); sr.Dispose(); - return logData; + return appendText; } catch (Exception exc) { @@ -296,11 +245,8 @@ namespace Handbrake this.Close(); } - /// - /// Copy Log Menu Item on the right click menu for the log rtf box - /// - /// - /// + #region User Interface + private void mnu_copy_log_Click(object sender, EventArgs e) { if (rtf_actLog.SelectedText != "") @@ -308,6 +254,42 @@ namespace Handbrake else Clipboard.SetDataObject(rtf_actLog.Text, true); } + private void btn_copy_Click(object sender, EventArgs e) + { + if (rtf_actLog.SelectedText != "") + Clipboard.SetDataObject(rtf_actLog.SelectedText, true); + else + Clipboard.SetDataObject(rtf_actLog.Text, true); + } + private void btn_scan_log_Click(object sender, EventArgs e) + { + // Switch to the scan log. + + if (monitor != null) + monitor.Abort(); + + rtf_actLog.Clear(); + read_file = "dvdinfo.dat"; + displayLogHeader(); + startLogThread(read_file); + txt_log.Text = "Scan Log"; + } + private void btn_encode_log_Click(object sender, EventArgs e) + { + // Switch to the encode log + + if (monitor != null) + monitor.Abort(); + + rtf_actLog.Clear(); + read_file = "hb_encode_log.dat"; + position = 0; + displayLogHeader(); + startLogThread(read_file); + txt_log.Text = "Encode Log"; + } + + #endregion #region System Information private struct MEMORYSTATUS // Unused var's are requred here. diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 6f5afee36..7a89b0f89 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -40,7 +40,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container(); System.Windows.Forms.ContextMenuStrip notifyIconMenu; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.btn_restore = new System.Windows.Forms.ToolStripMenuItem(); this.DVD_Save = new System.Windows.Forms.SaveFileDialog(); this.File_Save = new System.Windows.Forms.SaveFileDialog(); @@ -48,7 +48,6 @@ namespace Handbrake this.drop_chapterFinish = new System.Windows.Forms.ComboBox(); this.drop_chapterStart = new System.Windows.Forms.ComboBox(); this.drp_dvdtitle = new System.Windows.Forms.ComboBox(); - this.text_source = new System.Windows.Forms.TextBox(); this.text_destination = new System.Windows.Forms.TextBox(); this.drp_videoEncoder = new System.Windows.Forms.ComboBox(); this.drp_audbit_1 = new System.Windows.Forms.ComboBox(); @@ -75,6 +74,7 @@ namespace Handbrake this.drop_format = new System.Windows.Forms.ComboBox(); this.check_customCrop = new System.Windows.Forms.RadioButton(); this.check_autoCrop = new System.Windows.Forms.RadioButton(); + this.text_source = new System.Windows.Forms.TextBox(); this.lbl_src_res = new System.Windows.Forms.Label(); this.lbl_duration = new System.Windows.Forms.Label(); this.label_duration = new System.Windows.Forms.Label(); @@ -224,6 +224,7 @@ namespace Handbrake this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); this.StatusStrip = new System.Windows.Forms.StatusStrip(); this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel(); + this.hbproc = new System.Diagnostics.Process(); notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components); notifyIconMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit(); @@ -262,12 +263,12 @@ namespace Handbrake this.btn_restore}); notifyIconMenu.Name = "notifyIconMenu"; notifyIconMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; - notifyIconMenu.Size = new System.Drawing.Size(129, 26); + notifyIconMenu.Size = new System.Drawing.Size(124, 26); // // btn_restore // this.btn_restore.Name = "btn_restore"; - this.btn_restore.Size = new System.Drawing.Size(128, 22); + this.btn_restore.Size = new System.Drawing.Size(123, 22); this.btn_restore.Text = "Restore"; this.btn_restore.Click += new System.EventHandler(this.btn_restore_Click); // @@ -328,17 +329,6 @@ namespace Handbrake this.drp_dvdtitle.SelectedIndexChanged += new System.EventHandler(this.drp_dvdtitle_SelectedIndexChanged); this.drp_dvdtitle.Click += new System.EventHandler(this.drp_dvdtitle_Click); // - // text_source - // - this.text_source.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.text_source.Location = new System.Drawing.Point(99, 19); - this.text_source.Name = "text_source"; - this.text_source.ReadOnly = true; - this.text_source.Size = new System.Drawing.Size(584, 21); - this.text_source.TabIndex = 1; - this.text_source.Text = "Click \'Source\' to continue"; - this.ToolTip.SetToolTip(this.text_source, "Location of the source input file, folder or dvd."); - // // text_destination // this.text_destination.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -463,7 +453,7 @@ namespace Handbrake this.slider_videoQuality.Margin = new System.Windows.Forms.Padding(0); this.slider_videoQuality.Maximum = 100; this.slider_videoQuality.Name = "slider_videoQuality"; - this.slider_videoQuality.Size = new System.Drawing.Size(322, 42); + this.slider_videoQuality.Size = new System.Drawing.Size(322, 45); this.slider_videoQuality.TabIndex = 14; this.slider_videoQuality.TickFrequency = 17; this.ToolTip.SetToolTip(this.slider_videoQuality, "Set the quality level of the video. (Around 70% is fine for most)"); @@ -608,9 +598,9 @@ namespace Handbrake // // number // - dataGridViewCellStyle1.Format = "N0"; - dataGridViewCellStyle1.NullValue = null; - this.number.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Format = "N0"; + dataGridViewCellStyle2.NullValue = null; + this.number.DefaultCellStyle = dataGridViewCellStyle2; this.number.Frozen = true; this.number.HeaderText = "Chapter Number"; this.number.MaxInputLength = 3; @@ -713,6 +703,17 @@ namespace Handbrake this.check_autoCrop.UseVisualStyleBackColor = true; this.check_autoCrop.CheckedChanged += new System.EventHandler(this.check_autoCrop_CheckedChanged); // + // text_source + // + this.text_source.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.text_source.Location = new System.Drawing.Point(99, 19); + this.text_source.Name = "text_source"; + this.text_source.ReadOnly = true; + this.text_source.Size = new System.Drawing.Size(584, 21); + this.text_source.TabIndex = 1; + this.text_source.Text = "Click \'Source\' to continue"; + this.ToolTip.SetToolTip(this.text_source, "Location of the source input file, folder or dvd."); + // // lbl_src_res // this.lbl_src_res.AutoSize = true; @@ -964,7 +965,7 @@ namespace Handbrake this.frmMainMenu.Location = new System.Drawing.Point(0, 0); this.frmMainMenu.Name = "frmMainMenu"; this.frmMainMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; - this.frmMainMenu.Size = new System.Drawing.Size(1004, 24); + this.frmMainMenu.Size = new System.Drawing.Size(1000, 24); this.frmMainMenu.TabIndex = 0; this.frmMainMenu.Text = "MenuStrip"; // @@ -1191,19 +1192,19 @@ namespace Handbrake this.toolStripSeparator2, this.audioList_remove}); this.audioMenu.Name = "audioMenu"; - this.audioMenu.Size = new System.Drawing.Size(152, 76); + this.audioMenu.Size = new System.Drawing.Size(142, 76); // // audioList_moveup // this.audioList_moveup.Name = "audioList_moveup"; - this.audioList_moveup.Size = new System.Drawing.Size(151, 22); + this.audioList_moveup.Size = new System.Drawing.Size(141, 22); this.audioList_moveup.Text = "Move Up"; this.audioList_moveup.Click += new System.EventHandler(this.audioList_moveup_Click); // // audioList_movedown // this.audioList_movedown.Name = "audioList_movedown"; - this.audioList_movedown.Size = new System.Drawing.Size(151, 22); + this.audioList_movedown.Size = new System.Drawing.Size(141, 22); this.audioList_movedown.Text = "Move Down"; this.audioList_movedown.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.audioList_movedown.Click += new System.EventHandler(this.audioList_movedown_Click); @@ -1211,12 +1212,12 @@ namespace Handbrake // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(148, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); // // audioList_remove // this.audioList_remove.Name = "audioList_remove"; - this.audioList_remove.Size = new System.Drawing.Size(151, 22); + this.audioList_remove.Size = new System.Drawing.Size(141, 22); this.audioList_remove.Text = "Remove"; this.audioList_remove.Click += new System.EventHandler(this.audioList_remove_Click); // @@ -1228,7 +1229,7 @@ namespace Handbrake // // btn_RemoveAudioTrack // - this.btn_RemoveAudioTrack.BackColor = System.Drawing.SystemColors.Control; + this.btn_RemoveAudioTrack.BackColor = System.Drawing.Color.Transparent; this.btn_RemoveAudioTrack.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_RemoveAudioTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); this.btn_RemoveAudioTrack.Location = new System.Drawing.Point(132, 227); @@ -1241,7 +1242,7 @@ namespace Handbrake // // btn_addAudioTrack // - this.btn_addAudioTrack.BackColor = System.Drawing.SystemColors.Control; + this.btn_addAudioTrack.BackColor = System.Drawing.Color.Transparent; this.btn_addAudioTrack.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_addAudioTrack.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); this.btn_addAudioTrack.Location = new System.Drawing.Point(16, 227); @@ -1281,7 +1282,7 @@ namespace Handbrake this.tb_drc.Margin = new System.Windows.Forms.Padding(0); this.tb_drc.Maximum = 31; this.tb_drc.Name = "tb_drc"; - this.tb_drc.Size = new System.Drawing.Size(50, 42); + this.tb_drc.Size = new System.Drawing.Size(50, 45); this.tb_drc.TabIndex = 13; this.tb_drc.TickFrequency = 10; this.tb_drc.ValueChanged += new System.EventHandler(this.tb_drc_Scroll); @@ -1784,7 +1785,7 @@ namespace Handbrake this.slider_deblock.Maximum = 15; this.slider_deblock.Minimum = 4; this.slider_deblock.Name = "slider_deblock"; - this.slider_deblock.Size = new System.Drawing.Size(174, 42); + this.slider_deblock.Size = new System.Drawing.Size(174, 45); this.slider_deblock.TabIndex = 35; this.slider_deblock.Value = 4; this.slider_deblock.Scroll += new System.EventHandler(this.slider_deblock_Scroll); @@ -2110,45 +2111,46 @@ namespace Handbrake this.pmnu_saveChanges, this.pmnu_delete}); this.presets_menu.Name = "presets_menu"; - this.presets_menu.Size = new System.Drawing.Size(163, 98); + this.presets_menu.Size = new System.Drawing.Size(155, 98); this.presets_menu.Text = ";"; this.presets_menu.Opening += new System.ComponentModel.CancelEventHandler(this.presets_menu_Opening); // // pmnu_expandAll // this.pmnu_expandAll.Name = "pmnu_expandAll"; - this.pmnu_expandAll.Size = new System.Drawing.Size(162, 22); + this.pmnu_expandAll.Size = new System.Drawing.Size(154, 22); this.pmnu_expandAll.Text = "Expand All"; this.pmnu_expandAll.Click += new System.EventHandler(this.pmnu_expandAll_Click); // // pmnu_collapse // this.pmnu_collapse.Name = "pmnu_collapse"; - this.pmnu_collapse.Size = new System.Drawing.Size(162, 22); + this.pmnu_collapse.Size = new System.Drawing.Size(154, 22); this.pmnu_collapse.Text = "Collapse All"; this.pmnu_collapse.Click += new System.EventHandler(this.pmnu_collapse_Click); // // sep1 // this.sep1.Name = "sep1"; - this.sep1.Size = new System.Drawing.Size(159, 6); + this.sep1.Size = new System.Drawing.Size(151, 6); // // pmnu_saveChanges // this.pmnu_saveChanges.Name = "pmnu_saveChanges"; - this.pmnu_saveChanges.Size = new System.Drawing.Size(162, 22); + this.pmnu_saveChanges.Size = new System.Drawing.Size(154, 22); this.pmnu_saveChanges.Text = "Save Changes"; this.pmnu_saveChanges.Click += new System.EventHandler(this.pmnu_saveChanges_Click); // // pmnu_delete // this.pmnu_delete.Name = "pmnu_delete"; - this.pmnu_delete.Size = new System.Drawing.Size(162, 22); + this.pmnu_delete.Size = new System.Drawing.Size(154, 22); this.pmnu_delete.Text = "Delete"; this.pmnu_delete.Click += new System.EventHandler(this.pmnu_delete_click); // // toolStrip1 // + this.toolStrip1.BackColor = System.Drawing.Color.Transparent; this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.btn_source, @@ -2162,7 +2164,7 @@ namespace Handbrake this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.toolStrip1.Size = new System.Drawing.Size(1004, 39); + this.toolStrip1.Size = new System.Drawing.Size(1000, 39); this.toolStrip1.TabIndex = 1; this.toolStrip1.Text = "toolStrip1"; // @@ -2177,7 +2179,7 @@ namespace Handbrake this.btn_source.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.btn_source.ImageTransparentColor = System.Drawing.Color.Magenta; this.btn_source.Name = "btn_source"; - this.btn_source.Size = new System.Drawing.Size(90, 36); + this.btn_source.Size = new System.Drawing.Size(85, 36); this.btn_source.Text = "Source"; this.btn_source.ToolTipText = "Open a new source file or folder."; this.btn_source.Click += new System.EventHandler(this.btn_source_Click); @@ -2186,7 +2188,7 @@ namespace Handbrake // this.btn_file_source.Image = global::Handbrake.Properties.Resources.Movies_Small; this.btn_file_source.Name = "btn_file_source"; - this.btn_file_source.Size = new System.Drawing.Size(214, 22); + this.btn_file_source.Size = new System.Drawing.Size(194, 22); this.btn_file_source.Text = "Video File"; this.btn_file_source.Click += new System.EventHandler(this.btn_file_source_Click); // @@ -2195,20 +2197,20 @@ namespace Handbrake this.btn_dvd_source.Image = ((System.Drawing.Image)(resources.GetObject("btn_dvd_source.Image"))); this.btn_dvd_source.ImageTransparentColor = System.Drawing.Color.Magenta; this.btn_dvd_source.Name = "btn_dvd_source"; - this.btn_dvd_source.Size = new System.Drawing.Size(214, 22); + this.btn_dvd_source.Size = new System.Drawing.Size(194, 22); this.btn_dvd_source.Text = "DVD/ VIDEO_TS Folder"; this.btn_dvd_source.Click += new System.EventHandler(this.btn_dvd_source_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(211, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(191, 6); // // mnu_dvd_drive // this.mnu_dvd_drive.Image = global::Handbrake.Properties.Resources.disc_small; this.mnu_dvd_drive.Name = "mnu_dvd_drive"; - this.mnu_dvd_drive.Size = new System.Drawing.Size(214, 22); + this.mnu_dvd_drive.Size = new System.Drawing.Size(194, 22); this.mnu_dvd_drive.Text = "[No DVD Drive Ready]"; this.mnu_dvd_drive.Visible = false; this.mnu_dvd_drive.Click += new System.EventHandler(this.mnu_dvd_drive_Click); @@ -2224,7 +2226,7 @@ namespace Handbrake this.btn_start.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.btn_start.ImageTransparentColor = System.Drawing.Color.Magenta; this.btn_start.Name = "btn_start"; - this.btn_start.Size = new System.Drawing.Size(70, 36); + this.btn_start.Size = new System.Drawing.Size(67, 36); this.btn_start.Text = "Start"; this.btn_start.ToolTipText = "Start the encoding process"; this.btn_start.Click += new System.EventHandler(this.btn_start_Click); @@ -2235,7 +2237,7 @@ namespace Handbrake this.btn_add2Queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.btn_add2Queue.ImageTransparentColor = System.Drawing.Color.Magenta; this.btn_add2Queue.Name = "btn_add2Queue"; - this.btn_add2Queue.Size = new System.Drawing.Size(122, 36); + this.btn_add2Queue.Size = new System.Drawing.Size(110, 36); this.btn_add2Queue.Text = "Add to Queue"; this.btn_add2Queue.ToolTipText = "Add a new item to the Queue"; this.btn_add2Queue.Click += new System.EventHandler(this.btn_add2Queue_Click); @@ -2246,7 +2248,7 @@ namespace Handbrake this.btn_showQueue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.btn_showQueue.ImageTransparentColor = System.Drawing.Color.Magenta; this.btn_showQueue.Name = "btn_showQueue"; - this.btn_showQueue.Size = new System.Drawing.Size(115, 36); + this.btn_showQueue.Size = new System.Drawing.Size(104, 36); this.btn_showQueue.Tag = ""; this.btn_showQueue.Text = "Show Queue"; this.btn_showQueue.Click += new System.EventHandler(this.btn_showQueue_Click); @@ -2262,7 +2264,7 @@ namespace Handbrake this.tb_preview.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.tb_preview.ImageTransparentColor = System.Drawing.Color.Magenta; this.tb_preview.Name = "tb_preview"; - this.tb_preview.Size = new System.Drawing.Size(86, 36); + this.tb_preview.Size = new System.Drawing.Size(81, 36); this.tb_preview.Text = "Preview"; this.tb_preview.Click += new System.EventHandler(this.tb_preview_Click); // @@ -2272,7 +2274,7 @@ namespace Handbrake this.btn_ActivityWindow.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.btn_ActivityWindow.ImageTransparentColor = System.Drawing.Color.Magenta; this.btn_ActivityWindow.Name = "btn_ActivityWindow"; - this.btn_ActivityWindow.Size = new System.Drawing.Size(132, 36); + this.btn_ActivityWindow.Size = new System.Drawing.Size(120, 36); this.btn_ActivityWindow.Text = "Activity Window"; this.btn_ActivityWindow.ToolTipText = "Displays the activity window which displays the log of the last completed or curr" + "ently running encode."; @@ -2292,9 +2294,9 @@ namespace Handbrake // this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.lbl_encode}); - this.StatusStrip.Location = new System.Drawing.Point(0, 627); + this.StatusStrip.Location = new System.Drawing.Point(0, 623); this.StatusStrip.Name = "StatusStrip"; - this.StatusStrip.Size = new System.Drawing.Size(1004, 22); + this.StatusStrip.Size = new System.Drawing.Size(1000, 22); this.StatusStrip.TabIndex = 7; this.StatusStrip.Text = "statusStrip1"; // @@ -2305,13 +2307,23 @@ namespace Handbrake this.lbl_encode.Size = new System.Drawing.Size(31, 17); this.lbl_encode.Text = "{0}"; // + // hbproc + // + this.hbproc.StartInfo.Domain = ""; + this.hbproc.StartInfo.LoadUserProfile = false; + this.hbproc.StartInfo.Password = null; + this.hbproc.StartInfo.StandardErrorEncoding = null; + this.hbproc.StartInfo.StandardOutputEncoding = null; + this.hbproc.StartInfo.UserName = ""; + this.hbproc.SynchronizingObject = this; + // // frmMain // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScroll = true; - this.ClientSize = new System.Drawing.Size(1004, 649); + this.ClientSize = new System.Drawing.Size(1000, 645); this.Controls.Add(this.gb_source); this.Controls.Add(this.groupBox_dest); this.Controls.Add(this.groupBox_output); @@ -2394,7 +2406,6 @@ namespace Handbrake internal System.Windows.Forms.ComboBox drop_chapterStart; internal System.Windows.Forms.ComboBox drp_dvdtitle; internal System.Windows.Forms.Label Label17; - internal System.Windows.Forms.TextBox text_source; internal System.Windows.Forms.Label Label9; internal System.Windows.Forms.Label Label10; internal System.Windows.Forms.GroupBox groupBox_output; @@ -2556,6 +2567,9 @@ namespace Handbrake private System.Windows.Forms.Label lbl_max; private System.Windows.Forms.DataGridViewTextBoxColumn number; private System.Windows.Forms.DataGridViewTextBoxColumn name; + internal TextBox text_source; + private System.Diagnostics.Process hbproc; + } } \ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 759a1023d..8c3725dae 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -5,7 +5,6 @@ It may be used under the terms of the GNU General Public License. */ using System; -using System.Collections; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; @@ -22,8 +21,6 @@ namespace Handbrake public partial class frmMain : Form { // Objects which may be used by one or more other objects - Main hb_common_func = new Main(); - Encode encodeHandler = new Encode(); QueueHandler encodeQueue = new QueueHandler(); PresetsHandler presetHandler = new PresetsHandler(); QueryGenerator queryGen = new QueryGenerator(); @@ -31,7 +28,6 @@ namespace Handbrake // Globals: Mainly used for tracking. Title selectedTitle; DVD thisDVD; - Process hbproc; private frmQueue queueWindow; private frmPreview qtpreview; private Form splash; @@ -49,6 +45,7 @@ namespace Handbrake public frmMain() { + // Load and setup the splash screen in this thread splash = new frmSplashScreen(); splash.Show(); @@ -60,7 +57,7 @@ namespace Handbrake // Update the users config file with the CLI version data. lblStatus.Text = "Setting Version Data ..."; Application.DoEvents(); - hb_common_func.setCliVersionData(); + Main.setCliVersionData(); // Show the form, but leave disabled until preloading is complete then show the main form this.Enabled = false; @@ -132,6 +129,8 @@ namespace Handbrake // Queue Recovery queueRecovery(); + + } // Startup Functions @@ -145,7 +144,7 @@ namespace Handbrake return; } - Boolean update = hb_common_func.updateCheck(false); + Boolean update = Main.updateCheck(false); if (update) { frmUpdater updateWindow = new frmUpdater(); @@ -159,7 +158,7 @@ namespace Handbrake } private void queueRecovery() { - if (hb_common_func.check_queue_recovery()) + if (Main.check_queue_recovery()) { DialogResult result = MessageBox.Show("HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?", "Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question); @@ -256,7 +255,7 @@ namespace Handbrake String file; file = lastAction == "scan" ? "dvdinfo.dat" : "hb_encode_log.dat"; - frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, encodeHandler); + frmActivityWindow dvdInfoWindow = new frmActivityWindow(file, encodeQueue); dvdInfoWindow.Show(); } private void mnu_options_Click(object sender, EventArgs e) @@ -332,7 +331,7 @@ namespace Handbrake } private void mnu_UpdateCheck_Click(object sender, EventArgs e) { - Boolean update = hb_common_func.updateCheck(true); + Boolean update = Main.updateCheck(true); if (update) { frmUpdater updateWindow = new frmUpdater(); @@ -370,9 +369,9 @@ namespace Handbrake { DialogResult result = MessageBox.Show("Do you wish to include picture settings when updating the preset: " + treeView_presets.SelectedNode.Text, "Update Preset", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Yes) - presetHandler.updatePreset(treeView_presets.SelectedNode.Text, queryGen.generateTabbedComponentsQuery(this), true); + presetHandler.updatePreset(treeView_presets.SelectedNode.Text, QueryGenerator.generateTabbedComponentsQuery(this), true); else if (result == DialogResult.No) - presetHandler.updatePreset(treeView_presets.SelectedNode.Text, queryGen.generateTabbedComponentsQuery(this), false); + presetHandler.updatePreset(treeView_presets.SelectedNode.Text, QueryGenerator.generateTabbedComponentsQuery(this), false); } private void pmnu_delete_click(object sender, EventArgs e) { @@ -415,7 +414,7 @@ namespace Handbrake nodeStatus.Add(true); // Now add the new preset - Form preset = new frmAddPreset(this, queryGen.generateTabbedComponentsQuery(this), presetHandler); + Form preset = new frmAddPreset(this, QueryGenerator.generateTabbedComponentsQuery(this), presetHandler); preset.ShowDialog(); // Now reload the TreeView states @@ -703,7 +702,7 @@ namespace Handbrake { String file = lastAction == "scan" ? "dvdinfo.dat" : "hb_encode_log.dat"; - frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeHandler); + frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeQueue); ActivityWindow.Show(); } #endregion @@ -886,7 +885,7 @@ namespace Handbrake // Run the autoName & chapterNaming functions if (Properties.Settings.Default.autoNaming == "Checked") { - string autoPath = hb_common_func.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); + string autoPath = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); if (autoPath != null) text_destination.Text = autoPath; else @@ -894,7 +893,7 @@ namespace Handbrake } data_chpt.Rows.Clear(); - DataGridView chapterGridView = hb_common_func.chapterNaming(data_chpt, drop_chapterFinish.Text); + DataGridView chapterGridView = Main.chapterNaming(data_chpt, drop_chapterFinish.Text); if (chapterGridView != null) data_chpt = chapterGridView; @@ -918,11 +917,11 @@ namespace Handbrake drop_chapterFinish.Text = c_start.ToString(); } - lbl_duration.Text = hb_common_func.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString(); + lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString(); // Run the Autonaming function if (Properties.Settings.Default.autoNaming == "Checked") - text_destination.Text = hb_common_func.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); + text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); } private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e) @@ -941,11 +940,11 @@ namespace Handbrake drop_chapterFinish.Text = c_start.ToString(); } - lbl_duration.Text = hb_common_func.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString(); + lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString(); // Run the Autonaming function if (Properties.Settings.Default.autoNaming == "Checked") - text_destination.Text = hb_common_func.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); + text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex); // Add more rows to the Chapter menu if needed. if (Check_ChapterMarkers.Checked) @@ -1233,7 +1232,7 @@ namespace Handbrake { if (drp_anamorphic.Text == "None") { - int height = hb_common_func.cacluateNonAnamorphicHeight(width, text_top.Value, text_bottom.Value, text_left.Value, text_right.Value, selectedTitle); + int height = Main.cacluateNonAnamorphicHeight(width, text_top.Value, text_bottom.Value, text_left.Value, text_right.Value, selectedTitle); if (height != 0) text_height.Text = height.ToString(); } @@ -1553,7 +1552,7 @@ namespace Handbrake text_destination.Text = text_destination.Text.Replace(".m4v", ".mp4"); data_chpt.Rows.Clear(); data_chpt.Enabled = true; - DataGridView chapterGridView = hb_common_func.chapterNaming(data_chpt, drop_chapterFinish.Text); + DataGridView chapterGridView = Main.chapterNaming(data_chpt, drop_chapterFinish.Text); if (chapterGridView != null) data_chpt = chapterGridView; } @@ -1639,7 +1638,7 @@ namespace Handbrake using (StreamReader sr = new StreamReader(dvdInfoPath)) { - thisDVD = Parsing.DVD.Parse(sr); + thisDVD = DVD.Parse(sr); sr.Close(); sr.Dispose(); } @@ -1672,7 +1671,7 @@ namespace Handbrake // Now select the longest title if (thisDVD.Titles.Count != 0) - drp_dvdtitle.SelectedItem = hb_common_func.selectLongestTitle(drp_dvdtitle); + drp_dvdtitle.SelectedItem = Main.selectLongestTitle(drp_dvdtitle); // Enable the creation of chapter markers if the file is an image of a dvd. if (text_source.Text.ToLower().Contains(".iso") || text_source.Text.ToLower().Contains("VIDEO_TS")) @@ -2083,6 +2082,7 @@ namespace Handbrake base.OnFormClosing(e); } #endregion + // This is the END of the road ------------------------------------------------------------------------------ } } diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index 77037cb54..ca7b50f90 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -152,6 +152,12 @@ Make sure you have selected a "Title" from the "Source" box above otherwise the list will not be populated with the correct amount of chapters. Note: Do not change any of the chapter numbers! + + True + + + True + 232, 15 @@ -165,10 +171,10 @@ Note: Do not change any of the chapter numbers! 106, 15 - 17, 36 + 17, 52 - 123, 36 + 123, 52 1224, 15 @@ -579,8 +585,11 @@ Note: Do not change any of the chapter numbers! 1113, 15 + + 308, 52 + - 75 + 98 diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index bbea71f87..f83133db6 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -11,9 +11,6 @@ namespace Handbrake { public partial class frmOptions : Form { - /// - /// When the form loads, Initialise all the setting components with their correct values - /// public frmOptions() { InitializeComponent(); diff --git a/win/C#/frmPreview.Designer.cs b/win/C#/frmPreview.Designer.cs index 464ac255b..bab1f41ae 100644 --- a/win/C#/frmPreview.Designer.cs +++ b/win/C#/frmPreview.Designer.cs @@ -37,11 +37,11 @@ this.cb_preview = new System.Windows.Forms.ToolStripComboBox(); this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); this.cb_duration = new System.Windows.Forms.ToolStripComboBox(); - this.btn_playQT = new System.Windows.Forms.ToolStripButton(); - this.btn_playVLC = new System.Windows.Forms.ToolStripButton(); this.QTControl = new AxQTOControlLib.AxQTControl(); this.panel1 = new System.Windows.Forms.Panel(); this.lbl_status = new System.Windows.Forms.Label(); + this.btn_playQT = new System.Windows.Forms.ToolStripButton(); + this.btn_playVLC = new System.Windows.Forms.ToolStripButton(); this.toolBar.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.QTControl)).BeginInit(); this.panel1.SuspendLayout(); @@ -59,8 +59,8 @@ this.btn_playVLC}); this.toolBar.Location = new System.Drawing.Point(0, 0); this.toolBar.Name = "toolBar"; - this.toolBar.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.toolBar.Size = new System.Drawing.Size(774, 25); + this.toolBar.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + this.toolBar.Size = new System.Drawing.Size(772, 25); this.toolBar.TabIndex = 37; this.toolBar.Text = "toolStrip1"; // @@ -68,7 +68,7 @@ // this.lbl_preview.BackColor = System.Drawing.Color.Transparent; this.lbl_preview.Name = "lbl_preview"; - this.lbl_preview.Size = new System.Drawing.Size(100, 22); + this.lbl_preview.Size = new System.Drawing.Size(89, 22); this.lbl_preview.Text = "Start at Preview:"; // // cb_preview @@ -76,6 +76,7 @@ this.cb_preview.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cb_preview.DropDownWidth = 75; this.cb_preview.FlatStyle = System.Windows.Forms.FlatStyle.Standard; + this.cb_preview.Font = new System.Drawing.Font("Tahoma", 9F); this.cb_preview.Items.AddRange(new object[] { "1", "2", @@ -94,7 +95,7 @@ // this.toolStripLabel2.BackColor = System.Drawing.Color.Transparent; this.toolStripLabel2.Name = "toolStripLabel2"; - this.toolStripLabel2.Size = new System.Drawing.Size(111, 22); + this.toolStripLabel2.Size = new System.Drawing.Size(98, 22); this.toolStripLabel2.Text = "Duration (seconds)"; // // cb_duration @@ -102,6 +103,7 @@ this.cb_duration.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cb_duration.DropDownWidth = 75; this.cb_duration.FlatStyle = System.Windows.Forms.FlatStyle.Standard; + this.cb_duration.Font = new System.Drawing.Font("Tahoma", 9F); this.cb_duration.Items.AddRange(new object[] { "5", "10", @@ -119,26 +121,6 @@ this.cb_duration.Name = "cb_duration"; this.cb_duration.Size = new System.Drawing.Size(75, 25); // - // btn_playQT - // - this.btn_playQT.Image = global::Handbrake.Properties.Resources.Play_small; - this.btn_playQT.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.btn_playQT.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btn_playQT.Name = "btn_playQT"; - this.btn_playQT.Size = new System.Drawing.Size(99, 22); - this.btn_playQT.Text = "Play with QT"; - this.btn_playQT.Click += new System.EventHandler(this.btn_playQT_Click); - // - // btn_playVLC - // - this.btn_playVLC.Image = global::Handbrake.Properties.Resources.Play_small; - this.btn_playVLC.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.btn_playVLC.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btn_playVLC.Name = "btn_playVLC"; - this.btn_playVLC.Size = new System.Drawing.Size(103, 22); - this.btn_playVLC.Text = "Play with VLC"; - this.btn_playVLC.Click += new System.EventHandler(this.btn_playVLC_Click); - // // QTControl // this.QTControl.Enabled = true; @@ -156,7 +138,7 @@ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 25); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(774, 483); + this.panel1.Size = new System.Drawing.Size(772, 481); this.panel1.TabIndex = 40; // // lbl_status @@ -173,12 +155,32 @@ this.lbl_status.Text = "{0}"; this.lbl_status.Visible = false; // + // btn_playQT + // + this.btn_playQT.Image = global::Handbrake.Properties.Resources.Play_small; + this.btn_playQT.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.btn_playQT.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btn_playQT.Name = "btn_playQT"; + this.btn_playQT.Size = new System.Drawing.Size(89, 22); + this.btn_playQT.Text = "Play with QT"; + this.btn_playQT.Click += new System.EventHandler(this.btn_playQT_Click); + // + // btn_playVLC + // + this.btn_playVLC.Image = global::Handbrake.Properties.Resources.Play_small; + this.btn_playVLC.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.btn_playVLC.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btn_playVLC.Name = "btn_playVLC"; + this.btn_playVLC.Size = new System.Drawing.Size(93, 22); + this.btn_playVLC.Text = "Play with VLC"; + this.btn_playVLC.Click += new System.EventHandler(this.btn_playVLC_Click); + // // frmPreview // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; - this.ClientSize = new System.Drawing.Size(774, 508); + this.ClientSize = new System.Drawing.Size(772, 506); this.Controls.Add(this.panel1); this.Controls.Add(this.toolBar); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs index 748d63876..946f04947 100644 --- a/win/C#/frmPreview.cs +++ b/win/C#/frmPreview.cs @@ -15,7 +15,7 @@ namespace Handbrake { QueryGenerator hb_common_func = new QueryGenerator(); - Functions.Encode process = new Functions.Encode(); + Encode process = new Encode(); private delegate void UpdateUIHandler(); String currently_playing = ""; readonly frmMain mainWindow; @@ -88,7 +88,7 @@ namespace Handbrake MessageBox.Show(this, "Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning); else { - hbProc = process.runCli(this, (string)state); + hbProc = process.runCli((string)state); hbProc.WaitForExit(); hbProc = null; encodeCompleted(); diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 4f8ac2c36..39f548236 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -166,17 +166,15 @@ namespace Handbrake item.SubItems.Add(queue_item.Destination); // Destination item.SubItems.Add(parsed.VideoEncoder); // Video - // Display the first 4 audio tracks. - String audio = parsed.AudioEncoder1; - if (parsed.AudioEncoder2 != null) - audio += ", " + parsed.AudioEncoder2; - - if (parsed.AudioEncoder3 != null) - audio += ", " + parsed.AudioEncoder3; - - if (parsed.AudioEncoder4 != null) - audio += ", " + parsed.AudioEncoder4; - + // Display The Audio Track Information + string audio = string.Empty; + foreach (Functions.AudioTrack track in parsed.AudioInformation) + { + if (audio != "") + audio += ", " + track.Encoder; + else + audio = track.Encoder; + } item.SubItems.Add(audio); // Audio list_queue.Items.Add(item); @@ -203,9 +201,9 @@ namespace Handbrake } // found query is a global varible - Functions.QueryParser parsed = Functions.QueryParser.Parse(queue.getLastQueryItem().Query); - lbl_source.Text = queue.getLastQueryItem().Source; - lbl_dest.Text = queue.getLastQueryItem().Destination; + Functions.QueryParser parsed = Functions.QueryParser.Parse(queue.lastQueueItem.Query); + lbl_source.Text = queue.lastQueueItem.Source; + lbl_dest.Text = queue.lastQueueItem.Destination; lbl_title.Text = parsed.DVDTitle == 0 ? "Auto" : parsed.DVDTitle.ToString(); @@ -220,16 +218,16 @@ namespace Handbrake } lbl_vEnc.Text = parsed.VideoEncoder; - String audio = parsed.AudioEncoder1; - if (parsed.AudioEncoder2 != null) - audio += ", " + parsed.AudioEncoder2; - - if (parsed.AudioEncoder3 != null) - audio += ", " + parsed.AudioEncoder3; - - if (parsed.AudioEncoder4 != null) - audio += ", " + parsed.AudioEncoder4; + // Display The Audio Track Information + string audio = string.Empty; + foreach (Functions.AudioTrack track in parsed.AudioInformation) + { + if (audio != "") + audio += ", " + track.Encoder; + else + audio = track.Encoder; + } lbl_aEnc.Text = audio; } catch (Exception) @@ -379,9 +377,9 @@ namespace Handbrake } private void mnu_readd_Click(object sender, EventArgs e) { - if (queue.getLastQueryItem() != null) + if (queue.lastQueueItem != null) { - queue.add(queue.getLastQueryItem().Query, queue.getLastQueryItem().Source, queue.getLastQueryItem().Destination); + queue.add(queue.lastQueueItem.Query, queue.lastQueueItem.Source, queue.lastQueueItem.Destination); queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file updateUIElements(); } diff --git a/win/C#/frmUpdater.cs b/win/C#/frmUpdater.cs index 8496fa538..b07f97b0a 100644 --- a/win/C#/frmUpdater.cs +++ b/win/C#/frmUpdater.cs @@ -6,12 +6,13 @@ using System; using System.Windows.Forms; +using Handbrake.Functions; namespace Handbrake { public partial class frmUpdater : Form { - Functions.AppcastReader appcast = new Functions.AppcastReader(); + AppcastReader appcast = new AppcastReader(); public frmUpdater() { InitializeComponent();