浏览代码

UI updates and gallery settings display fixes

Ruben 5 月之前
父节点
当前提交
8e50b101bb

+ 1 - 0
src/PicView.Avalonia/Gallery/GalleryFunctions.cs

@@ -347,6 +347,7 @@ public static class GalleryFunctions
         }
 
         vm.Translation.IsShowingBottomGallery = TranslationManager.Translation.HideBottomGallery;
+        vm.IsBottomGalleryShown = true;
         if (!NavigationManager.CanNavigate(vm))
         {
             return;

+ 7 - 7
src/PicView.Avalonia/StartUp/QuickLoad.cs

@@ -203,17 +203,17 @@ public static class QuickLoad
 
         if (Settings.Gallery.IsBottomGalleryShown)
         {
-            if (vm.IsUIShown)
+            bool loadGallery;
+            if (!vm.IsUIShown)
             {
-                vm.GalleryMode = GalleryMode.BottomNoAnimation;
-                tasks.Add(GalleryLoad.LoadGallery(vm, fileInfo.DirectoryName));
+                loadGallery = Settings.Gallery.ShowBottomGalleryInHiddenUI;
             }
-            else if (Settings.Gallery.ShowBottomGalleryInHiddenUI)
+            else
             {
-                vm.GalleryMode = GalleryMode.BottomNoAnimation;
-                tasks.Add(GalleryLoad.LoadGallery(vm, fileInfo.DirectoryName));
+                loadGallery = true;
             }
-            else if (Settings.WindowProperties.Fullscreen)
+            
+            if (loadGallery)
             {
                 vm.GalleryMode = GalleryMode.BottomNoAnimation;
                 tasks.Add(GalleryLoad.LoadGallery(vm, fileInfo.DirectoryName));

+ 17 - 14
src/PicView.Avalonia/Views/GallerySettingsView.axaml

@@ -23,33 +23,36 @@
             Text="{CompiledBinding Translation.GallerySettings,
                                    Mode=OneWay}" />
 
-        <ToggleButton
+        <Button
             Background="Transparent"
             BorderThickness="0"
             Classes="altHover changeColor"
             Command="{CompiledBinding ToggleBottomGalleryCommand}"
-            IsChecked="{CompiledBinding IsBottomGalleryShown}"
             Margin="0,0,0,10"
-            ToolTip.Tip="{CompiledBinding Translation.ShowBottomGallery,
-                                          Mode=OneWay}"
+            Padding="0,10,0,10"
             Width="300"
             x:Name="ToggleBottomGalleryButton">
-            <TextBlock
-                Classes="txt"
-                Margin="0"
-                MaxWidth="240"
-                Padding="0,1,5,0"
-                Text="{CompiledBinding Translation.ShowBottomGallery,
-                                       Mode=OneWay}" />
-        </ToggleButton>
+            <StackPanel Orientation="Horizontal">
+                <Image
+                    Height="20"
+                    Margin="9,0,9,0"
+                    Source="{StaticResource GalleryImage}"
+                    Width="20" />
+                <TextBlock
+                    Classes="txt"
+                    Margin="0"
+                    MaxWidth="240"
+                    Padding="0,1,5,0"
+                    Text="{CompiledBinding Translation.IsShowingBottomGallery}" />
+            </StackPanel>
+        </Button>
 
         <ToggleButton
             Background="Transparent"
             BorderThickness="0"
             Classes="altHover changeColor"
             Command="{CompiledBinding ToggleBottomGalleryShownInHiddenUICommand}"
-            IsChecked="{CompiledBinding IsBottomGalleryShownInHiddenUI,
-                                        Mode=TwoWay}"
+            IsChecked="{CompiledBinding IsBottomGalleryShownInHiddenUI}"
             Margin="0,0,0,10"
             Width="300">
             <TextBlock

+ 26 - 80
src/PicView.Avalonia/Views/GallerySettingsView.axaml.cs

@@ -18,104 +18,50 @@ public partial class GalleryView : UserControl
                 return;
             }
 
-            if (vm.IsUniformFullChecked)
-            {
-                FullGalleryComboBox.SelectedIndex = 0;
-            }
-            else if (vm.IsUniformToFillFullChecked)
-            {
-                FullGalleryComboBox.SelectedIndex = 1;
-            }
-            else if (vm.IsFillFullChecked)
-            {
-                FullGalleryComboBox.SelectedIndex = 2;
-            }
-            else if (vm.IsNoneFullChecked)
-            {
-                FullGalleryComboBox.SelectedIndex = 3;
-            }
-            else if (vm.IsSquareFullChecked)
+            if (Settings.Gallery.FullGalleryStretchMode.Equals("Square",
+                    StringComparison.OrdinalIgnoreCase))
             {
                 FullGalleryComboBox.SelectedIndex = 4;
             }
-            else if (vm.IsFillSquareFullChecked)
+            else if (Settings.Gallery.FullGalleryStretchMode.Equals("FillSquare",
+                         StringComparison.OrdinalIgnoreCase))
             {
                 FullGalleryComboBox.SelectedIndex = 5;
             }
-            else
+            else if (Enum.TryParse<Stretch>(Settings.Gallery.FullGalleryStretchMode,
+                         out var stretchMode))
             {
-                if (Settings.Gallery.FullGalleryStretchMode.Equals("Square",
-                        StringComparison.OrdinalIgnoreCase))
-                {
-                    FullGalleryComboBox.SelectedIndex = 4;
-                }
-                else if (Settings.Gallery.FullGalleryStretchMode.Equals("FillSquare",
-                             StringComparison.OrdinalIgnoreCase))
-                {
-                    FullGalleryComboBox.SelectedIndex = 5;
-                }
-                else if (Enum.TryParse<Stretch>(Settings.Gallery.FullGalleryStretchMode,
-                             out var stretchMode))
+                FullGalleryComboBox.SelectedIndex = stretchMode switch
                 {
-                    FullGalleryComboBox.SelectedIndex = stretchMode switch
-                    {
-                        Stretch.Uniform => 0,
-                        Stretch.UniformToFill => 1,
-                        Stretch.Fill => 2,
-                        Stretch.None => 3,
-                        _ => FullGalleryComboBox.SelectedIndex
-                    };
-                }
+                    Stretch.Uniform => 0,
+                    Stretch.UniformToFill => 1,
+                    Stretch.Fill => 2,
+                    Stretch.None => 3,
+                    _ => FullGalleryComboBox.SelectedIndex
+                };
             }
 
-            if (vm.IsUniformBottomChecked)
-            {
-                BottomGalleryComboBox.SelectedIndex = 0;
-            }
-            else if (vm.IsUniformToFillBottomChecked)
-            {
-                BottomGalleryComboBox.SelectedIndex = 1;
-            }
-            else if (vm.IsFillBottomChecked)
-            {
-                BottomGalleryComboBox.SelectedIndex = 2;
-            }
-            else if (vm.IsNoneBottomChecked)
-            {
-                BottomGalleryComboBox.SelectedIndex = 3;
-            }
-            else if (vm.IsSquareBottomChecked)
+            if (Settings.Gallery.BottomGalleryStretchMode.Equals("Square",
+                    StringComparison.OrdinalIgnoreCase))
             {
                 BottomGalleryComboBox.SelectedIndex = 4;
             }
-            else if (vm.IsFillSquareBottomChecked)
+            else if (Settings.Gallery.BottomGalleryStretchMode.Equals("FillSquare",
+                         StringComparison.OrdinalIgnoreCase))
             {
                 BottomGalleryComboBox.SelectedIndex = 5;
             }
-            else
+            else if (Enum.TryParse<Stretch>(Settings.Gallery.BottomGalleryStretchMode,
+                         out var stretchMode))
             {
-                if (Settings.Gallery.BottomGalleryStretchMode.Equals("Square",
-                        StringComparison.OrdinalIgnoreCase))
-                {
-                    BottomGalleryComboBox.SelectedIndex = 4;
-                }
-                else if (Settings.Gallery.BottomGalleryStretchMode.Equals("FillSquare",
-                             StringComparison.OrdinalIgnoreCase))
-                {
-                    BottomGalleryComboBox.SelectedIndex = 5;
-                }
-                else if (Enum.TryParse<Stretch>(Settings.Gallery.BottomGalleryStretchMode,
-                             out var stretchMode))
+                BottomGalleryComboBox.SelectedIndex = stretchMode switch
                 {
-                    BottomGalleryComboBox.SelectedIndex = stretchMode switch
-                    {
-                        Stretch.Uniform => 0,
-                        Stretch.UniformToFill => 1,
-                        Stretch.Fill => 2,
-                        Stretch.None => 3,
-                        _ => FullGalleryComboBox.SelectedIndex
-                    };
-                }
+                    Stretch.Uniform => 0,
+                    Stretch.UniformToFill => 1,
+                    Stretch.Fill => 2,
+                    Stretch.None => 3,
+                    _ => FullGalleryComboBox.SelectedIndex
+                };
             }
 
             FullGalleryComboBox.SelectionChanged += (_, _) => FullGalleryComboBox_SelectionChanged();