|
|
|
<controls:UserControlBase
|
|
|
|
x:Class="StabilityMatrix.Avalonia.Views.OutputsPage"
|
|
|
|
xmlns="https://github.com/avaloniaui"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:avaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
|
|
|
|
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
|
|
|
|
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
|
|
|
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
|
|
|
|
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages"
|
|
|
|
xmlns:models1="clr-namespace:StabilityMatrix.Avalonia.Models"
|
|
|
|
xmlns:fluentAvalonia="clr-namespace:FluentIcons.FluentAvalonia;assembly=FluentIcons.FluentAvalonia"
|
|
|
|
xmlns:outputsPage="clr-namespace:StabilityMatrix.Avalonia.ViewModels.OutputsPage"
|
|
|
|
xmlns:selectableImageCard="clr-namespace:StabilityMatrix.Avalonia.Controls.SelectableImageCard"
|
|
|
|
xmlns:avalonia="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
|
|
|
|
d:DataContext="{x:Static mocks:DesignData.OutputsPageViewModel}"
|
|
|
|
d:DesignHeight="450"
|
|
|
|
d:DesignWidth="700"
|
|
|
|
x:CompileBindings="True"
|
|
|
|
x:DataType="vm:OutputsPageViewModel"
|
|
|
|
mc:Ignorable="d">
|
|
|
|
<Grid RowDefinitions="Auto, *" Margin="16">
|
|
|
|
<Grid Grid.Row="0" Margin="0,0,0,16"
|
|
|
|
HorizontalAlignment="Stretch"
|
|
|
|
RowDefinitions="Auto, Auto"
|
|
|
|
ColumnDefinitions="Auto, Auto, Auto, Auto, *, Auto, Auto">
|
|
|
|
<TextBlock Grid.Row="0"
|
|
|
|
Grid.Column="0"
|
|
|
|
Text="{x:Static lang:Resources.Label_OutputFolder}"
|
|
|
|
Margin="4" />
|
|
|
|
<ComboBox Grid.Column="0"
|
|
|
|
Grid.Row="1" ItemsSource="{Binding Categories}"
|
|
|
|
CornerRadius="8"
|
|
|
|
Margin="4,0"
|
|
|
|
SelectedItem="{Binding SelectedCategory}"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
MinWidth="150">
|
|
|
|
<ComboBox.Styles>
|
|
|
|
<Style
|
|
|
|
Selector="ComboBox /template/ ContentControl#ContentPresenter > StackPanel > TextBlock:nth-child(2)">
|
|
|
|
<Setter Property="IsVisible" Value="False" />
|
|
|
|
</Style>
|
|
|
|
</ComboBox.Styles>
|
|
|
|
<ComboBox.ItemTemplate>
|
|
|
|
<DataTemplate DataType="{x:Type models1:PackageOutputCategory}">
|
|
|
|
<StackPanel>
|
|
|
|
<TextBlock
|
|
|
|
Margin="0,4,0,4"
|
|
|
|
Text="{Binding Name, Mode=OneWay}" />
|
|
|
|
<TextBlock Text="{Binding Path, Mode=OneWay}" />
|
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
|
|
</ComboBox.ItemTemplate>
|
|
|
|
</ComboBox>
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="0"
|
|
|
|
Grid.Column="1"
|
|
|
|
Text="{x:Static lang:Resources.Label_OutputType}"
|
|
|
|
Margin="4"
|
|
|
|
IsVisible="{Binding CanShowOutputTypes}" />
|
|
|
|
<ComboBox Grid.Column="1" Grid.Row="1" ItemsSource="{Binding OutputTypes}"
|
|
|
|
IsVisible="{Binding CanShowOutputTypes}"
|
|
|
|
CornerRadius="8"
|
|
|
|
SelectedItem="{Binding SelectedOutputType}"
|
|
|
|
MinWidth="150"
|
|
|
|
Margin="4,0"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
VerticalContentAlignment="Center" />
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="0"
|
|
|
|
Grid.Column="2"
|
|
|
|
Margin="4"
|
|
|
|
Text="Search"/>
|
|
|
|
<TextBox Grid.Row="1"
|
|
|
|
Grid.Column="2"
|
|
|
|
Text="{Binding SearchQuery, Mode=TwoWay}"
|
|
|
|
Watermark="Search"
|
|
|
|
Margin="4, 0"
|
|
|
|
VerticalContentAlignment="Center"
|
|
|
|
MinWidth="150"/>
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="1"
|
|
|
|
Grid.Column="4"
|
|
|
|
IsVisible="{Binding !!NumItemsSelected}"
|
|
|
|
FontSize="16"
|
|
|
|
Margin="8, 0"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
TextAlignment="Center"
|
|
|
|
HorizontalAlignment="Right"
|
|
|
|
Text="{Binding NumImagesSelected, FallbackValue=1234 images selected}" />
|
|
|
|
|
|
|
|
<Button Grid.Row="1"
|
|
|
|
Grid.Column="5"
|
|
|
|
VerticalAlignment="Bottom"
|
|
|
|
CornerRadius="8"
|
|
|
|
Padding="12, 0"
|
|
|
|
Height="40"
|
|
|
|
Classes="danger"
|
|
|
|
Command="{Binding DeleteAllSelected}"
|
|
|
|
IsVisible="{Binding !!NumItemsSelected}" >
|
|
|
|
<avalonia:Icon Value="fa-solid fa-trash-can"/>
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button Grid.Row="1"
|
|
|
|
Grid.Column="6"
|
|
|
|
Content="{x:Static lang:Resources.Action_ClearSelection}"
|
|
|
|
VerticalAlignment="Bottom"
|
|
|
|
CornerRadius="8"
|
|
|
|
Margin="8, 0"
|
|
|
|
Height="40"
|
|
|
|
Command="{Binding ClearSelection}"
|
|
|
|
IsVisible="{Binding !!NumItemsSelected}" />
|
|
|
|
<Button Grid.Row="1"
|
|
|
|
Grid.Column="6"
|
|
|
|
Content="{x:Static lang:Resources.Action_SelectAll}"
|
|
|
|
VerticalAlignment="Bottom"
|
|
|
|
Classes="accent"
|
|
|
|
CornerRadius="8"
|
|
|
|
Margin="8, 0"
|
|
|
|
Height="40"
|
|
|
|
Command="{Binding SelectAll}"
|
|
|
|
IsVisible="{Binding !NumItemsSelected}" />
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<ScrollViewer Grid.Row="1">
|
|
|
|
<ItemsRepeater
|
|
|
|
ItemsSource="{Binding Outputs}"
|
|
|
|
VerticalAlignment="Top">
|
|
|
|
<ItemsRepeater.Layout>
|
|
|
|
<UniformGridLayout MinColumnSpacing="16" MinRowSpacing="16" />
|
|
|
|
</ItemsRepeater.Layout>
|
|
|
|
<ItemsRepeater.ItemTemplate>
|
|
|
|
<DataTemplate DataType="{x:Type outputsPage:OutputImageViewModel}">
|
|
|
|
<selectableImageCard:SelectableImageButton
|
|
|
|
Command="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).OnImageClick}"
|
|
|
|
CommandParameter="{Binding }"
|
|
|
|
IsSelected="{Binding IsSelected}"
|
|
|
|
Source="{Binding ImageFile.AbsolutePath}">
|
|
|
|
<selectableImageCard:SelectableImageButton.ContextFlyout>
|
|
|
|
<ui:FAMenuFlyout>
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
Text="{x:Static lang:Resources.Action_Copy}"
|
|
|
|
IconSource="Copy"
|
|
|
|
Command="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).CopyImage}"
|
|
|
|
CommandParameter="{Binding ImageFile.AbsolutePath}" />
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
Text="{x:Static lang:Resources.Action_OpenInExplorer}"
|
|
|
|
IconSource="Folder"
|
|
|
|
Command="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).OpenImage}"
|
|
|
|
CommandParameter="{Binding ImageFile.AbsolutePath}" />
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
Text="{x:Static lang:Resources.Action_OpenInViewer}"
|
|
|
|
IconSource="Image"
|
|
|
|
IsVisible="{Binding !!$parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).NumItemsSelected}"
|
|
|
|
Command="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).ShowImageDialog}"
|
|
|
|
CommandParameter="{Binding }" />
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
Text="{x:Static lang:Resources.Action_Delete}"
|
|
|
|
IconSource="Delete"
|
|
|
|
Command="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).DeleteImage}"
|
|
|
|
CommandParameter="{Binding }" />
|
|
|
|
|
|
|
|
<ui:MenuFlyoutSeparator
|
|
|
|
IsVisible="{Binding ImageFile.GenerationParameters, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
|
|
|
|
|
|
|
<ui:MenuFlyoutSubItem Text="{x:Static lang:Resources.Action_SendToInference}"
|
|
|
|
IconSource="Share"
|
|
|
|
IsVisible="{Binding ImageFile.GenerationParameters, Converter={x:Static ObjectConverters.IsNotNull}}">
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
Text="{x:Static lang:Resources.Label_TextToImage}"
|
|
|
|
IconSource="FullScreenMaximize"
|
|
|
|
Command="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).SendToTextToImage}"
|
|
|
|
CommandParameter="{Binding }" />
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
Text="{x:Static lang:Resources.Label_ImageToImage}"
|
|
|
|
IsEnabled="False"
|
|
|
|
IconSource="ImageCopy"
|
|
|
|
CommandParameter="{Binding }" />
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
Text="{x:Static lang:Resources.Label_Inpainting}"
|
|
|
|
IconSource="ImageEdit"
|
|
|
|
IsEnabled="False"
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
CommandParameter="{Binding }" />
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
Text="{x:Static lang:Resources.Label_Upscale}"
|
|
|
|
HotKey="{x:Null}"
|
|
|
|
Command="{Binding $parent[ItemsRepeater].((vm:OutputsPageViewModel)DataContext).SendToUpscale}"
|
|
|
|
CommandParameter="{Binding }">
|
|
|
|
<ui:MenuFlyoutItem.IconSource>
|
|
|
|
<fluentAvalonia:SymbolIconSource
|
|
|
|
FontSize="10"
|
|
|
|
Symbol="ResizeImage" />
|
|
|
|
</ui:MenuFlyoutItem.IconSource>
|
|
|
|
</ui:MenuFlyoutItem>
|
|
|
|
</ui:MenuFlyoutSubItem>
|
|
|
|
</ui:FAMenuFlyout>
|
|
|
|
</selectableImageCard:SelectableImageButton.ContextFlyout>
|
|
|
|
</selectableImageCard:SelectableImageButton>
|
|
|
|
</DataTemplate>
|
|
|
|
</ItemsRepeater.ItemTemplate>
|
|
|
|
</ItemsRepeater>
|
|
|
|
</ScrollViewer>
|
|
|
|
</Grid>
|
|
|
|
</controls:UserControlBase>
|