blob: c67298c32496f290890e14479577265905bd7036 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Preset.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
// A Preset for encoding with.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Services.Presets.Model
{
using Caliburn.Micro;
using HandBrakeWPF.Model.Audio;
using HandBrakeWPF.Model.Subtitles;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Presets.Interfaces;
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
public class Preset : PropertyChangedBase, IPresetObject
{
private bool isDefault;
private bool isSelected;
public Preset()
{
}
public Preset(Preset preset)
{
this.Category = preset.Category;
this.Description = preset.Description;
this.IsBuildIn = preset.IsBuildIn;
this.Name = preset.Name;
this.Task = new EncodeTask(preset.Task);
this.AudioTrackBehaviours = new AudioBehaviours(preset.AudioTrackBehaviours);
this.SubtitleTrackBehaviours = new SubtitleBehaviours(preset.SubtitleTrackBehaviours);
}
public string Category { get; set; }
public string Description { get; set; }
public bool IsExpanded { get; set; }
public string DisplayValue
{
get
{
string globalCateogry = this.IsBuildIn ? Resources.Preset_Official : Resources.Preset_Custom;
return string.Format("{0}", this.Name);
}
}
public bool IsSelected
{
get => this.isSelected;
set
{
this.isSelected = value;
this.NotifyOfPropertyChange(() => this.IsSelected);
}
}
public bool IsBuildIn { get; set; }
public bool IsDefault
{
get
{
return this.isDefault;
}
set
{
this.isDefault = value;
this.NotifyOfPropertyChange(() => this.IsDefault);
}
}
public string Name { get; set; }
public EncodeTask Task { get; set; }
public AudioBehaviours AudioTrackBehaviours { get; set; }
public SubtitleBehaviours SubtitleTrackBehaviours { get; set; }
public bool IsPresetDisabled { get; set; }
public void Update(EncodeTask task, AudioBehaviours audioBehaviours, SubtitleBehaviours subtitleBehaviours)
{
this.Task = task;
this.AudioTrackBehaviours = new AudioBehaviours(audioBehaviours);
this.SubtitleTrackBehaviours = new SubtitleBehaviours(subtitleBehaviours);
}
public override string ToString()
{
return this.Name;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj.GetType() != this.GetType())
{
return false;
}
return Equals((Preset)obj);
}
public override int GetHashCode()
{
return (this.Name != null ? this.Name.GetHashCode() : 0);
}
protected bool Equals(Preset other)
{
return string.Equals(this.Name, other.Name);
}
}
}
|