diff options
author | sr55 <[email protected]> | 2011-04-16 18:36:23 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-04-16 18:36:23 +0000 |
commit | c921f0242dd7da08ea07b9ef5e02d37dd91b020d (patch) | |
tree | 8f1324382a0ffae776274957d925cb10e90ac4bb /win/CS/HandBrake.ApplicationServices | |
parent | 680ed831fb94849f57565665ed4f467f2d3283e5 (diff) |
WinGui:
- Switching Audio Selection dropdown to be databound. Added The scanned source track to the Audio Track model.
- Added new Move to Top / Bottom options on the right click.
- Further UI tweaks and fixes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3935 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj | 2 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs | 56 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs (renamed from win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs) | 54 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Parsing/Title.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/LibScan.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs | 6 |
7 files changed, 88 insertions, 40 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 65a1b3e5f..dd44f6d9c 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -120,7 +120,7 @@ <Compile Include="Model\Preset.cs" />
<Compile Include="Model\QueueTask.cs" />
<Compile Include="Model\Encoding\SubtitleType.cs" />
- <Compile Include="Parsing\AudioTrack.cs" />
+ <Compile Include="Parsing\Audio.cs" />
<Compile Include="Parsing\Chapter.cs" />
<Compile Include="Parsing\Source.cs" />
<Compile Include="Parsing\Parser.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs index 159beb8e8..b9ecca97d 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs @@ -5,6 +5,8 @@ namespace HandBrake.ApplicationServices.Model.Encoding
{
+ using HandBrake.ApplicationServices.Parsing;
+
/// <summary>
/// An Audio Track for the Audio Panel
/// </summary>
@@ -20,6 +22,11 @@ namespace HandBrake.ApplicationServices.Model.Encoding /// The DRC Value
/// </summary>
private double drc;
+
+ /// <summary>
+ /// The Scanned Audio Track
+ /// </summary>
+ private Audio scannedTrack;
#endregion
/// <summary>
@@ -33,7 +40,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding this.SampleRate = 48;
this.Bitrate = 160;
this.DRC = 1;
- this.SourceTrack = "Automatic";
+ this.ScannedTrack = new Audio();
}
/// <summary>
@@ -43,24 +50,51 @@ namespace HandBrake.ApplicationServices.Model.Encoding {
get
{
- string[] tempSub = SourceTrack.Split(' ');
- int value;
- if (int.TryParse(tempSub[0], out value))
+ if (this.ScannedTrack != null)
{
- return value;
+ return this.ScannedTrack.TrackNumber;
}
+
return null;
}
}
/// <summary>
+ /// Gets or sets the Scanned Audio Tracks
+ /// </summary>
+ public Audio ScannedTrack
+ {
+ get
+ {
+ return this.scannedTrack;
+ }
+
+ set
+ {
+ this.scannedTrack = value;
+ this.OnPropertyChanged("ScannedTrack");
+ }
+ }
+
+ /// <summary>
+ /// Gets the Display Value for this model.
+ /// </summary>
+ public string TrackDisplay
+ {
+ get
+ {
+ return this.ScannedTrack.ToString();
+ }
+ }
+
+ /// <summary>
/// Gets the The UI display value for sample rate
/// </summary>
public string SampleRateDisplayValue
{
get
{
- return SampleRate == 0 ? "Auto" : SampleRate.ToString();
+ return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();
}
}
@@ -71,17 +105,11 @@ namespace HandBrake.ApplicationServices.Model.Encoding {
get
{
- return Bitrate == 0 ? "Auto" : Bitrate.ToString();
+ return this.Bitrate == 0 ? "Auto" : this.Bitrate.ToString();
}
}
/// <summary>
- /// Gets or sets the Source Track
- /// Used for display purposes only.
- /// </summary>
- public string SourceTrack { get; set; }
-
- /// <summary>
/// Gets or sets Audio Mixdown
/// </summary>
public Mixdown MixDown { get; set; }
@@ -110,6 +138,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding {
return this.drc;
}
+
set
{
if (!object.Equals(value, this.drc))
@@ -129,6 +158,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding {
return this.gain;
}
+
set
{
if (!object.Equals(value, this.gain))
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs index 0597f4d1b..14f807c6c 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Audio.cs @@ -12,17 +12,17 @@ namespace HandBrake.ApplicationServices.Parsing /// <summary>
/// An object represending an AudioTrack associated with a Title, in a DVD
/// </summary>
- public class AudioTrack
+ public class Audio
{
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref="Audio"/> class.
/// </summary>
- public AudioTrack()
- {
+ public Audio()
+ {
}
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref="Audio"/> class.
/// </summary>
/// <param name="trackNumber">
/// The track number.
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing /// <param name="bitrate">
/// The bitrate.
/// </param>
- public AudioTrack(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)
+ public Audio(int trackNumber, string language, string languageCode, string description, string format, int sampleRate, int bitrate)
{
this.TrackNumber = trackNumber;
this.Language = language;
@@ -57,6 +57,17 @@ namespace HandBrake.ApplicationServices.Parsing }
/// <summary>
+ /// Gets A Dummy Not Found Track
+ /// </summary>
+ public static Audio NoneFound
+ {
+ get
+ {
+ return new Audio { Description = "None Found" };
+ }
+ }
+
+ /// <summary>
/// Gets or sets The track number of this Audio Track
/// </summary>
public int TrackNumber { get; set; }
@@ -100,7 +111,7 @@ namespace HandBrake.ApplicationServices.Parsing /// <returns>
/// An Audio Track obkect
/// </returns>
- public static AudioTrack Parse(StringReader output)
+ public static Audio Parse(StringReader output)
{
string audioTrack = output.ReadLine();
Match m = Regex.Match(audioTrack, @"^ \+ ([0-9]*), ([A-Za-z0-9,\s]*) \((.*)\) \((.*)\)");
@@ -115,13 +126,13 @@ namespace HandBrake.ApplicationServices.Parsing if (track.Success)
{
- var thisTrack = new AudioTrack
+ var thisTrack = new Audio
{
- TrackNumber = int.Parse(track.Groups[1].Value.Trim()),
- Language = track.Groups[2].Value,
+ TrackNumber = int.Parse(track.Groups[1].Value.Trim()),
+ Language = track.Groups[2].Value,
Format = m.Groups[3].Value,
- Description = subformat,
- SampleRate = int.Parse(samplerateVal),
+ Description = subformat,
+ SampleRate = int.Parse(samplerateVal),
Bitrate = int.Parse(bitrateVal),
LanguageCode = iso639_2.Value.Replace("iso639-2: ", string.Empty).Replace(")", string.Empty)
};
@@ -140,12 +151,12 @@ namespace HandBrake.ApplicationServices.Parsing /// <returns>
/// An array of audio tracks
/// </returns>
- public static AudioTrack[] ParseList(StringReader output)
+ public static Audio[] ParseList(StringReader output)
{
- var tracks = new List<AudioTrack>();
+ var tracks = new List<Audio>();
while (true)
{
- AudioTrack thisTrack = Parse(output);
+ Audio thisTrack = Parse(output);
if (thisTrack != null)
tracks.Add(thisTrack);
else
@@ -160,10 +171,17 @@ namespace HandBrake.ApplicationServices.Parsing /// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>
public override string ToString()
{
- if (Description == null)
- return string.Format("{0} {1} ({2})", TrackNumber, Language, Format);
+ if (this.Description == NoneFound.Description)
+ {
+ return this.Description;
+ }
+
+ if (this.Description == null)
+ {
+ return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.Format);
+ }
- return string.Format("{0} {1} ({2}) ({3})", TrackNumber, Language, Format, Description);
+ return string.Format("{0} {1} ({2}) ({3})", this.TrackNumber, this.Language, this.Format, this.Description);
}
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs index 2f08eb19e..98c2f02f2 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs @@ -30,7 +30,7 @@ namespace HandBrake.ApplicationServices.Parsing /// </summary>
public Title()
{
- this.AudioTracks = new List<AudioTrack>();
+ this.AudioTracks = new List<Audio>();
this.Chapters = new List<Chapter>();
this.Subtitles = new List<Subtitle>();
}
@@ -45,7 +45,7 @@ namespace HandBrake.ApplicationServices.Parsing /// <summary>
/// Gets or sets a Collection of audio tracks associated with this Title
/// </summary>
- public List<AudioTrack> AudioTracks { get; set; }
+ public List<Audio> AudioTracks { get; set; }
/// <summary>
/// Gets or sets a Collection of subtitles associated with this Title
@@ -193,7 +193,7 @@ namespace HandBrake.ApplicationServices.Parsing thisTitle.Chapters.AddRange(Chapter.ParseList(output));
- thisTitle.AudioTracks.AddRange(AudioTrack.ParseList(output));
+ thisTitle.AudioTracks.AddRange(Audio.ParseList(output));
thisTitle.Subtitles.AddRange(Subtitle.ParseList(output));
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs index 6f200e447..1d93162a1 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs @@ -16,7 +16,7 @@ namespace HandBrake.ApplicationServices.Services using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop;
- using AudioTrack = HandBrake.ApplicationServices.Parsing.AudioTrack;
+ using AudioTrack = HandBrake.ApplicationServices.Parsing.Audio;
using Cropping = HandBrake.ApplicationServices.Model.Encoding.Cropping;
using ScanProgressEventArgs = HandBrake.Interop.ScanProgressEventArgs;
using Size = System.Drawing.Size;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs index 752141bf0..86cae01b5 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs @@ -68,7 +68,7 @@ namespace HandBrake.ApplicationServices.Utilities track.SampleRate = double.Parse(value);
break;
case "AudioTrack":
- track.SourceTrack = value;
+ //track.SourceTrack = value;
break;
case "AudioTrackDRCSlider":
track.DRC = double.Parse(value);
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs index 62de5d6d6..ce558107e 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs @@ -361,9 +361,9 @@ namespace HandBrake.ApplicationServices.Utilities for (int x = 0; x < encoderCount; x++)
{
AudioTrack track = new AudioTrack();
- if (trackData != null)
- if (trackData.Length >= (x + 1)) // Audio Track
- track.SourceTrack = trackData[x].Trim();
+ //if (trackData != null)
+ // if (trackData.Length >= (x + 1)) // Audio Track
+ // track.ScannedTrack = trackData[x].Trim();
if (trackMixes != null)
if (trackMixes.Length >= (x + 1)) // Audio Mix
|