LANCommander/LANCommander.Launcher/Views/Components/DownloadQueueItemView.axaml
Pat Hartl b183e4b18c Remove old launcher, rename Avalonia launcher
Also adds ARM builds for Linux + Windows launcher
2026-06-06 05:49:24 -05:00

247 lines
14 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:LANCommander.Launcher.ViewModels"
xmlns:local="using:LANCommander.Launcher.Views.Components"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
x:Class="LANCommander.Launcher.Views.Components.DownloadQueueItemView"
x:DataType="vm:InstallQueueItemViewModel">
<UserControl.Styles>
<Style Selector="Border.QueueItem">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="Border.QueueItem.Expanded">
<Setter Property="Background">
<LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%">
<GradientStop Color="#FF181818" Offset="0" />
<GradientStop Color="#FF0D0D0D" Offset="1" />
</LinearGradientBrush>
</Setter>
</Style>
</UserControl.Styles>
<Border Classes="QueueItem"
Classes.Expanded="{Binding IsExpanded}"
ClipToBounds="True">
<StackPanel>
<!-- Item header (clickable) -->
<Button Background="Transparent"
BorderThickness="0"
Padding="8"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Command="{Binding $parent[local:DownloadQueueItemView].ToggleExpandedCommand}"
CommandParameter="{Binding}">
<Grid ColumnDefinitions="Auto,*,Auto">
<!-- Cover art -->
<Border Grid.Column="0" Width="64" Height="86"
CornerRadius="0" ClipToBounds="True">
<local:Cover Source="{Binding CoverPath}"
Title="{Binding Title}" />
</Border>
<!-- Info -->
<StackPanel Grid.Column="1" Margin="12,10" VerticalAlignment="Center" Spacing="4">
<TextBlock Text="{Binding Title}"
FontSize="14" FontWeight="SemiBold"
TextTrimming="CharacterEllipsis" />
<!-- Active state -->
<TextBlock FontSize="11"
Foreground="{DynamicResource TextSecondaryBrush}"
IsVisible="{Binding IsActive}">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1}">
<Binding Path="ProgressText" />
<Binding Path="PercentText" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<ProgressBar Value="{Binding Progress}"
Minimum="0" Maximum="1"
Height="4" CornerRadius="2"
IsVisible="{Binding IsActive}" />
<TextBlock Text="{Binding SpeedText}"
FontSize="11"
Foreground="{DynamicResource TextDisabledBrush}"
IsVisible="{Binding IsActive}" />
<!-- Queued state -->
<TextBlock Text="{DynamicResource Queued}"
FontSize="11"
Foreground="{DynamicResource TextDisabledBrush}"
IsVisible="{Binding IsQueued}" />
<!-- Completed state -->
<StackPanel Orientation="Horizontal" Spacing="6"
IsVisible="{Binding IsCompleted}">
<TextBlock Text="{DynamicResource Complete}"
FontSize="11"
VerticalAlignment="Center" />
</StackPanel>
<TextBlock Text="{Binding CompletedOnText}"
FontSize="10"
Foreground="{DynamicResource TextDisabledBrush}"
IsVisible="{Binding CompletedOnText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
</StackPanel>
<!-- Cancel button (active) -->
<IconButton Grid.Column="2"
Command="{Binding $parent[local:DownloadQueueItemView].CancelCommand}"
CommandParameter="{Binding}"
Classes="Text Error"
Width="32" Height="32"
IconType="Regular"
IconValue="X"
IsVisible="{Binding IsActive}" />
<IconButton Grid.Column="2"
Command="{Binding $parent[local:DownloadQueueItemView].RemoveCommand}"
CommandParameter="{Binding}"
Classes="Text Error"
Width="32" Height="32"
IconType="Regular"
IconValue="X"
IsVisible="{Binding IsQueued}" />
<!-- Action buttons for completed items -->
<StackPanel Grid.Column="2"
Orientation="Horizontal"
Spacing="4"
VerticalAlignment="Center"
Margin="0,0,8,0"
IsVisible="{Binding IsCompleted}">
<IconButton Command="{Binding $parent[local:DownloadQueueItemView].PlayCommand}"
CommandParameter="{Binding}"
Text="{DynamicResource Play}"
Classes="Primary"
IconType="Fill"
IconValue="Play"
Height="32"
VerticalContentAlignment="Center" />
<IconButton Command="{Binding $parent[local:DownloadQueueItemView].ViewInLibraryCommand}"
CommandParameter="{Binding}"
Classes="Glass"
IconValue="Books"
Width="32"
Height="32"
Padding="0"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" />
</StackPanel>
</Grid>
</Button>
<!-- Expanded detail panel -->
<Border IsVisible="{Binding IsExpanded}"
Padding="16,8,16,12"
Background="Transparent"
BorderBrush="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
<Grid ColumnDefinitions="2*,3*">
<!-- Task timeline -->
<ItemsControl Grid.Column="0" ItemsSource="{Binding Tasks}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="vm:InstallTaskItemViewModel">
<Grid ColumnDefinitions="20,*" Height="24">
<!-- Top half of connecting line (hidden for first item) -->
<Border Grid.Column="0"
Width="2" Height="12"
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Top"
IsVisible="{Binding ShowTopLine}" />
<!-- Bottom half of connecting line (hidden for last item) -->
<Border Grid.Column="0"
Width="2" Height="12"
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
IsVisible="{Binding ShowBottomLine}" />
<!-- Filled dot (completed) -->
<Ellipse Grid.Column="0"
Width="10" Height="10"
Fill="{DynamicResource SystemAccentColor}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{Binding IsCompleted}" />
<!-- Running dot -->
<Ellipse Grid.Column="0"
Width="10" Height="10"
Fill="{DynamicResource SystemAccentColor}"
Opacity="0.6"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{Binding IsRunning}" />
<!-- Outlined circle (queued) -->
<Ellipse Grid.Column="0"
Width="10" Height="10"
Fill="Transparent"
Stroke="{DynamicResource SystemAccentColor}"
StrokeThickness="1.5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{Binding IsQueued}" />
<!-- Failed dot -->
<Ellipse Grid.Column="0"
Width="10" Height="10"
Fill="{DynamicResource ErrorBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{Binding IsFailed}" />
<!-- Skipped dot -->
<Ellipse Grid.Column="0"
Width="10" Height="10"
Fill="{DynamicResource SystemControlBackgroundChromeMediumBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{Binding IsSkipped}" />
<!-- Task label -->
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6"
VerticalAlignment="Center" Margin="8,0,0,0">
<TextBlock Text="{Binding Title}"
FontSize="12"
Foreground="{DynamicResource TextSecondaryBrush}"
VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" />
<TextBlock Text="{Binding ErrorMessage}"
FontSize="10"
Foreground="{DynamicResource ErrorBrush}"
VerticalAlignment="Center"
IsVisible="{Binding IsFailed}"
MaxWidth="200"
TextTrimming="CharacterEllipsis" />
</StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- Transfer speed chart -->
<DockPanel Grid.Column="1"
Margin="12,0,0,0"
VerticalAlignment="Stretch"
IsVisible="{Binding HasSpeedData}">
<TextBlock DockPanel.Dock="Top"
Text="{Binding SpeedChartLabel}"
FontSize="10"
Foreground="{DynamicResource TextDisabledBrush}"
Margin="0,0,0,2" />
<lvc:CartesianChart MinHeight="80"
Series="{Binding SpeedSeries}"
XAxes="{Binding SpeedXAxes}"
YAxes="{Binding SpeedYAxes}"
TooltipPosition="Auto"
ZoomMode="None" />
</DockPanel>
</Grid>
</Border>
</StackPanel>
</Border>
</UserControl>