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
Theme: one opacity setting, and the hex field stays editable
KnifeLemon7aa83e70c1c2
diff --git a/src/Filee.App/ViewModels/Pages/ThemePageViewModel.cs b/src/Filee.App/ViewModels/Pages/ThemePageViewModel.csindex 9ed9b8ae..950f17ae 100644--- a/src/Filee.App/ViewModels/Pages/ThemePageViewModel.cs+++ b/src/Filee.App/ViewModels/Pages/ThemePageViewModel.cs@@ -2,7 +2,6 @@using Avalonia.Media;using CommunityToolkit.Mvvm.ComponentModel;-using CommunityToolkit.Mvvm.Input;using Filee.App.Controls;using Filee.App.Services;using Filee.Core.Localization;@@ -26,7 +25,6 @@ public sealed partial class ThemePageViewModel : ObservableObjectAccent = Color.TryParse(theme.Accent, out var c) ? c : Colors.MediumPurple;AccentHex = $"#{Accent.R:X2}{Accent.G:X2}{Accent.B:X2}";CornerRadius = theme.CornerRadius;- DonutOpacityPercent = Math.Clamp(store.Settings.Donut.Opacity * 100, 10, 100);ReduceMotion = theme.ReduceMotion ?? platform.PrefersReducedMotion;PreviewItems =[@@ -50,8 +48,6 @@ public sealed partial class ThemePageViewModel : ObservableObjectpublic IBrush AccentBrush => new SolidColorBrush(Accent);[ObservableProperty] private double _cornerRadius;- [ObservableProperty, NotifyPropertyChangedFor(nameof(DonutSliceOpacity))] private double _donutOpacityPercent;- public double DonutSliceOpacity => DonutOpacityPercent / 100;[ObservableProperty] private bool _reduceMotion;partial void OnModeChanged(Choice<ThemeMode>? oldValue, Choice<ThemeMode> newValue)@@ -74,18 +70,8 @@ public sealed partial class ThemePageViewModel : ObservableObjectAccent = Color.FromRgb(color.R, color.G, color.B);}partial void OnCornerRadiusChanged(double value) => Save(t => t.CornerRadius = Math.Round(value));- partial void OnDonutOpacityPercentChanged(double value)- {- if (_loading)- return;- _store.Settings.Donut.Opacity = Math.Clamp(value / 100, 0.1, 1);- _store.SaveSettings();- }partial void OnReduceMotionChanged(bool value) => Save(t => t.ReduceMotion = value);- [RelayCommand]- private void PickSwatch(Color color) => Accent = color;-private void Save(Action<ThemeSettings> change){if (_loading)diff --git a/src/Filee.App/Views/Pages/ThemePage.axaml b/src/Filee.App/Views/Pages/ThemePage.axamlindex 1314fb0e..cda938e4 100644--- a/src/Filee.App/Views/Pages/ThemePage.axaml+++ b/src/Filee.App/Views/Pages/ThemePage.axaml@@ -70,7 +70,8 @@<x:Double x:Key="ColorViewTabStripHeight">0</x:Double></ColorPicker.Resources></ColorPicker>- <TextBlock Text="{Binding AccentHex}" VerticalAlignment="Center" FlowDirection="LeftToRight" />+ <TextBox Text="{Binding AccentHex}" Width="120" PlaceholderText="#7F77DD" FlowDirection="LeftToRight"+ AutomationProperties.Name="{DynamicResource theme.custom_color}" /></StackPanel></StackPanel></Border>@@ -97,20 +98,12 @@<Border Grid.Row="1" Grid.Column="2" Classes="card" VerticalAlignment="Top"><StackPanel Spacing="14"><TextBlock Classes="label" Text="{DynamicResource theme.preview}" />- <c:DonutMenu x:Name="PreviewDonut" Items="{Binding PreviewItems}" SliceOpacity="{Binding DonutSliceOpacity}"- OuterRadius="120" CenterTitle="JPG × 3" HorizontalAlignment="Center" />+ <c:DonutMenu x:Name="PreviewDonut" Items="{Binding PreviewItems}" OuterRadius="120" CenterTitle="JPG × 3" HorizontalAlignment="Center" /><StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Center"><Button Classes="accent" Content="{DynamicResource common.save}" /><Button Content="{DynamicResource common.cancel}" /></StackPanel>- <StackPanel Spacing="4">- <DockPanel>- <TextBlock DockPanel.Dock="Right" Text="{Binding DonutOpacityPercent, StringFormat={}{0:0}%}" />- <TextBlock Classes="label" Text="{DynamicResource toolbar.opacity}" />- </DockPanel>- <Slider x:Name="OpacitySlider" Minimum="10" Maximum="100" Value="{Binding DonutOpacityPercent}"- TickFrequency="1" IsSnapToTickEnabled="True" AutomationProperties.Name="{DynamicResource toolbar.opacity}" />- </StackPanel>+ <Slider Value="60" Maximum="100" /><ToggleSwitch IsChecked="True" HorizontalAlignment="Center" /></StackPanel></Border>diff --git a/tests/Filee.App.Tests/ThemeOpacityTests.cs b/tests/Filee.App.Tests/ThemeOpacityTests.csdeleted file mode 100644index 59461f73..00000000--- a/tests/Filee.App.Tests/ThemeOpacityTests.cs+++ /dev/null@@ -1,65 +0,0 @@-// Issue #276: the opacity example in Theme must control and preview the persisted donut opacity.--using Avalonia.Controls;-using Avalonia.Headless.XUnit;-using Filee.App.Controls;-using Filee.App.Services;-using Filee.App.ViewModels.Pages;-using Filee.App.Views.Pages;-using Filee.Core.Localization;-using Filee.Core.Platform;-using Filee.Core.Settings;--namespace Filee.App.Tests;--public class ThemeOpacityTests-{- [AvaloniaTheory]- [InlineData(ThemeMode.Light)]- [InlineData(ThemeMode.Dark)]- public void Opacity_slider_updates_the_real_preview_and_survives_reopening(ThemeMode mode)- {- TestServices.EnsureInitialized();- var folder = Directory.CreateTempSubdirectory("filee-opacity-").FullName;- var store = new UserDataStore(folder);- store.Load();- store.Settings.Theme.Mode = mode;- store.Settings.Donut.Opacity = 0.72;- AppHost.Get<ThemeService>().Apply(store.Settings.Theme, "en");- var model = new ThemePageViewModel(store, AppHost.Get<ILocalizer>(), AppHost.Get<IPlatformServices>());- var page = new ThemePage { DataContext = model };- var window = new Window { Content = page, Width = 980, Height = 760 };- try- {- window.Show();- RenderTests.Pump();- var slider = page.FindControl<Slider>("OpacitySlider")!;- var preview = page.FindControl<DonutMenu>("PreviewDonut")!;- Assert.Equal(72, slider.Value);- Assert.Equal(0.72, preview.SliceOpacity, 6);-- slider.Value = 30;- RenderTests.Pump();- Assert.Equal(0.30, preview.SliceOpacity, 6);- Assert.Equal(0.30, store.Settings.Donut.Opacity, 6);- RenderTests.Save(window, $"issue276-opacity-30-{mode}.png");-- slider.Value = 100;- RenderTests.Pump();- Assert.Equal(1, preview.SliceOpacity);- RenderTests.Save(window, $"issue276-opacity-100-{mode}.png");-- var reloaded = new UserDataStore(folder);- reloaded.Load();- var reopened = new ThemePageViewModel(reloaded, AppHost.Get<ILocalizer>(), AppHost.Get<IPlatformServices>());- Assert.Equal(100, reopened.DonutOpacityPercent);- Assert.Equal(1, reopened.DonutSliceOpacity);- }- finally- {- window.Close();- TestServices.EnsureInitialized();- Directory.Delete(folder, true);- }- }-}