diff options
author | sr55 <[email protected]> | 2017-08-23 19:40:20 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2017-08-23 19:40:20 +0100 |
commit | 0efb28ba6f4cc3970921480522f98e7830a03619 (patch) | |
tree | cbae819e65010e9cf49d53696812a56cf95f3c90 /win | |
parent | 9fd048196eb423965496c14dac683e6e2546e14f (diff) |
WinGui: Initial implementation of the Summary Tab. This may be subject to change. #833
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/EventArgs/OutputFormatChangedEventArgs.cs | 23 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 10 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs | 135 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Properties/ResourcesUI.resx | 45 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs | 23 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 204 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs | 542 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 53 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml.cs | 13 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SummaryView.xaml | 149 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs | 24 |
12 files changed, 1003 insertions, 219 deletions
diff --git a/win/CS/HandBrakeWPF/EventArgs/OutputFormatChangedEventArgs.cs b/win/CS/HandBrakeWPF/EventArgs/OutputFormatChangedEventArgs.cs new file mode 100644 index 000000000..3c5b69ba3 --- /dev/null +++ b/win/CS/HandBrakeWPF/EventArgs/OutputFormatChangedEventArgs.cs @@ -0,0 +1,23 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="OutputFormatChangedEventArgs.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// OutputFormat Changed Event Args +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.EventArgs +{ + using EventArgs = System.EventArgs; + + public class OutputFormatChangedEventArgs : EventArgs + { + public OutputFormatChangedEventArgs(string extension) + { + this.Extension = extension; + } + + public string Extension { get; private set; } + } +} diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 8ac0f2b20..55e73cb6f 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -166,6 +166,7 @@ <Compile Include="Converters\Subtitles\SubtitleBehaviourConverter.cs" />
<Compile Include="Converters\Video\VideoOptionsTooltipConverter.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
+ <Compile Include="EventArgs\OutputFormatChangedEventArgs.cs" />
<Compile Include="EventArgs\QueueCompletedEventArgs.cs" />
<Compile Include="EventArgs\QueueProgressEventArgs.cs" />
<Compile Include="EventArgs\SettingChangedEventArgs.cs" />
@@ -275,6 +276,7 @@ <Compile Include="Utilities\Win32.cs" />
<Compile Include="Utilities\Win7.cs" />
<Compile Include="ViewModels\Interfaces\IManagePresetViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\ISummaryViewModel.cs" />
<Compile Include="ViewModels\ManagePresetViewModel.cs" />
<Compile Include="ViewModels\AudioDefaultsViewModel.cs" />
<Compile Include="ViewModels\CountdownAlertViewModel.cs" />
@@ -293,6 +295,7 @@ <Compile Include="ViewModels\PopupWindowViewModel.cs" />
<Compile Include="ViewModels\StaticPreviewViewModel.cs" />
<Compile Include="ViewModels\SubtitlesDefaultsViewModel.cs" />
+ <Compile Include="ViewModels\SummaryViewModel.cs" />
<Compile Include="Views\ManagePresetView.xaml.cs">
<DependentUpon>ManagePresetView.xaml</DependentUpon>
</Compile>
@@ -420,6 +423,9 @@ <Compile Include="Views\SubtitlesDefaultsView.xaml.cs">
<DependentUpon>SubtitlesDefaultsView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\SummaryView.xaml.cs">
+ <DependentUpon>SummaryView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\X264View.xaml.cs">
<DependentUpon>X264View.xaml</DependentUpon>
</Compile>
@@ -577,6 +583,10 @@ <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Views\SummaryView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\X264View.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 75fc8ba41..cba715c3f 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -952,6 +952,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Summary.
+ /// </summary>
+ public static string MainView_SummaryTab {
+ get {
+ return ResourceManager.GetString("MainView_SummaryTab", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to through.
/// </summary>
public static string MainView_through {
@@ -2268,6 +2277,132 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Additional Audio Tracks.
+ /// </summary>
+ public static string SummaryView_AdditionalAudioTracks {
+ get {
+ return ResourceManager.GetString("SummaryView_AdditionalAudioTracks", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Additional Subtitle Tracks.
+ /// </summary>
+ public static string SummaryView_AdditionalSubtitleTracks {
+ get {
+ return ResourceManager.GetString("SummaryView_AdditionalSubtitleTracks", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Burned.
+ /// </summary>
+ public static string SummaryView_Burned {
+ get {
+ return ResourceManager.GetString("SummaryView_Burned", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Chapter Markers.
+ /// </summary>
+ public static string SummaryView_Chapters {
+ get {
+ return ResourceManager.GetString("SummaryView_Chapters", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Deblock.
+ /// </summary>
+ public static string SummaryView_Deblock {
+ get {
+ return ResourceManager.GetString("SummaryView_Deblock", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Detelecine.
+ /// </summary>
+ public static string SummaryView_Detelecine {
+ get {
+ return ResourceManager.GetString("SummaryView_Detelecine", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to display.
+ /// </summary>
+ public static string SummaryView_display {
+ get {
+ return ResourceManager.GetString("SummaryView_display", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Grayscale.
+ /// </summary>
+ public static string SummaryView_Grayscale {
+ get {
+ return ResourceManager.GetString("SummaryView_Grayscale", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No Audio Tracks.
+ /// </summary>
+ public static string SummaryView_NoAudioTracks {
+ get {
+ return ResourceManager.GetString("SummaryView_NoAudioTracks", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No Chapter Markers.
+ /// </summary>
+ public static string SummaryView_NoChapters {
+ get {
+ return ResourceManager.GetString("SummaryView_NoChapters", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No Filters.
+ /// </summary>
+ public static string SummaryView_NoFilters {
+ get {
+ return ResourceManager.GetString("SummaryView_NoFilters", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No Subtitle Tracks.
+ /// </summary>
+ public static string SummaryView_NoSubtitleTracks {
+ get {
+ return ResourceManager.GetString("SummaryView_NoSubtitleTracks", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Rotation.
+ /// </summary>
+ public static string SummaryView_Rotation {
+ get {
+ return ResourceManager.GetString("SummaryView_Rotation", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to storage.
+ /// </summary>
+ public static string SummaryView_storage {
+ get {
+ return ResourceManager.GetString("SummaryView_storage", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to 2-Pass Encoding.
/// </summary>
public static string VideoView_2Pass {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index 2e12b14ef..c387d0653 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -911,4 +911,49 @@ This will not affect your current settings in the Subtitle tab.</value> <data name="MainView_AlignAVStart" xml:space="preserve">
<value>Align A/V Start</value>
</data>
+ <data name="MainView_SummaryTab" xml:space="preserve">
+ <value>Summary</value>
+ </data>
+ <data name="SummaryView_AdditionalAudioTracks" xml:space="preserve">
+ <value>Additional Audio Tracks</value>
+ </data>
+ <data name="SummaryView_AdditionalSubtitleTracks" xml:space="preserve">
+ <value>Additional Subtitle Tracks</value>
+ </data>
+ <data name="SummaryView_Burned" xml:space="preserve">
+ <value>Burned</value>
+ </data>
+ <data name="SummaryView_Chapters" xml:space="preserve">
+ <value>Chapter Markers</value>
+ </data>
+ <data name="SummaryView_Deblock" xml:space="preserve">
+ <value>Deblock</value>
+ </data>
+ <data name="SummaryView_Detelecine" xml:space="preserve">
+ <value>Detelecine</value>
+ </data>
+ <data name="SummaryView_display" xml:space="preserve">
+ <value>display</value>
+ </data>
+ <data name="SummaryView_Grayscale" xml:space="preserve">
+ <value>Grayscale</value>
+ </data>
+ <data name="SummaryView_NoAudioTracks" xml:space="preserve">
+ <value>No Audio Tracks</value>
+ </data>
+ <data name="SummaryView_NoChapters" xml:space="preserve">
+ <value>No Chapter Markers</value>
+ </data>
+ <data name="SummaryView_NoFilters" xml:space="preserve">
+ <value>No Filters</value>
+ </data>
+ <data name="SummaryView_NoSubtitleTracks" xml:space="preserve">
+ <value>No Subtitle Tracks</value>
+ </data>
+ <data name="SummaryView_Rotation" xml:space="preserve">
+ <value>Rotation</value>
+ </data>
+ <data name="SummaryView_storage" xml:space="preserve">
+ <value>storage</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs index 44043d95d..66cc7aafa 100644 --- a/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs @@ -89,6 +89,7 @@ namespace HandBrakeWPF.Startup this.container.Singleton<IFiltersViewModel, FiltersViewModel>();
this.container.Singleton<IVideoViewModel, VideoViewModel>();
this.container.Singleton<IMetaDataViewModel, MetaDataViewModel>();
+ this.container.Singleton<ISummaryViewModel, SummaryViewModel>();
// Shell
this.container.Singleton<IShellViewModel, ShellViewModel>();
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs new file mode 100644 index 000000000..8ed5deb78 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs @@ -0,0 +1,23 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="ISummaryViewModel.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the ISummaryViewModel type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels.Interfaces +{ + using System; + + using HandBrakeWPF.EventArgs; + using HandBrakeWPF.Services.Encode.Model.Models; + + public interface ISummaryViewModel : ITabInterface + { + event EventHandler<OutputFormatChangedEventArgs> OutputFormatChanged; + void SetContainer(OutputFormat container); + void UpdateDisplayedInfo(); + } +}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 33e9acf25..0242fcbfb 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -18,7 +18,6 @@ namespace HandBrakeWPF.ViewModels using System.Linq;
using System.Threading;
using System.Windows;
- using System.Windows.Data;
using System.Windows.Input;
using Caliburn.Micro;
@@ -82,8 +81,6 @@ namespace HandBrakeWPF.ViewModels private readonly Win7 windowsSeven = new Win7();
private string windowName;
private string sourceLabel;
- private OutputFormat selectedOutputFormat;
- private bool isMkv;
private string statusLabel;
private string programStatusLabel;
private Source scannedSource;
@@ -140,6 +137,9 @@ namespace HandBrakeWPF.ViewModels /// <param name="videoViewModel">
/// The video View Model.
/// </param>
+ /// <param name="summaryViewModel">
+ /// The summary view model.
+ /// </param>
/// <param name="filtersViewModel">
/// The filters View Model.
/// </param>
@@ -167,7 +167,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="notifyIconService">Wrapper around the WinForms NotifyIcon for this app. </param>
public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
IErrorService errorService, IUpdateService updateService,
- IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel,
+ IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel, ISummaryViewModel summaryViewModel,
IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel,
IX264ViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel,
IQueueViewModel queueViewModel, IMetaDataViewModel metaDataViewModel, INotifyIconService notifyIconService)
@@ -183,6 +183,7 @@ namespace HandBrakeWPF.ViewModels this.userSettingService = userSettingService;
this.queueProcessor = IoC.Get<IQueueProcessor>();
+ this.SummaryViewModel = summaryViewModel;
this.PictureSettingsViewModel = pictureSettingsViewModel;
this.VideoViewModel = videoViewModel;
this.MetaDataViewModel = metaDataViewModel;
@@ -295,6 +296,8 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public IMetaDataViewModel MetaDataViewModel { get; set; }
+ public ISummaryViewModel SummaryViewModel { get; set; }
+
#endregion
#region Properties
@@ -389,12 +392,6 @@ namespace HandBrakeWPF.ViewModels if (this.selectedPreset != null)
{
- // Main Window Settings
- this.OptimizeMP4 = selectedPreset.Task.OptimizeMP4;
- this.IPod5GSupport = selectedPreset.Task.IPod5GSupport;
- this.SelectedOutputFormat = selectedPreset.Task.OutputFormat;
- this.AlignAVStart = selectedPreset.Task.AlignAVStart;
-
// Tab Settings
this.PictureSettingsViewModel.SetPreset(this.selectedPreset, this.CurrentTask);
this.VideoViewModel.SetPreset(this.selectedPreset, this.CurrentTask);
@@ -404,9 +401,7 @@ namespace HandBrakeWPF.ViewModels this.ChaptersViewModel.SetPreset(this.selectedPreset, this.CurrentTask);
this.AdvancedViewModel.SetPreset(this.selectedPreset, this.CurrentTask);
this.MetaDataViewModel.SetPreset(this.selectedPreset, this.CurrentTask);
-
- // Do this again to force an update for m4v/mp4 selection
- this.SelectedOutputFormat = selectedPreset.Task.OutputFormat;
+ this.SummaryViewModel.SetPreset(this.selectedPreset, this.CurrentTask);
}
this.NotifyOfPropertyChange(() => this.SelectedPreset);
@@ -420,63 +415,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Optimise MP4 Checkbox
- /// </summary>
- public bool OptimizeMP4
- {
- get
- {
- return this.CurrentTask.OptimizeMP4;
- }
- set
- {
- if (value == this.CurrentTask.OptimizeMP4)
- {
- return;
- }
- this.CurrentTask.OptimizeMP4 = value;
- this.NotifyOfPropertyChange(() => this.OptimizeMP4);
- }
- }
-
- /// <summary>
- /// iPod 5G Status
- /// </summary>
- public bool IPod5GSupport
- {
- get
- {
- return this.CurrentTask.IPod5GSupport;
- }
- set
- {
- if (value == this.CurrentTask.IPod5GSupport)
- {
- return;
- }
- this.CurrentTask.IPod5GSupport = value;
- this.NotifyOfPropertyChange(() => this.IPod5GSupport);
- }
- }
-
- public bool AlignAVStart
- {
- get
- {
- return this.CurrentTask.AlignAVStart;
- }
- set
- {
- if (value == this.CurrentTask.AlignAVStart)
- {
- return;
- }
- this.CurrentTask.AlignAVStart = value;
- this.NotifyOfPropertyChange(() => this.AlignAVStart);
- }
- }
-
- /// <summary>
/// Gets or sets The Current Encode Task that the user is building
/// </summary>
public EncodeTask CurrentTask { get; set; }
@@ -697,22 +635,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets a value indicating whether IsMkv.
- /// </summary>
- public bool IsMkv
- {
- get
- {
- return this.isMkv;
- }
- set
- {
- this.isMkv = value;
- this.NotifyOfPropertyChange(() => this.IsMkv);
- }
- }
-
- /// <summary>
/// Gets RangeMode.
/// </summary>
public IEnumerable<OutputFormat> OutputFormats
@@ -763,13 +685,11 @@ namespace HandBrakeWPF.ViewModels switch (ext)
{
case ".mkv":
- this.SelectedOutputFormat = OutputFormat.Mkv;
+ this.SummaryViewModel.SetContainer(OutputFormat.Mkv);
break;
case ".mp4":
- this.SelectedOutputFormat = OutputFormat.Mp4;
- break;
case ".m4v":
- this.SelectedOutputFormat = OutputFormat.Mp4;
+ this.SummaryViewModel.SetContainer(OutputFormat.Mp4);
break;
}
}
@@ -985,33 +905,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets SelectedOutputFormat.
- /// </summary>
- public OutputFormat SelectedOutputFormat
- {
- get
- {
- return this.selectedOutputFormat;
- }
-
- set
- {
- if (!Equals(this.selectedOutputFormat, value))
- {
- this.selectedOutputFormat = value;
- this.CurrentTask.OutputFormat = value;
- this.NotifyOfPropertyChange(() => SelectedOutputFormat);
- this.NotifyOfPropertyChange(() => this.CurrentTask.OutputFormat);
- this.NotifyOfPropertyChange(() => IsMkv);
- this.SetExtension(string.Format(".{0}", this.selectedOutputFormat.ToString().ToLower()));
-
- this.VideoViewModel.RefreshTask();
- this.AudioViewModel.RefreshTask();
- }
- }
- }
-
- /// <summary>
/// Gets a value indicating whether show advanced tab.
/// </summary>
public bool ShowAdvancedTab
@@ -1238,12 +1131,14 @@ namespace HandBrakeWPF.ViewModels {
return this.hasSource;
}
+
set
{
if (value.Equals(this.hasSource))
{
return;
}
+
this.hasSource = value;
this.NotifyOfPropertyChange(() => this.HasSource);
}
@@ -1286,6 +1181,8 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.Presets);
this.presetService.LoadCategoryStates();
+ this.SummaryViewModel.OutputFormatChanged += this.SummaryViewModel_OutputFormatChanged;
+
// Queue Recovery
bool queueRecovered = QueueRecoveryHelper.RecoverQueue(this.queueProcessor, this.errorService, StartupOptions.AutoRestartQueue);
@@ -1314,13 +1211,24 @@ namespace HandBrakeWPF.ViewModels }
// Log Cleaning
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearOldLogs))
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearOldLogs))
{
Thread clearLog = new Thread(() => GeneralUtilities.ClearLogFiles(30));
clearLog.Start();
}
}
+ private void SummaryViewModel_OutputFormatChanged(object sender, OutputFormatChangedEventArgs e)
+ {
+ if (!string.IsNullOrEmpty(e.Extension))
+ {
+ this.Destination = Path.ChangeExtension(this.Destination, e.Extension);
+ }
+
+ this.VideoViewModel.RefreshTask();
+ this.AudioViewModel.RefreshTask();
+ }
+
/// <summary>
/// Shutdown this View
/// </summary>
@@ -1340,6 +1248,8 @@ namespace HandBrakeWPF.ViewModels this.queueProcessor.JobProcessingStarted -= this.QueueProcessorJobProcessingStarted;
this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeStatusChanged;
this.userSettingService.SettingChanged -= this.UserSettingServiceSettingChanged;
+
+ this.SummaryViewModel.OutputFormatChanged -= this.SummaryViewModel_OutputFormatChanged;
}
#endregion
@@ -1858,11 +1768,11 @@ namespace HandBrakeWPF.ViewModels switch (Path.GetExtension(saveFileDialog.FileName))
{
case ".mkv":
- this.SelectedOutputFormat = OutputFormat.Mkv;
+ this.SummaryViewModel.SetContainer(OutputFormat.Mkv);
break;
case ".mp4":
case ".m4v":
- this.SelectedOutputFormat = OutputFormat.Mp4;
+ this.SummaryViewModel.SetContainer(OutputFormat.Mp4);
break;
}
@@ -2185,8 +2095,6 @@ namespace HandBrakeWPF.ViewModels this.SelectedPointToPoint = this.CurrentTask.PointToPointMode; // Force reset.
this.SelectedStartPoint = start;
this.SelectedEndPoint = end;
- this.NotifyOfPropertyChange(() => this.SelectedOutputFormat);
- this.NotifyOfPropertyChange(() => IsMkv);
// Update the Tab Controls
this.PictureSettingsViewModel.UpdateTask(this.CurrentTask);
@@ -2197,6 +2105,7 @@ namespace HandBrakeWPF.ViewModels this.ChaptersViewModel.UpdateTask(this.CurrentTask);
this.AdvancedViewModel.UpdateTask(this.CurrentTask);
this.MetaDataViewModel.UpdateTask(this.CurrentTask);
+ this.SummaryViewModel.UpdateTask(this.CurrentTask);
// Cleanup
this.ShowStatusWindow = false;
@@ -2206,56 +2115,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Make sure the correct file extension is set based on user preferences and setup the GUI for the file container selected.
- /// </summary>
- /// <param name="newExtension">
- /// The new extension.
- /// </param>
- private void SetExtension(string newExtension)
- {
- // Make sure the output extension is set correctly based on the users preferences and selection.
- if (newExtension == ".mp4" || newExtension == ".m4v")
- {
- switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
- {
- case 0: // Auto
- newExtension = MP4Helper.RequiresM4v(this.CurrentTask) ? ".m4v" : ".mp4";
- break;
- case 1: // MP4
- newExtension = ".mp4";
- break;
- case 2: // M4v
- newExtension = ".m4v";
- break;
- }
-
- this.IsMkv = false;
- }
-
- // Now disable controls that are not required. The Following are for MP4 only!
- if (newExtension == ".mkv")
- {
- this.IsMkv = true;
- this.CurrentTask.OptimizeMP4 = false;
- this.CurrentTask.IPod5GSupport = false;
- this.CurrentTask.AlignAVStart = false;
-
- this.NotifyOfPropertyChange(() => this.OptimizeMP4);
- this.NotifyOfPropertyChange(() => this.IPod5GSupport);
- this.NotifyOfPropertyChange(() => this.AlignAVStart);
- }
-
- // Update The browse file extension display
- if (Path.HasExtension(newExtension))
- {
- this.Destination = Path.ChangeExtension(this.Destination, newExtension);
- }
-
- // Update the UI Display
- this.NotifyOfPropertyChange(() => this.CurrentTask);
- }
-
- /// <summary>
/// Setup the UI tabs. Passes in any relevant models for setup.
/// </summary>
private void SetupTabs()
@@ -2271,6 +2130,7 @@ namespace HandBrakeWPF.ViewModels this.ChaptersViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.selectedPreset, this.CurrentTask);
this.AdvancedViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.selectedPreset, this.CurrentTask);
this.MetaDataViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.selectedPreset, this.CurrentTask);
+ this.SummaryViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.selectedPreset, this.CurrentTask);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs new file mode 100644 index 000000000..cac78160b --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -0,0 +1,542 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="SummaryViewModel.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// The Summary View Model +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.IO; + using System.Runtime.ExceptionServices; + using System.Text; + using System.Windows.Media.Imaging; + + using HandBrake.ApplicationServices.Interop.Model.Encoding; + + using HandBrakeWPF.EventArgs; + using HandBrakeWPF.Factories; + using HandBrakeWPF.Helpers; + using HandBrakeWPF.Properties; + using HandBrakeWPF.Services.Encode.Model; + using HandBrakeWPF.Services.Encode.Model.Models; + using HandBrakeWPF.Services.Interfaces; + using HandBrakeWPF.Services.Presets.Model; + using HandBrakeWPF.Services.Scan.Interfaces; + using HandBrakeWPF.Services.Scan.Model; + using HandBrakeWPF.Utilities; + using HandBrakeWPF.ViewModels.Interfaces; + + public class SummaryViewModel : ViewModelBase, ISummaryViewModel + { + private readonly IScan scanService; + private readonly IUserSettingService userSettingService; + + private Preset preset; + private EncodeTask task; + private Source source; + private Title currentTitle; + private bool isMkv; + + public SummaryViewModel(IScan scanService, IUserSettingService userSettingService) + { + this.scanService = scanService; + this.userSettingService = userSettingService; + } + + public event EventHandler<OutputFormatChangedEventArgs> OutputFormatChanged; + + public Preset Preset + { + get + { + return this.preset; + } + + private set + { + if (Equals(value, this.preset)) return; + this.preset = value; + this.NotifyOfPropertyChange(() => this.Preset); + } + } + + public EncodeTask Task + { + get + { + return this.task; + } + + set + { + if (Equals(value, this.task)) return; + this.task = value; + this.NotifyOfPropertyChange(() => this.Task); + } + } + + public Source Source + { + get + { + return this.source; + } + + set + { + if (Equals(value, this.source)) return; + this.source = value; + this.NotifyOfPropertyChange(() => this.Source); + } + } + + public Title CurrentTitle + { + get + { + return this.currentTitle; + } + set + { + if (Equals(value, this.currentTitle)) return; + this.currentTitle = value; + this.NotifyOfPropertyChange(() => this.CurrentTitle); + } + } + + public IEnumerable<OutputFormat> OutputFormats + { + get + { + return new List<OutputFormat> + { + OutputFormat.Mp4, OutputFormat.Mkv + }; + } + } + + #region DisplayProperties + + public BitmapImage PreviewImage { get; set; } + public bool PreviewNotAvailable { get; set; } + + public string VideoTrackInfo { get; set; } + public string AudioTrackInfo { get; set; } + public string SubtitleTrackInfo { get; set; } + public string ChapterInfo { get; set; } + public string FiltersInfo { get; set; } + + public string DimensionInfo { get; set; } + public string AspectInfo { get; set; } + + public bool IsPreviousPreviewControlVisible { get; set; } = false; + public bool IsNextPreviewControlVisible { get; set; } = false; + + #endregion + + #region Task Properties + + /// <summary> + /// Gets or sets SelectedOutputFormat. + /// </summary> + public OutputFormat SelectedOutputFormat + { + get + { + return this.Task?.OutputFormat ?? OutputFormat.Mp4; + } + + set + { + if (!Equals(this.Task.OutputFormat, value)) + { + this.Task.OutputFormat = value; + this.Task.OutputFormat = value; + this.NotifyOfPropertyChange(() => this.SelectedOutputFormat); + this.NotifyOfPropertyChange(() => this.Task.OutputFormat); + this.NotifyOfPropertyChange(() => this.IsMkv); + this.SetExtension(string.Format(".{0}", this.Task.OutputFormat.ToString().ToLower())); + + this.OnOutputFormatChanged(new OutputFormatChangedEventArgs(null)); + } + } + } + + /// <summary> + /// Gets or sets a value indicating whether IsMkv. + /// </summary> + public bool IsMkv + { + get + { + return this.isMkv; + } + set + { + this.isMkv = value; + this.NotifyOfPropertyChange(() => this.IsMkv); + } + } + + /// <summary> + /// Optimise MP4 Checkbox + /// </summary> + public bool OptimizeMP4 + { + get + { + return this.Task?.OptimizeMP4 ?? false; + } + set + { + if (value == this.Task.OptimizeMP4) + { + return; + } + this.Task.OptimizeMP4 = value; + this.NotifyOfPropertyChange(() => this.OptimizeMP4); + } + } + + /// <summary> + /// iPod 5G Status + /// </summary> + public bool IPod5GSupport + { + get + { + return this.Task?.IPod5GSupport ?? false; + } + set + { + if (value == this.Task.IPod5GSupport) + { + return; + } + this.Task.IPod5GSupport = value; + this.NotifyOfPropertyChange(() => this.IPod5GSupport); + } + } + + public bool AlignAVStart + { + get + { + return this.Task?.AlignAVStart ?? false; + } + set + { + if (value == this.Task.AlignAVStart) + { + return; + } + this.Task.AlignAVStart = value; + this.NotifyOfPropertyChange(() => this.AlignAVStart); + } + } + + #endregion + + public void SetSource(Source scannedSource, Title selectedTitle, Preset currentPreset, EncodeTask encodeTask) + { + this.Source = scannedSource; + this.CurrentTitle = selectedTitle; + this.Task = encodeTask; + this.UpdateDisplayedInfo(); + } + + public void SetPreset(Preset currentPreset, EncodeTask encodeTask) + { + this.Preset = currentPreset; + this.Task = encodeTask; + this.UpdateSettings(currentPreset); + this.UpdateDisplayedInfo(); + } + + public void UpdateTask(EncodeTask updatedTask) + { + this.Task = updatedTask; + this.UpdateDisplayedInfo(); + + this.NotifyOfPropertyChange(() => this.SelectedOutputFormat); + this.NotifyOfPropertyChange(() => this.IsMkv); + + this.NotifyOfPropertyChange(() => this.OptimizeMP4); + this.NotifyOfPropertyChange(() => this.IPod5GSupport); + this.NotifyOfPropertyChange(() => this.AlignAVStart); + } + + public void UpdateDisplayedInfo() + { + if (this.CurrentTitle == null) + { + this.ClearDisplay(); + return; + } + + this.PopulateSummaryTab(); + this.UpdatePreviewFrame(); + } + + public void SetContainer(OutputFormat container) + { + this.SelectedOutputFormat = container; + } + + private void UpdateSettings(Preset selectedPreset) + { + // Main Window Settings + this.SelectedOutputFormat = selectedPreset.Task.OutputFormat; + this.OptimizeMP4 = selectedPreset.Task.OptimizeMP4; + this.IPod5GSupport = selectedPreset.Task.IPod5GSupport; + this.AlignAVStart = selectedPreset.Task.AlignAVStart; + } + + private void SetExtension(string newExtension) + { + // Make sure the output extension is set correctly based on the users preferences and selection. + if (newExtension == ".mp4" || newExtension == ".m4v") + { + switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v)) + { + case 0: // Auto + newExtension = MP4Helper.RequiresM4v(this.Task) ? ".m4v" : ".mp4"; + break; + case 1: // MP4 + newExtension = ".mp4"; + break; + case 2: // M4v + newExtension = ".m4v"; + break; + } + + this.IsMkv = false; + } + + // Now disable controls that are not required. The Following are for MP4 only! + if (newExtension == ".mkv") + { + this.IsMkv = true; + this.OptimizeMP4 = false; + this.IPod5GSupport = false; + this.AlignAVStart = false; + } + + // Update The browse file extension display + if (Path.HasExtension(newExtension)) + { + this.OnOutputFormatChanged(new OutputFormatChangedEventArgs(newExtension)); + } + + // Update the UI Display + this.NotifyOfPropertyChange(() => this.Task); + } + + private void PopulateSummaryTab() + { + if (this.Task == null) + { + this.ClearDisplay(); + return; + } + + // Dimension Section + this.VideoTrackInfo = string.Format("{0}, {1} FPS {2}", EnumHelper<VideoEncoder>.GetDisplay(this.Task.VideoEncoder), this.Task.Framerate, this.Task.FramerateMode); + this.NotifyOfPropertyChange(() => this.VideoTrackInfo); + + this.AudioTrackInfo = this.GetAudioDescription(); + this.NotifyOfPropertyChange(() => this.AudioTrackInfo); + + this.SubtitleTrackInfo = this.GetSubtitleDescription(); + this.NotifyOfPropertyChange(() => this.SubtitleTrackInfo); + + this.ChapterInfo = this.Task.IncludeChapterMarkers ? ResourcesUI.SummaryView_Chapters : ResourcesUI.SummaryView_NoChapters; + this.NotifyOfPropertyChange(() => this.ChapterInfo); + + this.FiltersInfo = this.GetFilterDescription(); + this.NotifyOfPropertyChange(() => this.FiltersInfo); + + // Picutre Section + this.DimensionInfo = string.Format("{0}x{1} {2}, {3}x{4} {5}", this.Task.Width, this.Task.Height, ResourcesUI.SummaryView_storage, this.Task.DisplayWidth, this.Task.Height, ResourcesUI.SummaryView_display); + this.NotifyOfPropertyChange(() => this.DimensionInfo); + + this.AspectInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.AspectInfo); + } + + private string GetFilterDescription() + { + if (this.Task == null) + { + return ResourcesUI.SummaryView_NoFilters; + } + + List<string> filters = new List<string>(); + + if (this.Task.Detelecine != Detelecine.Off) + { + filters.Add(ResourcesUI.SummaryView_Detelecine); + } + + if (this.Task.DeinterlaceFilter != DeinterlaceFilter.Off) + { + filters.Add(EnumHelper<DeinterlaceFilter>.GetShortName(this.task.DeinterlaceFilter)); + } + + if (this.Task.Denoise != Denoise.Off) + { + filters.Add(this.Task.Denoise.ToString()); + } + + if (this.Task.Sharpen != Sharpen.Off) + { + filters.Add(this.Task.Sharpen.ToString()); + } + + if (this.Task.Deblock > 4) + { + filters.Add(ResourcesUI.SummaryView_Deblock); + } + + if (this.Task.Grayscale) + { + filters.Add(ResourcesUI.SummaryView_Grayscale); + } + + if (this.Task.Rotation != 0 || this.task.FlipVideo) + { + filters.Add(ResourcesUI.SummaryView_Rotation); + } + + return string.Join(", ", filters).Trim(); + } + + private string GetAudioDescription() + { + if (this.Task.AudioTracks.Count == 0) + { + return ResourcesUI.SummaryView_NoAudioTracks; + } + + StringBuilder desc = new StringBuilder(); + + if (this.Task.AudioTracks.Count >= 1) + { + AudioTrack track1 = this.Task.AudioTracks[0]; + desc.AppendLine(string.Format("{0}, {1}", EnumHelper<AudioEncoder>.GetDisplay(track1.Encoder), track1.MixDown)); + } + + if (this.Task.AudioTracks.Count >= 2) + { + AudioTrack track2 = this.Task.AudioTracks[1]; + desc.AppendLine(string.Format("{0}, {1}", EnumHelper<AudioEncoder>.GetDisplay(track2.Encoder), track2.MixDown)); + } + + if (this.Task.AudioTracks.Count > 2) + { + desc.AppendLine(string.Format("+ {0} {1}", this.Task.AudioTracks.Count - 2, ResourcesUI.SummaryView_AdditionalAudioTracks)); + } + + return desc.ToString().Trim(); + } + + private string GetSubtitleDescription() + { + if (this.Task.AudioTracks.Count == 0) + { + return ResourcesUI.SummaryView_NoSubtitleTracks; + } + + StringBuilder desc = new StringBuilder(); + + if (this.Task.SubtitleTracks.Count >= 1) + { + SubtitleTrack track1 = this.Task.SubtitleTracks[0]; + desc.AppendLine(string.Format("{0}, {1}", track1.SourceTrack, track1.Burned ? ResourcesUI.SummaryView_Burned : string.Empty)); + } + + if (this.Task.SubtitleTracks.Count >= 2) + { + SubtitleTrack track2 = this.Task.SubtitleTracks[1]; + desc.AppendLine(string.Format("{0}, {1}", track2.SourceTrack, track2.Burned ? ResourcesUI.SummaryView_Burned : string.Empty)); + } + + if (this.Task.SubtitleTracks.Count > 2) + { + desc.AppendLine(string.Format("+ {0} {1}", this.Task.SubtitleTracks.Count - 2, ResourcesUI.SummaryView_AdditionalSubtitleTracks)); + } + + return desc.ToString().Trim(); + } + + private void ClearDisplay() + { + this.VideoTrackInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.VideoTrackInfo); + + this.AudioTrackInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.AudioTrackInfo); + + this.SubtitleTrackInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.SubtitleTrackInfo); + + this.ChapterInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.ChapterInfo); + + this.FiltersInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.FiltersInfo); + + this.DimensionInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.ChapterInfo); + + this.AspectInfo = string.Empty; + this.NotifyOfPropertyChange(() => this.FiltersInfo); + } + + [HandleProcessCorruptedStateExceptions] + private void UpdatePreviewFrame() + { + // Don't preview for small images. + if (this.Task.Anamorphic == Anamorphic.Loose && this.Task.Width < 32) + { + this.PreviewNotAvailable = true; + return; + } + + if ((this.Task.Anamorphic == Anamorphic.None || this.Task.Anamorphic == Anamorphic.Custom) && (this.Task.Width < 32 || this.Task.Height < 32)) + { + this.PreviewNotAvailable = true; + return; + } + + BitmapImage image = null; + try + { + image = this.scanService.GetPreview(this.Task, 2, HBConfigurationFactory.Create()); // TODO make preview image configurable? + } + catch (Exception exc) + { + this.PreviewNotAvailable = true; + Debug.WriteLine(exc); + } + + if (image != null) + { + this.PreviewNotAvailable = false; + this.PreviewImage = image; + this.NotifyOfPropertyChange(() => this.PreviewImage); + } + } + + protected virtual void OnOutputFormatChanged(OutputFormatChangedEventArgs e) + { + this.OutputFormatChanged?.Invoke(this, e); + } + } +} diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 6577b2fd1..de9068ea9 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -397,52 +397,8 @@ </Grid>
</StackPanel>
- <!-- Output Options -->
- <StackPanel Grid.Row="2" IsEnabled="{Binding HasSource, Converter={StaticResource booleanConverter}, ConverterParameter=false}"
- Margin="10,5,10,5"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- >
- <Label Content="{x:Static Properties:ResourcesUI.MainView_OutputSettings}" FontWeight="Bold" />
- <StackPanel Orientation="Horizontal">
- <Label Margin="8,0,0,0" Content="{x:Static Properties:ResourcesUI.MainView_Container}" />
- <ComboBox Name="Container"
- MinWidth="100"
- Margin="8,0,0,0"
- ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Mux}"
- ItemsSource="{Binding OutputFormats, Converter={StaticResource enumComboConverter}}"
- SelectedItem="{Binding SelectedOutputFormat, Converter={StaticResource enumComboConverter}}"
- />
- <CheckBox Name="WebOptimized"
- Margin="8,0,0,0"
- VerticalAlignment="Center"
- Content="{x:Static Properties:ResourcesUI.MainView_WebOptimized}"
- IsChecked="{Binding Path=OptimizeMP4}"
- ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Optimise}"
- Visibility="{Binding IsMkv,
- Converter={StaticResource boolToVisConverter},
- ConverterParameter=true}"
- />
- <CheckBox Name="AlignAVStart"
- Margin="8,0,0,0"
- VerticalAlignment="Center"
- Content="{x:Static Properties:ResourcesUI.MainView_AlignAVStart}"
- ToolTip="{x:Static Properties:ResourcesTooltips.MainView_AlignAVStart}"
- IsChecked="{Binding Path=AlignAVStart}"
- Visibility="{Binding IsMkv,
- Converter={StaticResource boolToVisConverter},
- ConverterParameter=true}" />
- <CheckBox Name="iPod5G"
- Margin="8,0,0,0"
- VerticalAlignment="Center"
- Content="{x:Static Properties:ResourcesUI.MainView_iPod5G}"
- ToolTip="{x:Static Properties:ResourcesTooltips.MainView_IpodAtom}"
- IsChecked="{Binding Path=IPod5GSupport}"
- Visibility="{Binding IsMkv,
- Converter={StaticResource boolToVisConverter},
- ConverterParameter=true}" />
- </StackPanel>
- </StackPanel>
+ <!-- Presets Options -->
+ <!-- TODO New Preset Controls Grid.Row=2 -->
<!-- Tab Control -->
<TabControl Name="tabControl" IsEnabled="{Binding HasSource, Converter={StaticResource booleanConverter}, ConverterParameter=false}"
@@ -450,9 +406,12 @@ Margin="10,10,10,6"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
-
+ SelectionChanged="TabControl_OnSelectionChanged"
Visibility="{Binding IsQueueShowingInLine, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"
>
+ <TabItem Name="summaryTab" Header="{x:Static Properties:ResourcesUI.MainView_SummaryTab}">
+ <ContentControl x:Name="SummaryViewModel" />
+ </TabItem>
<TabItem Name="pictureTab" Header="{x:Static Properties:ResourcesUI.MainView_PictureTab}">
<ContentControl x:Name="PictureSettingsViewModel" />
</TabItem>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs index 8a180cf03..76f5a8f36 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs @@ -14,6 +14,7 @@ namespace HandBrakeWPF.Views using System.Windows.Input;
using System.Windows.Media;
+ using HandBrakeWPF.ViewModels;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -113,5 +114,17 @@ namespace HandBrakeWPF.Views return source as TreeViewItem;
}
+
+ private void TabControl_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (e.AddedItems.Count > 0)
+ {
+ TabItem tab = e.AddedItems[0] as TabItem;
+ if (tab != null && Properties.ResourcesUI.MainView_SummaryTab.Equals(tab.Header))
+ {
+ ((MainViewModel)this.DataContext).SummaryViewModel.UpdateDisplayedInfo();
+ }
+ }
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml b/win/CS/HandBrakeWPF/Views/SummaryView.xaml new file mode 100644 index 000000000..afae75bd8 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml @@ -0,0 +1,149 @@ +<UserControl x:Class="HandBrakeWPF.Views.SummaryView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" + xmlns:converters="clr-namespace:HandBrakeWPF.Converters" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="600"> + + <UserControl.Resources> + <converters:EnumComboConverter x:Key="enumComboConverter" /> + <converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" /> + </UserControl.Resources> + + <Grid Margin="5,5,0,0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="4*" /> + <ColumnDefinition Width="5*" /> + </Grid.ColumnDefinitions> + + <Grid.RowDefinitions> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + + <!-- Column 1 --> + + <Grid Margin="5,0,0,0" Grid.Column="0" > + <Grid.ColumnDefinitions> + <ColumnDefinition Width="75" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="10" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="10" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + + <Grid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="Margin" Value="0,3,0,3" /> + </Style> + <Style TargetType="CheckBox"> + <Setter Property="Margin" Value="0,2,0,2" /> + </Style> + </Grid.Resources> + + + <TextBlock Text="Format:" FontSize="14" FontFamily="Sergio Light" Grid.Row="0" VerticalAlignment="Center" /> + <ComboBox Name="Container" Width="100" HorizontalAlignment="Left" Margin="0,2,0,5" Grid.Row="0" Grid.Column="1" + ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Mux}" + ItemsSource="{Binding OutputFormats, Converter={StaticResource enumComboConverter}}" + SelectedItem="{Binding SelectedOutputFormat, Converter={StaticResource enumComboConverter}}" /> + <CheckBox Name="WebOptimized" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" + Content="{x:Static Properties:ResourcesUI.MainView_WebOptimized}" + IsChecked="{Binding Path=OptimizeMP4}" + ToolTip="{x:Static Properties:ResourcesTooltips.MainView_Optimise}" + Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" /> + <CheckBox Name="AlignAVStart" VerticalAlignment="Center" Grid.Row="2" Grid.Column="1" + Content="{x:Static Properties:ResourcesUI.MainView_AlignAVStart}" + ToolTip="{x:Static Properties:ResourcesTooltips.MainView_AlignAVStart}" + IsChecked="{Binding Path=AlignAVStart}" + Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" /> + <CheckBox Name="iPod5G" VerticalAlignment="Center" Grid.Row="3" Grid.Column="1" + Content="{x:Static Properties:ResourcesUI.MainView_iPod5G}" + ToolTip="{x:Static Properties:ResourcesTooltips.MainView_IpodAtom}" + IsChecked="{Binding Path=IPod5GSupport}" + Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" /> + + <TextBlock Text="Tracks:" FontSize="14" FontFamily="Sergio Light" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" /> + <TextBlock Text="{Binding VideoTrackInfo}" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" /> + <TextBlock Text="{Binding AudioTrackInfo}" Grid.Row="6" Grid.Column="1" /> + <TextBlock Text="{Binding SubtitleTrackInfo}" Grid.Row="7" Grid.Column="1" /> + <TextBlock Text="{Binding ChapterInfo}" Grid.Row="8" Grid.Column="1" /> + + <TextBlock Text="Filters:" FontSize="14" FontFamily="Sergio Light" Grid.Row="10" Grid.Column="0" VerticalAlignment="Center" /> + <TextBlock Text="{Binding FiltersInfo}" Grid.Row="10" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" TextWrapping="Wrap" /> + </Grid> + + <!-- Column 2 --> + + <Grid Grid.Column="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + + + <Image Source="{Binding PreviewImage}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,5,10,0" /> + + <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Left" + Background="Black" Opacity="0.55" Margin="10,5,20,0" Visibility="{Binding IsPreviousPreviewControlVisible, Converter={StaticResource boolToVisConverter}}"> + <TextBlock Text="<" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> + </Border> + + <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Right" + Background="Black" Opacity="0.55" Margin="10,5,20,0" Visibility="{Binding IsNextPreviewControlVisible, Converter={StaticResource boolToVisConverter}}"> + <TextBlock Text=">" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> + </Border> + + <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Bottom" HorizontalAlignment="Center" + Background="Black" Opacity="0.66" Margin="10,5,20,5"> + <TextBlock Text="Preview 2 of 10" FontSize="14" Foreground="White" Padding="8,3" /> + </Border> + + <Grid Margin="10,5,0,0" Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="85" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="Margin" Value="0,0,0,0" /> + <Setter Property="Padding" Value="3" /> + </Style> + </Grid.Resources> + + <TextBlock Text="Dimensions:" FontSize="14" FontFamily="Sergio Light" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" /> + <TextBlock Text="{Binding DimensionInfo}" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" /> + + <TextBlock Text="Aspect:" FontSize="14" FontFamily="Sergio Light" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Visibility="Collapsed" /> + <TextBlock Text="{Binding AspectInfo}" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Visibility="Collapsed" /> + </Grid> + </Grid> + + </Grid> +</UserControl> diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs new file mode 100644 index 000000000..e3c35b48e --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs @@ -0,0 +1,24 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="SummaryView.xaml.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Interaction logic for SummaryView.xaml +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Views +{ + using System.Windows.Controls; + + /// <summary> + /// Interaction logic for SummaryView.xaml + /// </summary> + public partial class SummaryView : UserControl + { + public SummaryView() + { + this.InitializeComponent(); + } + } +} |