diff --git a/src/Chronos.App/Archive/TrashDialogViewModel.cs b/src/Chronos.App/Archive/TrashDialogViewModel.cs index 0962c9e3..6cc735ca 100644 --- a/src/Chronos.App/Archive/TrashDialogViewModel.cs +++ b/src/Chronos.App/Archive/TrashDialogViewModel.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.IO; using System.Windows.Input; using Chronos.App.Infrastructure; +using Chronos.App.Videos; using Chronos.Core.Archiving; using Chronos.Core.Diagnostics; using Chronos.Core.Localization; @@ -9,6 +10,7 @@ using Chronos.Data; using Chronos.Data.Archiving; using Chronos.Data.Archiving.Jobs; using Chronos.Data.Jobs; +using Chronos.Data.Videos; using Chronos.Ui.Mvvm; namespace Chronos.App.Archiving; @@ -22,9 +24,16 @@ public sealed class TrashRowViewModel(TrashEntry entry, ICommand restore) /// "Photos", "Sequence": what the entry holds. public string KindText => TrashEmptyPlans.KindText(Entry.Kind); - /// "Photos · 12 photos · 340 MB · 2026/2026-09-28 Canon EOS R5" (the folder left to right in every language). - public string Detail => string.Join(Loc.Separator, KindText, Loc.Plural("Shell.Status.Photos", Entry.Frames), Formatting.Bytes(Entry.Bytes), - Formatting.LeftToRight(Entry.Folder)); + /// + /// "Photos · 12 photos · 340 MB · 2026/2026-09-28 Canon EOS R5" (the folder left to right in every language); a videos + /// entry has no photos: "Videos · 1.2 GB · …". + /// + public string Detail => Entry.Kind == TrashKind.Videos + ? string.Join(Loc.Separator, KindText, Formatting.Bytes(Entry.Bytes), Formatting.LeftToRight(Entry.Folder)) + : string.Join(Loc.Separator, KindText, Loc.Plural("Shell.Status.Photos", Entry.Frames), Formatting.Bytes(Entry.Bytes), Formatting.LeftToRight(Entry.Folder)); + + /// What Restore brings back: the render into its sequence's renders, or the sequence or photos. + public string RestoreToolTip => Entry.Kind == TrashKind.Videos ? Loc.L("Tooltips.Archive.TrashRestoreVideo") : Loc.L("Tooltips.Archive.TrashRestore"); /// "Deleted 02/10/2026 18:04". public string DeletedText => Loc.L("Archive.Trash.Deleted", Formatting.Date(Entry.DeletedAt) + " " + Formatting.TimeOfDay(Entry.DeletedAt)); @@ -175,6 +184,11 @@ public sealed class TrashDialogViewModel : ArchiveDialogViewModel BusyText = Loc.L("Archive.Trash.Restoring", entry.Title); try { + if (entry.Kind == TrashKind.Videos) + { + await RestoreVideoAsync(entry); + return; + } var result = await Task.Run(() => _archives.RestoreEntryAsync(entry.ArchiveId, entry.Name, _followUps)); Log.Info("archive", $"{entry.Title} restored from the trash ({entry.Kind}, {result.Photos} photo(s), {result.Kept.Count} kept)"); BusyText = null; @@ -205,6 +219,27 @@ public sealed class TrashDialogViewModel : ArchiveDialogViewModel } } + /// + /// A render deleted from Videos goes back among its sequence's renders after its hash is checked (the videos library + /// refuses a file that changed in the trash, or a sequence that is gone, and says why). + /// + private async Task RestoreVideoAsync(TrashEntry entry) + { + try + { + var render = await Task.Run(() => _archives.Videos.RestoreAsync(entry.ArchiveId, entry.Name)); + Log.Info("archive", $"{entry.Title} restored from the trash (render {render.Id})"); + Rows = [.. _rows.Where(r => r.Entry != entry)]; + await _restored(); + } + catch (VideoLibraryException ex) + { + Log.Warning("archive", $"Restoring {entry.Title} failed: {ex.Code}", ex); + var text = VideoText.Error(ex, entry.Title); + ShowMessage(text, text); + } + } + /// /// The line of what a restore kept in the trash, and its tooltip: one reason's sentence ("2 photos stayed in the trash: /// they could not be moved back."), or how many stayed when they stayed for different reasons. The tooltip holds that diff --git a/src/Chronos.App/Infrastructure/AppSettings.cs b/src/Chronos.App/Infrastructure/AppSettings.cs index 1a385bad..ad8dbec5 100644 --- a/src/Chronos.App/Infrastructure/AppSettings.cs +++ b/src/Chronos.App/Infrastructure/AppSettings.cs @@ -110,6 +110,12 @@ public sealed class AppSettings public string FolderTemplate { get; set; } = TemplateDefaults.Folder; public string FileTemplate { get; set; } = TemplateDefaults.File; + /// + /// Where Videos › Copy to folder puts copies of renders (owner review 1, R9): Videos\Chronos by default, null or empty + /// when unset (Copy then says why it cannot run). Never inside the archive or the workspace. + /// + public string? VideosFolder { get; set; } = Videos.VideosFolders.Default(); + /// Proxy long edge of new archives (also written into the open archive); 0 = full size, -1 = no proxies. public int ProxyLongEdge { get; set; } = 1920; diff --git a/src/Chronos.App/Jobs/JobNotices.cs b/src/Chronos.App/Jobs/JobNotices.cs index 62a02834..b0bb6966 100644 --- a/src/Chronos.App/Jobs/JobNotices.cs +++ b/src/Chronos.App/Jobs/JobNotices.cs @@ -41,7 +41,7 @@ public static class JobNotices private static bool Announces(JobKind kind) => kind is JobKind.Render or JobKind.DeepAnalyse or JobKind.Verify or JobKind.Rebuild or JobKind.Maintenance or JobKind.UploadCommit or JobKind.Move or JobKind.Adopt or JobKind.EmptyTrash or JobKind.Convert or JobKind.WorkspaceRender or JobKind.WorkspaceSend - or JobKind.WorkspaceMove; + or JobKind.WorkspaceMove or JobKind.VideoCopy; /// /// Work that keeps the index and its previews current: the next run repeats it, the Archive screen shows what is missing. diff --git a/src/Chronos.App/Sections/SettingsView.xaml b/src/Chronos.App/Sections/SettingsView.xaml index bdc4980f..69d859cf 100644 --- a/src/Chronos.App/Sections/SettingsView.xaml +++ b/src/Chronos.App/Sections/SettingsView.xaml @@ -192,6 +192,22 @@ + + + + + + + + + + internal void KeepSequence(Guid? sequenceId) => CurrentSequenceId = sequenceId; + /// + /// Opens Videos, narrowed to the renders of (the Export footer's "Videos (n)" and the Render + /// menu's "Videos"), or to every render with null; names the sequence in its filter chip. + /// + public void OpenVideos(Guid? sequenceId = null, string? title = null) + { + Videos.ShowSequence(sequenceId, title); + Navigate(SectionKey.Videos); + } + /// Closes the first-run overlay for good. public void CompleteWelcome() { @@ -362,6 +378,7 @@ public sealed class ShellViewModel : LocalizedViewModel Jobs.Dispose(); Library.Dispose(); Import.Dispose(); + Videos.Dispose(); Archive.Dispose(); Server.Dispose(); Settings.Dispose(); diff --git a/src/Chronos.App/Videos/VideoPlayerPane.xaml b/src/Chronos.App/Videos/VideoPlayerPane.xaml new file mode 100644 index 00000000..59cc7721 --- /dev/null +++ b/src/Chronos.App/Videos/VideoPlayerPane.xaml @@ -0,0 +1,40 @@ + + + + + +