Use font icon instead of image

This commit is contained in:
Luke44565 2024-03-13 15:03:07 -04:00
parent 8a610aafd7
commit b5562f2014
9 changed files with 60 additions and 5 deletions

View file

@ -38,6 +38,8 @@ namespace Ryujinx.UI.App.Common
public bool IsGame => FileExtension != "Folder"; public bool IsGame => FileExtension != "Folder";
public bool IsFolder => FileExtension == "Folder";
public static string GetApplicationBuildId(VirtualFileSystem virtualFileSystem, string titleFilePath) public static string GetApplicationBuildId(VirtualFileSystem virtualFileSystem, string titleFilePath)
{ {
using FileStream file = new(titleFilePath, FileMode.Open, FileAccess.Read); using FileStream file = new(titleFilePath, FileMode.Open, FileAccess.Read);

View file

@ -41,7 +41,6 @@ namespace Ryujinx.UI.App.Common
private readonly byte[] _ncaIcon; private readonly byte[] _ncaIcon;
private readonly byte[] _nroIcon; private readonly byte[] _nroIcon;
private readonly byte[] _nsoIcon; private readonly byte[] _nsoIcon;
private readonly byte[] _folderIcon;
private readonly VirtualFileSystem _virtualFileSystem; private readonly VirtualFileSystem _virtualFileSystem;
private Language _desiredTitleLanguage; private Language _desiredTitleLanguage;
@ -59,11 +58,15 @@ namespace Ryujinx.UI.App.Common
_ncaIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NCA.png"); _ncaIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NCA.png");
_nroIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NRO.png"); _nroIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NRO.png");
_nsoIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NSO.png"); _nsoIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_NSO.png");
_folderIcon = GetResourceBytes("Ryujinx.UI.Common.Resources.Icon_Folder.png");
} }
private static byte[] GetResourceBytes(string resourceName) private static byte[] GetResourceBytes(string resourceName)
{ {
if (resourceName == "")
{
return Array.Empty<byte>();
}
Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName); Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName);
byte[] resourceByteArray = new byte[resourceStream.Length]; byte[] resourceByteArray = new byte[resourceStream.Length];
@ -131,7 +134,6 @@ namespace Ryujinx.UI.App.Common
TitleName = fileInfo.Name, TitleName = fileInfo.Name,
FileExtension = "Folder", FileExtension = "Folder",
Path = fullPath, Path = fullPath,
Icon = _folderIcon,
}; };
OnApplicationAdded(new ApplicationAddedEventArgs OnApplicationAdded(new ApplicationAddedEventArgs
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

View file

@ -15,7 +15,6 @@
<None Remove="Resources\Icon_NSO.png" /> <None Remove="Resources\Icon_NSO.png" />
<None Remove="Resources\Icon_NSP.png" /> <None Remove="Resources\Icon_NSP.png" />
<None Remove="Resources\Icon_XCI.png" /> <None Remove="Resources\Icon_XCI.png" />
<None Remove="Resources\Icon_Folder.png" />
<None Remove="Resources\Logo_Amiibo.png" /> <None Remove="Resources\Logo_Amiibo.png" />
<None Remove="Resources\Logo_Discord.png" /> <None Remove="Resources\Logo_Discord.png" />
<None Remove="Resources\Logo_GitHub.png" /> <None Remove="Resources\Logo_GitHub.png" />
@ -34,7 +33,6 @@
<EmbeddedResource Include="Resources\Icon_NSO.png" /> <EmbeddedResource Include="Resources\Icon_NSO.png" />
<EmbeddedResource Include="Resources\Icon_NSP.png" /> <EmbeddedResource Include="Resources\Icon_NSP.png" />
<EmbeddedResource Include="Resources\Icon_XCI.png" /> <EmbeddedResource Include="Resources\Icon_XCI.png" />
<EmbeddedResource Include="Resources\Icon_Folder.png" />
<EmbeddedResource Include="Resources\Logo_Amiibo.png" /> <EmbeddedResource Include="Resources\Logo_Amiibo.png" />
<EmbeddedResource Include="Resources\Logo_Ryujinx.png" /> <EmbeddedResource Include="Resources\Logo_Ryujinx.png" />
<EmbeddedResource Include="Resources\Logo_Discord_Dark.png" /> <EmbeddedResource Include="Resources\Logo_Discord_Dark.png" />

View file

@ -86,6 +86,38 @@
<Setter Property="Width" <Setter Property="Width"
Value="120" /> Value="120" />
</Style> </Style>
<Style Selector="ui|SymbolIcon.listSmall">
<Setter Property="FontSize"
Value="50" />
</Style>
<Style Selector="ui|SymbolIcon.listNormal">
<Setter Property="FontSize"
Value="80" />
</Style>
<Style Selector="ui|SymbolIcon.listLarge">
<Setter Property="FontSize"
Value="100" />
</Style>
<Style Selector="ui|SymbolIcon.listHuge">
<Setter Property="FontSize"
Value="120" />
</Style>
<Style Selector="ui|SymbolIcon.gridSmall">
<Setter Property="FontSize"
Value="100" />
</Style>
<Style Selector="ui|SymbolIcon.gridNormal">
<Setter Property="FontSize"
Value="130" />
</Style>
<Style Selector="ui|SymbolIcon.gridLarge">
<Setter Property="FontSize"
Value="140" />
</Style>
<Style Selector="ui|SymbolIcon.gridHuge">
<Setter Property="FontSize"
Value="180" />
</Style>
<Style Selector="#TitleBarHost &gt; Image"> <Style Selector="#TitleBarHost &gt; Image">
<Setter Property="Margin" <Setter Property="Margin"
Value="10" /> Value="10" />

View file

@ -69,7 +69,16 @@
Grid.Row="0" Grid.Row="0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Top" VerticalAlignment="Top"
IsVisible="{Binding IsGame}"
Source="{Binding Icon, Converter={StaticResource ByteImage}}" /> Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
<ui:SymbolIcon
Grid.Row="0"
Classes.gridHuge="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridHuge}"
Classes.gridLarge="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridLarge}"
Classes.gridNormal="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridMedium}"
Classes.gridSmall="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridSmall}"
IsVisible="{Binding IsFolder}"
Symbol="Folder" />
<Panel <Panel
Grid.Row="1" Grid.Row="1"
Height="50" Height="50"

View file

@ -71,7 +71,17 @@
Classes.large="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridLarge}" Classes.large="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridLarge}"
Classes.normal="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridMedium}" Classes.normal="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridMedium}"
Classes.small="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridSmall}" Classes.small="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridSmall}"
IsVisible="{Binding IsGame}"
Source="{Binding Icon, Converter={StaticResource ByteImage}}" /> Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
<ui:SymbolIcon
Grid.RowSpan="3"
Grid.Column="0"
Classes.listHuge="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridHuge}"
Classes.listLarge="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridLarge}"
Classes.listNormal="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridMedium}"
Classes.listSmall="{Binding $parent[UserControl].((viewModels:MainWindowViewModel)DataContext).IsGridSmall}"
IsVisible="{Binding IsFolder}"
Symbol="Folder" />
<Border <Border
Grid.Column="2" Grid.Column="2"
Margin="0,0,5,0" Margin="0,0,5,0"

View file

@ -6,5 +6,6 @@ namespace Ryujinx.Ava.UI.Helpers
Grid, Grid,
Back, Back,
Chip, Chip,
Folder,
} }
} }

View file

@ -15,6 +15,7 @@ namespace Ryujinx.Ava.UI.Helpers
{ Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll) }, { Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll) },
{ Glyph.Back, char.ConvertFromUtf32((int)Symbol.Back) }, { Glyph.Back, char.ConvertFromUtf32((int)Symbol.Back) },
{ Glyph.Chip, char.ConvertFromUtf32(59748) }, { Glyph.Chip, char.ConvertFromUtf32(59748) },
{ Glyph.Folder, char.ConvertFromUtf32(61739) },
}; };
public GlyphValueConverter(string key) public GlyphValueConverter(string key)