diff options
author | Scott <[email protected]> | 2015-10-24 20:54:18 +0100 |
---|---|---|
committer | Scott <[email protected]> | 2015-10-24 20:54:18 +0100 |
commit | 0c541998fd82d300293ce9b7ab508d2f25627543 (patch) | |
tree | a108e0a1f4ab0190c119b03e5974081772cf8f81 /win/CS | |
parent | f08c123b7723df0a84b5b72cbb485c052cb7747a (diff) |
Improve the In-line queue display.
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml | 280 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml.cs | 27 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml | 19 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml.cs | 7 |
8 files changed, 336 insertions, 21 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 91d292c20..2af3ba412 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -297,6 +297,9 @@ <Compile Include="Views\MiniView.xaml.cs">
<DependentUpon>MiniView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\Queue\Embedded.xaml.cs">
+ <DependentUpon>Embedded.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\ShellView.xaml.cs">
<DependentUpon>ShellView.xaml</DependentUpon>
</Compile>
@@ -478,6 +481,10 @@ <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Views\Queue\Embedded.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\ShellView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 7a1f586a2..64b75e793 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1228,16 +1228,14 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.IsQueueShowingInLine);
this.QueueViewModel.Activate(false);
- Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.Content.GetType() == typeof(QueueView));
-
+ Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(QueueView));
if (window != null)
{
window.Activate();
}
else
{
- // TODO to control the size of this window, we will probably have to create a new window for hosting the queue.
- this.windowManager.ShowWindow(this.QueueViewModel);
+ this.windowManager.ShowWindow(IoC.Get<IQueueViewModel>());
}
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 18bb49284..cd3405d78 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -165,7 +165,7 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Display the current job status information.
/// </summary>
- public bool DisplayJobStatusInfo { get; set; } = false;
+ public bool IsQueueEmbedded { get; set; } = false;
#endregion
@@ -393,8 +393,8 @@ namespace HandBrakeWPF.ViewModels /// <param name="isInline">Indicdates if this panel is displayed in-line with the main view.</param>
public void Activate(bool isInline)
{
- this.DisplayJobStatusInfo = !isInline;
- this.NotifyOfPropertyChange(() => this.DisplayJobStatusInfo);
+ this.IsQueueEmbedded = !isInline;
+ this.NotifyOfPropertyChange(() => this.IsQueueEmbedded);
}
#endregion
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 9cdbfb626..bfec2c3e6 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -485,7 +485,7 @@ <!-- Tab Control -->
<TabControl Name="tabControl"
Grid.Row="4"
- Margin="10,10,5,5"
+ Margin="10,10,5,6"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
MinHeight="350" MinWidth="720"
@@ -522,10 +522,9 @@ <RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Content="Queue" FontWeight="Bold" Grid.Row="0"/>
- <ContentControl x:Name="QueueViewModel" Grid.Row="1" />
+ <ContentControl x:Name="QueueViewModel" cal:View.Context="Embedded" Margin="5,0,0,0" Grid.Row="1" />
</Grid>
-
<!-- Presets -->
<GroupBox Grid.RowSpan="4"
Grid.Column="1"
diff --git a/win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml b/win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml new file mode 100644 index 000000000..61565b74d --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml @@ -0,0 +1,280 @@ +<UserControl x:Class="HandBrakeWPF.Views.Queue.Embedded" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:cal="http://www.caliburnproject.org" + xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio" + xmlns:Subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles" + xmlns:video="clr-namespace:HandBrakeWPF.Converters.Video" + xmlns:commands="clr-namespace:HandBrakeWPF.Commands" + xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers" + xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" + + MinWidth="350" + MinHeight="250" + TextOptions.TextFormattingMode="Display" + mc:Ignorable="d"> + + <UserControl.Resources> + <Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" /> + <Converters:FullPathToFileNameConverter x:Key="filePathToFilenameConverter" /> + <Converters:EnumComboConverter x:Key="enumComboConverter" /> + <Converters:QueueStatusToVisibilityConverter x:Key="queueStatusVisConverter" /> + <Audio:AudioQueueDisplayConverter x:Key="audioTrackDisplayConverter" /> + <Subtitles:SubtitlesQueueDisplayConverter x:Key="subtitleTrackDisplayConverter" /> + <video:EncoderOptionsTooltipConverter x:Key="encoderOptionsTooltipConverter" /> + <video:VideoOptionsTooltipConverter x:Key="videoOptionsTooltipConverter" /> + + <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement"> + <Setter Property="ToolTipService.ShowDuration" Value="10000" /> + </Style> + + </UserControl.Resources> + + <Grid> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + + <ListBox Grid.Row="2" + Margin="10,5,0,1" + dd:DragDrop.DropHandler="{Binding}" + dd:DragDrop.IsDragSource="True" + dd:DragDrop.IsDropTarget="True" + ItemsSource="{Binding QueueTasks, Mode=OneWay}" + helpers:ListBoxHelper.SelectedItems="{Binding SelectedItems}" + SelectionMode="Extended"> + + <i:Interaction.Triggers> + <commands:InputBindingTrigger> + <commands:InputBindingTrigger.InputBinding> + <KeyBinding Key="Delete"/> + </commands:InputBindingTrigger.InputBinding> + <cal:ActionMessage MethodName="RemoveSelectedJobs" /> + </commands:InputBindingTrigger> + </i:Interaction.Triggers> + + <ListBox.ContextMenu> + <ContextMenu> + <MenuItem cal:Message.Attach="[Event Click] = [Action ClearCompleted]" Header="{x:Static Properties:ResourcesUI.QueueView_ClearCompleted}" /> + <MenuItem cal:Message.Attach="[Event Click] = [Action Clear]" Header="{x:Static Properties:ResourcesUI.QueueView_ClearAll}" /> + <MenuItem cal:Message.Attach="[Event Click] = [Action RemoveSelectedJobs]" Header="{x:Static Properties:ResourcesUI.QueueView_ClearSelected}" /> + <Separator /> + <MenuItem cal:Message.Attach="[Event Click] = [Action Import]" Header="{x:Static Properties:ResourcesUI.QueueView_Import}" /> + <MenuItem cal:Message.Attach="[Event Click] = [Action Export]" Header="{x:Static Properties:ResourcesUI.QueueView_Export}" /> + </ContextMenu> + </ListBox.ContextMenu> + + <ListBox.ItemContainerStyle> + <Style TargetType="{x:Type ListBoxItem}"> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + <Setter Property="Margin" Value="0,0,0,1" /> + <Setter Property="ToolTip"> + <Setter.Value> + <Grid MaxWidth="650" Margin="0,5,0,5" Style="{StaticResource LongToolTipHolder}"> + <Grid.Resources> + <Style TargetType="TextBlock"> + <Setter Property="Margin" Value="0,5,0,5" /> + </Style> + </Grid.Resources> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="95" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_Source}" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" /> + <TextBlock Text="{Binding Task.Source}" TextWrapping="Wrap" Grid.Row="0" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_Destination}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" /> + <TextBlock Text="{Binding Task.Destination}" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_PictureSettings}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" /> + <TextBlock Text="{Binding Task.PictureSettingsDesc}" TextWrapping="Wrap" Grid.Row="2" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_Video}" Grid.Row="3" Grid.Column="0" /> + <TextBlock Text="{Binding Task, Converter={StaticResource videoOptionsTooltipConverter}}" Grid.Row="3" Grid.Column="1" TextWrapping="Wrap" /> + + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_Audio}" Grid.Row="4" Grid.Column="0"/> + <TextBlock Text="{Binding Task.AudioTracks, Converter={StaticResource audioTrackDisplayConverter}}" + Grid.Row="4" Grid.Column="1"/> + + <TextBlock FontWeight="Bold" VerticalAlignment="Top" Text="{x:Static Properties:ResourcesUI.QueueView_Subtitles}" Grid.Row="5" Grid.Column="0" /> + <TextBlock Text="{Binding Task.SubtitleTracks, Converter={StaticResource subtitleTrackDisplayConverter}}" + Grid.Row="5" Grid.Column="1" /> + + <TextBlock FontWeight="Bold" VerticalAlignment="Top" Grid.Row="6" Grid.Column="0" Text="{x:Static Properties:ResourcesUI.QueueView_Advanced}" /> + <TextBlock Text="{Binding Task, Converter={StaticResource encoderOptionsTooltipConverter}}" Grid.Row="6" Grid.Column="1" TextWrapping="Wrap" /> + </Grid> + + </Setter.Value> + </Setter> + + </Style> + </ListBox.ItemContainerStyle> + + <ListBox.ItemTemplate> + <DataTemplate x:Name="QueueItemTemplate"> + + <Grid HorizontalAlignment="Stretch"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <!-- Marker --> + <Image Grid.Column="0" + Width="16" + Height="16" + Margin="10,0,10,0"> + <Image.Style> + <Style TargetType="{x:Type Image}"> + <Style.Triggers> + <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Waiting"> + <Setter Property="Source" Value="..\Images\Movies.png" /> + </DataTrigger> + <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="In Progress"> + <Setter Property="Source" Value="..\Images\Working0.png" /> + </DataTrigger> + <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Completed"> + <Setter Property="Source" Value="..\Images\Complete.png" /> + </DataTrigger> + <DataTrigger Binding="{Binding Status, Converter={StaticResource enumComboConverter}}" Value="Error"> + <Setter Property="Source" Value="..\Images\WarningSmall.png" /> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + + <!-- Settings --> + <StackPanel Grid.Column="1" + Margin="0,5,0,5" + HorizontalAlignment="Stretch"> + <StackPanel Orientation="Horizontal"> + <TextBlock FontWeight="Bold" Text="Title: " /> + <TextBlock Text="{Binding Task.Title}" /> + + <TextBlock Margin="10,0,0,0" + FontWeight="Bold" + Text="{Binding Task.PointToPointMode}" /> + <TextBlock Text=": " /> + <TextBlock Text="{Binding Task.StartPoint}" /> + <TextBlock Margin="5,0,5,0" Text="to" /> + <TextBlock Text="{Binding Task.EndPoint}" /> + </StackPanel> + + <!-- TODO Support Drive Label Name --> + <StackPanel Orientation="Horizontal"> + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_Source}" /> + <TextBlock Text="{Binding Task.Source, Converter={StaticResource filePathToFilenameConverter}}" /> + </StackPanel> + + <StackPanel Orientation="Horizontal"> + <TextBlock FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.QueueView_Destination}" /> + <TextBlock Text="{Binding Task.Destination, Converter={StaticResource filePathToFilenameConverter}}" /> + </StackPanel> + </StackPanel> + + <!-- Delete --> + <Grid Grid.Column="2" + Margin="10,0,10,0" + VerticalAlignment="Center"> + + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <Button Visibility="{Binding Status, Converter={StaticResource queueStatusVisConverter}}" + Grid.Row="0" Grid.Column="0" Margin="0,5,0,0"> + <Button.Template> + <ControlTemplate> + <Image Width="20" + Height="20" VerticalAlignment="Center" + Source="../Images/Refresh.ico" + ToolTip="{x:Static Properties:ResourcesTooltips.QueueView_ResetJobStatus}"> + </Image> + </ControlTemplate> + </Button.Template> + <i:Interaction.Triggers> + <i:EventTrigger EventName="Click"> + <cal:ActionMessage MethodName="RetryJob"> + <cal:Parameter Value="{Binding}" /> + </cal:ActionMessage> + </i:EventTrigger> + </i:Interaction.Triggers> + </Button> + + <Button Grid.Row="0" Grid.Column="1" Margin="10,5,0,0"> + <Button.Template> + <ControlTemplate> + <Image Width="20" + Height="20" VerticalAlignment="Center" + Source="../Images/Options24.png" + ToolTip="{x:Static Properties:ResourcesTooltips.QueueView_SendJobBack}"> + </Image> + </ControlTemplate> + </Button.Template> + <i:Interaction.Triggers> + <i:EventTrigger EventName="Click"> + <cal:ActionMessage MethodName="EditJob"> + <cal:Parameter Value="{Binding}" /> + </cal:ActionMessage> + </i:EventTrigger> + </i:Interaction.Triggers> + </Button> + + <Button Grid.Row="0" Grid.Column="2" Margin="10,5,0,0"> + <Button.Template> + <ControlTemplate> + <Image Width="20" + Height="20" VerticalAlignment="Center" + Source="../Images/delete.png" + ToolTip="{x:Static Properties:ResourcesTooltips.QueueView_DeleteJob}"> + </Image> + </ControlTemplate> + </Button.Template> + <i:Interaction.Triggers> + <i:EventTrigger EventName="Click"> + <cal:ActionMessage MethodName="RemoveJob"> + <cal:Parameter Value="{Binding}" /> + </cal:ActionMessage> + </i:EventTrigger> + </i:Interaction.Triggers> + </Button> + + + </Grid> + + </Grid> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + + + </Grid> +</UserControl> diff --git a/win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml.cs b/win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml.cs new file mode 100644 index 000000000..74109f775 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/Queue/Embedded.xaml.cs @@ -0,0 +1,27 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="Embedded.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 Embedded.xaml +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Views.Queue +{ + using System.Windows.Controls; + + /// <summary> + /// Interaction logic for VideoView + /// </summary> + public partial class Embedded : UserControl + { + /// <summary> + /// Initializes a new instance of the <see cref="Embedded"/> class. + /// </summary> + public Embedded() + { + this.InitializeComponent(); + } + } +} diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index 13df0e626..864b89c5a 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -1,4 +1,4 @@ -<UserControl x:Class="HandBrakeWPF.Views.QueueView"
+<Window x:Class="HandBrakeWPF.Views.QueueView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.caliburnproject.org"
@@ -14,13 +14,16 @@ xmlns:commands="clr-namespace:HandBrakeWPF.Commands"
xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers"
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
-
+ Title="{Binding Title}"
+ Width="700"
+ Height="500"
MinWidth="350"
MinHeight="250"
+ WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display"
mc:Ignorable="d">
- <UserControl.Resources>
+ <Window.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:FullPathToFileNameConverter x:Key="filePathToFilenameConverter" />
<Converters:EnumComboConverter x:Key="enumComboConverter" />
@@ -34,7 +37,7 @@ <Setter Property="ToolTipService.ShowDuration" Value="10000" />
</Style>
- </UserControl.Resources>
+ </Window.Resources>
<Grid>
@@ -176,9 +179,9 @@ </DockPanel>
</ToolBar>
- <StackPanel Grid.Row="1" Margin="10,20,10,0" Visibility="{Binding DisplayJobStatusInfo, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}">
- <TextBlock Text="{Binding JobsPending}" />
- <TextBlock Text="{Binding JobStatus}" />
+ <StackPanel Grid.Row="1" Margin="10,20,10,0">
+ <TextBlock Text="{Binding JobsPending}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" />
+ <TextBlock Text="{Binding JobStatus}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis"/>
</StackPanel>
<ListBox Grid.Row="2"
@@ -415,4 +418,4 @@ </Grid>
-</UserControl>
+</Window>
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs b/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs index e69dabe77..344a804cf 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml.cs @@ -10,19 +10,20 @@ namespace HandBrakeWPF.Views
{
using System.Windows;
- using System.Windows.Controls;
+
+ using HandBrakeWPF.Views;
/// <summary>
/// Interaction logic for VideoView
/// </summary>
- public partial class QueueView : UserControl
+ public partial class QueueView : Window
{
/// <summary>
/// Initializes a new instance of the <see cref="QueueView"/> class.
/// </summary>
public QueueView()
{
- InitializeComponent();
+ this.InitializeComponent();
}
}
}
|