summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-12-28 11:21:14 +0000
committersr55 <[email protected]>2012-12-28 11:21:14 +0000
commit93235d2c7d15e031015ebbbfeefa14778fe9a56e (patch)
treeba2f077297096a07af0d68d178292532655bd182 /win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
parentf89475c8a426907cc85a335460cc1d6e7750614b (diff)
WinGui: Initial work to implement x264 Preset/Tune/Profile/Level options in-gui.
Still some stuff to tidy up but should be usable for now. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5113 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs41
1 files changed, 29 insertions, 12 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
index 8e3c13e37..29b4bed48 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
@@ -18,6 +18,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Parsing;
using HandBrake.Interop.Model.Encoding;
+ using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -27,6 +28,11 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel
{
+ /// <summary>
+ /// The advanced encoder options command.
+ /// </summary>
+ private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;
+
#region Constants and Fields
/// <summary>
@@ -166,8 +172,9 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Initializes a new instance of the <see cref="AdvancedViewModel"/> class.
/// </summary>
- public AdvancedViewModel()
+ public AdvancedViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)
{
+ this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;
this.Task = new EncodeTask();
this.UpdateUIFromAdvancedOptions();
}
@@ -243,6 +250,12 @@ namespace HandBrakeWPF.ViewModels
this.Task.AdvancedEncoderOptions = value;
this.UpdateUIFromAdvancedOptions();
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+
+ // Reset the video tab if the user is using this tab.
+ if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))
+ {
+ this.advancedEncoderOptionsCommand.ExecuteClearVideo();
+ }
}
}
@@ -631,14 +644,6 @@ namespace HandBrakeWPF.ViewModels
#region Public Methods
/// <summary>
- /// The notify all changed.
- /// </summary>
- public void NotifyAllChanged()
- {
- this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
- }
-
- /// <summary>
/// The update ui from advanced options.
/// </summary>
public void UpdateUIFromAdvancedOptions()
@@ -885,8 +890,6 @@ namespace HandBrakeWPF.ViewModels
}
break;
- default:
- break;
}
}
}
@@ -933,6 +936,14 @@ namespace HandBrakeWPF.ViewModels
}
}
+ /// <summary>
+ /// The clear.
+ /// </summary>
+ public void Clear()
+ {
+ this.AdvancedOptionsString = string.Empty;
+ }
+
#endregion
#region ITabInterface
@@ -1042,7 +1053,7 @@ namespace HandBrakeWPF.ViewModels
int equalsIndex = existingSegment.IndexOf('=');
if (equalsIndex >= 0)
{
- optionName = existingSegment.Substring(0, existingSegment.IndexOf("="));
+ optionName = existingSegment.Substring(0, existingSegment.IndexOf("=", System.StringComparison.Ordinal));
}
if (!this.uiOptions.Contains(optionName) && optionName != string.Empty)
@@ -1154,6 +1165,12 @@ namespace HandBrakeWPF.ViewModels
this.Task.AdvancedEncoderOptions = string.Join(":", newOptions);
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+
+ // Reset the video tab if the user is using this tab.
+ if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))
+ {
+ this.advancedEncoderOptionsCommand.ExecuteClearVideo();
+ }
}
#endregion