diff options
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 9b9daf5c6..39aab77e0 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -65,7 +65,8 @@ namespace HandBrakeWPF.ViewModels private bool displayTuneControls;
private bool displayLevelControl;
private bool displayProfileControl;
-
+ private Dictionary<string, string> encoderOptions = new Dictionary<string, string>();
+
#endregion
#region Constructors and Destructors
@@ -497,9 +498,15 @@ namespace HandBrakeWPF.ViewModels }
set
{
- this.Task.VideoEncoder = value;
- this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);
- HandleEncoderChange(this.Task.VideoEncoder);
+ if (!object.Equals(value, this.Task.VideoEncoder))
+ {
+ // Cache the current extra args. We can set them back later if the user switches back
+ this.encoderOptions[EnumHelper<VideoEncoder>.GetShortName(this.Task.VideoEncoder)] = this.ExtraArguments;
+
+ this.Task.VideoEncoder = value;
+ this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);
+ HandleEncoderChange(this.Task.VideoEncoder);
+ }
}
}
@@ -1315,6 +1322,11 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => SelectedFramerate);
this.UseAdvancedTab = false;
}
+
+ // Cleanup Extra Arguments
+ // Load the cached arguments. Saves the user from resetting when switching encoders.
+ string result;
+ this.ExtraArguments = this.encoderOptions.TryGetValue(EnumHelper<VideoEncoder>.GetShortName(selectedEncoder), out result) ? result : string.Empty;
}
}
}
\ No newline at end of file |