Implement theme management and settings dialog in PLib video library manager. Add theme service for light/dark/system themes, integrate settings dialog for user preferences, and update app configuration to include appearance options. Enhance thumbnail caching with new methods for cache size and clearing. Update README.md to reflect new features and settings.

This commit is contained in:
Leonid Pershin
2026-08-08 12:04:53 +03:00
parent 625eae7ead
commit 37c5feb2a6
24 changed files with 1099 additions and 185 deletions
+43
View File
@@ -0,0 +1,43 @@
using PLib.Application.Library;
namespace PLib.Desktop.Settings;
/// <summary>
/// The subset of configuration the user can change at runtime, as one snapshot.
/// </summary>
/// <remarks>
/// Everything is written in a single pass rather than key by key: a settings file that is
/// only ever replaced whole cannot end up in a state that never existed in the UI.
/// </remarks>
public sealed record AppSettings
{
public required IReadOnlyList<string> Folders { get; init; }
public required int ThumbnailWidth { get; init; }
public required double ThumbnailPositionRatio { get; init; }
public required int MaxIndexingConcurrency { get; init; }
public required long MinimumFileSizeInBytes { get; init; }
public required ThemeMode Theme { get; init; }
public static AppSettings From(LibraryOptions library, AppearanceOptions appearance) => new()
{
Folders = [.. library.Folders],
ThumbnailWidth = library.ThumbnailWidth,
ThumbnailPositionRatio = library.ThumbnailPositionRatio,
MaxIndexingConcurrency = library.MaxIndexingConcurrency,
MinimumFileSizeInBytes = library.MinimumFileSizeInBytes,
Theme = appearance.Theme,
};
/// <summary>
/// True when the difference between the two snapshots means the library has to be
/// walked again. Cosmetic changes must not trigger a rescan.
/// </summary>
public bool RequiresRescanComparedTo(AppSettings other) =>
!Folders.SequenceEqual(other.Folders, LibraryPathComparer.Instance) ||
MinimumFileSizeInBytes != other.MinimumFileSizeInBytes;
}