Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 124 additions & 21 deletions src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml

Large diffs are not rendered by default.

46 changes: 36 additions & 10 deletions src/UniGetUI.Avalonia/Infrastructure/OperationHistoryLogDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.Platform.Storage;
using Avalonia.Styling;
using UniGetUI.Avalonia.ViewModels.Pages.LogPages;
using UniGetUI.Avalonia.Views;
using UniGetUI.Avalonia.Views.Controls;
Expand All @@ -21,9 +22,9 @@ public static async Task ShowAsync(OperationHistoryRecord record)
if (MainWindow.Instance is not { } owner)
return;

bool dark = ThemeHelper.IsDark;
var defaultBrush = new SolidColorBrush(dark ? Color.FromRgb(250, 250, 250) : Color.FromRgb(0, 0, 0));
var errorBrush = new SolidColorBrush(dark ? Color.FromRgb(255, 80, 80) : Color.FromRgb(205, 0, 0));
ThemeVariant theme = ThemeHelper.Variant;
IBrush defaultBrush = LookupBrush("TextFillColorPrimaryBrush", theme, Brushes.White);
IBrush errorBrush = LookupBrush("StatusErrorForeground", theme, Brushes.Red);

var lines = record.Output
.Select(l => new LogLineItem(l.Text.Replace("\r", "").Replace("\n", ""),
Expand All @@ -45,7 +46,8 @@ public static async Task ShowAsync(OperationHistoryRecord record)
MinWidth = 460,
MinHeight = 300,
Title = CoreTools.Translate("Operation log") + (target.Length > 0 ? $" — {target}" : ""),
Background = Application.Current?.FindResource("AppDialogBackground") as IBrush,
TitleMargin = new Thickness(24, 0, 0, 0),
Background = LookupBrush("AppDialogBackground", theme, Brushes.Transparent),
};

var copyButton = CreateDialogButton(CoreTools.Translate("Copy to clipboard"));
Expand All @@ -69,6 +71,7 @@ public static async Task ShowAsync(OperationHistoryRecord record)
};

var closeButton = CreateDialogButton(CoreTools.Translate("Close"), 100);
closeButton.Classes.Remove("secondary-action");
closeButton.Classes.Add("accent");
closeButton.Click += (_, _) => dialog.Close();

Expand All @@ -84,7 +87,7 @@ public static async Task ShowAsync(OperationHistoryRecord record)
{
CornerRadius = new CornerRadius(8),
ClipToBounds = true,
Background = Application.Current?.FindResource("AppDialogDarkBackground") as IBrush,
Background = LookupBrush("AppWindowBackground", theme, Brushes.Transparent),
Child = editor,
};
Grid.SetRow(editorBorder, 1);
Expand All @@ -96,19 +99,41 @@ public static async Task ShowAsync(OperationHistoryRecord record)
HorizontalAlignment = HorizontalAlignment.Right,
Children = { closeButton },
};
Grid.SetRow(footer, 2);

dialog.Content = new Grid
var body = new Grid
{
Margin = new Thickness(16),
RowDefinitions = new RowDefinitions("Auto,*,Auto"),
Margin = new Thickness(24, 0, 24, 24),
RowDefinitions = new RowDefinitions("Auto,*"),
RowSpacing = 10,
Children = { toolbar, editorBorder, footer },
Children = { toolbar, editorBorder },
};
Grid.SetRow(body, 0);

var footerSurface = new Border
{
Background = LookupBrush("AppWindowBackground", theme, Brushes.Transparent),
Padding = new Thickness(24),
Child = footer,
};
Grid.SetRow(footerSurface, 1);

dialog.Content = new Grid
{
RowDefinitions = new RowDefinitions("*,Auto"),
Children = { body, footerSurface },
};

await dialog.ShowDialog(owner);
}

private static IBrush LookupBrush(string key, ThemeVariant theme, IBrush fallback)
{
if (Application.Current?.TryGetResource(key, theme, out var resource) == true &&
resource is IBrush brush)
return brush;
return fallback;
}

private static Button CreateDialogButton(string content, double minWidth = 0) => new()
{
Content = content,
Expand All @@ -117,6 +142,7 @@ public static async Task ShowAsync(OperationHistoryRecord record)
Padding = new Thickness(11, 5, 11, 6),
CornerRadius = new CornerRadius(4),
FontSize = 14,
Classes = { "secondary-action" },
HorizontalContentAlignment = HorizontalAlignment.Center,
VerticalContentAlignment = VerticalAlignment.Center,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,76 @@
xmlns:automation="clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
xmlns:controls="using:UniGetUI.Avalonia.Views.Controls"
x:Class="UniGetUI.Avalonia.Views.DialogPages.OperationFailedDialog"
MaxWidth="800"
MaxWidth="850"
MinWidth="500"
MaxHeight="550"
MaxHeight="490"
MinHeight="300"
TitleMargin="24,0,0,0"
Background="{DynamicResource AppDialogBackground}">

<Grid RowDefinitions="Auto,*,Auto">
<dialogs:ImmersiveDialog.Styles>
<!-- Scoped to this dialog family: these do not alter global Button resources. -->
<Style Selector="Button.operation-dialog-action">
<Setter Property="Height" Value="32"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Background" Value="{DynamicResource SettingsCardBackground}"/>
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryActionBorderBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource SecondaryActionBorderThickness}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style Selector="Button.operation-dialog-action:pointerover">
<Setter Property="Background" Value="{DynamicResource SettingsCardHoverBackground}"/>
</Style>
<Style Selector="Button.operation-dialog-action:pressed">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTertiaryBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
</Style>
<Style Selector="SplitButton.operation-dialog-action">
<Setter Property="Height" Value="32"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Background" Value="{DynamicResource SettingsCardBackground}"/>
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryActionBorderBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource SecondaryActionBorderThickness}"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style Selector="SplitButton.operation-dialog-action:pointerover">
<Setter Property="Background" Value="{DynamicResource SettingsCardHoverBackground}"/>
</Style>
<Style Selector="SplitButton.operation-dialog-action:pressed">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTertiaryBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
</Style>
</dialogs:ImmersiveDialog.Styles>

<Grid RowDefinitions="Auto,*,Auto"
Background="{DynamicResource AppDialogBackground}">

<!-- ── Header ── -->
<Border Grid.Row="0" Padding="16,14,16,10">
<Border Grid.Row="0" Padding="24,8,24,12">
<TextBlock x:Name="HeaderContent"
TextWrapping="WrapWithOverflow"
FontSize="14"/>
</Border>

<!-- ── Colored output log ── -->
<Border Grid.Row="1"
Margin="8,0,8,8"
Margin="24,0,24,24"
CornerRadius="6"
ClipToBounds="True"
Background="{DynamicResource AppDialogDarkBackground}">
Background="{DynamicResource AppWindowBackground}">
<controls:LogTextEditor x:Name="OutputText"
automation:AutomationProperties.AccessibilityView="Raw"/>
</Border>

<!-- ── Footer buttons ── -->
<Border Grid.Row="2"
BorderThickness="0,1,0,0"
Padding="16,10">
Background="{DynamicResource AppWindowBackground}">
<Grid x:Name="ButtonsLayout"
Margin="24"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public OperationFailedDialog(AbstractOperation operation)
Content = CoreTools.Translate("Close"),
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Center,
Classes = { "operation-dialog-action" },
};
closeButton.Click += (_, _) => Close();

Expand Down Expand Up @@ -149,6 +150,7 @@ private Control SimpleRetryButton(AbstractOperation operation, string retryMode,
Content = label,
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Center,
Classes = { "operation-dialog-action" },
};
button.Click += (_, _) =>
{
Expand All @@ -170,6 +172,7 @@ string label
Content = label,
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Center,
Classes = { "operation-dialog-action" },
};
splitButton.Click += (_, _) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
xmlns:controls="using:UniGetUI.Avalonia.Views.Controls"
x:Class="UniGetUI.Avalonia.Views.DialogPages.OperationOutputWindow"
x:DataType="vm:OperationOutputViewModel"
MaxWidth="700"
MinWidth="400"
MaxHeight="500"
MaxWidth="780"
MinWidth="460"
MaxHeight="520"
MinHeight="300"
TitleMargin="24,0,0,0"
Background="{DynamicResource AppDialogBackground}"
Title="{Binding Title}">

<Border Margin="8"
<Border Margin="24,0,24,24"
CornerRadius="6"
ClipToBounds="True"
Background="{DynamicResource AppDialogDarkBackground}">
Background="{DynamicResource AppWindowBackground}">
<controls:LogTextEditor x:Name="OutputText"
automation:AutomationProperties.Name="{Binding Title}"
automation:AutomationProperties.AccessibilityView="Raw"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style Selector="Button.action-main:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource PackageActionHoverBackground}"/>
</Style>
<Style Selector="Button.action-chevron:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource PackageActionHoverBackground}"/>
</Style>

<!-- Screenshot pip dots (Button hosting an Ellipse) -->
<Style Selector="Button.pip">
<Setter Property="Background" Value="Transparent"/>
Expand Down
92 changes: 76 additions & 16 deletions src/UniGetUI.Avalonia/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,40 @@
<Style Selector="Button.caption-close:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="#A4262C"/>
</Style>
<!-- WinUI-like splitter: the track fills the resize gap while a compact pill
marks the drag axis. -->
<Style Selector="GridSplitter.winui-horizontal-splitter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<ControlTemplate>
<!-- Match the visible splitter track to the operation-card width.
OperationsList uses 8 DIPs of horizontal inset. -->
<Border Background="{TemplateBinding Background}"
Margin="8,0"
CornerRadius="6">
<Border Width="22" Height="4"
CornerRadius="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{DynamicResource TextFillColorTertiaryBrush}"
IsHitTestVisible="False"/>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="GridSplitter.winui-horizontal-splitter:pointerover">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorSecondaryBrush}"/>
</Style>
<Style Selector="GridSplitter.winui-horizontal-splitter:pressed">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTertiaryBrush}"/>
</Style>
<Style Selector="Border.operations-panel-border">
<Setter Property="BorderBrush" Value="{DynamicResource AppBorderBrush}"/>
</Style>
<Style Selector="Border.operations-panel-border.splitter-active">
<!-- Preserve the one-DIP separator's layout while the splitter surface replaces it. -->
<Setter Property="BorderBrush" Value="Transparent"/>
</Style>
</Window.Styles>
<Panel>
<!-- Solid inactive-state fallback, using the same theme resource as the #5111 Mica failure path. -->
Expand Down Expand Up @@ -151,7 +185,7 @@
</ContentControl>

<!-- ── Content: banners + page + operations ── -->
<Grid x:Name="ContentRoot" Grid.Column="1" RowDefinitions="*,4,Auto">
<Grid x:Name="ContentRoot" Grid.Column="1" RowDefinitions="*,0,Auto">

<!-- ── Page content (banners now surface as bottom-right toasts; see ToastHost) ── -->
<TransitioningContentControl Grid.Row="0"
Expand All @@ -169,18 +203,23 @@

<!-- ── GridSplitter (only visible when operations are present) ── -->
<GridSplitter x:Name="OperationsSplitter"
Classes="winui-horizontal-splitter"
Grid.Row="1"
Margin="0,0,0,2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ResizeDirection="Rows"
IsVisible="{Binding OperationsSplitterVisible}"
automation:AutomationProperties.AccessibilityView="Raw"
Background="Transparent"/>
PointerEntered="OperationsSplitter_PointerEntered"
PointerExited="OperationsSplitter_PointerExited"
automation:AutomationProperties.AccessibilityView="Raw"/>

<!-- ── Operations panel ── -->
<Border Grid.Row="2"
<Border x:Name="OperationsPanelBorder"
Classes="operations-panel-border"
Grid.Row="2"
IsVisible="{Binding OperationsPanelVisible}"
BorderThickness="0,1,0,0"
BorderBrush="{DynamicResource AppBorderBrush}"
automation:AutomationProperties.AccessibilityView="Control"
automation:AutomationProperties.Name="{t:Translate Operations}"
automation:AutomationProperties.LandmarkType="{x:Static peers:AutomationLandmarkType.Region}"
Expand Down Expand Up @@ -682,22 +721,43 @@
Width="10" Height="2"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
<!-- Maximize / Restore: square outline, geometry swapped in code-behind -->
<!-- Maximize / Restore Down. Windows uses the real ChromeRestore symbol from
its caption-icon font; the path is retained as a portable fallback. -->
<Button x:Name="MaximizeButton"
Width="46" Height="44"
Classes="caption"
automation:AutomationProperties.Name="{t:Translate Maximize}"
automation:AutomationProperties.Name="{t:Translate Maximize}"
ToolTip.Tip="{t:Translate Maximize}"
Click="MaximizeButton_Click">
<Path x:Name="MaximizeIcon"
Stroke="{Binding $parent[Button].Foreground}"
StrokeThickness="1"
StrokeLineCap="Round"
automation:AutomationProperties.AccessibilityView="Raw"

Data="M0,0 H10 V10 H0 Z"
Width="10" Height="10"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Panel Width="16" Height="16"
automation:AutomationProperties.AccessibilityView="Raw">
<Path x:Name="MaximizeIcon"
Stroke="{Binding $parent[Button].Foreground}"
StrokeThickness="1"
StrokeJoin="Miter"
Data="M1.5,1.5 H10.5 V10.5 H1.5 Z"
Width="12" Height="12"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<TextBlock x:Name="RestoreIcon"
IsVisible="False"
Text="&#xE923;"
FontSize="10"
TextAlignment="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<Path x:Name="RestoreFallbackIcon"
IsVisible="False"
Stroke="{Binding $parent[Button].Foreground}"
StrokeThickness="1"
StrokeLineCap="Round"
StrokeJoin="Round"
Data="M5,3 V2.5 A1.5,1.5 0 0 1 6.5,1 H12.5 A1.5,1.5 0 0 1 14,2.5 V8.5 A1.5,1.5 0 0 1 12.5,10 H11 M3.5,4 H9.5 A1.5,1.5 0 0 1 11,5.5 V12.5 A1.5,1.5 0 0 1 9.5,14 H3.5 A1.5,1.5 0 0 1 2,12.5 V5.5 A1.5,1.5 0 0 1 3.5,4 Z"
Width="10" Height="10"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Panel>
</Button>
<!-- Close: X -->
<Button Width="46" Height="44"
Expand Down
Loading
Loading