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.

Engine setup window fits small screens; INSTALL.txt names the qdbus variants

KnifeLemonbf444a528116
diff --git a/installer/linux/INSTALL.txt b/installer/linux/INSTALL.txt
index 5bdd8ea3..68d5c4a5 100644
--- a/installer/linux/INSTALL.txt
+++ b/installer/linux/INSTALL.txt
@@ -42,6 +42,8 @@ libwayland-client0 on Ubuntu). To turn it on:
kpackagetool6 --type=KWin/Script --install "${XDG_DATA_HOME:-$HOME/.local/share}/filee/application/kwin/filee-donut"
kwriteconfig6 --file kwinrc --group Plugins --key filee-donutEnabled true
qdbus6 org.kde.KWin /KWin reconfigure
+ The qdbus tool is qdbus6, qdbus-qt6 or plain qdbus depending on the
+ distribution; use whichever one you have.
After updating Filee, upgrade the installed script the same way, with
--upgrade instead of --install, then run the reconfigure line again.
Limits: Wayland cannot say which window is under the cursor, so a Ctrl+drag in
diff --git a/src/Filee.App/Views/EngineSetupWindow.axaml b/src/Filee.App/Views/EngineSetupWindow.axaml
index 8c2e1072..903011c5 100644
--- a/src/Filee.App/Views/EngineSetupWindow.axaml
+++ b/src/Filee.App/Views/EngineSetupWindow.axaml
@@ -8,56 +8,64 @@
Width="560" SizeToContent="Height" CanResize="False"
WindowStartupLocation="CenterScreen"
Background="{DynamicResource SurfaceBrush}">
- <StackPanel Margin="26,24" Spacing="16">
- <StackPanel Spacing="6">
+ <!-- The engine list scrolls between the fixed header and buttons: the window is no taller than the screen (#370). -->
+ <Grid RowDefinitions="Auto,*,Auto" Margin="0,24">
+ <StackPanel Spacing="6" Margin="26,0,26,12">
<TextBlock Classes="h1" Text="{DynamicResource setup.title}" />
<TextBlock Classes="muted" TextWrapping="Wrap" Text="{DynamicResource setup.description}" />
</StackPanel>
- <ItemsControl ItemsSource="{Binding Packages}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Spacing="10" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate x:DataType="svc:EnginePackageState">
- <Border Classes="card" Padding="14,12">
- <DockPanel>
- <!-- Already installed packages cannot be ticked; ticking is locked once installation started. -->
- <CheckBox DockPanel.Dock="Left" VerticalAlignment="Top" Margin="0,0,10,0"
- IsChecked="{Binding Selected}" IsEnabled="{Binding CanInstall}"
- IsVisible="{Binding !IsInstalled}" />
- <PathIcon DockPanel.Dock="Left" VerticalAlignment="Top" Margin="2,3,14,0" Width="14" Height="14"
- Data="{StaticResource Icon.Check}" Foreground="{DynamicResource SuccessBrush}" IsVisible="{Binding IsInstalled}" />
- <StackPanel Spacing="4">
- <StackPanel Orientation="Horizontal" Spacing="10">
- <TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
- <Border Classes="badge">
- <TextBlock Classes="caption" Text="{Binding StatusText}" />
- </Border>
+ <!-- 4px above and below so the first and last cards keep their shadow. -->
+ <ScrollViewer x:Name="PackageScroller" Grid.Row="1" Padding="26,4" HorizontalScrollBarVisibility="Disabled">
+ <ItemsControl ItemsSource="{Binding Packages}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Spacing="10" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate x:DataType="svc:EnginePackageState">
+ <Border Classes="card" Padding="14,12">
+ <DockPanel>
+ <!-- Already installed packages cannot be ticked; ticking is locked once installation started. -->
+ <CheckBox DockPanel.Dock="Left" VerticalAlignment="Top" Margin="0,0,10,0"
+ IsChecked="{Binding Selected}" IsEnabled="{Binding CanInstall}"
+ IsVisible="{Binding !IsInstalled}" />
+ <PathIcon DockPanel.Dock="Left" VerticalAlignment="Top" Margin="2,3,14,0" Width="14" Height="14"
+ Data="{StaticResource Icon.Check}" Foreground="{DynamicResource SuccessBrush}" IsVisible="{Binding IsInstalled}" />
+ <StackPanel Spacing="4">
+ <StackPanel Orientation="Horizontal" Spacing="10">
+ <TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
+ <Border Classes="badge">
+ <TextBlock Classes="caption" Text="{Binding StatusText}" />
+ </Border>
+ </StackPanel>
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding Description}" />
+ <TextBlock Classes="caption" Text="{Binding Sizes}" />
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding InstallGuidance}"
+ IsVisible="{Binding InstallGuidance, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
+ <ProgressBar Classes="soft" Maximum="100" Value="{Binding Progress}" IsVisible="{Binding IsBusy}" Margin="0,4,0,0" />
+ <TextBlock Classes="caption" Text="{Binding ProgressDetail}" IsVisible="{Binding ProgressDetail, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
</StackPanel>
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding Description}" />
- <TextBlock Classes="caption" Text="{Binding Sizes}" />
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{Binding InstallGuidance}"
- IsVisible="{Binding InstallGuidance, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
- <ProgressBar Classes="soft" Maximum="100" Value="{Binding Progress}" IsVisible="{Binding IsBusy}" Margin="0,4,0,0" />
- <TextBlock Classes="caption" Text="{Binding ProgressDetail}" IsVisible="{Binding ProgressDetail, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
- </StackPanel>
- </DockPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ </DockPanel>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </ScrollViewer>
- <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource setup.note}" />
+ <StackPanel Grid.Row="2" Spacing="16" Margin="26,12,26,0">
+ <TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource setup.note}" />
- <DockPanel>
- <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8">
- <Button Content="{Binding CloseText}" Command="{Binding CloseCommand}" />
- <Button Classes="accent" Content="{DynamicResource setup.install}" Command="{Binding InstallCommand}" IsVisible="{Binding CanChoose}" />
- </StackPanel>
- <TextBlock Classes="muted" VerticalAlignment="Center" Text="{Binding SelectionText}" IsVisible="{Binding CanChoose}" />
- </DockPanel>
- </StackPanel>
+ <DockPanel>
+ <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Spacing="8">
+ <!-- Esc is "Later" / "Continue in background" / "Done", like Cancel and Close in the other dialogs. -->
+ <Button x:Name="CloseButton" Content="{Binding CloseText}" Command="{Binding CloseCommand}" IsCancel="True" />
+ <Button x:Name="InstallButton" Classes="accent" Content="{DynamicResource setup.install}" Command="{Binding InstallCommand}"
+ IsVisible="{Binding CanChoose}" />
+ </StackPanel>
+ <TextBlock Classes="muted" VerticalAlignment="Center" Text="{Binding SelectionText}" IsVisible="{Binding CanChoose}" />
+ </DockPanel>
+ </StackPanel>
+ </Grid>
</Window>
diff --git a/src/Filee.App/Views/EngineSetupWindow.axaml.cs b/src/Filee.App/Views/EngineSetupWindow.axaml.cs
index 23f5e020..bc34982e 100644
--- a/src/Filee.App/Views/EngineSetupWindow.axaml.cs
+++ b/src/Filee.App/Views/EngineSetupWindow.axaml.cs
@@ -1,3 +1,4 @@
+using Avalonia;
using Avalonia.Controls;
using Filee.App.Services;
using Filee.App.ViewModels;
@@ -6,6 +7,10 @@ namespace Filee.App.Views;
public partial class EngineSetupWindow : Window
{
+ private const double ScreenMargin = 12;
+ private PixelRect? _area;
+ private double _scaling = 1;
+
public EngineSetupWindow()
{
InitializeComponent();
@@ -15,5 +20,44 @@ public partial class EngineSetupWindow : Window
if (DataContext is EngineSetupViewModel vm)
vm.CloseRequested += (_, _) => Close();
};
+ Opened += (_, _) => FitToScreen();
+ // Progress bars make the cards taller while engines install.
+ SizeChanged += (_, e) => KeepInside(e.NewSize.Height);
+ }
+
+ private void FitToScreen()
+ {
+ var screen = Screens.ScreenFromWindow(this) ?? Screens.Primary;
+ if (screen is not null)
+ FitTo(screen.WorkingArea, screen.Scaling);
}
+
+ /// <summary>
+ /// Keeps the window inside <paramref name="area"/> (pixels): the window grows with the engine list, so on a small or
+ /// scaled screen it would run past the bottom with its buttons (#370). Capped, the list scrolls instead; a window
+ /// that fits keeps its size and place.
+ /// </summary>
+ internal void FitTo(PixelRect area, double scaling)
+ {
+ _area = area;
+ _scaling = scaling;
+ MaxHeight = Math.Max(MinHeight, area.Height / scaling - FrameHeight() - 2 * ScreenMargin);
+ KeepInside(Math.Min(ClientSize.Height, MaxHeight));
+ }
+
+ /// <summary>Moves the window back on screen when its bottom or top would be off it, else leaves it where it is.</summary>
+ private void KeepInside(double clientHeight)
+ {
+ if (_area is not { } area)
+ return;
+ var height = (int)Math.Ceiling((clientHeight + FrameHeight()) * _scaling);
+ if (Position.Y >= area.Y && Position.Y + height <= area.Bottom)
+ return;
+ var margin = (int)Math.Round(ScreenMargin * _scaling);
+ var y = Math.Max(area.Y + margin, Math.Min(Position.Y, area.Bottom - margin - height));
+ Position = new PixelPoint(Position.X, y);
+ }
+
+ /// <summary>The title bar and borders, which MaxHeight (the client area) leaves out.</summary>
+ private double FrameHeight() => FrameSize is { } size ? Math.Max(0, size.Height - ClientSize.Height) : 0;
}
diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.cs
index c3c85b97..befc38c6 100644
--- a/tests/Filee.App.Tests/RenderTests.cs
+++ b/tests/Filee.App.Tests/RenderTests.cs
@@ -942,6 +942,45 @@ public class RenderTests
window.Close();
}
+ [AvaloniaFact]
+ public void Engine_setup_on_a_short_screen_scrolls_the_list_and_keeps_its_buttons()
+ {
+ TestServices.EnsureInitialized("en");
+ var vm = new EngineSetupViewModel(AppHost.Get<EngineDownloadService>(), AppHost.Get<Filee.Core.Localization.ILocalizer>());
+ var window = new EngineSetupWindow { DataContext = vm };
+ var closed = false;
+ window.Closed += (_, _) => closed = true;
+ window.Show();
+ Pump();
+ var fullHeight = window.ClientSize.Height;
+
+ // A screen with room for the whole list leaves the window as it was.
+ window.FitTo(new Avalonia.PixelRect(0, 0, 1920, (int)fullHeight + 200), 1);
+ Pump();
+ Assert.Equal(fullHeight, window.ClientSize.Height);
+
+ // 1366 × 768 at 150 % less the taskbar (#370): 480 high in window units, shorter than the list.
+ window.FitTo(new Avalonia.PixelRect(0, 0, 1366, 720), 1.5);
+ Pump();
+ Assert.True(fullHeight > 480, $"The list is {fullHeight} high, too short to test this.");
+ Assert.InRange(window.ClientSize.Height, 200, 480);
+ Assert.InRange(window.Position.Y, 0, 720 - window.ClientSize.Height * 1.5);
+ var scroller = window.FindControl<ScrollViewer>("PackageScroller")!;
+ Assert.True(scroller.Extent.Height > scroller.Viewport.Height);
+ foreach (var name in new[] { "CloseButton", "InstallButton" })
+ {
+ var button = window.FindControl<Button>(name)!;
+ var bottom = Avalonia.VisualExtensions.TranslatePoint(button, new Avalonia.Point(0, button.Bounds.Height), window)!.Value.Y;
+ Assert.InRange(bottom, 0, window.ClientSize.Height);
+ }
+ Save(window, "engine-setup-short-screen.png");
+
+ // Esc closes it like Cancel / Close in the other dialogs.
+ window.KeyPress(Key.Escape, RawInputModifiers.None, PhysicalKey.Escape, null);
+ Pump();
+ Assert.True(closed);
+ }
+
[AvaloniaFact]
public void Donut_toolbar_waits_for_files_in_drag_mode()
{