diff options
author | sr55 <[email protected]> | 2017-12-15 21:13:47 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2017-12-15 21:13:56 +0000 |
commit | 5283a0a7e3200218b7074574f65d2f849a052edb (patch) | |
tree | 30db0366333ff7478d4aebb085d07af51314fd81 /win/CS | |
parent | 5922dd68fcec189e3ffc33ea5a01d3b848636535 (diff) |
WinGui: Summary Tab Preview UI Consistency Tweaks to match the MacGUI. Moving the controls under the preview instead of an overlay.
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs | 19 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SummaryView.xaml | 40 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs | 36 |
5 files changed, 34 insertions, 68 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs index e7440b7a8..8ed5deb78 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISummaryViewModel.cs @@ -19,6 +19,5 @@ namespace HandBrakeWPF.ViewModels.Interfaces event EventHandler<OutputFormatChangedEventArgs> OutputFormatChanged; void SetContainer(OutputFormat container); void UpdateDisplayedInfo(); - void SetPreviewControlVisibility(bool isPreviousVisible, bool isNextVisible); } }
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs index 248ff157d..a0e4b2a78 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -46,7 +46,6 @@ namespace HandBrakeWPF.ViewModels private int selectedPreview = 2; private bool isPreviousPreviewControlVisible; - private bool isNextPreviewControlVisible; public SummaryViewModel(IScan scanService, IUserSettingService userSettingService) @@ -144,7 +143,6 @@ namespace HandBrakeWPF.ViewModels public string DimensionInfo { get; set; } public string AspectInfo { get; set; } - public bool IsPreviewInfoVisible { get; set; } public string PreviewInfo { get; set; } @@ -291,6 +289,7 @@ namespace HandBrakeWPF.ViewModels this.CurrentTitle = selectedTitle; this.Task = encodeTask; this.UpdateDisplayedInfo(); + this.SetPreviewControlVisibility(); } public void SetPreset(Preset currentPreset, EncodeTask encodeTask) @@ -364,10 +363,7 @@ namespace HandBrakeWPF.ViewModels this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, maxPreview); this.NotifyOfPropertyChange(() => this.PreviewInfo); - if (this.selectedPreview == maxPreview) - { - this.IsNextPreviewControlVisible = false; - } + this.SetPreviewControlVisibility(); } public void PreviousPreview() @@ -378,17 +374,14 @@ namespace HandBrakeWPF.ViewModels this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, maxPreview); this.NotifyOfPropertyChange(() => this.PreviewInfo); - if (this.selectedPreview == 1) - { - this.IsPreviousPreviewControlVisible = false; - } + this.SetPreviewControlVisibility(); } - public void SetPreviewControlVisibility(bool isPreviousVisible, bool isNextVisible) + public void SetPreviewControlVisibility() { if (this.selectedPreview > 1) { - this.IsPreviousPreviewControlVisible = isPreviousVisible; + this.IsPreviousPreviewControlVisible = true; } else { @@ -397,7 +390,7 @@ namespace HandBrakeWPF.ViewModels if (this.selectedPreview < this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount)) { - this.IsNextPreviewControlVisible = isNextVisible; + this.IsNextPreviewControlVisible = true; } else { diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index a783b126a..624ab40b2 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -277,12 +277,12 @@ <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="{x:Static Properties:ResourcesUI.MainView_Source}" FontWeight="Bold" Grid.Column="0" />
- <TextBlock Text="{Binding Path=SourceLabel}" TextTrimming="CharacterEllipsis" Grid.Column="1" MaxWidth="400" />
- <TextBlock Text="{Binding SourceInfo}" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="DimGray" Grid.Column="2" MaxWidth="400" />
+ <TextBlock Text="{Binding Path=SourceLabel}" TextTrimming="CharacterEllipsis" Grid.Column="1" MaxWidth="400" />
+ <TextBlock Text="{Binding SourceInfo}" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="DimGray" Grid.Column="2" Margin="15,0,0,0" MaxWidth="400" />
</Grid>
<StackPanel Orientation="Horizontal">
diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml b/win/CS/HandBrakeWPF/Views/SummaryView.xaml index e0da631d4..e2d638554 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml @@ -104,12 +104,12 @@ <RowDefinition Height="*" /> </Grid.RowDefinitions> - <Grid Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Top"> + <Grid Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Top" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="*" /> - <RowDefinition Height="Auto" MinHeight="26" /> - <RowDefinition Height="Auto" MinHeight="26" /> + <RowDefinition Height="Auto"/> + <RowDefinition Height="32"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> @@ -117,23 +117,33 @@ <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> - <Image Source="{Binding PreviewImage}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,5,10,0" x:Name="previewImage" MouseMove="PreviewImage_OnMouseMove" MouseLeave="PreviewImage_OnMouseLeave" Panel.ZIndex="0" Grid.ColumnSpan="2" + <Image Source="{Binding PreviewImage}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,5,10,0" x:Name="previewImage" Panel.ZIndex="0" Grid.ColumnSpan="2" MaxWidth="{Binding MaxWidth}" MaxHeight="{Binding MaxHeight}" /> - <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Left" Panel.ZIndex="1" cal:Message.Attach="[Event MouseDown] = [Action PreviousPreview]" Grid.ColumnSpan="2" - Background="Black" Opacity="0.75" Margin="20,0,0,0" Visibility="{Binding IsPreviousPreviewControlVisible, Converter={StaticResource boolToVisConverter}}" > - <TextBlock Text="<" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> + <Border Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Background="Transparent" Margin="0,5,0,5"> + <TextBlock Text="{Binding PreviewInfo}" TextAlignment="Center" Visibility="{Binding IsPreviewInfoVisible, Converter={StaticResource boolToVisConverter}}" /> </Border> - <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Center" HorizontalAlignment="Right" Panel.ZIndex="1" cal:Message.Attach="[Event MouseDown] = [Action NextPreview]" Grid.ColumnSpan="2" - Background="Black" Opacity="0.75" Margin="0,0,20,0" Visibility="{Binding IsNextPreviewControlVisible, Converter={StaticResource boolToVisConverter}}"> - <TextBlock Text=">" FontSize="30" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="8,3" Margin="0" /> - </Border> + <Grid Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" HorizontalAlignment="Center" Width="84" Visibility="{Binding IsPreviewControlsVisible, Converter={StaticResource boolToVisConverter}}"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="42" /> + <ColumnDefinition Width="42" /> + </Grid.ColumnDefinitions> + <Border BorderThickness="1,1,1,1" CornerRadius="4,0,0,4" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" cal:Message.Attach="[Event MouseDown] = [Action PreviousPreview]" + Visibility="{Binding IsPreviousPreviewControlVisible,Converter={StaticResource boolToVisConverter}}" + Background="Black" Opacity="0.5" Margin="0,0,0,0" > + <TextBlock Text="<" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="16,1" Margin="0,0,0,4" /> + </Border> + + <Border BorderThickness="1,1,1,1" CornerRadius="0,4,4,0" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="1" cal:Message.Attach="[Event MouseDown] = [Action NextPreview]" + Background="Black" Opacity="0.5" Margin="0,0,0,0" + Visibility="{Binding IsNextPreviewControlVisible,Converter={StaticResource boolToVisConverter}}" > + <TextBlock Text=">" FontSize="16" Foreground="White" Padding="16,1" VerticalAlignment="Center" TextAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,4" /> + </Border> + + </Grid> + - <Border BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" VerticalAlignment="Bottom" HorizontalAlignment="Center" Grid.ColumnSpan="2" - Background="Black" Opacity="0.75" Margin="0,5,0,10"> - <TextBlock Text="{Binding PreviewInfo}" FontSize="14" Foreground="White" Padding="8,3" Visibility="{Binding IsPreviewInfoVisible, Converter={StaticResource boolToVisConverter}}" /> - </Border> </Grid> </Grid> diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs index 5b0354576..e3c35b48e 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs @@ -10,13 +10,6 @@ namespace HandBrakeWPF.Views { using System.Windows.Controls; - using System.Windows.Input; - using System.Windows.Media; - - using HandBrakeWPF.ViewModels.Interfaces; - - using Image = System.Windows.Controls.Image; - using Point = System.Windows.Point; /// <summary> /// Interaction logic for SummaryView.xaml @@ -27,34 +20,5 @@ namespace HandBrakeWPF.Views { this.InitializeComponent(); } - - private void PreviewImage_OnMouseMove(object sender, MouseEventArgs e) - { - Image image = sender as Image; - - if (image != null && image.ActualWidth > 0) - { - Point p = Mouse.GetPosition(image); - double width = image.ActualWidth / 2; - - bool leftHalf = p.X <= width; - bool rightHalf = p.X > width; - - ((ISummaryViewModel)this.DataContext).SetPreviewControlVisibility(leftHalf, rightHalf); - } - } - - private void PreviewImage_OnMouseLeave(object sender, MouseEventArgs e) - { - HitTestResult result = VisualTreeHelper.HitTest(this.previewImage, e.GetPosition(this.previewImage)); - - if (result != null && result.VisualHit.GetType() == typeof(Image)) - { - e.Handled = true; - return; - } - - ((ISummaryViewModel)this.DataContext).SetPreviewControlVisibility(false, false); - } } } |