diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 66e6243a..f8f4f020 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -70,13 +70,14 @@ Dependencies point one way: `Core` ← `Core.Windows`, `Data`, `Protocol` ← `S | Folder | Content | |---|---| | `Shell` | `MainWindow` (rail and its shortcuts, taskbar progress), `ShellViewModel` (rail, sections, first run), `OsNotifications` (toasts as Windows notifications while the window is minimised or in the background), dialogs, `ErrorText` (the sentence of an error toast), `ScreenCapture` (`--capture` scenes), `SectionTemplates.xaml` (view model → view) | -| `Sections` | One `XxxView.xaml` + `XxxViewModel` per screen: Welcome, Library, Sequence (the Edit section: the editor, and `SequencePickerView` choosing the sequence in place), Import, Archive, Jobs (two tabs, Queue and Scheduled: `SchedulesView` shows `Jobs/SchedulesViewModel`), Server, Settings (its last page is About) | +| `Sections` | One `XxxView.xaml` + `XxxViewModel` per screen: Welcome, Library, Sequence (the Edit section: the editor, `SequencePickerView` choosing in place a project of the workspace or a sequence of the library, the in-window dialogs of the workspace, and the opening of this PC's sequences as workspace projects: the project opened last, else "Open in workspace", the checkout and the copy job followed until it opens), Import, Archive, Jobs (two tabs, Queue and Scheduled: `SchedulesView` shows `Jobs/SchedulesViewModel`), Server, Settings (its last page is About) | | `Library` | Filter, facets, pager, timeline, saved views, quick and mass actions, remote cards and thumbnails, thumbnail cache, list export | -| `Editor` | `EditorSession` (project, undo/redo, saving, merges through `Data/Projects/ProjectMerge`), `ISequenceSource` (`LocalSequenceSource`, `RemoteSequenceSource`), the steps of the Edit path (`EditPath`: their order, each step's state, the step of each finding, the memory of the step shown; tabs Analysis, Frames, Exposure, Motion, Camera, Time, Stack, Export), `PreviewRenderer`, `ExportPlanner`, `ExportSync`, `SavedCopies`, `SequenceJobs`, `ProjectFiles` (save and open `.chronos` project files) | +| `Editor` | `EditorSession` (project, undo/redo, saving, merges through `Data/Projects/ProjectMerge`), `ISequenceSource` (`LocalSequenceSource`, `RemoteSequenceSource`, `WorkspaceSequenceSource`: a workspace project over its media, the working state saved in `project.chronos` under the project's lease and merged, renders at the home with the portable settings through `IProjectRenders`), the steps of the Edit path (`EditPath`: their order, each step's state, the step of each finding, the memory of the step shown; tabs Analysis, Frames, Exposure, Motion, Camera, Time, Stack, Export), `PreviewRenderer`, `ExportPlanner`, `ExportSync`, `SavedCopies`, `SequenceJobs`, `ProjectFiles` (save and open `.chronos` project files: format 2 opens its workspace project, format 1 gives its settings to Main) | +| `Workspace` | Owner review 2, R8: `WorkspaceHost` (the desktop's `WorkspaceStore` and `WorkspaceSync` over Settings › Workspace's folder, this PC's archive as the home; checkout and copy, status, Save version with the sync after it, sync, resolve, restore, history, new, rename, delete, the plan and removal of a local copy whose unsent work goes to `/.trash`, pruning past Kept versions), `ProjectMenuViewModel` (the title's ▾: state chip, the menu, Update media; `IWorkspaceUi` is what it asks of the section), `WorkspaceDialogs` (Open in workspace, project name, Save version, History, conflict, Remove local copy; `WorkspaceDialogs.xaml`), `WorkspaceProjectItem` (a picker row), `WorkspaceText` (states, versions, failures) | | `Import` | `CardPool` (inserted cards, remembered cards, folders), camera profiles, plans and choices, destinations (archive, folder, server through `ServerImportSink`), card actions (verified delete, format, eject) | | `Archive` | `CurrentArchive`, `ArchiveTree`, figures for the charts, maintenance reports, Reorganize (`ReorganizeDialogViewModel`: folder, file and title templates each with its switch, the dry run, Apply queues the `move` job of that plan; `ReorganizePlans`: each template's check, the plan as rows and a summary; `ReorganizeOffer`: per archive, the templates Settings › Archive's toast offers, joined while that archive's toast is up), Convert (`ConvertDialogViewModel`: format, JPEG quality and a mode chosen at every run, the dry run, Apply behind a typed confirmation for Replace queues the `convert` job of that plan; `ConvertPlans`: the plan as rows, a summary, the space line and the Replace confirmation; `ConvertUndo`: the Undo of a finished Replace, which restores its `Replaced` trash entries), retag, delete and trash dialogs (`SequenceDeletion`, `DeletePlans`, `TrashEmptyPlans`: Empty… behind a dry run and a typed confirmation), `ArchiveFailures` | | `Server` | `ServerSession`, `ConnectFlow` (trust on first use), `SyncHost` (sync engine, agent, metered hold, editor connections, Export Sync), sync table, `RemoteSequenceApi` | -| `Jobs`, `Settings`, `About` | Job list and buffering, `JobNotices` (which job endings raise a toast; `JobEndings` lets a batch speak once); the schedules of Jobs › Scheduled (`DesktopScheduleHost`: the desktop's `IScheduleHost` and its system schedules `archive-scan`, `index-backup`, `housekeeping`; `CacheTrimStep`, the host's clean-up step; `SchedulesViewModel`, `ScheduleRowViewModel`, `ScheduleEditorViewModel` and `ScheduleDialogs.xaml`, the in-window editor; `ScheduleText`); settings rows (`LogSettingsRows`: Advanced's log rows), encoder and format inventories, `ProcessingTuning` (Settings › Rendering and Analysis applied to each job: parallelism, memory budget, quality), `InterfacePriority`, language catalog, naming preview; `AboutViewModel` (owned by the shell, not a section: Settings › About, the update notice of Settings › Updates and the update check on start), update check and download | +| `Jobs`, `Settings`, `About` | Job list and buffering, `JobNotices` (which job endings raise a toast; `JobEndings` lets a batch speak once); the schedules of Jobs › Scheduled (`DesktopScheduleHost`: the desktop's `IScheduleHost` and its system schedules `archive-scan`, `index-backup`, `housekeeping`; `CacheTrimStep`, the host's clean-up step; `SchedulesViewModel`, `ScheduleRowViewModel`, `ScheduleEditorViewModel` and `ScheduleDialogs.xaml`, the in-window editor; `ScheduleText`); settings rows (`LogSettingsRows`: Advanced's log rows; `WorkspaceSettingsRows`: Settings › Workspace), encoder and format inventories, `ProcessingTuning` (Settings › Rendering and Analysis applied to each job: parallelism, memory budget, quality), `InterfacePriority`, language catalog, naming preview; `AboutViewModel` (owned by the shell, not a section: Settings › About, the update notice of Settings › Updates and the update check on start), update check and download | | `Infrastructure` | `AppServices` (composition root; `SequenceReorganized`, raised after each Reorganize step, reloads an editor open on that sequence), `AppSettings`, `AppLogging` (Settings › Advanced › Logs applied to the log files from their first line, a launch that only hands over included, and at every save), `AppEnvironment` (installed or portable), `AppClock` (today's date, frozen by `--capture`), `StartWithWindows` (this copy's sign-in entry), `UiLanguage`, `LiveRegion`, `RenderNodeHost`, `DiagnosticsBundle`, `ShellActions` (BRIEF §8.6), `SingleInstance` (one Chronos per data folder; a later launch hands its file over a named pipe, or waits for a closing one to exit and starts in its place), device monitor | | `DesignTime` | `SampleData`: the archive, jobs and server the screenshots and smoke tests run on, dated from the fixed `SampleData.Now` | @@ -97,7 +98,7 @@ Dependencies point one way: `Core` ← `Core.Windows`, `Data`, `Protocol` ← `S | Host | Composition root | What it runs | |---|---|---| -| Chronos (desktop) | `App/Infrastructure/AppServices` | SQLite index in `%LOCALAPPDATA%\Chronos` (or `.\data` when portable, unless the copy is in a OneDrive folder); `ArchiveService` with WIC first, then managed decoders; `ProcessingService` with Media Foundation, then managed encoders; one `JobEngine` with the handlers of both; thumbnails; `ServerSession`; `SyncHost` while signed in (sync engine and agent, upload and download handlers, metered hold, editors of server sequences); the render node while opted in and signed in; update check and download (`About/UpdateCheck`, `About/UpdateDownload`, `About/UpdateFlow`: the setup, or the portable zip for a portable copy, verified against `SHA256SUMS`, resumable, cancellable, failing after 60 s without data); diagnostics bundle; the `Scheduler` on `DesktopScheduleHost`, started once the archive was reopened (an unplugged one is looked for every minute), which then runs the archive scan once (again when an unplugged archive is back), and whose system schedules replaced the rescan timer, the daily backup loop and the job-history purge (scans follow Settings › Analysis › After a scan at every run); the restore staged in Settings › Advanced (`DatabaseBackups`) | +| Chronos (desktop) | `App/Infrastructure/AppServices` | SQLite index in `%LOCALAPPDATA%\Chronos` (or `.\data` when portable, unless the copy is in a OneDrive folder); `ArchiveService` with WIC first, then managed decoders; `ProcessingService` with Media Foundation, then managed encoders; one `JobEngine` with the handlers of both and the workspace copy; the workspace (`WorkspaceHost`: `%LOCALAPPDATA%\Chronos\workspace` or `.\data\workspace`, unless Settings › Workspace says otherwise; none in a capture); thumbnails; `ServerSession`; `SyncHost` while signed in (sync engine and agent, upload and download handlers, metered hold, editors of server sequences); the render node while opted in and signed in; update check and download (`About/UpdateCheck`, `About/UpdateDownload`, `About/UpdateFlow`: the setup, or the portable zip for a portable copy, verified against `SHA256SUMS`, resumable, cancellable, failing after 60 s without data); diagnostics bundle; the `Scheduler` on `DesktopScheduleHost`, started once the archive was reopened (an unplugged one is looked for every minute), which then runs the archive scan once (again when an unplugged archive is back), and whose system schedules replaced the rescan timer, the daily backup loop and the job-history purge (scans follow Settings › Analysis › After a scan at every run); the restore staged in Settings › Advanced (`DatabaseBackups`) | | Chronos Server | `Server/Hosting/ServerHost.Build` | Options from `server.json` + `CHRONOS_*`; PostgreSQL (or SQLite on Windows); `ArchiveModule` then `ProcessingModule` register job handler providers; `JobEngineHost` (renders only managed formats and MP4 jobs no render node can take, BRIEF §14.7); `RenderNodeService`/`RenderNodeMonitor`; `UploadService`; `VolumeSpace` (free space of the archive, the space path and `/data`, file system and mount from `/proc/self/mountinfo`; tests replace it); `EventHub` (WebSocket); embedded admin panel; LAN discovery beacon; Windows service host; `SchedulerHost` with the system schedules `archive-scan` (every 10 minutes, also once at start), `upload-cleanup` (every 6 hours), `index-backup` (SQLite only, 03:00), `housekeeping` (job history, 04:00) and `audit-cleanup` (04:30; Settings › Logs shows and sets its age limit, 0 while it is off; seeded and reset from `AuditRetentionDays`, 0 by default: off, the audit log kept; `CHRONOS_AUDIT_RETENTION_DAYS` fixes it before the first pass), no other timer queues work (a 10-minute timer only reads archive.json again) | | Chronos Uploader | `Uploader/App.xaml.cs` | `ChronosClient`, persisted queue, watch folders; no database | | Chronos Setup | `Setup/Program` | TPK1 payload extraction, registry, shortcuts, file types named in setup's language, silent mode, uninstaller; only what starts a program its log or payload lists is changed: Windows services of those programs stopped once the programs have closed, started again (also after a failure) or deleted through the Service Control Manager (an elevated `/SERVICES … /NAMES` step when needed), sign-in entries of those programs moved to the program an upgrade renamed or removed, shared shortcuts handed to the product that keeps the program; the Server only for all users inside Program Files; "Remove my data" limited to the programs no other installed product uses | @@ -171,8 +172,10 @@ index rows. A workspace on a fast disk checks a project out (its head as the bas job), edits the working state, saves versions locally (portable settings, positions parked by photo) and pushes them in order: a push whose parent is the head fast-forwards; otherwise the home's new versions are pulled, each local version is replayed on them (`ProjectMerge.Replay`) and the working state merged, and settings both sides changed stop there as a -conflict for the user. Main's head is the sequence's own settings (mirrored both ways), so the editor, analyses, renders -and server sync keep reading `project.json` and the index's settings; other projects never leave their home. +conflict for the user. Main's head is the sequence's own settings (mirrored both ways), so analyses, the Library's quick +renders and server sync keep reading `project.json` and the index's settings; other projects never leave their home. The +desktop's Edit opens only workspace projects (`App/Workspace`): it edits their working state, and a render of one runs +at the home with its portable settings, recording the project and the version. Sync (desktop ↔ server, BRIEF §14.5) reuses the same paths: `SyncService` compares the local index with the server's listing (settings and tags carry version counters), uploads go through the chunked protocol into the server's diff --git a/i18n/en/Editor.resx b/i18n/en/Editor.resx index 264c9f65..3369c389 100644 --- a/i18n/en/Editor.resx +++ b/i18n/en/Editor.resx @@ -159,6 +159,24 @@ No warnings {0} preview Set hero + Close + Compare + Changed since version {0}{0} version number + Current + {0} {1} now, {2} in that versionlong; {0} setting name, {1} value now, {2} value in the version compared + No versions yet + Savedhow a version was made: saved by a user + Outside changehow a version was made: settings written outside the workspace (an analysis, the server) + Importedhow a version was made: the project's first, from settings that were there + Mergedhow a version was made: merged with changes made meanwhile + Restoredhow a version was made: an earlier one brought back + Versions + Not sent + Library offline + Restore + Same as now + History of {0}{0} project name + Version {0}{0} version number Opening sequence Cut: pause or gap Keyframe @@ -172,6 +190,14 @@ Shutter angle Path smoothing Stabilise + Existing + Mediathe photos the workspace copies: proxies or originals + New + Open + Originals + Project + Proxies + Open in workspace {0}: {1} → {2}invariant {0}: {1} ← {2}invariant; right-to-left languages: the arrow points from the old value to the new one {0} setting changed @@ -184,10 +210,12 @@ Paththe guided path of the Edit section: its steps from the analysis to the export Cancel Clear search + Library Sequences Loading sequences No sequence matches Choose a sequence + Workspace Preview 1:1invariant Preview 10 s @@ -205,6 +233,18 @@ This frame cannot be read. Vectors original | corrected + Delete project… + Delete + Its versions are sent to the library first, then the project goes to the library's project trash; the sequence and its photos stay.long + Delete project {0}?{0} project name + History… + Keep + Mainthe name of every sequence's first project, holding the sequence's own settings + New project… + Remove local copy… + Rename… + Save version… + Sync Project file applied The project file’s settings were not applied.long The sequence of this project file is not in the library.long @@ -214,6 +254,11 @@ Project file folder Undo This file is not a Chronos project or cannot be read.long + Rename + Create + Name + New project + Rename project Proxies not received Getting the proxies Auto @@ -221,6 +266,17 @@ Luminance {0} · proxies outdated {0} · read-only + Unsaved changes + Discard changes + Files + The photos copied to this PC are deleted; the project stays in the library and opens again from there.long + None + Remove + Send first + Size + Remove local copy of {0}{0} project name + Versions not sent + Yes Render · {0} Render finished Render queued @@ -231,6 +287,9 @@ Back to Auto Changes not saved Retry + Note + Save + Save a version of {0}{0} project name Cancel job {0} {1} on {2} {0} left @@ -310,4 +369,40 @@ {0} pxinvariant {0}invariant {0}×invariant + Later + {0} was changed in the library while you edited it here. These settings differ: keep yours, take the library's, or keep both as two projects.long; {0} project name + Take library'stake the library's values where both sides changed a setting + Changed in the library too + Workspace copy failed + Copying to the workspace + Project {0} created{0} project name + Project not deleted + Project {0} deleted{0} project name + {0} {1} here, {2} in the librarylong; {0} setting name, {1} value in this workspace, {2} value in the library + Project in sync + Library photos changed + Version not sent yet + Nothing new to save + Library offline + Local copy not removed + Local copy removed + Project renamed + Version {0} restored{0} version number + Version {0} saved{0} version number + Your versions saved as {0}{0} the name of the new project holding them + Version {0} saved and sent{0} version number + Not sentversions saved here wait to be sent to the library + Library newerthe library has versions the workspace has not taken + Conflict + In sync + No media + Changedthe project has changes not saved as a version + Offline + Checkingthe project's state is being read from the library + Syncing + Sync failed + Project synced + Undo + Update media + Updating media diff --git a/i18n/en/Errors.resx b/i18n/en/Errors.resx index 5ef37c3f..3311f72d 100644 --- a/i18n/en/Errors.resx +++ b/i18n/en/Errors.resx @@ -48,9 +48,23 @@ Unknown token “{0}” at position {1}. The closing brace at position {1} has no opening one; double it for a literal brace. Something went wrong. + Settle the conflict first: Sync shows which settings differ. {0} did not match its source after it was copied.{0} file path + A file of this project in the workspace cannot be read; the log names it. + The last edit could not be stored yet; it is tried again, try once more in a moment. + The library's copy of this project does not match what was sent; nothing was removed. + A project name has 1 to 60 characters. + The Main project holds the sequence's own settings: it cannot be deleted. + The workspace's photos of this project changed; the editor reads them again. + The workspace holds no photos of this project; open it again to copy them. + Another project of this sequence has that name. The project is no longer in the workspace. + The library cannot be reached now; your work stays in the workspace and can be sent once it is back. The workspace copies proxies for now; copying the originals comes in a later version. The workspace project belongs to another sequence. The workspace copy job has no valid parameters. + This project is no longer in the library. + This project was saved by a newer Chronos: it opens read-only. + The library refused a version of this project; the log says why. + Some work is not in the library yet: send it first, or discard it. diff --git a/i18n/en/Settings.resx b/i18n/en/Settings.resx index dc162458..bc2192bd 100644 --- a/i18n/en/Settings.resx +++ b/i18n/en/Settings.resx @@ -132,6 +132,7 @@ Server Storage Updates + Workspace Auto · {0} Background priority Codec @@ -196,4 +197,10 @@ {0} used · {1} free {0} used Latest version + After each version + Folder + Kept versions + Sync + {0} version + {0} versions diff --git a/i18n/en/Tooltips.resx b/i18n/en/Tooltips.resx index 9df76ae9..75e98a54 100644 --- a/i18n/en/Tooltips.resx +++ b/i18n/en/Tooltips.resx @@ -203,6 +203,11 @@ Use this frame in renders again Sort by this column; click again to reverse Click a row to show the frame + Show the settings that differ between version {0} and the project now{0} version number + The project is this version now + Saved here, waiting to be sent to the library + The library cannot be reached: the versions this PC keeps are listed + Make version {0} the project again (one step: Ctrl+Z takes it back); unsaved changes are saved as a version first{0} version number Adds blur along the motion like a slower shutter; costs optical flow on every frame Optical flow precision for blur and synthesised frames; Best is the slowest Target shutter angle; 180° is the film look, more smears moving things @@ -217,6 +222,13 @@ Not applicable: used only by motion blur and interpolated timing Not applicable: stabilisation is off Not applicable: stacking is off + Open a project the library has for this sequence; Main holds its settings as they are + The new project's name: 1 to 60 characters, each name once per sequence + A new project of this sequence, starting from Main + Copy the project's photos into the workspace, then open it there + Copying the originals, to render on this PC, comes in a later update + The sequence's projects in the library + Copy the proxies: light and fast to edit; renders use the library's originals Let the advisor set every section from the analysis and list what changed The advisor never stacks on its own: a median erases moving stars Apply the advisor’s heavier choices for this section and list what changed · Ctrl+Z undoes @@ -226,6 +238,7 @@ Keep editing {0} · Esc{0} the open sequence's title Show every sequence again Open the selected sequence · Enter + Enter or a double-click opens this project in the workspace Double-click or Enter opens it in Edit Filter by title, camera or tag as you type · ↓ goes to the list · Enter opens · Esc clears Play the frames · Space; arrows step one frame @@ -242,13 +255,28 @@ Show or hide the shot data Overlay the motion to the next frame measured by the engine Drag the line to compare · drag to pan · wheel zooms · double-click 1:1 + Send this project's versions to the library, then move it to the library's project trash + Move the project, with all its versions, to the library's project trash + The project's versions: compare one with now, or restore it + Keep the project as it is + Project {0} ({1}): save a version, sync, history, other projects and the local copy{0} project name, {1} its state + Make another project of this sequence, starting from this one (for example a vertical cut for social media) + Free this PC's space: delete the photos copied to the workspace; the project stays in the library + Give this project another name, here and in the library + Keep the project as it is now as a version of its history, with an optional note (Ctrl+S) Project files are for sequences in an archive on this PC Apply the project file’s settings again Save a .chronos file that opens this sequence with these settings when double-clicked Bring back the settings the sequence had before the file was opened · Ctrl+Z + Rename the project here and in the library + Make the project in the library and open it in the workspace + 1 to 60 characters, each name once per sequence Your account can look at this server sequence but not change it Edited with proxies on this PC; changes are saved on {0} and analyses and renders run there Shown from {0}; your account can look at this sequence but not change it + Remove the copy without sending what is not in the library; that work is kept aside in the workspace's trash + Delete the workspace copy; every version is in the library + Save and send what is not in the library yet, then remove the copy Render with the selected preset; progress in the job bar · Ctrl+R Fix the file name first: {0} Every frame is excluded: include some in the Frames step @@ -261,6 +289,8 @@ Render on {0} with the selected preset; progress beside the title · Ctrl+R Return every control of this section to Auto · Ctrl+Z undoes Try to save now; saving is also retried automatically + What changed, as the history will show it (optional) + Save the version, and send it to the library when Sync automatically is on {0} running on {1} Cancel the job on {0}; Retry in the notice that follows queues it again from its last checkpoint {0} paused on {1} @@ -292,6 +322,24 @@ Photos shown per second of video; more plays the sequence faster Close without the change; the stored settings stay as they were Stay in the editor; saving is retried in the background + The settings that differ: your value, then the library's + Keep your values of these settings; they are sent to the library + Decide later and keep editing; Sync asks again + Photos were added to or removed from this sequence in the library after the workspace copied it + Keep the library's values in this project, and send yours to a new project “{0}”{0} the new project's name + Versions saved here that wait to be sent to the library: {0}. Sync sends them{0} number of versions + Versions in the library this workspace has not taken yet: {0}. Sync takes them{0} number of versions + You and the library changed the same settings: Sync to choose which to keep + Every version of this project is in the library, and nothing changed since the last one + The workspace holds no photos of this project: opening it copies them again + Changes not saved as a version yet: Save version (Ctrl+S) keeps them in the history + The library cannot be reached now: your work stays here and is sent once it is back + The library cannot be reached now. Versions waiting to be sent once it is back: {0}{0} number of versions + Asking the library where this project stands + Taking the library's new versions and sending yours + Use the library's values of these settings in the editor + Bring back the project as it was before the restore + Copy the library's frames into the workspace again; the frames you excluded or keyed follow their photos Import photos already in the archive again; nothing is overwritten Copy into this PC's archive with the naming templates · {0} Start the import with this card's settings as soon as it is inserted; a toast lets you cancel @@ -677,6 +725,7 @@ Keep the index as it is Log files last written longer ago are deleted Keep every setting as it is + How many of the library's versions each project keeps on this PC besides those not sent; older ones stay in the library Language of the interface · applies immediately A log file that reaches this size continues in a new numbered file Least severe level written to the log files; Debug and Trace help find problems but fill the files fast @@ -688,6 +737,7 @@ Without this extension some formats are read only from their embedded preview, or not at all, on this PC Frames whose mean brightness is at most this share of white count as night (star fields, night presets) · Enter applies, Esc reverts Open the data folder in Explorer + Show the workspace folder in Explorer Version, build, system, licence, third-party code Portable mode, logs, diagnostics, database backup and restore, reset Analysis width, night and star thresholds, deep analysis @@ -700,6 +750,7 @@ Default server, render node, trusted certificates Cache folder, thumbnails in memory, cache limit Update check on start + Where projects are edited on this PC: the folder, sync and versions kept Photos the running job processes at once; jobs run one at a time. Fewer leave more room to other programs · Enter applies, Esc reverts Auto: half the logical cores Back to Auto: half the logical cores @@ -737,6 +788,8 @@ Every pixel is decoded No decoder on this PC reads its pixels; such frames are left out of renders Send a daily anonymous count of versions and languages in use; nothing else, off by default + The workspace's folder (a fast disk is best); moving it comes in a later update + Send each version you save to the library at once, and take the library's new versions Install in Program Files for every account · asks for administrator approval {0} · it runs as a Windows service, so it installs for all users in Program Files Return to the options without changing anything diff --git a/i18n/it/Editor.it.resx b/i18n/it/Editor.it.resx index 40c3f8ba..980e5388 100644 --- a/i18n/it/Editor.it.resx +++ b/i18n/it/Editor.it.resx @@ -151,6 +151,24 @@ Nessun avviso anteprima {0} Imposta copertina + Chiudi + Confronta + Cambiato dalla versione {0} + Attuale + {0} {1} ora, {2} in quella versione + Ancora nessuna versione + Salvata + Modifica esterna + Importata + Unita + Ripristinata + Versioni + Non inviata + Libreria non in linea + Ripristina + Uguale ad ora + Cronologia di {0} + Versione {0} Apertura sequenza Taglio: pausa o vuoto Fotogramma chiave @@ -164,6 +182,14 @@ Angolo otturatore Smussatura percorso Stabilizza + Esistente + Media + Nuovo + Apri + Originali + Progetto + Proxy + Apri nello spazio di lavoro {0} impostazione cambiata {0} impostazioni cambiate Niente da cambiare @@ -174,10 +200,12 @@ Percorso Annulla Cancella ricerca + Libreria Sequenze Caricamento sequenze Nessuna sequenza trovata Scegli una sequenza + Spazio di lavoro Anteprima Anteprima 10 s Confronta @@ -194,6 +222,18 @@ Questo fotogramma non si può leggere. Vettori originale | corretto + Elimina progetto… + Elimina + Le sue versioni vengono prima inviate alla libreria, poi il progetto va nel cestino dei progetti della libreria; la sequenza e le sue foto restano. + Eliminare il progetto {0}? + Cronologia… + Mantieni + Principale + Nuovo progetto… + Rimuovi copia locale… + Rinomina… + Salva versione… + Sincronizza File di progetto applicato Le impostazioni del file di progetto non sono state applicate. La sequenza di questo file di progetto non è nella libreria. @@ -203,6 +243,11 @@ Cartella file progetto Annulla Questo file non è un progetto Chronos o non si può leggere. + Rinomina + Crea + Nome + Nuovo progetto + Rinomina progetto Proxy non ricevuti Scaricamento dei proxy Auto @@ -210,6 +255,17 @@ Luminanza {0} · proxy superati {0} · sola lettura + Modifiche non salvate + Scarta modifiche + File + Le foto copiate su questo PC vengono eliminate; il progetto resta nella libreria e si riapre da lì. + Nessuna + Rimuovi + Prima invia + Dimensione + Rimuovi copia locale di {0} + Versioni non inviate + Sì Renderizza · {0} Render completato Render in coda @@ -220,6 +276,9 @@ Torna ad Auto Modifiche non salvate Riprova + Nota + Salva + Salva una versione di {0} Annulla attività {0} su {2}: {1} mancano {0} @@ -285,4 +344,40 @@ Nessuno Disattivo Attivo + Più tardi + {0} è stato modificato nella libreria mentre lo modificavi qui. Queste impostazioni sono diverse: tieni le tue, prendi quelle della libreria o tienile entrambe come due progetti. + Prendi la libreria + Modificato anche nella libreria + Copia di lavoro non riuscita + Copia nello spazio di lavoro + Progetto {0} creato + Progetto non eliminato + Progetto {0} eliminato + {0} {1} qui, {2} nella libreria + Progetto sincronizzato + Foto della libreria cambiate + Versione non ancora inviata + Niente di nuovo da salvare + Libreria non in linea + Copia locale non rimossa + Copia locale rimossa + Progetto rinominato + Versione {0} ripristinata + Versione {0} salvata + Versioni salvate come {0} + Versione {0} salvata e inviata + Da inviare + Libreria più nuova + Conflitto + Sincronizzato + Senza media + Modificato + Non in linea + Verifica + Sincronizzazione + Sincronizzazione non riuscita + Sincronizzazione eseguita + Annulla + Aggiorna media + Aggiornamento media diff --git a/i18n/it/Errors.it.resx b/i18n/it/Errors.it.resx index bf37db7c..91df245c 100644 --- a/i18n/it/Errors.it.resx +++ b/i18n/it/Errors.it.resx @@ -48,9 +48,23 @@ Segnaposto sconosciuto «{0}» alla posizione {1}. La parentesi graffa chiusa alla posizione {1} non ha un'apertura; raddoppiala per una graffa letterale. Si è verificato un problema. + Risolvi prima il conflitto: Sincronizza mostra quali impostazioni sono diverse. {0} non corrispondeva all'originale dopo la copia. + Un file di questo progetto nello spazio di lavoro non è leggibile; il log lo indica. + L'ultima modifica non è ancora stata memorizzata; viene ritentata, riprova tra un momento. + La copia di questo progetto nella libreria non corrisponde a quanto inviato; non è stato rimosso nulla. + Il nome di un progetto ha da 1 a 60 caratteri. + Il progetto Principale contiene le impostazioni della sequenza: non può essere eliminato. + Le foto di questo progetto nello spazio di lavoro sono cambiate; l'editor le rilegge. + Lo spazio di lavoro non ha foto di questo progetto; riaprilo per copiarle. + Un altro progetto di questa sequenza ha già quel nome. Il progetto non è più nello spazio di lavoro. + La libreria ora non è raggiungibile; il tuo lavoro resta nello spazio di lavoro e potrà essere inviato quando torna. Per ora lo spazio di lavoro copia i proxy; la copia degli originali arriverà in una versione successiva. Il progetto dello spazio di lavoro appartiene a un'altra sequenza. Il job di copia di lavoro non ha parametri validi. + Questo progetto non è più nella libreria. + Questo progetto è stato salvato da un Chronos più recente: si apre in sola lettura. + La libreria ha rifiutato una versione di questo progetto; il log spiega il motivo. + Parte del lavoro non è ancora nella libreria: prima inviala oppure scartala. diff --git a/i18n/it/Settings.it.resx b/i18n/it/Settings.it.resx index 58db5333..4af7d46b 100644 --- a/i18n/it/Settings.it.resx +++ b/i18n/it/Settings.it.resx @@ -129,6 +129,7 @@ Server Spazio su disco Aggiornamenti + Spazio di lavoro Auto · {0} Priorità bassa Codec @@ -193,4 +194,10 @@ {0} usati · {1} liberi {0} usati Ultima versione + Dopo ogni versione + Cartella + Versioni tenute + Sincronizzazione + {0} versione + {0} versioni diff --git a/i18n/it/Tooltips.it.resx b/i18n/it/Tooltips.it.resx index 1735fa45..57626515 100644 --- a/i18n/it/Tooltips.it.resx +++ b/i18n/it/Tooltips.it.resx @@ -203,6 +203,11 @@ Usa di nuovo questo fotogramma nei render Ordina per questa colonna; un altro clic inverte Fai clic su una riga per mostrare il fotogramma + Mostra le impostazioni diverse tra la versione {0} e il progetto attuale + Il progetto ora è questa versione + Salvata qui, in attesa di essere inviata alla libreria + La libreria non è raggiungibile: sono elencate le versioni che questo PC conserva + Rendi di nuovo la versione {0} il progetto (un passo: Ctrl+Z lo annulla); le modifiche non salvate diventano prima una versione Aggiunge mosso lungo il movimento come un tempo più lungo; richiede il flusso ottico su ogni fotogramma Precisione del flusso ottico per mosso e fotogrammi sintetici; Massima è la più lenta Angolo otturatore obiettivo; 180° è l’aspetto cinema, di più impasta ciò che si muove @@ -217,6 +222,13 @@ Non applicabile: serve solo al mosso e ai tempi interpolati Non applicabile: la stabilizzazione è spenta Non applicabile: lo stacking è spento + Apri un progetto che la libreria ha per questa sequenza; Principale ne contiene le impostazioni attuali + Il nome del nuovo progetto: da 1 a 60 caratteri, ogni nome una sola volta per sequenza + Un nuovo progetto di questa sequenza, a partire da Principale + Copia le foto del progetto nello spazio di lavoro, poi aprilo lì + La copia degli originali, per renderizzare su questo PC, arriverà in un aggiornamento successivo + I progetti della sequenza nella libreria + Copia i proxy: leggeri e veloci da modificare; i render usano gli originali della libreria Lascia che il consulente imposti ogni sezione dall’analisi ed elenchi cosa è cambiato Il consulente non fa mai stacking da solo: una mediana cancella le stelle in movimento Applica le scelte più incisive del consulente per questa sezione ed elenca cosa è cambiato · Ctrl+Z annulla @@ -226,6 +238,7 @@ Continua a modificare {0} · Esc Mostra di nuovo tutte le sequenze Apri la sequenza selezionata · Invio + Invio o un doppio clic apre questo progetto nello spazio di lavoro Doppio clic o Invio la apre in Modifica Filtra per titolo, fotocamera o tag mentre scrivi · ↓ va all'elenco · Invio apre · Esc svuota Riproduce i fotogrammi · Spazio; le frecce avanzano di uno @@ -242,13 +255,28 @@ Mostra o nasconde i dati di scatto Sovrappone il movimento verso il fotogramma successivo misurato dal motore Trascina la linea per confrontare · trascina per spostare · la rotellina ingrandisce · doppio clic 1:1 + Invia le versioni di questo progetto alla libreria, poi spostalo nel cestino dei progetti della libreria + Sposta il progetto, con tutte le sue versioni, nel cestino dei progetti della libreria + Le versioni del progetto: confrontane una con lo stato attuale o ripristinala + Tieni il progetto com'è + Progetto {0} ({1}): salva una versione, sincronizza, cronologia, altri progetti e copia locale + Crea un altro progetto di questa sequenza a partire da questo (per esempio un taglio verticale per i social) + Libera spazio su questo PC: elimina le foto copiate nello spazio di lavoro; il progetto resta nella libreria + Dai un altro nome a questo progetto, qui e nella libreria + Tieni il progetto com'è ora come versione della sua cronologia, con una nota facoltativa (Ctrl+S) I file di progetto sono per le sequenze di un archivio su questo PC Applica di nuovo le impostazioni del file di progetto Salva un file .chronos che, con un doppio clic, apre questa sequenza con queste impostazioni Ripristina le impostazioni che la sequenza aveva prima di aprire il file · Ctrl+Z + Rinomina il progetto qui e nella libreria + Crea il progetto nella libreria e aprilo nello spazio di lavoro + Da 1 a 60 caratteri, ogni nome una sola volta per sequenza Il tuo account può vedere questa sequenza del server ma non modificarla Modificata con i proxy su questo PC; le modifiche si salvano su {0} e analisi e render vengono eseguiti lì Mostrata da {0}; il tuo account può vedere questa sequenza ma non modificarla + Rimuovi la copia senza inviare ciò che non è nella libreria; quel lavoro resta da parte nel cestino dello spazio di lavoro + Elimina la copia di lavoro; ogni versione è nella libreria + Salva e invia ciò che non è ancora nella libreria, poi rimuovi la copia Renderizza con il preset scelto; avanzamento nella barra dei lavori · Ctrl+R Correggi prima il nome del file: {0} Tutti i fotogrammi sono esclusi: includine alcuni nel passo Fotogrammi @@ -261,6 +289,8 @@ Renderizza su {0} con il preset scelto; avanzamento accanto al titolo · Ctrl+R Riporta in Auto ogni controllo di questa sezione · Ctrl+Z annulla Prova a salvare ora; il salvataggio viene anche ritentato da solo + Cosa è cambiato, come lo mostrerà la cronologia (facoltativo) + Salva la versione e inviala alla libreria quando la sincronizzazione automatica è attiva {0} in corso su {1} Annulla l’attività su {0}; Riprova nell’avviso che segue la rimette in coda dall’ultimo punto di ripresa {0} in pausa su {1} @@ -291,6 +321,24 @@ Foto mostrate per secondo di video; di più accelera la sequenza Chiude senza la modifica; le impostazioni salvate restano com’erano Resta nell’editor; il salvataggio viene ritentato in background + Le impostazioni diverse: il tuo valore, poi quello della libreria + Tieni i tuoi valori di queste impostazioni; vengono inviati alla libreria + Decidi più tardi e continua a modificare; Sincronizza lo chiede di nuovo + Sono state aggiunte o tolte foto a questa sequenza nella libreria dopo che lo spazio di lavoro l'ha copiata + Tieni i valori della libreria in questo progetto e invia i tuoi a un nuovo progetto «{0}» + Versioni salvate qui in attesa di essere inviate alla libreria: {0}. Sincronizza le invia + Versioni nella libreria non ancora prese da questo spazio di lavoro: {0}. Sincronizza le prende + Tu e la libreria avete modificato le stesse impostazioni: sincronizza per scegliere quali tenere + Ogni versione di questo progetto è nella libreria e nulla è cambiato dall'ultima + Lo spazio di lavoro non ha foto di questo progetto: aprirlo le copia di nuovo + Modifiche non ancora salvate come versione: Salva versione (Ctrl+S) le tiene nella cronologia + La libreria ora non è raggiungibile: il tuo lavoro resta qui e viene inviato quando torna + La libreria ora non è raggiungibile. Versioni in attesa di essere inviate quando torna: {0} + Chiede alla libreria lo stato di questo progetto + Prende le nuove versioni della libreria e invia le tue + Usa nell'editor i valori della libreria per queste impostazioni + Riporta il progetto com'era prima del ripristino + Copia di nuovo i fotogrammi della libreria nello spazio di lavoro; i fotogrammi esclusi o con keyframe seguono le loro foto Importa di nuovo le foto già in archivio; nulla viene sovrascritto Copia nell'archivio di questo PC con i modelli dei nomi · {0} Avvia l'importazione con le impostazioni della scheda appena viene inserita; un avviso permette di annullare @@ -675,6 +723,7 @@ Lascia l'indice com'è I file di log scritti l'ultima volta prima di questo periodo vengono eliminati Lascia ogni impostazione com'è + Quante versioni della libreria ogni progetto tiene su questo PC oltre a quelle non inviate; le più vecchie restano nella libreria Lingua dell'interfaccia · si applica subito Un file di log che raggiunge questa dimensione prosegue in un nuovo file numerato Livello minimo scritto nei file di log; Debug e Trace aiutano a trovare i problemi ma riempiono i file in fretta @@ -686,6 +735,7 @@ Senza questa estensione alcuni formati si leggono solo dall'anteprima incorporata, o per niente, su questo PC I fotogrammi con luminosità media al massimo pari a questa quota del bianco contano come notturni (campi stellari, preset notturni) · Invio applica, Esc annulla Apri la cartella dati in Esplora file + Mostra la cartella dello spazio di lavoro in Esplora file Quando Chronos è ridotto a icona o in secondo piano, schede inserite, attività finite e messaggi del server compaiono anche come notifiche di Windows Versione, build, sistema, licenza, codice di terze parti Modalità portatile, log, diagnostica, backup e ripristino del database, valori predefiniti @@ -698,6 +748,7 @@ Server predefinito, nodo di rendering, certificati attendibili Cartella della cache, miniature in memoria, limite della cache Controllo degli aggiornamenti all'avvio + Dove si modificano i progetti su questo PC: cartella, sincronizzazione e versioni tenute Foto che l'attività in corso elabora insieme; le attività girano una alla volta. Meno lasciano più spazio agli altri programmi · Invio applica, Esc annulla Auto: metà dei core logici Torna ad Auto: metà dei core logici @@ -735,6 +786,8 @@ Ogni pixel viene decodificato Nessun decodificatore su questo PC ne legge i pixel; questi fotogrammi restano fuori dai rendering Invia ogni giorno un conteggio anonimo di versioni e lingue in uso; nient'altro, disattivato per impostazione predefinita + La cartella dello spazio di lavoro (meglio un disco veloce); spostarla arriverà in un aggiornamento successivo + Invia subito alla libreria ogni versione che salvi e prendi le nuove versioni della libreria Installa in Programmi per tutti gli account · chiede l'autorizzazione di amministratore {0} · è un servizio di Windows, quindi si installa per tutti gli utenti in Programmi Torna alle opzioni senza modificare nulla diff --git a/src/Chronos.App/Editor/EditorSession.cs b/src/Chronos.App/Editor/EditorSession.cs index aab5ae05..f0dbc2a8 100644 --- a/src/Chronos.App/Editor/EditorSession.cs +++ b/src/Chronos.App/Editor/EditorSession.cs @@ -166,11 +166,15 @@ public sealed class EditorSession : IAsyncDisposable /// /// The jobs that render and its batch: one job on this PC (the sequence is prepared once), - /// one per preset on a server, where a render node uploads one file per job (BRIEF §14.7). + /// one per preset on a server, where a render node uploads one file per job (BRIEF §14.7), and for a workspace project + /// one per preset at its home with the project's portable settings (, owner review 2, R8). /// - public IReadOnlyList RenderRequests(ExportSettings export) => IsRemote - ? ProcessingJobs.RenderEach(Content.Sequence, export, Content.SourceWidth, Content.SourceHeight, Project with { Export = export }) - : [RenderRequest(export)]; + public IReadOnlyList RenderRequests(ExportSettings export) => Source switch + { + IProjectRenders renders => renders.RenderRequests(Content.Sequence, Project, export, Content.SourceWidth, Content.SourceHeight), + _ when IsRemote => ProcessingJobs.RenderEach(Content.Sequence, export, Content.SourceWidth, Content.SourceHeight, Project with { Export = export }), + _ => [RenderRequest(export)], + }; /// /// Makes a "Save both" copy of this PC's settings the project, as one undoable step; null when it stores the same values. diff --git a/src/Chronos.App/Editor/EditorViewModel.cs b/src/Chronos.App/Editor/EditorViewModel.cs index 2dd816a7..d31f2f84 100644 --- a/src/Chronos.App/Editor/EditorViewModel.cs +++ b/src/Chronos.App/Editor/EditorViewModel.cs @@ -89,6 +89,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable /// The user chose a step since the editor opened. private bool _stepChosen; + private Workspace.ProjectMenuViewModel? _project; private bool _disposed; public EditorViewModel(ShellViewModel shell, EditorSession session, IReadOnlyList encoders, EncoderHost host) @@ -175,6 +176,23 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable /// A server sequence edited with proxies (the header says where it lives). public bool IsRemote => Session.IsRemote; + /// + /// The project menu beside the title (owner review 2, R8) when the sequence is open as a workspace project: its state, + /// Save version, Sync, History and the rest; null otherwise (a server sequence, a capture's library sequence). + /// + public Workspace.ProjectMenuViewModel? Project + { + get => _project; + internal set + { + _project?.Dispose(); + Set(ref _project, value); + OnPropertyChanged(nameof(HasProject)); + } + } + + public bool HasProject => _project is not null; + /// The server a server sequence lives on ("Studio NAS"); null for a sequence of this PC. public string? ServerName => IsRemote ? Shell.Services.Server.ServerName ?? Loc.L("Server.Label.Server") : null; @@ -711,6 +729,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable Shell.Services.Sync.Changed -= OnSyncChanged; Shell.Services.SequenceReorganized -= OnSequenceReorganized; foreach (var tab in Tabs) tab.Dispose(); + _project?.Dispose(); base.Dispose(); await Session.DisposeAsync(); } @@ -1134,6 +1153,8 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable if (job is { Kind: JobKind.DeepAnalyse, State: JobState.Done }) ClearVisited(); // A render this editor followed to its end is said here, with its output, unless the Jobs screen said it first. if (job.State == JobState.Done) _ = ReloadAsync(job.Kind == JobKind.Render && Shell.Jobs.ClaimRenderToast(job.Id) ? job : null); + // An analysis may have written its Auto values into the library's settings (Main): the project takes them or says so. + if (job.State == JobState.Done && _project is { } project) _ = project.JobEndedAsync(job); else if (IsRemote && job.State is JobState.Failed or JobState.Cancelled) ReportServerJobEnded(job); }); } diff --git a/src/Chronos.App/Editor/ProjectFiles.cs b/src/Chronos.App/Editor/ProjectFiles.cs index e762c9d9..e1436daa 100644 --- a/src/Chronos.App/Editor/ProjectFiles.cs +++ b/src/Chronos.App/Editor/ProjectFiles.cs @@ -1,5 +1,6 @@ using System.IO; using Chronos.App.Infrastructure; +using Chronos.App.Sections; using Chronos.App.Shell; using Chronos.Core.Diagnostics; using Chronos.Core.Localization; @@ -36,7 +37,10 @@ public sealed class ProjectFiles(ShellViewModel shell) /// /// Opens the project file at : its sequence in the editor (found by id, else by archive and /// folder), then the file's settings as one undo step. Says in one sentence why when the file cannot be read, its - /// sequence is not in the library, or the sequence cannot take the settings now. + /// sequence is not in the library, or the sequence cannot take the settings now. With the workspace (owner review 2, + /// R8), a file of format 2 opens its project there (a workspace's own project.chronos as it is; a copy of one + /// gives that project its settings), and a file of format 1 gives its settings to the sequence's Main project, which + /// opens in the workspace (copied first when it is not there yet). /// public async Task OpenAsync(string path) { @@ -53,16 +57,30 @@ public sealed class ProjectFiles(ShellViewModel shell) return; } if (shell.Services.Database is not { } db) throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine")); - if (await ProjectBundles.ResolveAsync(db, bundle) is not { } sequence) + var home = bundle.Workspace is { Home: { IsArchive: true } h } ? await db.Sequences.GetAsync(h.SequenceId) : null; + if ((home ?? await ProjectBundles.ResolveAsync(db, bundle)) is not { } sequence) { Log.Info("project", $"Project file '{path}': sequence {bundle.Sequence.Id} ('{bundle.Sequence.Folder}' in archive {bundle.Archive.Id}) not in the index"); shell.Notify(Loc.L("Editor.ProjectFile.NotFound"), bundle.Sequence.Title ?? Path.GetFileName(path), Loc.L("Shell.Nav.Archive"), Loc.L("Tooltips.Nav.Archive"), () => shell.Navigate(SectionKey.Archive), isError: true); return; } - // Not opened: the editor said why, or kept the open sequence's edit the user chose not to discard. - if (await shell.Sequence.ShowAsync(sequence.Id) is not { } editor) return; - Apply(editor, bundle); + if (!shell.Services.Workspace.IsEnabled) + { + // Not opened: the editor said why, or kept the open sequence's edit the user chose not to discard. + if (await shell.Sequence.ShowAsync(sequence.Id) is { } editor) Apply(editor, bundle); + return; + } + if (bundle.Workspace is { } workspace) + { + // A workspace's own working state opens as it is; a copy of one (saved elsewhere, another PC's) gives its project its settings. + var own = shell.Services.Workspace.Store.Find(workspace.ProjectId) is { } project + && string.Equals(Path.GetFullPath(project.BundlePath), Path.GetFullPath(path), StringComparison.OrdinalIgnoreCase); + await shell.Sequence.ShowAsync(sequence.Id, new ProjectRequest(sequence.Id, workspace.ProjectId), own ? null : editor => Apply(editor, bundle)); + return; + } + // Format 1: the settings go to the sequence's Main project, once it is open (now, or after its copy into the workspace). + await shell.Sequence.ShowAsync(sequence.Id, ProjectRequest.MainOf(sequence.Id), editor => Apply(editor, bundle)); } /// Gives the open sequence the file's settings, unless the editor cannot change them now (a job runs, read-only). diff --git a/src/Chronos.App/Editor/WorkspaceSequenceSource.cs b/src/Chronos.App/Editor/WorkspaceSequenceSource.cs new file mode 100644 index 00000000..9ae8554f --- /dev/null +++ b/src/Chronos.App/Editor/WorkspaceSequenceSource.cs @@ -0,0 +1,342 @@ +using System.IO; +using System.Text.Json; +using Chronos.Core.Advice; +using Chronos.Core.Analysis; +using Chronos.Core.Analysis.Deep; +using Chronos.Core.Archiving; +using Chronos.Core.Diagnostics; +using Chronos.Core.Export; +using Chronos.Core.Imaging; +using Chronos.Core.Localization; +using Chronos.Core.Model; +using Chronos.Core.Project; +using Chronos.Core.Render; +using Chronos.Data; +using Chronos.Data.Archiving; +using Chronos.Data.Archiving.Jobs; +using Chronos.Data.Jobs; +using Chronos.Data.Processing; +using Chronos.Data.Projects; +using Chronos.Data.Workspaces; +using Chronos.Protocol; + +namespace Chronos.App.Editor; + +/// A source whose renders are made otherwise than from the project as the editor holds it (a workspace project: at its home). +public interface IProjectRenders +{ + /// The jobs that render of (the editor's settings, positions on the source's frames). + IReadOnlyList RenderRequests(Sequence sequence, ProjectSettings project, ExportSettings export, int sourceWidth, int sourceHeight); +} + +/// +/// A workspace project open in the editor (owner review 2, R8: editing happens in the workspace, never inside the +/// library): the frames and pixels of the media the workspace holds (media/media.json, the proxies), the project +/// from its working state (project.chronos, positions placed on those frames), saved there atomically under the +/// project's lease and merged against the basis like (a pull or a copy job writes it +/// too). Jobs run on this PC's engine against the home's sequence (same id): an analysis reads the home's originals, a +/// render renders the home's originals with the project's portable settings and records the project and the version +/// (). The deep report is the home's while its frames are the media's, else the copy the +/// workspace took. A copy job that changed the media (Update media) makes saves made against the frames read before refused +/// () until the editor has read them again and moved its positions by frame. +/// +public sealed class WorkspaceSequenceSource : ISequenceSource, IProjectRenders +{ + private const int JobsListed = 200; + + private readonly WorkspaceSync _sync; + private readonly ChronosDatabase _db; + private readonly ImageDecoder _decoder; + private readonly JobEngine? _engine; + private readonly Lock _gate = new(); + private readonly List _retired = []; + private IRenderFrameSource? _frames; + private IFrameSource? _pixels; + private int _frameCount; + private int _framesVersion = -1; + private Guid[] _frameIds = []; + private FramePhotos _photos = new([]); + private BundleWorkspace? _workspace; + private bool _readOnly; + private int _disposed; + + public WorkspaceSequenceSource(WorkspaceSync sync, Guid projectId, ChronosDatabase db, ImageDecoder decoder, JobEngine? engine) + { + ArgumentNullException.ThrowIfNull(sync); + ArgumentNullException.ThrowIfNull(db); + ArgumentNullException.ThrowIfNull(decoder); + _sync = sync; + _db = db; + _decoder = decoder; + _engine = engine; + ProjectId = projectId; + if (engine is not null) engine.JobChanged += OnJobChanged; + } + + public Guid ProjectId { get; } + + /// The project's folder in the workspace. + public WorkspaceProject Project => _sync.Store.Project(ProjectId); + + /// The workspace section of the project file as read last (name, Main, home, base, media); null before the first read. + public BundleWorkspace? Workspace => Volatile.Read(ref _workspace); + + /// The frames version of the home the media read last were copied at; -1 before the first read. + public int MediaFramesVersion => Volatile.Read(ref _framesVersion); + + /// The photos of the media read last, in frame order (what positions name). + public FramePhotos Photos => Volatile.Read(ref _photos); + + public bool IsRemote => false; + + /// Settings of a newer Chronos: shown, never saved. + public bool IsReadOnly => Volatile.Read(ref _readOnly); + + public bool IsOutdated => false; + + /// A workspace project's read-only state is known when it opens. + public event Action? ReadOnlyChanged + { + add { } + remove { } + } + + public event Action? JobChanged; + + /// The workspace holds no media for the project (copy them again), or the project is gone. + public async Task LoadAsync(CancellationToken cancellationToken) + { + WorkspaceSession session; + try + { + session = await _sync.OpenAsync(ProjectId, cancellationToken); + } + catch (InvalidOperationException ex) + { + throw new EditorException(Loc.L("Errors.Workspace.NotCheckedOut"), ex); + } + catch (InvalidDataException ex) + { + throw new EditorException(Loc.L("Editor.Error.Project"), ex); + } + if (session is not { Sequence: { } media, Media: { } index }) throw new EditorException(Loc.L("Errors.Workspace.MediaMissing")); + var home = session.Bundle.Workspace!.Home; + var row = await _db.Sequences.GetAsync(home.SequenceId, cancellationToken); + var archive = row is null ? null : await _db.Archives.GetAsync(row.ArchiveId, cancellationToken); + IReadOnlyList renders = row is null ? [] : await _db.Renders.ListBySequenceAsync(home.SequenceId, cancellationToken); + return await Task.Run(() => + { + var frames = media.Frames; + Swap(media, index, session.Bundle.Workspace!, session.IsReadOnly); + var times = frames.Where(f => f.CapturedAt is not null).Select(f => f.CapturedAt!.Value).Order().ToList(); + // The home's row (camera, interval, tags) with the frames this workspace holds. + var sequence = (row ?? media.Sequence) with + { + FrameCount = frames.Count, + FramesVersion = index.FramesVersion, + FirstCapture = times.Count > 0 ? times[0] : null, + LastCapture = times.Count > 0 ? times[^1] : null, + SettingsJson = session.Working.ToJson(), + }; + var folder = archive is null ? null : new ArchivePaths(archive.RootPath).Sequence(row!.Folder); + var (deep, otherFrames) = ReadReport(folder, row?.FramesVersion == index.FramesVersion, session.Project.AnalysisPath, frames.Count); + var context = SequenceContext.FromFrames(frames); + return new SequenceContent(sequence, frames, session.Working, LightAnalyzer.Analyze(frames), deep, context.SourceWidth, context.SourceHeight, + folder?.Exports, [.. renders.OrderByDescending(r => r.Created)], []) + { + DeepOfOtherFrames = otherFrames, + }; + }, cancellationToken); + } + + /// Only a copy job changes the workspace's frames (Update media): its media index is compared with the one read last. + public Task FramesCurrentAsync(CancellationToken cancellationToken) => Task.Run(() => + { + var (framesVersion, ids) = (Volatile.Read(ref _framesVersion), Volatile.Read(ref _frameIds)); + try + { + return Project.ReadMedia() is { } media && media.FramesVersion == framesVersion && media.Frames.Select(f => f.Id).SequenceEqual(ids); + } + catch (InvalidDataException ex) + { + Log.Warning("editor", $"The media index of workspace project {ProjectId} cannot be read", ex); + return false; + } + }, cancellationToken); + + /// Whether the home's frames moved past those the workspace holds (frames added or removed there): "Update media" copies them again. + public async Task HomeFramesChangedAsync(CancellationToken cancellationToken) + { + if (Workspace is not { } workspace || MediaFramesVersion < 0) return false; + return await _db.Sequences.GetAsync(workspace.Home.SequenceId, cancellationToken) is { } row && row.FramesVersion != MediaFramesVersion; + } + + public async ValueTask DecodeAsync(int index, int maxLongEdge, DecodePurpose purpose, CancellationToken cancellationToken) + { + IFrameSource? pixels; + int count; + lock (_gate) (pixels, count) = (_pixels, _frameCount); + if (pixels is null || (uint)index >= (uint)count) return null; + // The loader decodes synchronously: an async delegate keeps a superseded decode's cancellation in user code (R4). + return await Task.Run(async () => await pixels.LoadAsync(index, maxLongEdge, cancellationToken).ConfigureAwait(false), cancellationToken); + } + + /// The project is read-only, or its media are gone. + /// The media changed since they were read (a copy job): read them again first. + public Task SaveProjectAsync(ProjectSettings project, ProjectSettings basis, CancellationToken cancellationToken) + { + ArgumentNullException.ThrowIfNull(project); + ArgumentNullException.ThrowIfNull(basis); + var framesVersion = Volatile.Read(ref _framesVersion); + if (framesVersion < 0) throw new InvalidOperationException("LoadAsync first."); + var folder = Project; + return Task.Run(async () => + { + using (await folder.LockAsync(_sync.LockWait, cancellationToken)) + { + var bundle = folder.ReadBundle(); + if (bundle.IsReadOnly || project.IsNewerFormat) throw new EditorException(Loc.L("Errors.Workspace.ReadOnly")); + var media = folder.ReadMedia() ?? throw new EditorException(Loc.L("Errors.Workspace.MediaMissing")); + // A copy job moved the working state onto other frames: the editor reads them and moves its positions first. + if (media.FramesVersion != framesVersion) throw new FramesChangedException(Loc.L("Errors.Workspace.MediaChanged")); + var stored = ProjectSettings.FromJson(ProjectContent.Place(bundle.Project.ToJson(), media.Photos), allowNewer: true); + var merged = ProjectMerge.SameValues(stored, basis) ? project : ProjectMerge.Merge(basis, project, stored); + if (ProjectMerge.SameValues(merged, stored)) return merged; + folder.WriteBundle(bundle with { Project = merged, Saved = DateTimeOffset.UtcNow }); + return merged; + } + }, cancellationToken); + } + + public async Task SubmitAsync(ArchiveJobRequest request, CancellationToken cancellationToken) + { + if (_engine is null) throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine")); + var job = await _engine.EnqueueAsync(request, cancellationToken: cancellationToken); + return job.Id; + } + + public async Task> ListJobsAsync(CancellationToken cancellationToken) => + (await _db.Jobs.ListAsync(null, JobsListed, null, cancellationToken)).Items; + + public Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken) => + (_engine ?? throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine"))).CancelAsync(jobId, cancellationToken); + + public Task RetryJobAsync(Guid jobId, CancellationToken cancellationToken) => + (_engine ?? throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine"))).ResumeAsync(jobId, cancellationToken); + + /// + /// The render at the home (owner review 2, R8: edit with proxies, render where the originals are): one job of this PC's + /// engine per preset, with the project's portable settings (positions parked by photo, placed on the home's frames by + /// the render) and the project recorded on the render; the version too when the settings are those of the last + /// version saved (an unsaved working state renders as it is, without a version). + /// + public IReadOnlyList RenderRequests(Sequence sequence, ProjectSettings project, ExportSettings export, int sourceWidth, int sourceHeight) + { + ArgumentNullException.ThrowIfNull(sequence); + ArgumentNullException.ThrowIfNull(project); + ArgumentNullException.ThrowIfNull(export); + var portable = ProjectContent.ToPortable(project with { Export = export }, Photos); + var hash = ProjectContent.Hash(portable); + var (tipId, tipHash) = Tip(); + var version = new ProjectVersion + { + Id = tipId ?? Guid.Empty, + ProjectId = ProjectId, + Number = 0, + SettingsJson = portable, + ContentHash = hash, + }; + var requests = ProcessingJobs.RenderVersion(sequence, version, export, sourceWidth, sourceHeight); + if (tipId is not null && string.Equals(tipHash, hash, StringComparison.OrdinalIgnoreCase)) return requests; + return [.. requests.Select(r => r with { ParametersJson = WithoutVersion(r.ParametersJson) })]; + } + + public async ValueTask DisposeAsync() + { + if (Interlocked.Exchange(ref _disposed, 1) == 1) return; + if (_engine is not null) _engine.JobChanged -= OnJobChanged; + List sources; + lock (_gate) + { + sources = [.. _retired]; + if (_frames is not null) sources.Add(_frames); + _retired.Clear(); + (_frames, _pixels) = (null, null); + } + foreach (var source in sources) + { + if (source is IAsyncDisposable disposable) await disposable.DisposeAsync(); + } + } + + /// + /// Takes the media read now: a frame source over them when they differ from those read before (the old one is disposed + /// with this source, as a decode may still read it), their frames and photos, the project's workspace section. + /// + private void Swap(WorkspaceSequence media, WorkspaceMedia index, BundleWorkspace workspace, bool readOnly) + { + var ids = media.Frames.Select(f => f.Id).ToArray(); + lock (_gate) + { + if (_frames is null || index.FramesVersion != _framesVersion || !ids.AsSpan().SequenceEqual(_frameIds)) + { + if (_frames is not null) _retired.Add(_frames); + _frames = media.OpenFrames(_decoder); + _pixels = (IFrameSource)_frames; + _frameCount = media.Frames.Count; + } + _frameIds = ids; + _framesVersion = index.FramesVersion; + _photos = index.Photos; + _workspace = workspace; + _readOnly = readOnly; + } + } + + /// The last version saved: the newest one not sent yet, else the base; with its content hash. + private (Guid? Id, string? Hash) Tip() + { + try + { + if (_sync.Unpushed(ProjectId) is { Count: > 0 } unsent) return (unsent[^1].Id, unsent[^1].ContentHash); + return Project.ReadBundle().Workspace?.Base is { } basis ? (basis.VersionId, basis.ContentHash) : (null, null); + } + catch (Exception ex) when (ex is IOException or InvalidDataException or InvalidOperationException) + { + Log.Warning("editor", $"The versions of workspace project {ProjectId} cannot be read; the render names none", ex); + return (null, null); + } + } + + private static string? WithoutVersion(string? parametersJson) + { + if (parametersJson is null || JsonSerializer.Deserialize(parametersJson, ProtocolJson.Default.RenderJobParameters) is not { } parameters) return parametersJson; + return JsonSerializer.Serialize(parameters with { ProjectVersionId = null }, ProtocolJson.Default.RenderJobParameters); + } + + /// + /// The deep report the editor shows: the home's while its frames are the workspace's, else the copy the workspace took; + /// whether one of another number of frames was read instead. + /// + private static (DeepAnalysisReport? Report, bool OtherFrames) ReadReport(SequencePaths? home, bool sameFrames, string copied, int frameCount) + { + var otherFrames = false; + foreach (var path in new[] { sameFrames ? home?.AnalysisPath : null, copied }) + { + if (path is null || !File.Exists(path)) continue; + try + { + var report = DeepAnalysisReport.Load(path); + if (report.FrameCount == frameCount) return (report, false); + otherFrames = true; + } + catch (Exception ex) when (ex is IOException or InvalidDataException or JsonException or UnauthorizedAccessException) + { + Log.Warning("editor", $"{path} cannot be read", ex); + } + } + return (null, otherFrames); + } + + private void OnJobChanged(Job job) => JobChanged?.Invoke(job); +} diff --git a/src/Chronos.App/Infrastructure/AppServices.cs b/src/Chronos.App/Infrastructure/AppServices.cs index 90f39ebc..f954a9b0 100644 --- a/src/Chronos.App/Infrastructure/AppServices.cs +++ b/src/Chronos.App/Infrastructure/AppServices.cs @@ -9,6 +9,7 @@ using Chronos.App.Jobs; using Chronos.App.Library; using Chronos.App.Server; using Chronos.App.Settings; +using Chronos.App.Workspace; using Chronos.Core.Archiving; using Chronos.Core.Diagnostics; using Chronos.Core.Export; @@ -23,6 +24,7 @@ using Chronos.Data.Archiving; using Chronos.Data.Jobs; using Chronos.Data.Processing; using Chronos.Data.Scheduling; +using Chronos.Data.Workspaces; using Chronos.Protocol.Client; namespace Chronos.App.Infrastructure; @@ -71,6 +73,7 @@ public sealed class AppServices : IAsyncDisposable ArchiveSetup = new EngineArchiveSetup(this); Sync = new SyncHost(this); ScheduleHost = new DesktopScheduleHost(settings, () => Database, () => Archives); + Workspace = new WorkspaceHost(environment, settings, saveSettings, () => Database, () => Archives, () => Engine); Server = new ServerSession(settings, saveSettings, new ChronosServerApiFactory(), new DpapiTokenProtector()); Encoders = new MediaFoundationInventory(); Formats = new WicFormatInventory(() => _wic); @@ -117,6 +120,9 @@ public sealed class AppServices : IAsyncDisposable /// public event Action? SequenceReorganized; + /// The workspace where Edit opens projects (owner review 2, R8), with this PC's archive as their home. + public WorkspaceHost Workspace { get; } + public IEncoderInventory Encoders { get; set; } /// Decode tier per format on this PC and the missing codec extensions (Settings › Formats). @@ -169,11 +175,12 @@ public sealed class AppServices : IAsyncDisposable typeof(AppServices).Assembly.GetCustomAttribute()?.InformationalVersion ?? "0.0.0"; /// The job handlers of this PC's engine — the single registration list; a kind without a handler stays - /// queued (it is never claimed here). + /// queued (it is never claimed here). The workspace copy is the desktop's alone: it writes into this PC's workspace. public static IReadOnlyList CreateJobHandlers(AppServices services) => [ .. services.Archives?.CreateJobHandlers() ?? [], .. services.Processing?.CreateJobHandlers() ?? [], .. services.Sync.Service?.CreateJobHandlers(services.Sync) ?? [], + .. services.Database is { } db && services.Archives is { } archives ? WorkspaceJobs.CreateHandlers(db, archives) : [], ]; /// diff --git a/src/Chronos.App/Infrastructure/AppSettings.cs b/src/Chronos.App/Infrastructure/AppSettings.cs index 0e7bf5d6..5e425a03 100644 --- a/src/Chronos.App/Infrastructure/AppSettings.cs +++ b/src/Chronos.App/Infrastructure/AppSettings.cs @@ -57,6 +57,7 @@ public sealed class AppSettings public const int DefaultThumbnailMemoryItems = 2_000; public const int DefaultCacheLimitGb = 20; public const int DefaultScanIntervalMinutes = 10; + public const int DefaultWorkspaceKeptVersions = 20; /// 2⁻⁴ of white: the deep analysis' night threshold (a mean log2 luminance of −4). public const double DefaultNightBrightnessPercent = 6.25; @@ -155,6 +156,19 @@ public sealed class AppSettings /// Upper bound of the disk cache in GB. public int CacheLimitGb { get; set; } = DefaultCacheLimitGb; + // ---- Workspace (owner review 2, R8) ---- + /// The workspace, where projects are edited outside the library; null = workspace under the data folder. + public string? WorkspaceFolder { get; set; } + + /// A version saved in the workspace is sent to its home at once (and the home's new versions taken). + public bool WorkspaceAutoSync { get; set; } = true; + + /// Versions taken from a home that a workspace project keeps besides its base and the versions not sent yet. + public int WorkspaceKeptVersions { get; set; } = DefaultWorkspaceKeptVersions; + + /// The workspace project opened last for each sequence (sequence id → project id); Edit opens it again. + public Dictionary WorkspaceRecent { get; set; } = []; + // ---- Server ---- public string? ServerUrl { get; set; } public string? ServerUsername { get; set; } diff --git a/src/Chronos.App/Sections/SequencePickerView.xaml b/src/Chronos.App/Sections/SequencePickerView.xaml index 3dfc4ad4..7191b87c 100644 --- a/src/Chronos.App/Sections/SequencePickerView.xaml +++ b/src/Chronos.App/Sections/SequencePickerView.xaml @@ -5,12 +5,14 @@ xmlns:v="clr-namespace:Chronos.Ui.Visuals;assembly=Chronos.Ui" xmlns:l="clr-namespace:Chronos.Ui.Localization;assembly=Chronos.Ui" xmlns:lib="clr-namespace:Chronos.App.Library" + xmlns:ws="clr-namespace:Chronos.App.Workspace" IsVisibleChanged="OnVisibleChanged"> @@ -24,6 +26,11 @@ + + @@ -57,49 +64,91 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -