diff options
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs | 201 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 149 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml | 86 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml | 84 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 13 |
5 files changed, 401 insertions, 132 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs index 13095ce30..f0b942120 100644 --- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs @@ -54,121 +54,120 @@ namespace HandBrakeWPF.Helpers /// </returns>
public static string AutoName(EncodeTask task, string sourceOrLabelName)
{
- string autoNamePath = string.Empty;
- if (task.Title != 0) // TODO check.
+ string autoNamePath = string.Empty;
+ if (task.Title != 0) // TODO check.
+ {
+ // Get the Source Name and remove any invalid characters
+ string sourceName = Path.GetInvalidFileNameChars().Aggregate(sourceOrLabelName, (current, character) => current.Replace(character.ToString(), string.Empty));
+ sourceName = Path.GetFileNameWithoutExtension(sourceName);
+
+ // Remove Underscores
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
+ sourceName = sourceName.Replace("_", " ");
+
+ // Switch to "Title Case"
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameTitleCase))
+ sourceName = sourceName.ToTitleCase();
+
+ // Get the Selected Title Number
+
+ string dvdTitle = task.Title.ToString();
+
+ // Get the Chapter Start and Chapter End Numbers
+ string chapterStart = task.StartPoint.ToString();
+ string chapterFinish = task.EndPoint.ToString();
+ string combinedChapterTag = chapterStart;
+ if (chapterFinish != chapterStart && chapterFinish != string.Empty)
+ combinedChapterTag = chapterStart + "-" + chapterFinish;
+
+ /*
+ * File Name
+ */
+ string destinationFilename;
+ if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != string.Empty)
{
- // Get the Source Name and remove any invalid characters
- string sourceName = Path.GetInvalidFileNameChars().Aggregate(sourceOrLabelName, (current, character) => current.Replace(character.ToString(), string.Empty));
- sourceName = Path.GetFileNameWithoutExtension(sourceName);
-
- // Remove Underscores
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
- sourceName = sourceName.Replace("_", " ");
-
- // Switch to "Title Case"
- if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameTitleCase))
- sourceName = sourceName.ToTitleCase();
-
- // Get the Selected Title Number
-
- string dvdTitle = task.Title.ToString();
-
- // Get the Chapter Start and Chapter End Numbers
- string chapterStart = task.StartPoint.ToString();
- string chapterFinish = task.EndPoint.ToString();
- string combinedChapterTag = chapterStart;
- if (chapterFinish != chapterStart && chapterFinish != string.Empty)
- combinedChapterTag = chapterStart + "-" + chapterFinish;
-
- /*
- * File Name
- */
- string destinationFilename;
- if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat) != string.Empty)
- {
- destinationFilename = userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat);
- destinationFilename = destinationFilename.Replace("{source}", sourceName)
- .Replace("{title}", dvdTitle)
- .Replace("{chapters}", combinedChapterTag)
- .Replace("{date}", DateTime.Now.Date.ToShortDateString().Replace('/', '-'));
- }
- else
- destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;
+ destinationFilename = userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNameFormat);
+ destinationFilename = destinationFilename.Replace("{source}", sourceName)
+ .Replace("{title}", dvdTitle)
+ .Replace("{chapters}", combinedChapterTag)
+ .Replace("{date}", DateTime.Now.Date.ToShortDateString().Replace('/', '-'));
+ }
+ else
+ destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;
- /*
- * File Extension
- */
- if (task.OutputFormat == OutputFormat.Mp4 || task.OutputFormat == OutputFormat.M4V)
+ /*
+ * File Extension
+ */
+ if (task.OutputFormat == OutputFormat.Mp4 || task.OutputFormat == OutputFormat.M4V)
+ {
+ switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
{
- switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
- {
- case 0: // Automatic
- destinationFilename += task.IncludeChapterMarkers || task.RequiresM4v ? ".m4v" : ".mp4";
- break;
- case 1: // Always MP4
- destinationFilename += ".mp4";
- break;
- case 2: // Always M4V
- destinationFilename += ".m4v";
- break;
- }
+ case 0: // Automatic
+ destinationFilename += task.IncludeChapterMarkers || task.RequiresM4v ? ".m4v" : ".mp4";
+ break;
+ case 1: // Always MP4
+ destinationFilename += ".mp4";
+ break;
+ case 2: // Always M4V
+ destinationFilename += ".m4v";
+ break;
}
- else if (task.OutputFormat == OutputFormat.Mkv)
- destinationFilename += ".mkv";
+ }
+ else if (task.OutputFormat == OutputFormat.Mkv)
+ destinationFilename += ".mkv";
- /*
- * File Destination Path
- */
+ /*
+ * File Destination Path
+ */
- // If there is an auto name path, use it...
- if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().StartsWith("{source_path}") && !string.IsNullOrEmpty(task.Source))
- {
- string savedPath = userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().Replace("{source_path}\\", string.Empty).Replace("{source_path}", string.Empty);
-
- string directory = Directory.Exists(task.Source)
- ? task.Source
- : Path.GetDirectoryName(task.Source);
- string requestedPath = Path.Combine(directory, savedPath);
-
- autoNamePath = Path.Combine(requestedPath, destinationFilename);
- if (autoNamePath == task.Source)
- {
- // Append out_ to files that already exist or is the source file
- autoNamePath = Path.Combine(Path.GetDirectoryName(task.Source), "output_" + destinationFilename);
- }
- }
- else if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Contains("{source_folder_name}") && !string.IsNullOrEmpty(task.Source))
+ // If there is an auto name path, use it...
+ if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().StartsWith("{source_path}") && !string.IsNullOrEmpty(task.Source))
+ {
+ string savedPath = userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().Replace("{source_path}\\", string.Empty).Replace("{source_path}", string.Empty);
+
+ string directory = Directory.Exists(task.Source)
+ ? task.Source
+ : Path.GetDirectoryName(task.Source);
+ string requestedPath = Path.Combine(directory, savedPath);
+
+ autoNamePath = Path.Combine(requestedPath, destinationFilename);
+ if (autoNamePath == task.Source)
{
- // Second Case: We have a Path, with "{source_folder}" in it, therefore we need to replace it with the folder name from the source.
- string path = Path.GetDirectoryName(task.Source);
- if (!string.IsNullOrEmpty(path))
- {
- string[] filesArray = path.Split(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
- string sourceFolder = filesArray[filesArray.Length - 1];
-
- autoNamePath = Path.Combine(userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Replace("{source_folder_name}", sourceFolder), destinationFilename);
- }
+ // Append out_ to files that already exist or is the source file
+ autoNamePath = Path.Combine(Path.GetDirectoryName(task.Source), "output_" + destinationFilename);
}
- else if (!task.Destination.Contains(Path.DirectorySeparatorChar.ToString()))
+ }
+ else if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Contains("{source_folder_name}") && !string.IsNullOrEmpty(task.Source))
+ {
+ // Second Case: We have a Path, with "{source_folder}" in it, therefore we need to replace it with the folder name from the source.
+ string path = Path.GetDirectoryName(task.Source);
+ if (!string.IsNullOrEmpty(path))
{
- // Third case: If the destination box doesn't already contain a path, make one.
- if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim() != string.Empty &&
- userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim() != "Click 'Browse' to set the default location")
- {
- autoNamePath = Path.Combine(userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath), destinationFilename);
- }
- else // ...otherwise, output to the source directory
- autoNamePath = null;
+ string[] filesArray = path.Split(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
+ string sourceFolder = filesArray[filesArray.Length - 1];
+
+ autoNamePath = Path.Combine(userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Replace("{source_folder_name}", sourceFolder), destinationFilename);
}
- else // Otherwise, use the path that is already there.
+ }
+ else if (!task.Destination.Contains(Path.DirectorySeparatorChar.ToString()))
+ {
+ // Third case: If the destination box doesn't already contain a path, make one.
+ if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim() != string.Empty &&
+ userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim() != "Click 'Browse' to set the default location")
{
- // Use the path and change the file extension to match the previous destination
- autoNamePath = Path.Combine(Path.GetDirectoryName(task.Destination), destinationFilename);
+ autoNamePath = Path.Combine(userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath), destinationFilename);
}
+ else // ...otherwise, output to the source directory
+ autoNamePath = null;
+ }
+ else // Otherwise, use the path that is already there.
+ {
+ // Use the path and change the file extension to match the previous destination
+ autoNamePath = Path.Combine(Path.GetDirectoryName(task.Destination), destinationFilename);
}
-
- return autoNamePath;
}
+
+ return autoNamePath;
}
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 1e6034cf9..d742eea5c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -7,8 +7,6 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-using HandBrakeWPF.Services.Interfaces;
-
namespace HandBrakeWPF.ViewModels
{
using System;
@@ -19,12 +17,10 @@ namespace HandBrakeWPF.ViewModels using System.IO;
using System.Linq;
using System.Windows;
- using System.Windows.Media;
using Caliburn.Micro;
using HandBrake.ApplicationServices;
- using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
@@ -35,6 +31,8 @@ namespace HandBrakeWPF.ViewModels using Ookii.Dialogs.Wpf;
+ using HandBrakeWPF.Services.Interfaces;
+
/// <summary>
/// HandBrakes Main Window
/// </summary>
@@ -83,6 +81,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private string sourceLabel;
+ /// <summary>
+ /// The Selected Output Format Backing Field
+ /// </summary>
+ private OutputFormat selectedOutputFormat;
+
+ /// <summary>
+ /// Is a MKV file backing field
+ /// </summary>
+ private bool isMkv;
+
public string sourcePath;
private string dvdDrivePath;
private string dvdDriveLabel;
@@ -289,10 +297,11 @@ namespace HandBrakeWPF.ViewModels {
get
{
- if (this.selectedSourceType == SourceType.DvdDrive)
- {
- return this.dvdDriveLabel;
- }
+ // TODO
+ //if (this.selectedSourceType == SourceType.DvdDrive)
+ //{
+ // return this.dvdDriveLabel;
+ //}
if (selectedTitle != null && !string.IsNullOrEmpty(selectedTitle.SourceName))
{
@@ -403,7 +412,39 @@ namespace HandBrakeWPF.ViewModels }
}
- /* Properties for User Selections */
+ /// <summary>
+ /// Gets or sets a value indicating whether IsMkv.
+ /// </summary>
+ public bool IsMkv
+ {
+ get
+ {
+ return this.isMkv;
+ }
+ set
+ {
+ this.isMkv = value;
+ this.NotifyOfPropertyChange("IsMkv");
+ }
+ }
+
+ /// <summary>
+ /// Gets RangeMode.
+ /// </summary>
+ public IEnumerable<OutputFormat> OutputFormats
+ {
+ get
+ {
+ return new List<OutputFormat>
+ {
+ OutputFormat.Mp4, OutputFormat.Mkv
+ };
+ }
+ }
+
+ #endregion
+
+ #region Properties for Settings
/// <summary>
/// Gets or sets SelectedTitle.
@@ -505,6 +546,25 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Gets or sets SelectedOutputFormat.
+ /// </summary>
+ public OutputFormat SelectedOutputFormat
+ {
+ get
+ {
+ return this.selectedOutputFormat;
+ }
+ set
+ {
+ this.selectedOutputFormat = value;
+ this.NotifyOfPropertyChange("SelectedOutputFormat");
+ this.NotifyOfPropertyChange("IsMkv");
+ this.SetExtension(string.Format(".{0}", this.selectedOutputFormat.ToString().ToLower())); // TODO, tidy up
+ }
+ }
+
+
#endregion
#region Load and Shutdown Handling
@@ -574,7 +634,7 @@ namespace HandBrakeWPF.ViewModels {
this.WindowManager.ShowWindow(IoC.Get<IPreviewViewModel>());
}
-
+
/// <summary>
/// Launch the Help pages.
/// </summary>
@@ -669,11 +729,11 @@ namespace HandBrakeWPF.ViewModels if (File.Exists(this.CurrentTask.Destination))
{
- MessageBoxResult result = this.errorService.ShowMessageBox("The current file already exists, do you wish to overwrite it?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (result == MessageBoxResult.No)
- {
- return;
- }
+ MessageBoxResult result = this.errorService.ShowMessageBox("The current file already exists, do you wish to overwrite it?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question);
+ if (result == MessageBoxResult.No)
+ {
+ return;
+ }
}
// Create the Queue Task and Start Processing
@@ -733,6 +793,7 @@ namespace HandBrakeWPF.ViewModels this.CurrentTask.Destination = dialog.FileName;
this.NotifyOfPropertyChange("CurrentTask");
+ this.SetExtension(Path.GetExtension(dialog.FileName));
}
/// <summary>
@@ -808,16 +869,14 @@ namespace HandBrakeWPF.ViewModels MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{
- Preset preset = new Preset
- { Name = parsed.PresetName, CropSettings = parsed.UsesPictureSettings, Task = parsed };
+ Preset preset = new Preset { Name = parsed.PresetName, CropSettings = parsed.UsesPictureSettings, Task = parsed };
presetService.Update(preset);
}
}
else
{
- Preset preset = new Preset
- { Name = parsed.PresetName, Task = parsed, CropSettings = parsed.UsesPictureSettings, };
+ Preset preset = new Preset { Name = parsed.PresetName, Task = parsed, CropSettings = parsed.UsesPictureSettings, };
presetService.Add(preset);
}
@@ -835,7 +894,7 @@ namespace HandBrakeWPF.ViewModels {
savefiledialog.ShowDialog();
string filename = savefiledialog.FileName;
-
+
if (filename != null)
{
PlistPresetHandler.Export(savefiledialog.FileName, this.selectedPreset);
@@ -859,7 +918,7 @@ namespace HandBrakeWPF.ViewModels #endregion
- #region Private Worker Methods
+ #region Private Methods
/// <summary>
/// Start a Scan
@@ -878,6 +937,54 @@ namespace HandBrakeWPF.ViewModels this.scanService.Scan(filename, title, this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount));
}
+ /// <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 = this.CurrentTask.RequiresM4v ? ".m4v" : ".mp4";
+ break;
+ case 1: // MP4
+ newExtension = ".mp4";
+ break;
+ case 2: // M4v
+ newExtension = ".m4v";
+ break;
+ }
+
+ this.selectedOutputFormat = OutputFormat.Mp4;
+ this.IsMkv = false;
+ }
+
+ // Now disable controls that are not required. The Following are for MP4 only!
+ if (newExtension == ".mkv")
+ {
+ this.IsMkv = true;
+ this.CurrentTask.LargeFile = false;
+ this.CurrentTask.OptimizeMP4 = false;
+ this.CurrentTask.IPod5GSupport = false;
+ this.selectedOutputFormat = OutputFormat.Mkv;
+ }
+
+ // Update The browse file extension display
+ if (Path.HasExtension(newExtension))
+ {
+ this.CurrentTask.Destination = Path.ChangeExtension(this.CurrentTask.Destination, newExtension);
+ }
+
+ // Update the UI Display
+ this.NotifyOfPropertyChange("CurrentTask");
+ }
+
#endregion
#region Event Handlers
diff --git a/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml b/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml index 512a1b91d..161546a41 100644 --- a/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml @@ -2,7 +2,10 @@ 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:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+ xmlns:cal="http://www.caliburnproject.org"
+ xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
@@ -22,9 +25,86 @@ <Button Content="Remove" Click="Remove" Grid.Column="1" Width="75" />
</Grid>
- <DataGrid Grid.Row="2" Margin="10" ItemsSource="{Binding AudioTracks, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <ListBox Grid.Row="2" ItemsSource="{Binding AudioTracks, RelativeSource={RelativeSource AncestorType=UserControl}}"
+ SelectionMode="Extended" Background="LightGray" Margin="10,10,10,10">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="ListBoxItem">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
+ </Style>
+ </ListBox.ItemContainerStyle>
- </DataGrid>
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+
+ <Grid HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!-- Marker -->
+ <Image Source="../Images/Movies.png" Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" />
+
+ <!-- Settings -->
+ <Grid Grid.Column="1" HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="28" />
+ <RowDefinition Height="28" />
+ </Grid.RowDefinitions>
+
+ <!-- Row 1-->
+
+ <TextBlock Text="Source" FontWeight="Bold" Grid.Column="0" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Height="22" />
+ <TextBlock Text="Codec" FontWeight="Bold" Grid.Column="2" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22" />
+ <TextBlock Text="Bitrate" FontWeight="Bold" Grid.Column="4" VerticalAlignment="Center" />
+ <ComboBox Width="70" Grid.Column="5" Margin="5,0,5,0" Height="22" />
+ <TextBlock Text="Samplerate" FontWeight="Bold" Grid.Column="6" VerticalAlignment="Center" />
+ <ComboBox Width="70" Grid.Column="7" Margin="5,0,5,0" Height="22" />
+
+ <!-- Row 2-->
+ <TextBlock Text="Mixdown" FontWeight="Bold" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"/>
+ <ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Grid.Row="1" Height="22" />
+ <TextBlock Text="DRC" FontWeight="Bold" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center"/>
+ <NumericUpDown:NumericUpDown Width="45" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" Margin="5,0,5,0" />
+ <TextBlock Text="Gain" FontWeight="Bold" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center"/>
+ <NumericUpDown:NumericUpDown Width="45" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0" />
+
+ </Grid>
+
+ <!-- Delete -->
+ <Image Source="../Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="RemoveJob">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+
+ </Grid>
+
+
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
</Grid>
</UserControl>
diff --git a/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml index 8ae5e48d1..19c195e5d 100644 --- a/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml @@ -3,6 +3,8 @@ 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:cal="http://www.caliburnproject.org"
+ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+ xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
@@ -24,9 +26,87 @@ <Button Content="Import SRT" Click="ImportSrt" Grid.Column="2" Width="75" />
</Grid>
- <DataGrid Grid.Row="2" Margin="10" ItemsSource="{Binding SubtitleTracks, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <ListBox Grid.Row="2" ItemsSource="{Binding SubtitleTracks, RelativeSource={RelativeSource AncestorType=UserControl}}"
+ SelectionMode="Extended" Background="LightGray" Margin="10,10,10,10">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="ListBoxItem">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
+ </Style>
+ </ListBox.ItemContainerStyle>
- </DataGrid>
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!-- Marker -->
+ <Image Source="../Images/Movies.png" Width="16" Height="16" Grid.Column="0" Margin="10,0,10,0" />
+
+ <!-- Settings -->
+ <Grid Grid.Column="1" HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="28" />
+ <RowDefinition Height="28" />
+ </Grid.RowDefinitions>
+
+ <!-- Row 1-->
+
+ <TextBlock Text="Source" FontWeight="Bold" Grid.Column="0" VerticalAlignment="Center" />
+ <ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Height="22" />
+ <TextBlock Text="Forced Only" FontWeight="Bold" Grid.Column="2" VerticalAlignment="Center" />
+ <CheckBox Grid.Column="3" VerticalAlignment="Center" Margin="5,0,5,0"/>
+ <TextBlock Text="Burn In" FontWeight="Bold" Grid.Column="4" VerticalAlignment="Center" />
+ <CheckBox Grid.Column="5" VerticalAlignment="Center" Margin="5,0,5,0"/>
+ <TextBlock Text="Default" FontWeight="Bold" Grid.Column="6" VerticalAlignment="Center" />
+ <CheckBox Grid.Column="7" VerticalAlignment="Center" Margin="5,0,5,0"/>
+
+ <!-- Row 2-->
+ <TextBlock Text="Language" FontWeight="Bold" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"/>
+ <ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Grid.Row="1" Height="22" />
+ <TextBlock Text="Char Code" FontWeight="Bold" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center"/>
+ <ComboBox Width="100" Grid.Column="3" Grid.Row="1" Margin="5,0,5,0" Height="22" />
+ <TextBlock Text="Offset" FontWeight="Bold" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center"/>
+ <NumericUpDown:NumericUpDown Width="45" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0" />
+
+ </Grid>
+
+ <!-- Delete -->
+ <Image Source="../Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">
+ <i:Interaction.Triggers>
+ <i:EventTrigger EventName="MouseDown">
+ <cal:ActionMessage MethodName="RemoveJob">
+ <cal:Parameter Value="{Binding}" />
+ </cal:ActionMessage>
+ </i:EventTrigger>
+ </i:Interaction.Triggers>
+ </Image>
+
+ </Grid>
+
+
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+
+
</Grid>
</UserControl>
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index cd4e5ccc4..4fb29ae7c 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -173,11 +173,14 @@ <Label Content="Output Settings (Preset: None)" FontWeight="Bold" />
<StackPanel Orientation="Horizontal">
<Label Content="Container" Margin="8,0,0,0" />
- <ComboBox Name="Container" Margin="8,0,0,0" MinWidth="100" SelectedItem="{Binding Path=CurrentTask.OutputFormat}" />
-
- <CheckBox Name="LargeFileMp4" Content="Large File Size" IsChecked="{Binding Path=CurrentTask.LargeFile}" VerticalAlignment="Center" Margin="8,0,0,0" />
- <CheckBox Name="WebOptimized" Content="Web Optimized" IsChecked="{Binding Path=CurrentTask.OptimizeMP4}" VerticalAlignment="Center" Margin="8,0,0,0" />
- <CheckBox Name="iPod5G" Content="iPod 5G Support" IsChecked="{Binding Path=CurrentTask.IPod5GSupport}" VerticalAlignment="Center" Margin="8,0,0,0" />
+ <ComboBox Name="Container" Margin="8,0,0,0" MinWidth="100" ItemsSource="{Binding OutputFormats}" SelectedItem="{Binding SelectedOutputFormat}" />
+
+ <CheckBox Name="LargeFileMp4" Content="Large File Size" IsChecked="{Binding Path=CurrentTask.LargeFile}"
+ Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" VerticalAlignment="Center" Margin="8,0,0,0" />
+ <CheckBox Name="WebOptimized" Content="Web Optimized" IsChecked="{Binding Path=CurrentTask.OptimizeMP4}"
+ Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" VerticalAlignment="Center" Margin="8,0,0,0" />
+ <CheckBox Name="iPod5G" Content="iPod 5G Support" IsChecked="{Binding Path=CurrentTask.IPod5GSupport}"
+ Visibility="{Binding IsMkv, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" VerticalAlignment="Center" Margin="8,0,0,0" />
</StackPanel>
</StackPanel>
|