Skip to content

armgit / Filee

Public Imported from GitHub
0

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.

Sponsors get their own card near the top of the About page

KnifeLemon3562363bbd71
diff --git a/src/Filee.App/Views/Pages/AboutPage.axaml b/src/Filee.App/Views/Pages/AboutPage.axaml
index 808d0abc..138e267f 100644
--- a/src/Filee.App/Views/Pages/AboutPage.axaml
+++ b/src/Filee.App/Views/Pages/AboutPage.axaml
@@ -23,6 +23,13 @@
</StackPanel>
</StackPanel>
</Border>
+ <!-- The sponsors right below Filee itself, while there are any -->
+ <Border Classes="card" IsVisible="{Binding #Supporters.IsVisible}">
+ <StackPanel Spacing="12">
+ <TextBlock Classes="h2" Text="{DynamicResource sponsor.thanks}" />
+ <v:SupportersView x:Name="Supporters" ShowTitle="False" LogoHeight="40" />
+ </StackPanel>
+ </Border>
<Border Classes="card">
<StackPanel Spacing="12">
<TextBlock Classes="h2" Text="{DynamicResource about.updates}" />
@@ -53,7 +60,6 @@
</StackPanel>
</Button>
</WrapPanel>
- <v:SupportersView Margin="0,6,0,0" />
</StackPanel>
</Border>
<Border Classes="card">
diff --git a/src/Filee.App/Views/SupportersView.axaml b/src/Filee.App/Views/SupportersView.axaml
index 1055b8a3..3cac0a23 100644
--- a/src/Filee.App/Views/SupportersView.axaml
+++ b/src/Filee.App/Views/SupportersView.axaml
@@ -13,7 +13,7 @@
</Style>
</UserControl.Styles>
<StackPanel Spacing="6">
- <TextBlock Classes="label" Text="{DynamicResource sponsor.thanks}" />
+ <TextBlock x:Name="Title" Classes="label" Text="{DynamicResource sponsor.thanks}" />
<ItemsControl x:Name="Logos">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -24,7 +24,7 @@
<DataTemplate x:DataType="v:SupporterItem">
<Button Classes="supporter" Click="OnOpen" Tag="{Binding Url}" ToolTip.Tip="{Binding Name}">
<Panel>
- <Image Source="{Binding Logo}" Height="28" MaxWidth="140" Stretch="Uniform"
+ <Image Source="{Binding Logo}" Height="{Binding $parent[v:SupportersView].LogoHeight}" MaxWidth="200" Stretch="Uniform"
IsVisible="{Binding Logo, Converter={x:Static ObjectConverters.IsNotNull}}" />
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" VerticalAlignment="Center"
IsVisible="{Binding Logo, Converter={x:Static ObjectConverters.IsNull}}" />
diff --git a/src/Filee.App/Views/SupportersView.axaml.cs b/src/Filee.App/Views/SupportersView.axaml.cs
index 7a7d7d74..8399b69d 100644
--- a/src/Filee.App/Views/SupportersView.axaml.cs
+++ b/src/Filee.App/Views/SupportersView.axaml.cs
@@ -14,12 +14,39 @@ public sealed record SupporterItem(string Name, string? Url, Bitmap? Logo);
/// <summary>The sponsors' logos and the backers' names shipped with this release; hidden while there are none.</summary>
public partial class SupportersView : UserControl
{
+ public static readonly StyledProperty<double> LogoHeightProperty =
+ AvaloniaProperty.Register<SupportersView, double>(nameof(LogoHeight), 28);
+
+ public static readonly StyledProperty<bool> ShowTitleProperty =
+ AvaloniaProperty.Register<SupportersView, bool>(nameof(ShowTitle), true);
+
+ /// <summary>Height of the logos: small in the Sponsor window, larger on the About page.</summary>
+ public double LogoHeight
+ {
+ get => GetValue(LogoHeightProperty);
+ set => SetValue(LogoHeightProperty, value);
+ }
+
+ /// <summary>Whether the view shows its own "Thank you" line (the About page card has a heading instead).</summary>
+ public bool ShowTitle
+ {
+ get => GetValue(ShowTitleProperty);
+ set => SetValue(ShowTitleProperty, value);
+ }
+
public SupportersView()
{
InitializeComponent();
Show(Supporters.Bundled, BundledLogo);
}
+ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
+ {
+ base.OnPropertyChanged(change);
+ if (change.Property == ShowTitleProperty)
+ Title.IsVisible = ShowTitle;
+ }
+
/// <summary>Shows <paramref name="list"/>, the logos read by <paramref name="logo"/> (null when missing).</summary>
public void Show(SupporterList list, Func<string, Bitmap?> logo)
{
diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.cs
index 8dccdab6..26208f47 100644
--- a/tests/Filee.App.Tests/RenderTests.cs
+++ b/tests/Filee.App.Tests/RenderTests.cs
@@ -388,6 +388,19 @@ public class RenderTests
Save(window, "window-sponsor-supporters-en.png");
window.Close();
+ var vm = new MainWindowViewModel(AppHost.Services, AppHost.Get<Filee.Core.Localization.ILocalizer>(), AppHost.Get<UpdateService>());
+ vm.Navigate("about");
+ var main = new MainWindow { DataContext = vm, Width = 1080, Height = 820 };
+ main.Show();
+ Pump();
+ var about = main.GetVisualDescendants().OfType<Filee.App.Views.Pages.AboutPage>().Single();
+ about.Supporters.Show(new SupporterList(
+ [new Supporter("Acme", "https://acme.example", "acme.png"), new Supporter("Globex", "https://globex.example")],
+ [new("Kim"), new("Lee"), new("Park")]), _ => Logo());
+ Pump();
+ Save(main, "page-about-supporters-en.png");
+ main.Close();
+
// A stand-in logo: a wide coloured mark like a company's.
static Avalonia.Media.Imaging.Bitmap Logo()
{