From 9d83f1c5539761bcae5b351669ac8a5c7bb1eace Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 23 Apr 2010 21:01:57 +0000 Subject: WinGui: - Quality Slider tooltip fixed. - More stylecop warnings cleaned up. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3255 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Controls/AudioPanel.cs | 168 ++++++++++++++++++++++++++++++++++-------- win/C#/Controls/Subtitles.cs | 1 - win/C#/Controls/x264Panel.cs | 11 ++- 3 files changed, 142 insertions(+), 38 deletions(-) (limited to 'win/C#/Controls') diff --git a/win/C#/Controls/AudioPanel.cs b/win/C#/Controls/AudioPanel.cs index d66305c34..b3b2eaa33 100644 --- a/win/C#/Controls/AudioPanel.cs +++ b/win/C#/Controls/AudioPanel.cs @@ -14,13 +14,11 @@ namespace Handbrake.Controls using Presets; using AudioTrack = Model.AudioTrack; + /// + /// The AudioPanel Control + /// public partial class AudioPanel : UserControl { - /// - /// The audio list has changed - /// - public event EventHandler AudioListChanged; - /// /// Initializes a new instance of the class. /// Create a new instance of the Audio Panel @@ -32,6 +30,11 @@ namespace Handbrake.Controls drp_audioSample.SelectedIndex = 1; } + /// + /// The audio list has changed + /// + public event EventHandler AudioListChanged; + /// /// Get the audio panel /// @@ -44,7 +47,9 @@ namespace Handbrake.Controls /// /// Set the File Container. This funciton is used to limit the available options for each file container. /// - /// + /// + /// the file path + /// public void SetContainer(string path) { string oldval = drp_audioEncoder.Text; @@ -84,7 +89,7 @@ namespace Handbrake.Controls /// /// Checks if the settings used required the .m4v (rather than .mp4) extension /// - /// + /// True if m4v is required public bool RequiresM4V() { return lv_audioList.Items.Cast().Any(item => item.SubItems[2].Text.Contains("AC3")); @@ -93,7 +98,7 @@ namespace Handbrake.Controls /// /// Load an arraylist of AudioTrack items into the list. /// - /// + /// List of audio tracks public void LoadTracks(ArrayList audioTracks) { ClearAudioList(); @@ -118,7 +123,8 @@ namespace Handbrake.Controls /// /// Set the Track list dropdown from the parsed title captured during the scan /// - /// + /// The selected title + /// A preset public void SetTrackList(Title selectedTitle, Preset preset) { if (selectedTitle.AudioTracks.Count == 0) @@ -129,28 +135,25 @@ namespace Handbrake.Controls drp_audioTrack.SelectedIndex = 0; return; } - else - { - drp_audioTrack.Items.Clear(); - drp_audioTrack.Items.Add("Automatic"); - drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray()); - if (lv_audioList.Items.Count == 0 && preset != null) + drp_audioTrack.Items.Clear(); + drp_audioTrack.Items.Add("Automatic"); + drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray()); + + if (lv_audioList.Items.Count == 0 && preset != null) + { + QueryParser parsed = QueryParser.Parse(preset.Query); + foreach (AudioTrack audioTrack in parsed.AudioInformation) { - QueryParser parsed = QueryParser.Parse(preset.Query); - foreach (AudioTrack audioTrack in parsed.AudioInformation) - { - ListViewItem newTrack = new ListViewItem(GetNewID().ToString()); - newTrack.SubItems.Add(audioTrack.Track); - newTrack.SubItems.Add(audioTrack.Encoder); - newTrack.SubItems.Add(audioTrack.MixDown); - newTrack.SubItems.Add(audioTrack.SampleRate); - newTrack.SubItems.Add(audioTrack.Bitrate); - newTrack.SubItems.Add(audioTrack.DRC.ToString()); - lv_audioList.Items.Add(newTrack); - } + ListViewItem newTrack = new ListViewItem(GetNewID().ToString()); + newTrack.SubItems.Add(audioTrack.Track); + newTrack.SubItems.Add(audioTrack.Encoder); + newTrack.SubItems.Add(audioTrack.MixDown); + newTrack.SubItems.Add(audioTrack.SampleRate); + newTrack.SubItems.Add(audioTrack.Bitrate); + newTrack.SubItems.Add(audioTrack.DRC); + lv_audioList.Items.Add(newTrack); } - } // Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options @@ -190,6 +193,16 @@ namespace Handbrake.Controls } // Control and ListView + + /// + /// one of the controls has changed. Event handler + /// + /// + /// The sender. + /// + /// + /// The e. + /// private void controlChanged(object sender, EventArgs e) { Control ctl = (Control)sender; @@ -261,6 +274,15 @@ namespace Handbrake.Controls lv_audioList.Select(); } + /// + /// The Audio List selected index changed event handler + /// + /// + /// The sender. + /// + /// + /// The e. + /// private void lv_audioList_SelectedIndexChanged(object sender, EventArgs e) { // Set the dropdown controls based on the selected item in the Audio List. @@ -288,12 +310,25 @@ namespace Handbrake.Controls } // Track Controls + + /// + /// The Add Audio Track button event handler + /// + /// + /// The sender. + /// + /// + /// The e. + /// private void btn_addAudioTrack_Click(object sender, EventArgs e) { if (drp_audioTrack.Text == "None Found") { - MessageBox.Show("Your source appears to have no audio tracks that HandBrake supports.", "Warning", - MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageBox.Show( + "Your source appears to have no audio tracks that HandBrake supports.", + "Warning", + MessageBoxButtons.OK, + MessageBoxIcon.Warning); return; } @@ -320,28 +355,72 @@ namespace Handbrake.Controls lv_audioList.Select(); } + /// + /// The Remove Track button event handler + /// + /// + /// The sender. + /// + /// + /// The e. + /// private void btn_RemoveAudioTrack_Click(object sender, EventArgs e) { RemoveTrack(); } // Audio List Menu + + /// + /// The Audio List Move Up menu item + /// + /// + /// The sender. + /// + /// + /// The e. + /// private void audioList_moveup_Click(object sender, EventArgs e) { MoveTrack(true); } + /// + /// The audio list move down menu item + /// + /// + /// The sender. + /// + /// + /// The e. + /// private void audioList_movedown_Click(object sender, EventArgs e) { MoveTrack(false); } + /// + /// The audio list remove menu item + /// + /// + /// The sender. + /// + /// + /// The e. + /// private void audioList_remove_Click(object sender, EventArgs e) { RemoveTrack(); } // Public Functions + + /// + /// Add track for preset + /// + /// + /// The item. + /// private void AddTrackForPreset(ListViewItem item) { lv_audioList.Items.Add(item); @@ -349,6 +428,9 @@ namespace Handbrake.Controls this.AudioListChanged(this, new EventArgs()); } + /// + /// Clear the audio list + /// private void ClearAudioList() { lv_audioList.Items.Clear(); @@ -356,11 +438,20 @@ namespace Handbrake.Controls this.AudioListChanged(this, new EventArgs()); } + /// + /// Get a new ID for the next audio track + /// + /// + /// an int + /// private int GetNewID() { return lv_audioList.Items.Count + 1; } + /// + /// Remove an audio track from the list + /// private void RemoveTrack() { // Remove the Item and reselect the control if the following conditions are met. @@ -390,6 +481,12 @@ namespace Handbrake.Controls } } + /// + /// Move an audio track up or down the audio list + /// + /// + /// The up. + /// private void MoveTrack(bool up) { if (lv_audioList.SelectedIndices.Count == 0) return; @@ -409,6 +506,9 @@ namespace Handbrake.Controls } } + /// + /// Regenerate all the audio track id's on the audio list + /// private void ReGenerateListIDs() { int i = 1; @@ -419,6 +519,9 @@ namespace Handbrake.Controls } } + /// + /// Set the bitrate dropdown + /// private void SetBitrate() { int max = 0; @@ -473,10 +576,13 @@ namespace Handbrake.Controls drp_audioBitrate.Items.Add("768"); } - if (drp_audioBitrate.SelectedItem == null) + if (drp_audioBitrate.SelectedItem == null) drp_audioBitrate.SelectedIndex = drp_audioBitrate.Items.Count - 1; } + /// + /// Set the mixdown dropdown + /// private void SetMixDown() { drp_audioMix.Items.Clear(); diff --git a/win/C#/Controls/Subtitles.cs b/win/C#/Controls/Subtitles.cs index c511133ae..3326ee74e 100644 --- a/win/C#/Controls/Subtitles.cs +++ b/win/C#/Controls/Subtitles.cs @@ -1,5 +1,4 @@ /* Subtitles.cs $ - This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ diff --git a/win/C#/Controls/x264Panel.cs b/win/C#/Controls/x264Panel.cs index bc715f46b..4b943e32f 100644 --- a/win/C#/Controls/x264Panel.cs +++ b/win/C#/Controls/x264Panel.cs @@ -1,8 +1,7 @@ /* x264Panel.cs $ - - This file is part of the HandBrake source code. - Homepage: . - It may be used under the terms of the GNU General Public License. */ + This file is part of the HandBrake source code. + Homepage: . + It may be used under the terms of the GNU General Public License. */ namespace Handbrake.Controls { @@ -335,9 +334,9 @@ namespace Handbrake.Controls int val, val2; // default psy-rd = 1 (10 for the slider) - psyrd = double.TryParse(x[0], out psyrd) ? psyrd*10 : 10.0; + psyrd = double.TryParse(x[0], out psyrd) ? psyrd * 10 : 10.0; // default psy-trellis = 0 - psytrellis = double.TryParse(x[1], out psytrellis) ? psytrellis*10 : 0.0; + psytrellis = double.TryParse(x[1], out psytrellis) ? psytrellis * 10 : 0.0; int.TryParse(psyrd.ToString(), out val); int.TryParse(psytrellis.ToString(), out val2); -- cgit v1.2.3