mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 11:14:25 +00:00
Use dark media type logos
This commit is contained in:
@@ -54,6 +54,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.Svg;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Humanizer;
|
||||
@@ -105,7 +106,19 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
var genericFolderIcon =
|
||||
new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/inode-directory.png")));
|
||||
|
||||
var mediaResource = new Uri($"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.svg");
|
||||
// Check if we're using dark theme
|
||||
bool isDarkTheme = view.ActualThemeVariant == ThemeVariant.Dark;
|
||||
|
||||
// Build the appropriate SVG path based on theme
|
||||
string svgPath = isDarkTheme
|
||||
? $"avares://Aaru.Gui/Assets/Logos/Media/Dark/{imageFormat.Info.MediaType}.svg"
|
||||
: $"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.svg";
|
||||
|
||||
var mediaResource = new Uri(svgPath);
|
||||
|
||||
// Fallback to light theme version if dark version doesn't exist
|
||||
if(isDarkTheme && !AssetLoader.Exists(mediaResource))
|
||||
mediaResource = new Uri($"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.svg");
|
||||
|
||||
MediaLogo = AssetLoader.Exists(mediaResource)
|
||||
? new SvgImage
|
||||
@@ -180,8 +193,10 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle))
|
||||
{
|
||||
MediaTitleText =
|
||||
string.Format(Aaru.Localization.Core.Media_title_0_WithMarkup, imageFormat.Info.MediaTitle);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer))
|
||||
{
|
||||
@@ -190,8 +205,10 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel))
|
||||
{
|
||||
MediaModelText =
|
||||
string.Format(Aaru.Localization.Core.Media_model_0_WithMarkup, imageFormat.Info.MediaModel);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber))
|
||||
{
|
||||
@@ -218,8 +235,10 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel))
|
||||
{
|
||||
DriveModelText =
|
||||
string.Format(Aaru.Localization.Core.Drive_model_0_WithMarkup, imageFormat.Info.DriveModel);
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber))
|
||||
{
|
||||
@@ -245,8 +264,9 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags is { Count: > 0 })
|
||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.Order())
|
||||
MediaTagsList.Add(tag.Humanize());
|
||||
{
|
||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.Order()) MediaTagsList.Add(tag.Humanize());
|
||||
}
|
||||
|
||||
if(imageFormat.Info.ReadableSectorTags is { Count: > 0 })
|
||||
{
|
||||
@@ -765,9 +785,8 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Sessions is { Count: > 0 })
|
||||
{
|
||||
foreach(Session session in opticalMediaImage.Sessions) Sessions.Add(session);
|
||||
}
|
||||
foreach(Session session in opticalMediaImage.Sessions)
|
||||
Sessions.Add(session);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
@@ -777,9 +796,8 @@ public sealed class ImageInfoViewModel : ViewModelBase
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Tracks is { Count: > 0 })
|
||||
{
|
||||
foreach(Track track in opticalMediaImage.Tracks) Tracks.Add(track);
|
||||
}
|
||||
foreach(Track track in opticalMediaImage.Tracks)
|
||||
Tracks.Add(track);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.Svg;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
@@ -439,8 +440,20 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if we're using dark theme
|
||||
bool isDarkTheme = _view.ActualThemeVariant == ThemeVariant.Dark;
|
||||
|
||||
// Build the appropriate SVG path based on theme
|
||||
string svgPath = isDarkTheme
|
||||
? $"avares://Aaru.Gui/Assets/Logos/Media/Dark/{imageFormat.Info.MediaType}.svg"
|
||||
: $"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.svg";
|
||||
|
||||
// Create image model with appropriate icon based on media type
|
||||
var mediaResource = new Uri($"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.svg");
|
||||
var mediaResource = new Uri(svgPath);
|
||||
|
||||
// Fallback to light theme version if dark version doesn't exist
|
||||
if(isDarkTheme && !AssetLoader.Exists(mediaResource))
|
||||
mediaResource = new Uri($"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.svg");
|
||||
|
||||
var imageModel = new ImageModel
|
||||
{
|
||||
|
||||
@@ -81,18 +81,9 @@
|
||||
<Grid Grid.Row="0"
|
||||
ColumnDefinitions="Auto,*"
|
||||
ColumnSpacing="16">
|
||||
<Border Grid.Column="0"
|
||||
Width="160"
|
||||
Height="160"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Background="LightGray"
|
||||
CornerRadius="80"
|
||||
Padding="16">
|
||||
<Image Width="128"
|
||||
Height="128"
|
||||
Source="{Binding MediaLogo, Mode=OneWay}" />
|
||||
</Border>
|
||||
<StackPanel Grid.Column="1"
|
||||
Spacing="8"
|
||||
VerticalAlignment="Center">
|
||||
|
||||
@@ -274,14 +274,9 @@
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</StackPanel.ContextMenu>
|
||||
<Border Width="32"
|
||||
Height="32"
|
||||
Background="LightGray"
|
||||
CornerRadius="16">
|
||||
<Image Width="24"
|
||||
Height="24"
|
||||
Source="{Binding Icon, Mode=OneWay}" />
|
||||
</Border>
|
||||
<TextBlock Text="{Binding FileName, Mode=OneWay}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
@@ -290,14 +285,9 @@
|
||||
ItemsSource="{Binding Partitions, Mode=OneWay}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4">
|
||||
<Border Width="32"
|
||||
Height="32"
|
||||
Background="LightGray"
|
||||
CornerRadius="16">
|
||||
<Image Width="24"
|
||||
Height="24"
|
||||
Source="{Binding Icon, Mode=OneWay}" />
|
||||
</Border>
|
||||
<TextBlock Text="{Binding Name, Mode=OneWay}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
@@ -306,14 +296,9 @@
|
||||
ItemsSource="{Binding FileSystems, Mode=OneWay}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4">
|
||||
<Border Width="32"
|
||||
Height="32"
|
||||
Background="LightGray"
|
||||
CornerRadius="16">
|
||||
<Image Width="24"
|
||||
Height="24"
|
||||
Source="{Binding Icon, Mode=OneWay}" />
|
||||
</Border>
|
||||
<TextBlock Text="{Binding Name, Mode=OneWay}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
@@ -322,14 +307,9 @@
|
||||
ItemsSource="{Binding Roots, Mode=OneWay}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4">
|
||||
<Border Width="32"
|
||||
Height="32"
|
||||
Background="LightGray"
|
||||
CornerRadius="16">
|
||||
<Image Width="24"
|
||||
Height="24"
|
||||
Source="{Binding Icon, Mode=OneWay}" />
|
||||
</Border>
|
||||
<TextBlock Text="{Binding VolumeName, Mode=OneWay}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
@@ -338,14 +318,9 @@
|
||||
ItemsSource="{Binding Subdirectories, Mode=OneWay}">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Spacing="4">
|
||||
<Border Width="32"
|
||||
Height="32"
|
||||
Background="LightGray"
|
||||
CornerRadius="16">
|
||||
<Image Width="24"
|
||||
Height="24"
|
||||
Source="{Binding Icon, Mode=OneWay}" />
|
||||
</Border>
|
||||
<TextBlock Text="{Binding Name, Mode=OneWay}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
Reference in New Issue
Block a user