diff options
author | sr55 <[email protected]> | 2010-02-08 20:59:46 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-02-08 20:59:46 +0000 |
commit | 974fc416c9b792a5e7b1b2ce59083f68f2e6f8c4 (patch) | |
tree | 615ce4cd2177b363ff7393e2e8825dfba8d0bc24 /win/C#/Controls | |
parent | e9d428e473e896b6a8d699c9c745e200869cfd69 (diff) |
WinGui:
- Banish % Quality display.
- Code Refactoring.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3105 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Controls')
-rw-r--r-- | win/C#/Controls/AudioPanel.cs | 89 | ||||
-rw-r--r-- | win/C#/Controls/x264Panel.cs | 212 |
2 files changed, 159 insertions, 142 deletions
diff --git a/win/C#/Controls/AudioPanel.cs b/win/C#/Controls/AudioPanel.cs index a56daa3be..b60bf767e 100644 --- a/win/C#/Controls/AudioPanel.cs +++ b/win/C#/Controls/AudioPanel.cs @@ -112,6 +112,53 @@ namespace Handbrake.Controls }
}
+ /// <summary>
+ /// Set the Track list dropdown from the parsed title captured during the scan
+ /// </summary>
+ /// <param name="selectedTitle"></param>
+ public void SetTrackList(Parsing.Title selectedTitle)
+ {
+ drp_audioTrack.Items.Clear();
+ drp_audioTrack.Items.Add("Automatic");
+ drp_audioTrack.Items.Add("None");
+ drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray());
+
+ // Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options
+ if (Properties.Settings.Default.NativeLanguage == "Any")
+ drp_audioTrack.SelectedIndex = drp_audioTrack.Items.Count >= 3 ? 2 : 0;
+ else
+ {
+ if (Properties.Settings.Default.DubAudio) // "Dub Foreign language audio"
+ {
+ int i = 0;
+ foreach (object item in drp_audioTrack.Items)
+ {
+ if (item.ToString().Contains(Properties.Settings.Default.NativeLanguage))
+ {
+ drp_audioTrack.SelectedIndex = i;
+ break;
+ }
+
+ i++;
+ }
+
+ if (drp_audioTrack.SelectedItem != null)
+ foreach (ListViewItem item in lv_audioList.Items)
+ item.SubItems[1].Text = drp_audioTrack.SelectedItem.ToString();
+ else
+ {
+ drp_audioTrack.SelectedIndex = 0;
+ if (drp_audioTrack.SelectedItem != null)
+ foreach (ListViewItem item in lv_audioList.Items)
+ item.SubItems[1].Text = drp_audioTrack.SelectedItem.ToString();
+ }
+ }
+ else
+ drp_audioTrack.SelectedIndex = drp_audioTrack.Items.Count >= 3 ? 2 : 0; // "Use Foreign language audio and Subtitles"
+ }
+ drp_audioMix.SelectedIndex = 0;
+ }
+
// Control and ListView
private void controlChanged(object sender, EventArgs e)
{
@@ -246,48 +293,6 @@ namespace Handbrake.Controls }
// Public Functions
- public void SetTrackList(Parsing.Title selectedTitle)
- {
- drp_audioTrack.Items.Clear();
- drp_audioTrack.Items.Add("Automatic");
- drp_audioTrack.Items.Add("None");
- drp_audioTrack.Items.AddRange(selectedTitle.AudioTracks.ToArray());
-
- // Handle Native Language and "Dub Foreign language audio" and "Use Foreign language audio and Subtitles" Options
- if (Properties.Settings.Default.NativeLanguage == "Any")
- drp_audioTrack.SelectedIndex = drp_audioTrack.Items.Count >= 3 ? 2 : 0;
- else
- {
- if (Properties.Settings.Default.DubAudio) // "Dub Foreign language audio"
- {
- int i = 0;
- foreach (object item in drp_audioTrack.Items)
- {
- if (item.ToString().Contains(Properties.Settings.Default.NativeLanguage))
- {
- drp_audioTrack.SelectedIndex = i;
- break;
- }
-
- i++;
- }
-
- if (drp_audioTrack.SelectedItem != null)
- foreach (ListViewItem item in lv_audioList.Items)
- item.SubItems[1].Text = drp_audioTrack.SelectedItem.ToString();
- else
- {
- drp_audioTrack.SelectedIndex = 0;
- if (drp_audioTrack.SelectedItem != null)
- foreach (ListViewItem item in lv_audioList.Items)
- item.SubItems[1].Text = drp_audioTrack.SelectedItem.ToString();
- }
- }
- else
- drp_audioTrack.SelectedIndex = drp_audioTrack.Items.Count >= 3 ? 2 : 0; // "Use Foreign language audio and Subtitles"
- }
- drp_audioMix.SelectedIndex = 0;
- }
private void AddTrackForPreset(ListViewItem item)
{
lv_audioList.Items.Add(item);
diff --git a/win/C#/Controls/x264Panel.cs b/win/C#/Controls/x264Panel.cs index 4229c8298..78480b2de 100644 --- a/win/C#/Controls/x264Panel.cs +++ b/win/C#/Controls/x264Panel.cs @@ -11,6 +11,14 @@ namespace Handbrake.Controls {
public partial class x264Panel : UserControl
{
+ /*
+ * TODO This code was ported from the obj-c MacGUI code. It's really messy and could really do with being cleaned up
+ * at some point.
+ */
+
+ /// <summary>
+ /// Initializes a new instance of the x264 panel user control
+ /// </summary>
public x264Panel()
{
InitializeComponent();
@@ -18,109 +26,22 @@ namespace Handbrake.Controls if (Properties.Settings.Default.tooltipEnable)
ToolTip.Active = true;
- reset2Defaults();
+ Reset2Defaults();
}
- public string x264Query
+ /// <summary>
+ /// Gets or sets the X264 query string
+ /// </summary>
+ public string X264Query
{
get { return rtf_x264Query.Text; }
set { rtf_x264Query.Text = value; }
}
-
- private void widgetControlChanged(object sender, EventArgs e)
- {
- Control changedControlName = (Control) sender;
- string controlName = "";
-
- switch (changedControlName.Name.Trim())
- {
- case "drop_refFrames":
- controlName = "ref";
- break;
- case "check_mixedReferences":
- controlName = "mixed-refs";
- break;
- case "drop_bFrames":
- controlName = "bframes";
- break;
- case "drop_directPrediction":
- controlName = "direct";
- break;
- case "check_weightedBFrames":
- controlName = "weightb";
- break;
- case "check_pyrmidalBFrames":
- controlName = "b-pyramid";
- break;
- case "drop_MotionEstimationMethod":
- controlName = "me";
- break;
- case "drop_MotionEstimationRange":
- controlName = "merange";
- break;
- case "drop_subpixelMotionEstimation":
- controlName = "subq";
- break;
- case "drop_analysis":
- controlName = "analyse";
- break;
- case "check_8x8DCT":
- controlName = "8x8dct";
- break;
- case "drop_deblockAlpha":
- controlName = "deblock";
- break;
- case "drop_deblockBeta":
- controlName = "deblock";
- break;
- case "drop_trellis":
- controlName = "trellis";
- break;
- case "check_noFastPSkip":
- controlName = "no-fast-pskip";
- break;
- case "check_noDCTDecimate":
- controlName = "no-dct-decimate";
- break;
- case "check_Cabac":
- controlName = "cabac";
- break;
- case "slider_psyrd":
- controlName = "psy-rd";
- break;
- case "slider_psytrellis":
- controlName = "psy-rd";
- break;
- case "drop_adaptBFrames":
- controlName = "b-adapt";
- break;
- }
- on_x264_WidgetChange(controlName);
- }
- private void rtf_x264Query_TextChanged(object sender, EventArgs e)
- {
- if (rtf_x264Query.Text.EndsWith("\n"))
- {
- string query = rtf_x264Query.Text.Replace("\n", "");
- reset2Defaults();
- rtf_x264Query.Text = query;
- X264_StandardizeOptString();
- X264_SetCurrentSettingsInPanel();
-
- if (rtf_x264Query.Text == string.Empty)
- reset2Defaults();
- }
- }
- private void btn_reset_Click(object sender, EventArgs e)
- {
- rtf_x264Query.Text = "";
- reset2Defaults();
- }
/// <summary>
/// Reset all components to defaults and clears the x264 rtf box
/// </summary>
- public void reset2Defaults()
+ public void Reset2Defaults()
{
check_8x8DCT.CheckState = CheckState.Checked;
check_Cabac.CheckState = CheckState.Checked;
@@ -427,9 +348,9 @@ namespace Handbrake.Controls /// <summary>
/// This function will update the X264 Query when one of the GUI widgets changes.
/// </summary>
- private void on_x264_WidgetChange(string sender)
+ private void OnX264WidgetChange(string sender)
{
- animate(sender);
+ Animate(sender);
String optNameToChange = sender;
String currentOptString = rtf_x264Query.Text;
@@ -440,9 +361,9 @@ namespace Handbrake.Controls // IF the current H264 Option String Contains Multiple Items or Just 1 Item
if ((currentOptString.Contains(checkOptNameToChange)) || (currentOptString.StartsWith(checkOptNameToChangeBegin)))
- hasOptions(currentOptString, optNameToChange);
+ HasOptions(currentOptString, optNameToChange);
else // IF there is no options in the rich text box!
- hasNoOptions(optNameToChange);
+ HasNoOptions(optNameToChange);
}
/// <summary>
@@ -451,7 +372,7 @@ namespace Handbrake.Controls /// </summary>
/// <param name="currentOptString"></param>
/// <param name="optNameToChange"></param>
- private void hasOptions(string currentOptString, string optNameToChange)
+ private void HasOptions(string currentOptString, string optNameToChange)
{
String thisOpt; // The separated option such as "bframes=3"
String optName; // The option name such as "bframes"
@@ -663,7 +584,7 @@ namespace Handbrake.Controls /// e.g no-fast-pskip
/// </summary>
/// <param name="optNameToChange"></param>
- private void hasNoOptions(string optNameToChange)
+ private void HasNoOptions(IEquatable<string> optNameToChange)
{
string colon = "";
if (rtf_x264Query.Text != "")
@@ -852,7 +773,7 @@ namespace Handbrake.Controls /// Shows and hides controls based on the values of other controls.
/// </summary>
/// <param name="sender"></param>
- private void animate(string sender)
+ private void Animate(string sender)
{
/* Lots of situations to cover.
- B-frames (when 0 turn of b-frame specific stuff, when < 2 disable b-pyramid)
@@ -998,5 +919,96 @@ namespace Handbrake.Controls break;
}
}
+
+
+ private void widgetControlChanged(object sender, EventArgs e)
+ {
+ Control changedControlName = (Control)sender;
+ string controlName = "";
+
+ switch (changedControlName.Name.Trim())
+ {
+ case "drop_refFrames":
+ controlName = "ref";
+ break;
+ case "check_mixedReferences":
+ controlName = "mixed-refs";
+ break;
+ case "drop_bFrames":
+ controlName = "bframes";
+ break;
+ case "drop_directPrediction":
+ controlName = "direct";
+ break;
+ case "check_weightedBFrames":
+ controlName = "weightb";
+ break;
+ case "check_pyrmidalBFrames":
+ controlName = "b-pyramid";
+ break;
+ case "drop_MotionEstimationMethod":
+ controlName = "me";
+ break;
+ case "drop_MotionEstimationRange":
+ controlName = "merange";
+ break;
+ case "drop_subpixelMotionEstimation":
+ controlName = "subq";
+ break;
+ case "drop_analysis":
+ controlName = "analyse";
+ break;
+ case "check_8x8DCT":
+ controlName = "8x8dct";
+ break;
+ case "drop_deblockAlpha":
+ controlName = "deblock";
+ break;
+ case "drop_deblockBeta":
+ controlName = "deblock";
+ break;
+ case "drop_trellis":
+ controlName = "trellis";
+ break;
+ case "check_noFastPSkip":
+ controlName = "no-fast-pskip";
+ break;
+ case "check_noDCTDecimate":
+ controlName = "no-dct-decimate";
+ break;
+ case "check_Cabac":
+ controlName = "cabac";
+ break;
+ case "slider_psyrd":
+ controlName = "psy-rd";
+ break;
+ case "slider_psytrellis":
+ controlName = "psy-rd";
+ break;
+ case "drop_adaptBFrames":
+ controlName = "b-adapt";
+ break;
+ }
+ OnX264WidgetChange(controlName);
+ }
+ private void rtf_x264Query_TextChanged(object sender, EventArgs e)
+ {
+ if (rtf_x264Query.Text.EndsWith("\n"))
+ {
+ string query = rtf_x264Query.Text.Replace("\n", "");
+ Reset2Defaults();
+ rtf_x264Query.Text = query;
+ X264_StandardizeOptString();
+ X264_SetCurrentSettingsInPanel();
+
+ if (rtf_x264Query.Text == string.Empty)
+ Reset2Defaults();
+ }
+ }
+ private void btn_reset_Click(object sender, EventArgs e)
+ {
+ rtf_x264Query.Text = "";
+ Reset2Defaults();
+ }
}
}
\ No newline at end of file |