summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-12-27 21:26:24 +0000
committersr55 <[email protected]>2012-12-27 21:26:24 +0000
commitb87cca000d252e72f4d130068e9a2ea70f28b07f (patch)
tree5ff63c31fde712e690a2c0e497b85b9bc8aab90e /win/CS/HandBrakeWPF
parent78f11a25002417f9b000535d9e60849a5391b879 (diff)
WinGui: Improved handling of preview filename generation and fixed the seconds / frames options to update in realtime with the duration calculation.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5108 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs27
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml4
2 files changed, 21 insertions, 10 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
index ff723c7f0..d917c20c8 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
@@ -17,8 +17,6 @@ namespace HandBrakeWPF.ViewModels
using System.Threading;
using System.Windows;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
@@ -76,9 +74,6 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
/// </summary>
- /// <param name="windowManager">
- /// The window manager.
- /// </param>
/// <param name="encodeService">
/// The encode Service.
/// </param>
@@ -88,7 +83,7 @@ namespace HandBrakeWPF.ViewModels
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public PreviewViewModel(IWindowManager windowManager, IEncodeServiceWrapper encodeService, IErrorService errorService, IUserSettingService userSettingService)
+ public PreviewViewModel(IEncodeServiceWrapper encodeService, IErrorService errorService, IUserSettingService userSettingService)
{
this.encodeService = encodeService;
this.errorService = errorService;
@@ -274,8 +269,24 @@ namespace HandBrakeWPF.ViewModels
PointToPointMode = PointToPointMode.Preview
};
- this.CurrentlyPlaying = encodeTask.Destination.Replace(".m", "_sample.m");
-
+ // Filename handling.
+ if (string.IsNullOrEmpty(encodeTask.Destination))
+ {
+ string filename = Path.ChangeExtension(Path.GetTempFileName(), encodeTask.OutputFormat == OutputFormat.Mkv ? "m4v" : "mkv");
+ encodeTask.Destination = filename;
+ this.CurrentlyPlaying = filename;
+ }
+ else
+ {
+ 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);
+ string previewFullPath = Path.Combine(directory, previewFilename);
+ encodeTask.Destination = previewFullPath;
+ this.CurrentlyPlaying = previewFullPath;
+ }
+
// Setup the encode task as a preview encode
encodeTask.IsPreviewEncode = true;
encodeTask.PreviewEncodeStartAt = this.StartAt.ToString(CultureInfo.InvariantCulture);
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index ebca0805c..5bed28974 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -373,7 +373,7 @@
<TextBox Name="StartPointText"
MinWidth="60"
Margin="8,0,0,0"
- Text="{Binding SelectedStartPoint}"
+ Text="{Binding SelectedStartPoint, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding ShowTextEntryForPointToPointMode,
Converter={StaticResource boolToVisConverter},
ConverterParameter=false}"
@@ -391,7 +391,7 @@
<TextBox Name="EndPointText"
MinWidth="60"
Margin="8,0,0,0"
- Text="{Binding SelectedEndPoint}"
+ Text="{Binding SelectedEndPoint, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding ShowTextEntryForPointToPointMode,
Converter={StaticResource boolToVisConverter},
ConverterParameter=false}"