summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-05-19 21:02:08 +0000
committersr55 <[email protected]>2012-05-19 21:02:08 +0000
commita8c98d2da676d507a0754ec191d53a1122a40220 (patch)
treeae847166896db64e8e7c1d78b1962f909bc19a6c /win/CS/HandBrakeWPF/ViewModels
parentb5a8be6d070e651d475978e06459a1f565d855f5 (diff)
WinGui: When Changing the output format, limit to only valid choices in the video and audio encoder dropdowns.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4688 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs16
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs10
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs13
5 files changed, 42 insertions, 5 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
index 1936a9898..06bd20326 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
@@ -138,6 +138,22 @@ namespace HandBrakeWPF.ViewModels
this.Task.AudioTracks.Remove(track);
}
+ /// <summary>
+ /// Trigger a Notify Property Changed on the Task to force various UI elements to update.
+ /// </summary>
+ public void RefreshTask()
+ {
+ this.NotifyOfPropertyChange(() => this.Task);
+
+ if (Task.OutputFormat == OutputFormat.Mp4)
+ {
+ foreach (AudioTrack track in this.Task.AudioTracks.Where(track => track.Encoder == AudioEncoder.ffflac || track.Encoder == AudioEncoder.Vorbis))
+ {
+ track.Encoder = AudioEncoder.ffaac;
+ }
+ }
+ }
+
#endregion
#region Implemented Interfaces
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs
index e1d4328c6..6f3edca2a 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs
@@ -14,5 +14,9 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// </summary>
public interface IAudioViewModel : ITabInterface
{
+ /// <summary>
+ /// Trigger a Notify Property Changed on the Task to force various UI elements to update.
+ /// </summary>
+ void RefreshTask();
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs
index d89e90ac6..d3b162501 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs
@@ -14,5 +14,9 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// </summary>
public interface IVideoViewModel : ITabInterface
{
+ /// <summary>
+ /// Trigger a Notify Property Changed on the Task to force various UI elements to update.
+ /// </summary>
+ void RefreshTask();
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 8a3f2eb60..6c5576442 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -689,9 +689,14 @@ namespace HandBrakeWPF.ViewModels
set
{
this.selectedOutputFormat = value;
+ this.CurrentTask.OutputFormat = value;
this.NotifyOfPropertyChange(() => SelectedOutputFormat);
+ this.NotifyOfPropertyChange(() => this.CurrentTask.OutputFormat);
this.NotifyOfPropertyChange(() => IsMkv);
this.SetExtension(string.Format(".{0}", this.selectedOutputFormat.ToString().ToLower())); // TODO, tidy up
+
+ this.VideoViewModel.RefreshTask();
+ this.AudioViewModel.RefreshTask();
}
}
@@ -1196,19 +1201,15 @@ namespace HandBrakeWPF.ViewModels
{
case 0: // Auto
newExtension = this.CurrentTask.RequiresM4v ? ".m4v" : ".mp4";
- this.CurrentTask.OutputFormat = newExtension == ".m4v" ? OutputFormat.M4V : OutputFormat.Mp4;
break;
case 1: // MP4
newExtension = ".mp4";
- this.CurrentTask.OutputFormat = OutputFormat.Mp4;
break;
case 2: // M4v
newExtension = ".m4v";
- this.CurrentTask.OutputFormat = OutputFormat.M4V;
break;
}
- this.selectedOutputFormat = OutputFormat.Mp4;
this.IsMkv = false;
}
@@ -1220,7 +1221,6 @@ namespace HandBrakeWPF.ViewModels
this.CurrentTask.OptimizeMP4 = false;
this.CurrentTask.IPod5GSupport = false;
this.selectedOutputFormat = OutputFormat.Mkv;
- this.CurrentTask.OutputFormat = OutputFormat.Mkv;
}
// Update The browse file extension display
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
index 6ca5618ed..bf7c76c55 100644
--- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
@@ -508,6 +508,19 @@ namespace HandBrakeWPF.ViewModels
//this.DisplayX264Options = encoder == VideoEncoder.X264;
}
+ /// <summary>
+ /// Trigger a Notify Property Changed on the Task to force various UI elements to update.
+ /// </summary>
+ public void RefreshTask()
+ {
+ this.NotifyOfPropertyChange(() => this.Task);
+
+ if (Task.OutputFormat == OutputFormat.Mp4 && this.SelectedVideoEncoder == VideoEncoder.Theora)
+ {
+ this.SelectedVideoEncoder = VideoEncoder.X264;
+ }
+ }
+
#endregion
#region Advanced