diff --git a/Splitter-UI/App.axaml b/Splitter-UI/App.axaml index f167199..11ae681 100644 --- a/Splitter-UI/App.axaml +++ b/Splitter-UI/App.axaml @@ -2,6 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Splitter_UI.App" xmlns:local="using:Splitter_UI" + xmlns:cnv="using:Splitter_UI.Converters" RequestedThemeVariant="Default"> @@ -9,7 +10,13 @@ + + + avares://Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf#Font Awesome 7 Free Solid + + - + + \ No newline at end of file diff --git a/Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Regular-400.otf b/Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Regular-400.otf new file mode 100644 index 0000000..7cf3bee Binary files /dev/null and b/Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Regular-400.otf differ diff --git a/Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf b/Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf new file mode 100644 index 0000000..b00559c Binary files /dev/null and b/Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf differ diff --git a/Splitter-UI/Converters/ActionToIconConverter.cs b/Splitter-UI/Converters/ActionToIconConverter.cs new file mode 100644 index 0000000..b2a5144 --- /dev/null +++ b/Splitter-UI/Converters/ActionToIconConverter.cs @@ -0,0 +1,20 @@ +using System.Globalization; +using Avalonia.Data.Converters; + +namespace Splitter_UI.Converters; + +public sealed class ActionToIconConverter : IValueConverter +{ + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + return value switch + { + "crop" => "\uf125", // FA7 crop + "rotate" => "\uf2f1", // FA7 rotate + _ => null + }; + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + => throw new NotSupportedException(); +} diff --git a/Splitter-UI/Program.cs b/Splitter-UI/Program.cs index d435954..85d83c7 100644 --- a/Splitter-UI/Program.cs +++ b/Splitter-UI/Program.cs @@ -1,4 +1,5 @@ using Avalonia; +using Avalonia.Media; using Microsoft.Extensions.DependencyInjection; namespace Splitter_UI; @@ -46,6 +47,14 @@ internal sealed class Program public static AppBuilder BuildAvaloniaApp(ServiceProvider provider) => AppBuilder.Configure(() => new App(provider)) .UsePlatformDetect() + .With(new FontManagerOptions + { + FontFallbacks = new[] + { + new FontFallback { FontFamily = new FontFamily("Font Awesome 7 Free") }, + new FontFallback { FontFamily = new FontFamily("Font Awesome 7 Free Solid") } + } + }) #if DEBUG .WithDeveloperTools() #endif diff --git a/Splitter-UI/ViewModels/FileJobViewModel.cs b/Splitter-UI/ViewModels/FileJobViewModel.cs index cc8d896..7b23c7c 100644 --- a/Splitter-UI/ViewModels/FileJobViewModel.cs +++ b/Splitter-UI/ViewModels/FileJobViewModel.cs @@ -35,7 +35,8 @@ public partial class FileJobViewModel : ObservableObject private async Task LoadThumbnailAsync() { - Probe = await _fileProbe.ProbeAsync(Job); - Thumbnail = await _thumbnails.CreateThumbnailAsync(Job.InputFile, Probe); + Probe = await _fileProbe.ProbeAsync(Job); + Thumbnail = await _thumbnails.CreateThumbnailAsync(Job.InputFile, Probe); + SuggestedAction = Probe.Rotation == 0 ? "crop" : "rotate"; } } diff --git a/Splitter-UI/Views/FileListView.axaml b/Splitter-UI/Views/FileListView.axaml index 59e9c0e..3d58a2f 100644 --- a/Splitter-UI/Views/FileListView.axaml +++ b/Splitter-UI/Views/FileListView.axaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:Splitter_UI.ViewModels" xmlns:views="clr-namespace:Splitter_UI.Views" + xmlns:svg="clr-namespace:Avalonia.Svg.Skia;assembly=Avalonia.Svg.Skia" x:Class="Splitter_UI.Views.FileListView" x:DataType="vm:FileListViewModel"> @@ -39,21 +40,30 @@ - - - + + + + + + + + + + -