summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-02-23 18:56:01 +0000
committersr55 <[email protected]>2013-02-23 18:56:01 +0000
commit2b9da3e96aaf259c166b5f7ead3b0ea4b96565ac (patch)
tree72df4c7c3585ae6a705f97fdc54c0c5d0e776cca /win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
parent170fc142ee0784ed6f80a63a353a8b5739edb6bf (diff)
WinGui: Enhancements to the preview window and scanning option.s
- Allow up to 60 preview images and expand the video preview selection up to 240 seconds. - Allow a preview to be generated when the queue is already running. - Grey out the preview Play button when it's encoding. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5263 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs27
1 files changed, 18 insertions, 9 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
index 7ebb88619..39bc48090 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Services;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -35,7 +36,7 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Backing field for the encode service.
/// </summary>
- private readonly IEncode encodeService;
+ private readonly IEncodeServiceWrapper encodeService;
/// <summary>
/// The error service
@@ -74,18 +75,17 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
/// </summary>
- /// <param name="encodeService">
- /// The encode Service.
- /// </param>
/// <param name="errorService">
/// The error Service.
/// </param>
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public PreviewViewModel(IEncodeServiceWrapper encodeService, IErrorService errorService, IUserSettingService userSettingService)
+ public PreviewViewModel(IErrorService errorService, IUserSettingService userSettingService)
{
- this.encodeService = encodeService;
+ // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point
+ this.encodeService = new EncodeServiceWrapper(userSettingService);
+
this.errorService = errorService;
this.userSettingService = userSettingService;
this.Title = "Preview";
@@ -93,6 +93,7 @@ namespace HandBrakeWPF.ViewModels
this.PercentageValue = 0;
this.StartAt = 1;
this.Duration = 30;
+ this.CanPlay = true;
UseSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);
@@ -114,7 +115,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- return new List<int> { 5, 10, 30, 45, 60, 75, 90, 105, 120 };
+ return new List<int> { 5, 10, 30, 45, 60, 75, 90, 105, 120, 150, 180, 210, 240 };
}
}
@@ -210,6 +211,8 @@ namespace HandBrakeWPF.ViewModels
set
{
this.isEncoding = value;
+ this.CanPlay = !value;
+ this.NotifyOfPropertyChange(() => this.CanPlay);
this.NotifyOfPropertyChange(() => this.IsEncoding);
}
}
@@ -219,6 +222,11 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public string CurrentlyPlaying { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether can play.
+ /// </summary>
+ public bool CanPlay { get; set; }
+
#endregion
#region Public Methods
@@ -279,7 +287,7 @@ namespace HandBrakeWPF.ViewModels
}
else
{
- string directory = Path.GetDirectoryName(encodeTask.Destination) ?? string.Empty;
+ string directory = Path.GetDirectoryName(encodeTask.Destination) ?? string.Empty;
string filename = Path.GetFileNameWithoutExtension(encodeTask.Destination);
string extension = Path.GetExtension(encodeTask.Destination);
string previewFilename = string.Format("{0}_preview{1}", filename, extension);
@@ -287,7 +295,7 @@ namespace HandBrakeWPF.ViewModels
encodeTask.Destination = previewFullPath;
this.CurrentlyPlaying = previewFullPath;
}
-
+
// Setup the encode task as a preview encode
encodeTask.IsPreviewEncode = true;
encodeTask.PreviewEncodeStartAt = this.StartAt.ToString(CultureInfo.InvariantCulture);
@@ -415,6 +423,7 @@ namespace HandBrakeWPF.ViewModels
{
this.Percentage = "0.00%";
this.PercentageValue = 0;
+ this.IsEncoding = false;
this.encodeService.EncodeCompleted -= this.encodeService_EncodeCompleted;
this.encodeService.EncodeStatusChanged -= this.encodeService_EncodeStatusChanged;