summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-03-01 19:01:54 +0000
committersr55 <[email protected]>2012-03-01 19:01:54 +0000
commit2efd8f264113bcd3d8c39a1f408c16cc27100aa7 (patch)
treeaedb1cc0017839a91bdc80c46819332b76a975f9 /win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
parent5bb4078641106578dd0a8e1eab6e1cfbc814067e (diff)
WinGui: (WPF) Further work wiring up the new UI.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4479 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
index b27c14583..63c333db2 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
@@ -123,6 +123,46 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Setup this tab for the specified preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ public void SetPreset(Preset preset)
+ {
+ if (preset != null && preset.Task != null)
+ {
+ // Store the previously selected tracks
+ List<Audio> selectedTracks = this.AudioTracks.Select(track => track.ScannedTrack).ToList();
+ this.AudioTracks.Clear();
+
+ // Add the tracks from the preset
+ foreach (AudioTrack track in preset.Task.AudioTracks)
+ {
+ this.AudioTracks.Add(new AudioTrack(track));
+ }
+
+ // Attempt to restore the previously selected tracks.
+ // or fallback to the first source track.
+ foreach (AudioTrack track in this.AudioTracks)
+ {
+ if (selectedTracks.Count != 0)
+ {
+ track.ScannedTrack = selectedTracks[0];
+ selectedTracks.RemoveAt(0);
+ }
+ else
+ {
+ if (this.SourceTracks != null)
+ {
+ track.ScannedTrack = this.SourceTracks.FirstOrDefault();
+ }
+ }
+ }
+ }
+ }
+
+ /// <summary>
/// Get Appropiate Bitrates for the selected encoder and mixdown.
/// </summary>
/// <param name="encoder">