1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="AudioBehaviours.cs" company="HandBrake Project (http://handbrake.fr)">
3 //   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
4 // </copyright>
5 // <summary>
6 //   Audio Behaviours
7 // </summary>
8 // --------------------------------------------------------------------------------------------------------------------
9 
10 namespace HandBrakeWPF.Model.Audio
11 {
12     using System.ComponentModel;
13     using System.Linq;
14 
15     using Caliburn.Micro;
16 
17     using HandBrakeWPF.Services.Encode.Model.Models;
18 
19     public class AudioBehaviours : PropertyChangedBase
20     {
21         private AudioBehaviourModes selectedBehaviour;
22         private BindingList<string> selectedLanguages;
23         private AudioTrackDefaultsMode trackDefaultBehaviour;
24 
AudioBehaviours()25         public AudioBehaviours()
26         {
27             this.SelectedBehaviour = AudioBehaviourModes.None;
28             this.SelectedTrackDefaultBehaviour = AudioTrackDefaultsMode.FirstTrack;
29             this.SelectedLanguages = new BindingList<string>();
30             this.BehaviourTracks = new BindingList<AudioBehaviourTrack>();
31             this.AllowedPassthruOptions = new AllowedPassthru();
32         }
33 
AudioBehaviours(AudioBehaviours behaviours)34         public AudioBehaviours(AudioBehaviours behaviours)
35         {
36             this.SelectedBehaviour = behaviours.SelectedBehaviour;
37             this.SelectedTrackDefaultBehaviour = behaviours.SelectedTrackDefaultBehaviour;
38             this.SelectedLanguages = new BindingList<string>(behaviours.selectedLanguages.ToList());
39             this.BehaviourTracks = behaviours.BehaviourTracks;
40             this.AllowedPassthruOptions = new AllowedPassthru(behaviours.AllowedPassthruOptions);
41         }
42 
43         public AudioBehaviourModes SelectedBehaviour
44         {
45             get
46             {
47                 return this.selectedBehaviour;
48             }
49 
50             set
51             {
52                 if (value == this.selectedBehaviour)
53                 {
54                     return;
55                 }
56                 this.selectedBehaviour = value;
57                 this.NotifyOfPropertyChange(() => this.SelectedBehaviour);
58             }
59         }
60 
61         public AudioTrackDefaultsMode SelectedTrackDefaultBehaviour
62         {
63             get
64             {
65                 return this.trackDefaultBehaviour;
66             }
67             set
68             {
69                 if (value == this.trackDefaultBehaviour)
70                 {
71                     return;
72                 }
73                 this.trackDefaultBehaviour = value;
74                 this.NotifyOfPropertyChange(() => this.SelectedTrackDefaultBehaviour);
75             }
76         }
77 
78         public BindingList<string> SelectedLanguages
79         {
80             get
81             {
82                 return this.selectedLanguages;
83             }
84             set
85             {
86                 if (Equals(value, this.selectedLanguages))
87                 {
88                     return;
89                 }
90                 this.selectedLanguages = value;
91                 this.NotifyOfPropertyChange(() => this.SelectedLanguages);
92             }
93         }
94 
95         public BindingList<AudioBehaviourTrack> BehaviourTracks { get; set; }
96 
97         public AllowedPassthru AllowedPassthruOptions { get; set; }
98     }
99 }
100