mirror of
https://github.com/unclshura/splitter.git
synced 2026-06-22 00:22:01 +00:00
Added FontAwesome. Added suggested op decal.
This commit is contained in:
parent
1f93eba839
commit
3f1924a429
@ -2,6 +2,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
x:Class="Splitter_UI.App"
|
x:Class="Splitter_UI.App"
|
||||||
xmlns:local="using:Splitter_UI"
|
xmlns:local="using:Splitter_UI"
|
||||||
|
xmlns:cnv="using:Splitter_UI.Converters"
|
||||||
RequestedThemeVariant="Default">
|
RequestedThemeVariant="Default">
|
||||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||||
|
|
||||||
@ -9,7 +10,13 @@
|
|||||||
<local:ViewLocator/>
|
<local:ViewLocator/>
|
||||||
</Application.DataTemplates>
|
</Application.DataTemplates>
|
||||||
|
|
||||||
|
<Application.Resources>
|
||||||
|
<cnv:ActionToIconConverter x:Key="ActionToIconConverter"/>
|
||||||
|
<FontFamily x:Key="FontAwesome">avares://Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf#Font Awesome 7 Free Solid</FontFamily>
|
||||||
|
</Application.Resources>
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<FluentTheme />
|
<FluentTheme/>
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
|
|
||||||
</Application>
|
</Application>
|
||||||
BIN
Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Regular-400.otf
Normal file
BIN
Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Regular-400.otf
Normal file
Binary file not shown.
BIN
Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf
Normal file
BIN
Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf
Normal file
Binary file not shown.
20
Splitter-UI/Converters/ActionToIconConverter.cs
Normal file
20
Splitter-UI/Converters/ActionToIconConverter.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
using Avalonia.Media;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Splitter_UI;
|
namespace Splitter_UI;
|
||||||
@ -46,6 +47,14 @@ internal sealed class Program
|
|||||||
public static AppBuilder BuildAvaloniaApp(ServiceProvider provider)
|
public static AppBuilder BuildAvaloniaApp(ServiceProvider provider)
|
||||||
=> AppBuilder.Configure<App>(() => new App(provider))
|
=> AppBuilder.Configure<App>(() => new App(provider))
|
||||||
.UsePlatformDetect()
|
.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
|
#if DEBUG
|
||||||
.WithDeveloperTools()
|
.WithDeveloperTools()
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -37,5 +37,6 @@ public partial class FileJobViewModel : ObservableObject
|
|||||||
{
|
{
|
||||||
Probe = await _fileProbe.ProbeAsync(Job);
|
Probe = await _fileProbe.ProbeAsync(Job);
|
||||||
Thumbnail = await _thumbnails.CreateThumbnailAsync(Job.InputFile, Probe);
|
Thumbnail = await _thumbnails.CreateThumbnailAsync(Job.InputFile, Probe);
|
||||||
|
SuggestedAction = Probe.Rotation == 0 ? "crop" : "rotate";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="clr-namespace:Splitter_UI.ViewModels"
|
xmlns:vm="clr-namespace:Splitter_UI.ViewModels"
|
||||||
xmlns:views="clr-namespace:Splitter_UI.Views"
|
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:Class="Splitter_UI.Views.FileListView"
|
||||||
x:DataType="vm:FileListViewModel">
|
x:DataType="vm:FileListViewModel">
|
||||||
|
|
||||||
@ -39,11 +40,23 @@
|
|||||||
<DataTemplate x:DataType="vm:FileJobViewModel">
|
<DataTemplate x:DataType="vm:FileJobViewModel">
|
||||||
<Border Margin="6" Padding="6" Background="#2A2A2A" CornerRadius="4">
|
<Border Margin="6" Padding="6" Background="#2A2A2A" CornerRadius="4">
|
||||||
<StackPanel MinWidth="160" MaxWidth="160">
|
<StackPanel MinWidth="160" MaxWidth="160">
|
||||||
|
|
||||||
<Border Width="160" Height="90" ClipToBounds="True">
|
<Border Width="160" Height="90" ClipToBounds="True">
|
||||||
|
<Grid>
|
||||||
|
<!-- Thumbnail -->
|
||||||
<Image Source="{Binding Thumbnail}"
|
<Image Source="{Binding Thumbnail}"
|
||||||
Stretch="UniformToFill"
|
Stretch="UniformToFill"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"/>
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<!-- Suggested action decal -->
|
||||||
|
<TextBlock
|
||||||
|
FontFamily="{StaticResource FontAwesome}"
|
||||||
|
Text="{Binding SuggestedAction, Converter={StaticResource ActionToIconConverter}}"
|
||||||
|
FontSize="12"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Foreground="LimeGreen"/>
|
||||||
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<TextBlock Text="{Binding FileName}"
|
<TextBlock Text="{Binding FileName}"
|
||||||
@ -51,9 +64,6 @@
|
|||||||
Margin="0,6,0,0"
|
Margin="0,6,0,0"
|
||||||
FontSize="10"/>
|
FontSize="10"/>
|
||||||
|
|
||||||
<TextBlock Text="{Binding SuggestedAction}"
|
|
||||||
Foreground="LightGreen"
|
|
||||||
FontSize="10"/>
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
MinWidth="160"
|
MinWidth="160"
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Media;
|
||||||
|
using Avalonia.Platform;
|
||||||
|
|
||||||
namespace Splitter_UI.Views;
|
namespace Splitter_UI.Views;
|
||||||
|
|
||||||
@ -8,5 +11,19 @@ public partial class MainWindow : Window
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
//var uri = new Uri("avares://Splitter-UI/Assets/Fonts/Font Awesome 7 Free-Solid-900.otf");
|
||||||
|
|
||||||
|
//if (!AssetLoader.Exists(uri))
|
||||||
|
//{
|
||||||
|
// Console.WriteLine("Resource NOT FOUND: " + uri);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//using var stream = AssetLoader.Open(uri);
|
||||||
|
//using var ms = new MemoryStream();
|
||||||
|
//stream.CopyTo(ms);
|
||||||
|
|
||||||
|
//Console.WriteLine("Resource FOUND. Size = " + ms.Length + " bytes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user