summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views/QueueSelectionView.xaml
blob: 6346727580cfb163907c2784377592cc9fcdcbd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<Window x:Class="HandBrakeWPF.Views.QueueSelectionView"
        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:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Conveters="clr-namespace:HandBrakeWPF.Converters"
        xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
        Title="{Binding Title}"
        MinWidth="550"
        Width="550"
        Height="475"
        MinHeight="475"
        WindowStartupLocation="CenterScreen"
        TextOptions.TextFormattingMode="Display"
        mc:Ignorable="d">

    <Window.Resources>

        <Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">
            <Setter Property="ToolTipService.ShowDuration" Value="20000" />
            <Setter Property="Margin" Value="0,2,0,2" />
        </Style>
        
        <Conveters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
    </Window.Resources>

    <Grid HorizontalAlignment="Stretch"
          VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!--  Header  -->
        <TextBlock Text="{x:Static Properties:Resources.QueueSelectionView_Title}" FontSize="26" FontFamily="Segoe UI Light" FontWeight="Bold" Margin="10,10,10,10" Grid.Row="0" />

        <!-- Text -->
        <StackPanel Orientation="Vertical" Grid.Row="1" Margin="10,0,10,0">
            <TextBlock Text="{x:Static Properties:Resources.QueueSelectionView_ChooseTitles}" />
        </StackPanel>

        <!-- Selection -->
        <ListBox x:Name="SelectionGrid" Grid.Row="2"
                 MinHeight="240"
                 Margin="10,10,10,10"
                 VerticalAlignment="Stretch"
                 HorizontalAlignment="Stretch"
                 ItemsSource="{Binding TitleList}"
                 SelectionMode="Single" 
                 PreviewKeyDown="SelectionGrid_OnKeyDown">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="Margin" Value="0,0,0,1" />
                </Style>
            </ListBox.ItemContainerStyle>

            <ListBox.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Select All" cal:Message.Attach="[Event Click] = [Action SelectAll]" />
                    <MenuItem Header="Deselect All" cal:Message.Attach="[Event Click] = [Action UnSelectAll]" />
                    <Separator />
                    <MenuItem Header="Order by Title" IsChecked="{Binding OrderedByTitle}" cal:Message.Attach="[Event Click] = [Action OrderByTitle]" />
                    <MenuItem Header="Order by Duration" IsChecked="{Binding OrderedByDuration}" cal:Message.Attach="[Event Click] = [Action OrderByDuration]" />
                    <MenuItem Header="Order by Name" IsChecked="{Binding OrderedByName}" cal:Message.Attach="[Event Click] = [Action OrderByName]" />
                </ContextMenu>
            </ListBox.ContextMenu>

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid HorizontalAlignment="Stretch" MinHeight="32" Margin="5">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        
                        <CheckBox IsChecked="{Binding IsSelected}" Grid.RowSpan="2" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" />

                        <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Margin="10,0,0,0" >                           
                            <TextBlock Text="Title:" Margin="0,0,5,0" FontWeight="Bold" />
                            <TextBlock Text="{Binding Title}" Margin="5,0,5,0" />
                        </StackPanel>

                        <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="10,0,0,0" >
                            <TextBlock Text="Source:" Margin="0,0,5,0" FontWeight="Bold" />
                            <TextBlock Text="{Binding SourceName}" Margin="5,0,5,0" />
                        </StackPanel>
                    </Grid>

                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <!-- Checlist -->
        <StackPanel Orientation="Vertical" Grid.Row="3" Margin="10,10,10,0">
            <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                <TextBlock Text="{Binding CurrentPreset}" TextWrapping="Wrap" />
            </StackPanel>
          
            <TextBlock Text="{x:Static Properties:Resources.QueueSelection_AutoNameWarning}"
                       TextWrapping="Wrap" Visibility="{Binding IsAutoNamingEnabled, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"/>
        </StackPanel>

        <!--  Controls  -->
        <Grid Grid.Row="4"
              Margin="0,20,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <Button Grid.Column="1"
                    Margin="0,5,10,10"
                    cal:Message.Attach="[Event Click] = [Action Cancel]"
                    Content="{x:Static Properties:Resources.Generic_Cancel}"
                    IsCancel="True"
                    Padding="8,2" />
            <Button Grid.Column="2"
                    Margin="0,5,10,10"
                    cal:Message.Attach="[Event Click] = [Action Add]"
                    Content="{x:Static Properties:Resources.Generic_Add}"
                    IsDefault="True"
                    Padding="8,2" />
        </Grid>

    </Grid>
</Window>