Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Donut toolbar: count both faces, clear button on search, fresh preset search per donut (#425, #427)
cre8ive-marketing9ba5ba17d92b
diff --git a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.csindex 078ab663..1d05900d 100644--- a/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/ToolbarPageViewModel.cs@@ -26,17 +26,26 @@ public sealed partial class ProfileItemViewModel(ToolbarProfile profile, ILocali{public ToolbarProfile Profile { get; } = profile;+ private ILocalizer _loc = loc;+[ObservableProperty] private string _name = loc.DisplayName(profile);- public string Count => $"{Profile.PresetIds.Count}";+ /// <summary>Slices on the front, and on the back when it has any (#425): "8" or "8 · 3".</summary>+ public string Count => Profile.BackPresetIds is { Count: > 0 } back ? $"{Profile.PresetIds.Count} · {back.Count}" : $"{Profile.PresetIds.Count}";++ /// <summary>What the two numbers are: "Front 8 · Back 3".</summary>+ public string CountTip =>+ $"{_loc["toolbar.face_front"]} {Profile.PresetIds.Count} · {_loc["toolbar.face_back"]} {Profile.BackPresetIds?.Count ?? 0}";/// <summary>A donut for mixed selections (marked in the list).</summary>public bool IsMixed => Profile.IsFallback;public void Refresh(ILocalizer l){+ _loc = l;Name = l.DisplayName(Profile);OnPropertyChanged(nameof(Count));+ OnPropertyChanged(nameof(CountTip));OnPropertyChanged(nameof(IsMixed));}}@@ -199,6 +208,8 @@ public sealed partial class ToolbarPageViewModel : ObservableObject, IDisposableProfileName = value is null ? "" : _loc.DisplayName(value.Profile);_loading = false;Message = null;+ // A search typed for the last donut's presets would hide this one's (#427).+ PaletteSearch = "";RebuildProfileEditor();ForgetJudgements();Rebuild();diff --git a/src/Filee.App/Views/Pages/HomePage.axaml b/src/Filee.App/Views/Pages/HomePage.axamlindex e1eb35d9..94bafb31 100644--- a/src/Filee.App/Views/Pages/HomePage.axaml+++ b/src/Filee.App/Views/Pages/HomePage.axaml@@ -74,7 +74,7 @@<Button DockPanel.Dock="Right" Classes="ghost" Content="{DynamicResource home.clear_history}" Command="{Binding ClearHistoryCommand}" /><TextBlock Classes="h2" VerticalAlignment="Center" Text="{DynamicResource home.recent}" /></DockPanel>- <TextBox Classes="search" Text="{Binding Search}" PlaceholderText="{DynamicResource common.search}"+ <TextBox Classes="search clearButton" Text="{Binding Search}" PlaceholderText="{DynamicResource common.search}"IsVisible="{Binding !IsEmpty}"><TextBox.InnerLeftContent><PathIcon Width="14" Height="14" Margin="10,0,0,0" Data="{StaticResource Icon.Search}" Foreground="{DynamicResource TextSecondaryBrush}" />diff --git a/src/Filee.App/Views/Pages/PresetsPage.axaml b/src/Filee.App/Views/Pages/PresetsPage.axamlindex 3da5b6da..316a0b8c 100644--- a/src/Filee.App/Views/Pages/PresetsPage.axaml+++ b/src/Filee.App/Views/Pages/PresetsPage.axaml@@ -23,7 +23,7 @@<PathIcon Width="14" Height="14" Data="{StaticResource Icon.Delete}" /></Button></WrapPanel>- <TextBox Classes="search" DockPanel.Dock="Top" Margin="0,0,0,8" Text="{Binding Search}" Watermark="{DynamicResource common.search}">+ <TextBox Classes="search clearButton" DockPanel.Dock="Top" Margin="0,0,0,8" Text="{Binding Search}" Watermark="{DynamicResource common.search}"><TextBox.InnerLeftContent><PathIcon Width="14" Height="14" Margin="10,0,0,0" Data="{StaticResource Icon.Search}" Foreground="{DynamicResource TextSecondaryBrush}" /></TextBox.InnerLeftContent>diff --git a/src/Filee.App/Views/Pages/ToolbarPage.axaml b/src/Filee.App/Views/Pages/ToolbarPage.axamlindex ce94ec2d..6aaf7718 100644--- a/src/Filee.App/Views/Pages/ToolbarPage.axaml+++ b/src/Filee.App/Views/Pages/ToolbarPage.axaml@@ -141,7 +141,7 @@<!-- 1. Profiles --><StackPanel Spacing="8"><TextBlock Classes="label" Text="{DynamicResource toolbar.step_profile}" />- <TextBox Classes="search" Text="{Binding ProfileSearch}" Watermark="{DynamicResource common.search}">+ <TextBox Classes="search clearButton" Text="{Binding ProfileSearch}" Watermark="{DynamicResource common.search}"><TextBox.InnerLeftContent><PathIcon Width="14" Height="14" Margin="10,0,0,0" Data="{StaticResource Icon.Search}" Foreground="{DynamicResource TextSecondaryBrush}" /></TextBox.InnerLeftContent>@@ -150,7 +150,7 @@<ListBox.ItemTemplate><DataTemplate x:DataType="vm:ProfileItemViewModel"><DockPanel>- <Border DockPanel.Dock="Right" Classes="badge">+ <Border DockPanel.Dock="Right" Classes="badge" ToolTip.Tip="{Binding CountTip}"><TextBlock Classes="caption" Text="{Binding Count}" /></Border><PathIcon DockPanel.Dock="Right" Width="13" Height="13" Margin="0,0,8,0" Data="{StaticResource Icon.Shapes}"@@ -348,7 +348,7 @@</StackPanel></Button></Grid>- <TextBox Classes="search" Text="{Binding PaletteSearch}" Watermark="{DynamicResource common.search}">+ <TextBox Classes="search clearButton" Text="{Binding PaletteSearch}" Watermark="{DynamicResource common.search}"><TextBox.InnerLeftContent><PathIcon Width="14" Height="14" Margin="10,0,0,0" Data="{StaticResource Icon.Search}" Foreground="{DynamicResource TextSecondaryBrush}" /></TextBox.InnerLeftContent>diff --git a/tests/Filee.App.Tests/ToolbarEditorTests.cs b/tests/Filee.App.Tests/ToolbarEditorTests.csindex 08a3ada8..07112027 100644--- a/tests/Filee.App.Tests/ToolbarEditorTests.cs+++ b/tests/Filee.App.Tests/ToolbarEditorTests.cs@@ -240,6 +240,65 @@ public class ToolbarPageTests}}+ [AvaloniaFact]+ public void A_profile_counts_both_faces_and_switching_profiles_clears_the_preset_search()+ {+ TestServices.EnsureInitialized("en");+ var store = AppHost.Get<UserDataStore>();+ var profiles = store.Profiles.Select(p => p.Clone()).ToList();+ try+ {+ using var vm = new ToolbarPageViewModel(store, AppHost.Get<Filee.Core.Localization.ILocalizer>(), AppHost.Get<WindowService>(),+ AppHost.Get<PresetAvailability>(), AppHost.Get<ConverterCatalog>(), NullLogger<ToolbarPageViewModel>.Instance);++ // #425: the badge counted only the front face.+ var images = vm.Profiles.Single(p => p.Profile.Id == "images");+ images.Profile.PresetIds = ["to-png", "to-jpg", "to-webp"];+ images.Profile.BackPresetIds = ["to-pdf"];+ images.Refresh(AppHost.Get<Filee.Core.Localization.ILocalizer>());+ Assert.Equal("3 · 1", images.Count);+ Assert.Equal("Front 3 · Back 1", images.CountTip);+ images.Profile.BackPresetIds = [];+ images.Refresh(AppHost.Get<Filee.Core.Localization.ILocalizer>());+ Assert.Equal("3", images.Count); // no back face: the one number, as before++ // #427: a search typed for one donut's presets doesn't hide the next donut's.+ vm.SelectedProfile = images;+ vm.PaletteSearch = "png";+ vm.SelectedProfile = vm.Profiles.Single(p => p.Profile.Id == "pdf");+ Assert.Equal("", vm.PaletteSearch);+ Assert.Equal(vm.Palette.Count, vm.VisiblePalette.Count);+ }+ finally+ {+ store.Profiles.Clear();+ store.Profiles.AddRange(profiles);+ store.SaveLibrary();+ }+ }++ [AvaloniaFact]+ public void Search_boxes_have_a_clear_button()+ {+ TestServices.EnsureInitialized("en");+ using var vm = new ToolbarPageViewModel(AppHost.Get<UserDataStore>(), AppHost.Get<Filee.Core.Localization.ILocalizer>(), AppHost.Get<WindowService>(),+ AppHost.Get<PresetAvailability>(), AppHost.Get<ConverterCatalog>(), NullLogger<ToolbarPageViewModel>.Instance);+ var page = new ToolbarPage { DataContext = vm };+ var window = new Window { Content = page, Width = 1100, Height = 800 };+ window.Show();+ Dispatcher.UIThread.RunJobs();++ var boxes = page.GetVisualDescendants().OfType<TextBox>().Where(t => t.Classes.Contains("search")).ToList();+ Assert.Equal(2, boxes.Count);+ Assert.All(boxes, box => Assert.Contains("clearButton", box.Classes));+ vm.PaletteSearch = "pdf";+ boxes[1].Focus(); // Fluent shows the button in a focused box with text+ Dispatcher.UIThread.RunJobs();+ Assert.Contains(boxes[1].GetVisualDescendants().OfType<Button>(), b => b.IsEffectivelyVisible);+ RenderTests.Save(window, "toolbar-search-clear-en.png");+ window.Close();+ }+[AvaloniaFact]public void A_new_group_heads_the_available_presets_and_every_profile_count_stays_right(){@@ -270,7 +329,7 @@ public class ToolbarPageTestsvar chips = vm.VisiblePalette.Select(c => store.FindPreset(c.PresetId)!).ToList();var at = chips.FindIndex(p => p.Id == "test-new-group");Assert.True(at >= 0 && chips.Take(at).All(p => p.IsGroup), $"at {at}");- Assert.Equal($"{pdf.Profile.PresetIds.Count}", pdf.Count);+ Assert.Equal($"{pdf.Profile.PresetIds.Count} · {pdf.Profile.BackPresetIds!.Count}", pdf.Count);Assert.DoesNotContain("test-new-group", vm.SelectedProfile!.Profile.PresetIds); // on no donut until dragged there}finally@@ -312,7 +371,7 @@ public class ToolbarPageTestsAssert.False(vm.IsMixed);Assert.NotNull(vm.ExtensionTags);Assert.Equal(builtIn.PresetIds, vm.DonutItems.Select(d => d.Id));- Assert.Equal($"{builtIn.PresetIds.Count}", item.Count);+ Assert.Equal($"{builtIn.PresetIds.Count} · {builtIn.BackPresetIds!.Count}", item.Count);Assert.Equal(store.Profiles.Select(p => p.Id), vm.Profiles.Select(p => p.Profile.Id));Assert.Equal(store.Profiles.FindIndex(p => p.IsFallback) - 1, store.Profiles.IndexOf(item.Profile));