diff options
author | sr55 <[email protected]> | 2010-01-31 14:40:06 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-01-31 14:40:06 +0000 |
commit | aa24522a3739ba995cb0890004e448c4d741b292 (patch) | |
tree | 87b6d611617f6a3f34c7d960e0dc63ed36d8228c | |
parent | 138ea1180443c3b73b81e47da016a54bf133f133 (diff) |
WinGui:
- More refactoring.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3092 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/C#/Controls/Filters.cs | 152 | ||||
-rw-r--r-- | win/C#/Controls/PictureSettings.cs | 6 | ||||
-rw-r--r-- | win/C#/Controls/Subtitles.cs | 53 | ||||
-rw-r--r-- | win/C#/Functions/PresetLoader.cs | 12 | ||||
-rw-r--r-- | win/C#/Functions/QueryGenerator.cs | 2 | ||||
-rw-r--r-- | win/C#/HandBrakeCS.csproj | 1 | ||||
-rw-r--r-- | win/C#/Model/Subtitle.cs | 78 | ||||
-rw-r--r-- | win/C#/Parsing/Title.cs | 13 |
8 files changed, 218 insertions, 99 deletions
diff --git a/win/C#/Controls/Filters.cs b/win/C#/Controls/Filters.cs index 757536ced..6f8d3afd5 100644 --- a/win/C#/Controls/Filters.cs +++ b/win/C#/Controls/Filters.cs @@ -1,12 +1,24 @@ -using System;
+/* Filters.cs $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+using System;
using System.Windows.Forms;
namespace Handbrake.Controls
{
public partial class Filters : UserControl
{
+ /// <summary>
+ /// The Filter settings have changed
+ /// </summary>
public event EventHandler FilterSettingsChanged;
+ /// <summary>
+ /// Creates a new instance of Filters
+ /// </summary>
public Filters()
{
InitializeComponent();
@@ -16,53 +28,10 @@ namespace Handbrake.Controls drop_detelecine.SelectedIndex = 0;
}
- // Controls
- private void drop_detelecine_SelectedIndexChanged(object sender, EventArgs e)
- {
- text_customDT.Visible = drop_detelecine.Text == "Custom";
- // A Filter has changed so raise a FilterSettingsChanged event.
- if (this.FilterSettingsChanged != null)
- this.FilterSettingsChanged(this, new EventArgs());
- }
- private void drop_decomb_SelectedIndexChanged(object sender, EventArgs e)
- {
- text_customDC.Visible = drop_decomb.Text == "Custom";
- if (drop_decomb.SelectedIndex != 0 && drop_deinterlace.SelectedIndex != 0)
- drop_deinterlace.SelectedIndex = 0;
-
- // A Filter has changed so raise a FilterSettingsChanged event.
- if (this.FilterSettingsChanged != null)
- this.FilterSettingsChanged(this, new EventArgs());
- }
- private void drop_deinterlace_SelectedIndexChanged(object sender, EventArgs e)
- {
- text_customDI.Visible = drop_deinterlace.Text == "Custom";
- if (drop_decomb.SelectedIndex != 0 && drop_deinterlace.SelectedIndex != 0)
- drop_decomb.SelectedIndex = 0;
-
- // A Filter has changed so raise a FilterSettingsChanged event.
- if (this.FilterSettingsChanged != null)
- this.FilterSettingsChanged(this, new EventArgs());
- }
- private void drop_denoise_SelectedIndexChanged(object sender, EventArgs e)
- {
- text_customDN.Visible = drop_denoise.Text == "Custom";
-
- // A Filter has changed so raise a FilterSettingsChanged event.
- if (this.FilterSettingsChanged != null)
- this.FilterSettingsChanged(this, new EventArgs());
- }
- private void slider_deblock_Scroll(object sender, EventArgs e)
- {
- lbl_deblockVal.Text = slider_deblock.Value == 4 ? "Off" : slider_deblock.Value.ToString();
-
- // A Filter has changed so raise a FilterSettingsChanged event.
- if (this.FilterSettingsChanged != null)
- this.FilterSettingsChanged(this, new EventArgs());
- }
-
- // Returns the CLI query for the query generator.
- public string getCLIQuery
+ /// <summary>
+ /// Returns the CLI query for the query generator.
+ /// </summary>
+ public string GetCLIQuery
{
get
{
@@ -155,8 +124,11 @@ namespace Handbrake.Controls }
}
- // Setup for each component for the preset loader.
- public void setDeTelecine(string value)
+ /// <summary>
+ /// Set the Detelecine control
+ /// </summary>
+ /// <param name="value">The value part of the CLI string</param>
+ public void SetDeTelecine(string value)
{
text_customDT.Text = "";
text_customDT.Visible = false;
@@ -175,7 +147,12 @@ namespace Handbrake.Controls break;
}
}
- public void setDeNoise(string value)
+
+ /// <summary>
+ /// Set the Denoise control
+ /// </summary>
+ /// <param name="value">The value part of the CLI string</param>
+ public void SetDeNoise(string value)
{
text_customDN.Text = "";
text_customDN.Visible = false;
@@ -200,7 +177,12 @@ namespace Handbrake.Controls break;
}
}
- public void setDeInterlace(string value)
+
+ /// <summary>
+ /// Set the Deinterlace Control
+ /// </summary>
+ /// <param name="value">The value part of the CLI string</param>
+ public void SetDeInterlace(string value)
{
text_customDI.Text = "";
text_customDI.Visible = false;
@@ -227,7 +209,12 @@ namespace Handbrake.Controls break;
}
}
- public void setDecomb(string value)
+
+ /// <summary>
+ /// Set the Decomb Control
+ /// </summary>
+ /// <param name="value">The value part of the CLI string</param>
+ public void SetDecomb(string value)
{
text_customDC.Text = "";
text_customDC.Visible = false;
@@ -246,7 +233,12 @@ namespace Handbrake.Controls break;
}
}
- public void setDeBlock(int value)
+
+ /// <summary>
+ /// Set the Deblock Control
+ /// </summary>
+ /// <param name="value">The deblock value</param>
+ public void SetDeBlock(int value)
{
if (value != 0)
{
@@ -259,9 +251,59 @@ namespace Handbrake.Controls lbl_deblockVal.Text = "Off";
}
}
- public void setGrayScale(bool value)
+
+ /// <summary>
+ /// Set the grayscale control
+ /// </summary>
+ /// <param name="value">Boolean value</param>
+ public void SetGrayScale(bool value)
{
check_grayscale.CheckState = value ? CheckState.Checked : CheckState.Unchecked;
}
+
+ // Controls
+ private void drop_detelecine_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ text_customDT.Visible = drop_detelecine.Text == "Custom";
+ // A Filter has changed so raise a FilterSettingsChanged event.
+ if (this.FilterSettingsChanged != null)
+ this.FilterSettingsChanged(this, new EventArgs());
+ }
+ private void drop_decomb_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ text_customDC.Visible = drop_decomb.Text == "Custom";
+ if (drop_decomb.SelectedIndex != 0 && drop_deinterlace.SelectedIndex != 0)
+ drop_deinterlace.SelectedIndex = 0;
+
+ // A Filter has changed so raise a FilterSettingsChanged event.
+ if (this.FilterSettingsChanged != null)
+ this.FilterSettingsChanged(this, new EventArgs());
+ }
+ private void drop_deinterlace_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ text_customDI.Visible = drop_deinterlace.Text == "Custom";
+ if (drop_decomb.SelectedIndex != 0 && drop_deinterlace.SelectedIndex != 0)
+ drop_decomb.SelectedIndex = 0;
+
+ // A Filter has changed so raise a FilterSettingsChanged event.
+ if (this.FilterSettingsChanged != null)
+ this.FilterSettingsChanged(this, new EventArgs());
+ }
+ private void drop_denoise_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ text_customDN.Visible = drop_denoise.Text == "Custom";
+
+ // A Filter has changed so raise a FilterSettingsChanged event.
+ if (this.FilterSettingsChanged != null)
+ this.FilterSettingsChanged(this, new EventArgs());
+ }
+ private void slider_deblock_Scroll(object sender, EventArgs e)
+ {
+ lbl_deblockVal.Text = slider_deblock.Value == 4 ? "Off" : slider_deblock.Value.ToString();
+
+ // A Filter has changed so raise a FilterSettingsChanged event.
+ if (this.FilterSettingsChanged != null)
+ this.FilterSettingsChanged(this, new EventArgs());
+ }
}
}
diff --git a/win/C#/Controls/PictureSettings.cs b/win/C#/Controls/PictureSettings.cs index cf8f022f1..d5d088b47 100644 --- a/win/C#/Controls/PictureSettings.cs +++ b/win/C#/Controls/PictureSettings.cs @@ -1,3 +1,9 @@ +/* PictureSetting.cs $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
using System;
using System.ComponentModel;
using System.Drawing;
diff --git a/win/C#/Controls/Subtitles.cs b/win/C#/Controls/Subtitles.cs index 4fac297e5..fb179bba2 100644 --- a/win/C#/Controls/Subtitles.cs +++ b/win/C#/Controls/Subtitles.cs @@ -1,8 +1,15 @@ -using System;
+/* Subtitles.cs $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using Handbrake.Functions;
+using Handbrake.Model;
namespace Handbrake.Controls
{
@@ -10,7 +17,7 @@ namespace Handbrake.Controls {
readonly IDictionary<string, string> LangMap = new Dictionary<string, string>();
List<SubtitleInfo> SubList = new List<SubtitleInfo>();
- private int _fileContainer;
+ private int FileContainer;
public Subtitles()
{
@@ -43,17 +50,17 @@ namespace Handbrake.Controls srtLangVal = srt_lang.SelectedItem.ToString();
srtCode = srt_charcode.SelectedItem.ToString();
srtOffsetMs = (int)srt_offset.Value;
- if (defaultSub == "Yes") setNoSrtDefault();
+ if (defaultSub == "Yes") SetNoSrtDefault();
} else
{
if (defaultSub == "Yes") SetNoDefault();
if (burnedVal == "Yes") SetNoBurned();
- if (_fileContainer == 0)
+ if (FileContainer == 0)
burnedVal = "Yes"; // MP4 must have bitmap subs burned in.
}
- if (_fileContainer == 0) // MP4 and M4V file extension
+ if (FileContainer == 0) // MP4 and M4V file extension
{
// Make sure we only have 1 bitmap track.
if (drp_subtitleTracks.SelectedItem != null && drp_subtitleTracks.SelectedItem.ToString().Contains("Bitmap"))
@@ -208,7 +215,7 @@ namespace Handbrake.Controls if (check_default.Checked) // Make sure we only have 1 default track
if (lv_subList.Items[lv_subList.SelectedIndices[0]].SubItems[0].Text.Contains(".srt"))
- setNoSrtDefault();
+ SetNoSrtDefault();
else
SetNoDefault();
@@ -305,7 +312,7 @@ namespace Handbrake.Controls }
}
- private void setNoSrtDefault()
+ private void SetNoSrtDefault()
{
int c = 0;
foreach (ListViewItem item in lv_subList.Items)
@@ -411,9 +418,9 @@ namespace Handbrake.Controls }
public void SetContainer(int value)
{
- _fileContainer = value;
+ FileContainer = value;
Boolean trigger = false;
- if (_fileContainer != 1)
+ if (FileContainer != 1)
foreach (ListViewItem item in lv_subList.Items)
{
if (item.SubItems[1].Text.Contains("Bitmap"))
@@ -429,32 +436,4 @@ namespace Handbrake.Controls return SubList;
}
}
-
- public class SubtitleInfo
- {
- public string Track { get; set; }
- public string Forced { get; set; }
- public string Burned { get; set; }
- public string Default { get; set; }
- public string SrtLang { get; set; }
- public string SrtCharCode { get; set; }
- public int SrtOffset { get; set; }
- public string SrtPath { get; set; }
- public string SrtFileName { get; set; }
-
- public ListViewItem ListView
- {
- get
- {
- ListViewItem listTrack = new ListViewItem(Track);
- listTrack.SubItems.Add(Forced);
- listTrack.SubItems.Add(Burned);
- listTrack.SubItems.Add(Default);
- listTrack.SubItems.Add(SrtLang);
- listTrack.SubItems.Add(SrtCharCode);
- listTrack.SubItems.Add(SrtOffset.ToString());
- return listTrack;
- }
- }
- }
}
\ No newline at end of file diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index a653f9669..c88ff2d59 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -132,12 +132,12 @@ namespace Handbrake.Functions #endregion
#region Filters
- mainWindow.Filters.setDecomb(presetQuery.Decomb);
- mainWindow.Filters.setDeInterlace(presetQuery.DeInterlace);
- mainWindow.Filters.setDeNoise(presetQuery.DeNoise);
- mainWindow.Filters.setDeTelecine(presetQuery.DeTelecine);
- mainWindow.Filters.setDeBlock(presetQuery.DeBlock);
- mainWindow.Filters.setGrayScale(presetQuery.Grayscale);
+ mainWindow.Filters.SetDecomb(presetQuery.Decomb);
+ mainWindow.Filters.SetDeInterlace(presetQuery.DeInterlace);
+ mainWindow.Filters.SetDeNoise(presetQuery.DeNoise);
+ mainWindow.Filters.SetDeTelecine(presetQuery.DeTelecine);
+ mainWindow.Filters.SetDeBlock(presetQuery.DeBlock);
+ mainWindow.Filters.SetGrayScale(presetQuery.Grayscale);
#endregion
#region Video
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs index 050e9b76c..03fa22c83 100644 --- a/win/C#/Functions/QueryGenerator.cs +++ b/win/C#/Functions/QueryGenerator.cs @@ -182,7 +182,7 @@ namespace Handbrake.Functions #endregion
#region Filters
- query += mainWindow.Filters.getCLIQuery;
+ query += mainWindow.Filters.GetCLIQuery;
#endregion
#region Video Settings Tab
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index 70aaa8164..46b392680 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -224,6 +224,7 @@ </Compile>
<Compile Include="Model\AudioTrack.cs" />
<Compile Include="Model\DriveInformation.cs" />
+ <Compile Include="Model\SourceType.cs" />
<Compile Include="Presets\PlistPresetHandler.cs" />
<Compile Include="Presets\Preset.cs" />
<Compile Include="Presets\PresetsHandler.cs" />
diff --git a/win/C#/Model/Subtitle.cs b/win/C#/Model/Subtitle.cs new file mode 100644 index 000000000..69ddbbdd7 --- /dev/null +++ b/win/C#/Model/Subtitle.cs @@ -0,0 +1,78 @@ +/* Subtitle.cs $
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+using System.Windows.Forms;
+
+namespace Handbrake.Model
+{
+ /// <summary>
+ /// Subtitle Information
+ /// </summary>
+ public class SubtitleInfo
+ {
+ /// <summary>
+ /// Subtitle Track
+ /// </summary>
+ public string Track { get; set; }
+
+ /// <summary>
+ /// Forced Subtitle
+ /// </summary>
+ public string Forced { get; set; }
+
+ /// <summary>
+ /// Burned In Subtitle
+ /// </summary>
+ public string Burned { get; set; }
+
+ /// <summary>
+ /// Default Subtitle Track
+ /// </summary>
+ public string Default { get; set; }
+
+ /// <summary>
+ /// SRT Language
+ /// </summary>
+ public string SrtLang { get; set; }
+
+ /// <summary>
+ /// SRT Character Code
+ /// </summary>
+ public string SrtCharCode { get; set; }
+
+ /// <summary>
+ /// SRT Offset
+ /// </summary>
+ public int SrtOffset { get; set; }
+
+ /// <summary>
+ /// Path to the SRT file
+ /// </summary>
+ public string SrtPath { get; set; }
+
+ /// <summary>
+ /// SRT Filename
+ /// </summary>
+ public string SrtFileName { get; set; }
+
+ /// <summary>
+ /// A ListViewItem Containing information about this subitlte
+ /// </summary>
+ public ListViewItem ListView
+ {
+ get
+ {
+ ListViewItem listTrack = new ListViewItem(Track);
+ listTrack.SubItems.Add(Forced);
+ listTrack.SubItems.Add(Burned);
+ listTrack.SubItems.Add(Default);
+ listTrack.SubItems.Add(SrtLang);
+ listTrack.SubItems.Add(SrtCharCode);
+ listTrack.SubItems.Add(SrtOffset.ToString());
+ return listTrack;
+ }
+ }
+ }
+}
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index b588e6433..e13858fd3 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -74,6 +74,9 @@ namespace Handbrake.Parsing get { return m_titleNumber; }
}
+ /// <summary>
+ /// Source Name
+ /// </summary>
public string SourceName
{
get { return source; }
@@ -150,6 +153,11 @@ namespace Handbrake.Parsing m_duration.Minutes, m_duration.Seconds);
}
+ /// <summary>
+ /// Parse the Title Information
+ /// </summary>
+ /// <param name="output"></param>
+ /// <returns></returns>
public static Title Parse(StringReader output)
{
var thisTitle = new Title();
@@ -216,6 +224,11 @@ namespace Handbrake.Parsing return thisTitle;
}
+ /// <summary>
+ /// Return a list of parsed titles
+ /// </summary>
+ /// <param name="output"></param>
+ /// <returns></returns>
public static Title[] ParseList(string output)
{
var titles = new List<Title>();
|