mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[GUI] Use dir_colors to color files in Subdirectory window.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Avalonia.Media;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Aaru.Gui.Models;
|
||||
@@ -76,5 +77,6 @@ public sealed class FileModel
|
||||
[NotNull]
|
||||
public string Mode => $"{Stat.Mode}";
|
||||
|
||||
public FileEntryInfo Stat { get; set; }
|
||||
public FileEntryInfo Stat { get; set; }
|
||||
public IBrush Color { get; set; }
|
||||
}
|
||||
@@ -43,9 +43,11 @@ using Aaru.CommonTypes.Interop;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core;
|
||||
using Aaru.Gui.Models;
|
||||
using Aaru.Helpers;
|
||||
using Aaru.Localization;
|
||||
using Aaru.Logging;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform.Storage;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using JetBrains.Annotations;
|
||||
@@ -112,7 +114,13 @@ public sealed class SubdirectoryViewModel
|
||||
Entries.Add(new FileModel
|
||||
{
|
||||
Name = dirent,
|
||||
Stat = stat
|
||||
Stat = stat,
|
||||
Color =
|
||||
new SolidColorBrush(Color.Parse(DirColorsParser.Instance.ExtensionColors
|
||||
.TryGetValue(Path.GetExtension(dirent),
|
||||
out string hex)
|
||||
? hex
|
||||
: DirColorsParser.Instance.NormalColor))
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,12 @@
|
||||
ItemsSource="{Binding Entries, Mode=OneWay}"
|
||||
IsReadOnly="True"
|
||||
SelectionMode="Extended"> <!-- TODO: SelectedItemsSource="{Binding SelectedEntries}" -->
|
||||
<DataGrid.Styles>
|
||||
<Style Selector="DataGridRow">
|
||||
<Setter Property="Foreground"
|
||||
Value="{Binding Color, Mode=OneWay}" />
|
||||
</Style>
|
||||
</DataGrid.Styles>
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<Button Command="{Binding ExtractFilesCommand, Mode=OneWay}">
|
||||
|
||||
Reference in New Issue
Block a user