diff options
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs | 27 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 4 |
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}"
|