aboutsummaryrefslogblamecommitdiff
path: root/Ryujinx.Ava/Ui/Controls/GameGridView.axaml
blob: 13b75f1191f23de6ec89a571df0d1a747892a958 (plain) (tree)


























































































































































































                                                                                                                                                         
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
             xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
             xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Ryujinx.Ava.Ui.Controls.GameGridView">
	<UserControl.Resources>
		<controls:BitmapArrayValueConverter x:Key="ByteImage" />
		<MenuFlyout x:Key="GameContextMenu" Opened="MenuBase_OnMenuOpened">
			<MenuItem
                Command="{Binding ToggleFavorite}"
                Header="{locale:Locale GameListContextMenuToggleFavorite}"
                ToolTip.Tip="{locale:Locale GameListContextMenuToggleFavoriteToolTip}" />
			<Separator />
			<MenuItem
                Command="{Binding OpenUserSaveDirectory}"
                Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
                ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
			<MenuItem
                Command="{Binding OpenDeviceSaveDirectory}"
                Header="{locale:Locale GameListContextMenuOpenUserDeviceDirectory}"
                ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserDeviceDirectoryToolTip}" />
			<MenuItem
                Command="{Binding OpenBcatSaveDirectory}"
                Header="{locale:Locale GameListContextMenuOpenUserBcatDirectory}"
                ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserBcatDirectoryToolTip}" />
			<Separator />
			<MenuItem
                Command="{Binding OpenTitleUpdateManager}"
                Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
                ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
			<MenuItem
                Command="{Binding OpenDlcManager}"
                Header="{locale:Locale GameListContextMenuManageDlc}"
                ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
			<MenuItem
                Command="{Binding OpenCheatManager}"
                Header="{locale:Locale GameListContextMenuManageCheat}"
                ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
			<MenuItem
                Command="{Binding OpenModsDirectory}"
                Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
                ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
			<MenuItem
                Command="{Binding OpenSdModsDirectory}"
                Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
                ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
			<Separator />
			<MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
				<MenuItem
                    Command="{Binding PurgePtcCache}"
                    Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
                    ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
				<MenuItem
                    Command="{Binding PurgeShaderCache}"
                    Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
                    ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
				<MenuItem
                    Command="{Binding OpenPtcDirectory}"
                    Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
                    ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
				<MenuItem
                    Command="{Binding OpenShaderCacheDirectory}"
                    Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
                    ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
			</MenuItem>
			<MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
				<MenuItem
                    Command="{Binding ExtractExeFs}"
                    Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
                    ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
				<MenuItem
                    Command="{Binding ExtractRomFs}"
                    Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
                    ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
				<MenuItem
                    Command="{Binding ExtractLogo}"
                    Header="{locale:Locale GameListContextMenuExtractDataLogo}"
                    ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
			</MenuItem>
		</MenuFlyout>
	</UserControl.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>
		<ListBox Grid.Row="0"
                 Padding="8"
                 HorizontalAlignment="Stretch"
                 DoubleTapped="GameList_DoubleTapped"
                 SelectionChanged="GameList_SelectionChanged"
                 ContextFlyout="{StaticResource GameContextMenu}"
                 VerticalAlignment="Stretch"
                 Items="{Binding AppsObservableList}">
			<ListBox.ItemsPanel>
				<ItemsPanelTemplate>
					<flex:FlexPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" JustifyContent="Center"
                                    AlignContent="FlexStart" />
				</ItemsPanelTemplate>
			</ListBox.ItemsPanel>
			<ListBox.Styles>
				<Style Selector="ListBoxItem">
					<Setter Property="Padding" Value="0" />
					<Setter Property="Margin" Value="5" />
					<Setter Property="CornerRadius" Value="5" />
					<Setter Property="Background" Value="{DynamicResource SystemAccentColorDark3}" />
					<Style.Animations>
						<Animation Duration="0:0:0.7">
							<KeyFrame Cue="0%">
								<Setter Property="MaxWidth" Value="0"/>
								<Setter Property="Opacity" Value="0.0"/>
							</KeyFrame>
							<KeyFrame Cue="50%">
								<Setter Property="MaxWidth" Value="1000"/>
								<Setter Property="Opacity" Value="0.3"/>
							</KeyFrame>
							<KeyFrame Cue="100%">
								<Setter Property="MaxWidth" Value="1000"/>
								<Setter Property="Opacity" Value="1.0"/>
							</KeyFrame>
						</Animation>
					</Style.Animations>
				</Style>
			</ListBox.Styles>
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Grid>
						<Grid.Styles>
							<Style Selector="ui|SymbolIcon.small.icon">
								<Setter Property="FontSize" Value="15" />
							</Style>
							<Style Selector="ui|SymbolIcon.normal.icon">
								<Setter Property="FontSize" Value="19" />
							</Style>
							<Style Selector="ui|SymbolIcon.large.icon">
								<Setter Property="FontSize" Value="23" />
							</Style>
							<Style Selector="ui|SymbolIcon.huge.icon">
								<Setter Property="FontSize" Value="26" />
							</Style>
						</Grid.Styles>
						<Border
                            Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
                            Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
                            Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
                            Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
                            HorizontalAlignment="Stretch"
                            Padding="{Binding $parent[UserControl].DataContext.GridItemPadding}" CornerRadius="5"
                            VerticalAlignment="Stretch" Margin="0" ClipToBounds="True">
							<Grid Margin="0">
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto" />
									<RowDefinition Height="Auto" />
								</Grid.RowDefinitions>
								<Image HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0" Grid.Row="0"
                                       Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
								<StackPanel IsVisible="{Binding $parent[UserControl].DataContext.ShowNames}"
                                            Height="50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                            Margin="5" Grid.Row="1">
									<TextBlock Text="{Binding TitleName}" TextAlignment="Center" TextWrapping="Wrap"
                                               HorizontalAlignment="Stretch" />
								</StackPanel>
							</Grid>
						</Border>
						<ui:SymbolIcon Classes.icon="true" Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
                               Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
                               Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
                               Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
									    Foreground="Yellow" Symbol="StarFilled"
                               IsVisible="{Binding Favorite}" Margin="5" VerticalAlignment="Top"
                               HorizontalAlignment="Left" />
						<ui:SymbolIcon Classes.icon="true" Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
                               Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
                               Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
                               Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
									    Foreground="Black" Symbol="Star"
                               IsVisible="{Binding Favorite}" Margin="5" VerticalAlignment="Top"
                               HorizontalAlignment="Left" />
					</Grid>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>
	</Grid>
</UserControl>