summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2016-12-31 13:04:46 +0000
committersr55 <[email protected]>2016-12-31 13:05:08 +0000
commit60d0eab5d5ae9c9b6973ed4169de103e9fde0cfe (patch)
tree88413570432f0a3a9e324ca101a22d695f6c583d /win/CS
parent431de87198315f3781078731fcc77399e35141b5 (diff)
WinGui: Store the Extra Args when switching video encoders. This prevents invalid arguments getting passed to the encoder and as a bonus, remembers the users setting if they switch back
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs20
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