merge: integration branch claude/keen-knuth-uhxv8w (remote editor after review) into the Library workstream

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-06 20:38:30 +00:00
commit a4ceb89247
81 files changed
+3827 -263

No files matched your search

+36 -1
View File
@@ -146,10 +146,45 @@ One line per decision: date · decision · alternative · reason.
| 2026-10-03 | Editor: the corrected-frame preview is built in the App layer (RenderPreparation corrections, then geometry, exposure and the knee), measured at 128 px; the preparation is split into a measuring pass and re-solves so slider steps never re-decode; analysis decodes are kept as Half within 1/16 of available memory (64–512 MB). | A Core single-frame entry point | Preview speed without touching the render engine. |
| 2026-10-03 | Editor autosave 400 ms after the last change with a three-way JSON merge (the editor wins on members both sides changed); a failed save stays pending and retries from 2 s doubling to 60 s; closing with an unsaved failure asks through a destructive modal. Undo takes adopted outside changes; a drag, click or key press is one step. | A Save button / dropping the change | Data safety; §12.1 allows modals for destructive actions. |
| 2026-10-03 | Editor 1:1 and wheel zoom render at the source's long edge, Fit at the view's size; labelled preview tools (icon + text) with full screen, play and the crop view icon-only; the shot-data pill moves above the tools when they do not fit at 1200 px. | Render only the visible region | Decoders decode whole frames; simplest correct option. |
| 2026-10-03 | Export tab: preset grid columns = width / 200 px; Output label column fixed at 96 px with ellipsis and tooltip; Optimise all skips Stack; render follow-ups are a toast with Show in folder plus the history line's show-file link. User presets ("Customise") and the Export "Sync" box are not built. | Fixed 4 columns / placeholder controls | The fixed grid clipped at 1200 px; user presets need a preset store and render-path resolution, and nothing backs an export-sync flag yet. |
| 2026-10-03 | Export tab: preset grid columns = width / 200 px; Output label column fixed at 96 px with ellipsis and tooltip; Optimise all skips Stack; render follow-ups are a toast with Show in folder plus the history line's show-file link. User presets ("Customise") are not built; the Export "Sync" box is (2026-10-06: ExportSettings.SyncToServer, off by default). | Fixed 4 columns / placeholder controls | The fixed grid clipped at 1200 px; user presets need a preset store and render-path resolution. |
| 2026-10-03 | Exposure measuring tool switches Luminance / Flicker (frame-to-frame log-luminance change before and after correction) / Waveform (luma per column band of the corrected preview); the Time tab shows a plan chart beside the remap curve; the Camera free crop is four margin sliders (≤ 45 % each, ≥ 10 % of the frame left). | One chart per tab | §12.3 measuring needs and Editor.html. |
| 2026-10-03 | Import omits the Convert row and the profile "New" button: card profiles are born on first insertion and shared through camera profiles (settings row followed by the cards of that camera; a card without settings joins automatically). | Conversion at import / card-less profiles | A converted file breaks the hash-verified erase/format gate and immutable originals; a profile needs a card identity (§13 "rules shared by all cards of that camera"). |
| 2026-10-03 | Import sessions merge in the session table and split per photo in Show plan (merges only into the earlier session of the same body and format). Folder and Server destinations run in the screen with a partial result on failure; a server 4xx (not 401/403) fails only that file. Automatic import always goes to this PC's archive. | New job kinds / abort on any error | No job handlers exist for those destinations; §13 lists errors per file; the archive is the gated destination for erase/format. |
| 2026-10-03 | Format gate: every photo on the card must be verified by the job's own import records; non-photo files are listed in the typed confirmation, not blocking; the card is re-listed right before SHFormatDrive, behind a typed confirmation of the card name; a card that leaves needs a new check. | Count only DCIM photos / block on any file | Sony and Canon cards always carry camera files; §8.6 and DESIGN §4. |
| 2026-10-03 | Archive manager: Overview (tree, tiles, charts, mass operations on the tree selection narrowed by a Camera/Status/Tag filter) and Maintenance (health with one fix per line, recent runs, duplicates, orphans); duplicates/orphans searches and retag run in-screen, cancellable and logged; rename apply is journaled and completed at the next open; Maintenance adds a database backup. No Delete… or Merge/split yet. | Engine jobs for every action / Archive.html's single page | No result store for read-only reports; deleting or moving frames needs engine operations (the trash lives in the server). |
| 2026-10-06 | Radio buttons that bind TwoWay are grouped by their shared panel, never by GroupName (kept only for chips in item templates, which bind OneWay). | GroupName on every group | WPF shares a GroupName across every window not yet connected to the screen, so the installer capture (one window per stage, each with its own view model) cross-wired Just me / All users into an endless loop; the same applies to views built in tests and captures. |
| 2026-10-06 | Reading direction is set by TitanoWindow (constructor plus Loc.CultureChanged while shown, applied through the Dispatcher). UiLanguage keeps only a Window.Loaded class handler for plain windows such as FullScreenPreview. The Uploader's WindowDirection and Setup's own code are removed. | Keep three mechanisms (UiLanguage loop plus class handler, Uploader WindowDirection, SetupWindow code) | One place covers the client, Uploader and Setup windows created before or after a language switch. The class handler is still needed for the one non-TitanoWindow window. |
| 2026-10-06 | Toasts are announced with a UIA notification event on the host: errors use ImportantAll (assertive), other notices use All (polite). | LiveSetting on each toast container plus LiveRegionChanged | A toast is a new element, not a text that changes, and the host's peer is always in the UIA tree, whereas an item container's peer may not be. |
| 2026-10-06 | The job bar's live region announces ShellViewModel.JobAnnouncement (job name when it starts, the idle line when the queue empties). JobBar gets a StatusBar peer so the region has a peer. | Announce the job bar text | The bar text changes every second (counter, speed, time left), which is too noisy for a screen reader. This matches the integration rule 'announce states, not progress ticks'. |
| 2026-10-06 | The render job label arrow is chosen at creation by Loc.IsRightToLeft (Jobs.Target.Render / Jobs.Target.RenderRtl, both invariant). | A translatable '{0} → {1}' key that RTL translators change to '←'; or storing title and preset separately | This is the same pattern Import.Session.Time/TimeRtl already uses, it is right in RTL without waiting for translations, and it needs no schema or wire change. The label was already in the creation language through the preset name. |
| 2026-10-06 | Field.Error (an attached string with a read-only HasError) is the shared error state for inputs without a validating binding. PasswordBox triggers on it and on nothing else. | A Validation.HasError trigger on PasswordBox | PasswordBox.Password is not a dependency property, so Validation.HasError can never become true there. The Uploader and the login dialog needed a settable state. |
| 2026-10-06 | The TextBox template no longer applies Padding (TextBoxBase pushes it into PART_ContentHost, confirmed by reading the IL of TextBoxBase.AttachToVisualTree). The leading icon takes Padding as its margin, and fixed 22/24 px offsets apply only when an icon is present. | Keep the Grid margin and cancel the host's padding | The host's Padding is set by the control at every template apply and cannot be overridden from XAML. The placeholder and the text now start at the same x. |
| 2026-10-06 | The Arabic smoke test checks mirroring through FlowDirection values plus one TranslatePoint position check on the rail. | Only pixel or screen-coordinate checks | FlowDirection is what WPF mirrors by. The integration branch's capture fix shows the window content carries the mirror, so TranslatePoint to the window reflects it. |
| 2026-10-06 | The nav rail's RadioButtons keep GroupName 'Rail' (the two lists live in separate item templates) but bind IsChecked one way. | Group by panel as the integration decision says | Panel grouping cannot span two ItemsControls. A one-way binding keeps a shared GroupName from writing another window's selection back into the shell, which is the case the integration rule exists for. |
| 2026-10-06 | Common.CurveReadout is invariant ('{0} → {1}'). | Translatable so RTL languages could use '←' | The curve readout is drawn in a left-to-right island (numbers on an LTR axis), where '←' would point the wrong way. |
| 2026-10-06 | Heatmap month labels: initials only when all 12 abbreviated names start with a cased letter and contain no digit, otherwise culture-formatted month numbers 1-12 | A localized resource list Archive.Chart.MonthInitials, or hard-coded per-culture overrides | Correct for every shipped and future culture with no translation work. It also avoids non-Gregorian month names (fa uses Persian months) and needs no fallback for languages not yet translated. |
| 2026-10-06 | Keep IsEnabled=False on the content behind a dialog and give ListBoxes a local template that does not repaint when disabled | IsHitTestVisible=False plus keyboard containment instead of disabling | Screen readers and access keys still treat the content as disabled. Rows and buttons dim themselves, so the list does not dim twice. |
| 2026-10-06 | Fix the chart-label contrast and invisible future months through token aliases scoped to the chart grid and the heatmap (Brush.TextFaint -> Color.TextMuted, Brush.Card -> Color.Stroke) | Edit BarChart/HeatmapStrip (owned by the shared group) or only report the defect | Smallest local equivalent that fixes a major contrast defect now, with no new colours. It follows theme switches through DynamicResource and becomes inert once the kit is fixed. |
| 2026-10-06 | Index health duplicates line: after a duplicates search it shows the groups found (warning with a Mark copies fix); before any search it shows the flagged-copy count ('No copies flagged' / 'n duplicate frames' with Show) | Only reword the line to flagged copies, or hide it until a search has run | The line can never be a green tick while the Duplicates card lists groups, and it keeps the flagged-copy information that already existed. |
| 2026-10-06 | All orphan kinds use the Warning glyph (▲ amber) | Add a neutral/info StatusKind in the shared kit | Every orphan line is an actionable issue with a fix button, and Warning is readable in both themes without a kit change. |
| 2026-10-06 | Archive failures become a toast with the action's title, one localized cause sentence from ArchiveFailures.Cause and a Retry action that re-runs the same command; relink Retry re-opens the folder picker | Open logs as in Shell.ReportError, or retry with the same folder | BRIEF 0.2 rule 6 asks for one sentence plus one action. Retry fits these I/O failures. Re-picking the folder covers both 'drive is back' and 'wrong folder'. |
| 2026-10-06 | Dialog failures appear as an error line (✕ Error StatusGlyph, raw text in its tooltip) with no separate Retry button; Apply stays the retry, and a failed apply re-runs the dry run | Add a Retry button to the Rename and Retag dialogs | DESIGN allows two dialog buttons at most. Re-planning shows what is left after a partial or stale apply. |
| 2026-10-06 | Cancel is the default (Enter) button in the Rebuild, Rename and Retag dialogs | No default button, or Apply as default | DESIGN: the safe action is left and default. Enter in the text fields is already handled by EditBehavior. |
| 2026-10-06 | Rebuild counts show '—' with the reason (offline sentence or failure cause) in the tooltip when they cannot be counted | Remove the two count rows when they cannot be counted | The dialog keeps the same shape, and the reason sits next to the value it explains. |
| 2026-10-06 | Rename the Overview/Maintenance segment to 'Health' (new key Archive.View.Health; it: 'Stato') and keep the toolbar's 'Maintenance ▾' | Rename the toolbar menu to 'Tools ▾', or change the English value of Archive.View.Maintenance | BRIEF 12.5 names the toolbar menu Maintenance. A new key makes the missing translations visible in i18n check instead of leaving stale ones. |
| 2026-10-06 | Paths inside sentences are wrapped with the existing Formatting.LeftToRight (LRE/PDF); path-only elements get FlowDirection=LeftToRight with start alignment | LRI/PDI isolates as the review suggested, or Import's BidiText.Ltr | Reuses the app-wide facility already used by Settings, Welcome and Server, and gives the same result for these strings. |
| 2026-10-06 | In RTL the tree swaps its arrow keys, and the year tooltip uses a second key (Tooltips.Archive.YearRowRtl) chosen at runtime | One direction-neutral tooltip using arrow glyphs | Matches WPF TreeView behaviour. Translators of RTL languages get a sentence that already names the right keys. |
| 2026-10-06 | Chart values reach screen readers through AutomationProperties.HelpText built from the bar and month tooltips | Wire ItemActivated/CellActivated to filter the set, or add an automation peer per bar | Not every chart has a matching set filter (format, month). HelpText needs no kit change and keeps the chart's own name. |
| 2026-10-06 | The heatmap scale moves into the card header as '0 ▭ max' (Accent bar with an opacity-mask gradient) and MaxCellSize rises to 32 | Right-align the kit's own scale under the grid | Matches Archive.html and lets the grid use the card's width. |
| 2026-10-06 | The set filter button's accessible name is 'Set filter · <current set>', built from existing keys | AutomationProperties.ItemStatus or HelpText set to the set text | Narrator reads the name first and always, and no new key is needed. |
| 2026-10-06 | A 409 whose settings were changed to different values on both sides opens an explicit prompt, and nothing is sent until the user chooses. Keep mine is destructive and overwrites the server's values. Take server is the safe default (also on Enter or Esc): it applies the server's values as one undoable step, and Ctrl+Z brings the editor's values back. Members changed on one side only still merge silently. The local editor keeps editor-wins for changes made by this PC's own analysis jobs. | Editor-wins merge plus a toast offering to take the server's values; or document editor-wins | BRIEF §14.5 asks for last-writer-wins with an explicit conflict prompt when both sides changed. Editor-wins would silently overwrite another client's change. A modal is allowed for confirmations (§12.1). The safe default loses nothing because the editor's values come back with Ctrl+Z. |
| 2026-10-06 | The Export Sync checkbox sits on its own row under Save to (12 px). | Beside the folder ComboBox as in Export.html | The 194 px field column minus the 10 px scrollbar cannot hold the folder plus 'Sincronizza' or longer translations without clipping. Rules against clipping and for +40 % text width win over the mockup's placement. |
| 2026-10-06 | Export Sync is off by default, stored per sequence in the project's export settings, and travels inside the render job. | On by default, as Export.html shows it checked | BRIEF §14.5 says renders are uploaded on request. Uploads can be large. |
| 2026-10-06 | A render that finishes while the server session is down still queues its send, for the saved session's server. The send waits for credentials and fails visibly on the Jobs screen if they never come back. | Drop it, or keep a separate pending-send store | No silent loss and no new storage; the sync job already waits for credentials. |
| 2026-10-06 | Server sequences whose cached frames are not the server's (different ids or order) open read-only, or trigger a proxy download and then open. Frame changes while the sequence is open make it read-only, with a toast that offers Get proxies. | Edit against the stale list, or block opening outright | Project settings name frames by position (exclusions, hero, keyframes, remap curve). |
| 2026-10-06 | An account without the Edit right opens server sequences read-only. It may still pick a preset to render, without changing the project. | Refuse to open, or let it edit and fail on save | Viewing and rendering are separate rights on the server. |
| 2026-10-06 | The server's job progress shows beside the title in the editor header (glyph, 6 px bar, Cancel), and a failed or cancelled job raises a toast with Retry. | Feed server jobs into the shell's job bar and Jobs screen | The job bar and the Jobs screen list this PC's engine jobs only. BRIEF §11.5 requires cancel to be always available. |
| 2026-10-06 | For a server sequence, Save to, the Encoder row, the encoder name and notices, and the Jobs history link are disabled or hidden, each with a tooltip saying why. Renders are one server job per preset. | Show this PC's encoder and folder | DECISIONS 2026-10-03: the server always writes to the sequence's exports/ and splits batches per preset; the server or its render node picks the encoder. |
| 2026-10-06 | Save-both copies are listed and restored by a Restore settings split button under the Export history line. A restore is one undoable step, and its toast Undo only acts while the restore is still the latest change. | The header menu or the Frames tab | This is the least intrusive place: it is next to render history, it shows only when copies exist, and none of the mockups has room for it elsewhere. |
| 2026-10-06 | Additive API: GET /api/v1/sequences/{id}/analysis/report (Read permission), and UpdateSequenceRequest.HeroFrameId. Settings sent alone move hero_frame_id when heroFrame changes. | Ship the deep report inside the manifest, or have the client resolve the hero frame only | The manifest stays small, and the Library thumbnail follows the hero whoever edits it (the editor, or sync of a local copy). |
| 2026-10-06 | The checkbox's inner gap between box and text stays at the theme's 8 px. | Change the shared CheckBox template to 6 px | The template is shared by the whole app and lives outside this workstream. |
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Копиране в структурата…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Индексиране на място…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} серия е променена</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} серии са променени</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Щракнете или плъзнете, за да покажете кадър; маркерите показват стъпки на експозицията, предупреждения и ключови кадри</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Изключва този кадър от всички рендери; снимката не се изтрива</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Показва първия засегнат кадър</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Прави този кадър заглавен; редакторът се отваря на него</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Използва отново този кадър в рендерите</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Сортира по тази колона; щракнете отново за обратен ред</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Щракнете върху ред, за да покажете кадъра</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>In die Struktur kopieren…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>An Ort und Stelle indizieren…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} Sequenz geändert</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} Sequenzen geändert</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Klicken oder ziehen, um einen Frame anzuzeigen; Markierungen zeigen Belichtungsstufen, Warnungen und Keyframes</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Diesen Frame aus allen Renderings ausschließen; das Foto wird nicht gelöscht</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Ersten betroffenen Frame anzeigen</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Diesen Frame zum Titelbild machen; der Editor öffnet sich auf ihm</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Diesen Frame wieder in Renderings verwenden</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Nach dieser Spalte sortieren; erneut klicken kehrt die Reihenfolge um</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Auf eine Zeile klicken, um den Frame anzuzeigen</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Αντιγραφή στη διάταξη…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Καταχώριση επιτόπου…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} ακολουθία άλλαξε</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} ακολουθίες άλλαξαν</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Κάντε κλικ ή σύρετε για να εμφανιστεί ένα καρέ. Οι δείκτες δείχνουν βήματα έκθεσης, προειδοποιήσεις και καρέ-κλειδιά</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Εξαίρεση αυτού του καρέ από κάθε απόδοση. Η φωτογραφία δεν διαγράφεται</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Εμφάνιση του πρώτου σχετικού καρέ</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Ορισμός αυτού του καρέ ως καρέ εξωφύλλου. Το πρόγραμμα επεξεργασίας ανοίγει σε αυτό</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Χρήση αυτού του καρέ ξανά στις αποδόσεις</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Ταξινόμηση κατά αυτήν τη στήλη. Κάντε ξανά κλικ για αντιστροφή</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Κάντε κλικ σε μια γραμμή για να εμφανιστεί το καρέ</value></data>
+23
View File
@@ -6,6 +6,7 @@
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Editor.Analyse" xml:space="preserve"><value>Analyse</value></data>
<data name="Editor.Analyse.Queued" xml:space="preserve"><value>Analysis queued</value></data>
<data name="Editor.Analyse.QueuedServer" xml:space="preserve"><value>Analysis queued on {0}</value></data>
<data name="Editor.Aspect.Ratio" xml:space="preserve"><value>{0}</value><comment>invariant</comment></data>
<data name="Editor.Aspect.Source" xml:space="preserve"><value>Source</value></data>
<data name="Editor.Back" xml:space="preserve"><value>Back</value></data>
@@ -45,11 +46,20 @@
<data name="Editor.Chart.Target" xml:space="preserve"><value>target curve</value></data>
<data name="Editor.Chart.Waveform" xml:space="preserve"><value>Waveform</value></data>
<data name="Editor.Chart.WaveformOf" xml:space="preserve"><value>luma of frame {0}</value></data>
<data name="Editor.Conflict.Message" xml:space="preserve"><value>{0} was changed on {1} while you edited it. The settings below differ: keep your values there, or take the server's here.</value><comment>long; {0} sequence title, {1} server name</comment></data>
<data name="Editor.Conflict.Title" xml:space="preserve"><value>Changed on {0} too</value><comment>{0} server name</comment></data>
<data name="Editor.Copy.Restored" xml:space="preserve"><value>Project restored</value></data>
<data name="Editor.Copy.Same" xml:space="preserve"><value>Nothing to restore</value></data>
<data name="Editor.Copy.Undo" xml:space="preserve"><value>Undo</value></data>
<data name="Editor.Empty" xml:space="preserve"><value>Pick a sequence in the Library</value></data>
<data name="Editor.Error.FramesChanged" xml:space="preserve"><value>The frames of this sequence changed on the server; get its proxies again.</value><comment>long</comment></data>
<data name="Editor.Error.Missing" xml:space="preserve"><value>This sequence is no longer in the archive.</value><comment>long</comment></data>
<data name="Editor.Error.NoEngine" xml:space="preserve"><value>Jobs cannot run until the archive index is open.</value><comment>long</comment></data>
<data name="Editor.Error.Project" xml:space="preserve"><value>The settings of this sequence cannot be read.</value><comment>long</comment></data>
<data name="Editor.Error.RemoteReadOnly" xml:space="preserve"><value>Your account cannot change the sequences of this server.</value><comment>long</comment></data>
<data name="Editor.Error.SaveConflict" xml:space="preserve"><value>The settings of this sequence were changed elsewhere at the same time.</value><comment>long</comment></data>
<data name="Editor.Error.SavedCopy" xml:space="preserve"><value>The saved settings {0} cannot be read.</value><comment>long</comment></data>
<data name="Editor.Error.SignedOut" xml:space="preserve"><value>Connect to the server to open this sequence.</value><comment>long</comment></data>
<data name="Editor.Export.About" xml:space="preserve"><value>about {0}</value></data>
<data name="Editor.Export.AddToQueue" xml:space="preserve"><value>Add to queue</value></data>
<data name="Editor.Export.Batch" xml:space="preserve"><value>Batch…</value></data>
@@ -79,12 +89,15 @@
<data name="Editor.Export.Recommended" xml:space="preserve"><value>Recommended</value></data>
<data name="Editor.Export.RenderNow" xml:space="preserve"><value>Render now</value></data>
<data name="Editor.Export.Resolution" xml:space="preserve"><value>Resolution</value></data>
<data name="Editor.Export.Restore" xml:space="preserve"><value>Restore settings · {0}</value></data>
<data name="Editor.Export.RestoreName" xml:space="preserve"><value>Restore copy</value></data>
<data name="Editor.Export.Result" xml:space="preserve"><value>Result</value></data>
<data name="Editor.Export.Reveal" xml:space="preserve"><value>show file</value></data>
<data name="Editor.Export.SaveTo" xml:space="preserve"><value>Save to</value></data>
<data name="Editor.Export.SequenceFolder" xml:space="preserve"><value>Sequence exports/</value></data>
<data name="Editor.Export.Size" xml:space="preserve"><value>Estimated size</value></data>
<data name="Editor.Export.Software" xml:space="preserve"><value>software</value></data>
<data name="Editor.Export.Sync" xml:space="preserve"><value>Sync</value></data>
<data name="Editor.Export.Time" xml:space="preserve"><value>Estimated time</value></data>
<data name="Editor.Export.Unavailable" xml:space="preserve"><value>No encoder here</value></data>
<data name="Editor.Export.Width" xml:space="preserve"><value>Width</value></data>
@@ -151,6 +164,8 @@
<data name="Editor.Optimise.Nothing" xml:space="preserve"><value>Nothing to change</value></data>
<data name="Editor.OptimiseAll" xml:space="preserve"><value>Optimise all</value></data>
<data name="Editor.OptimiseSection" xml:space="preserve"><value>Optimise section</value></data>
<data name="Editor.Outdated.Fetch" xml:space="preserve"><value>Get proxies</value></data>
<data name="Editor.Outdated.Title" xml:space="preserve"><value>Frames changed on {0}</value></data>
<data name="Editor.Preview" xml:space="preserve"><value>Preview</value></data>
<data name="Editor.Preview.ActualSize" xml:space="preserve"><value>1:1</value><comment>invariant</comment></data>
<data name="Editor.Preview.Clip" xml:space="preserve"><value>Preview 10 s</value></data>
@@ -168,12 +183,17 @@
<data name="Editor.Preview.Unreadable" xml:space="preserve"><value>This frame cannot be read.</value></data>
<data name="Editor.Preview.Vectors" xml:space="preserve"><value>Vectors</value></data>
<data name="Editor.Preview.Wipe" xml:space="preserve"><value>original | corrected</value></data>
<data name="Editor.Proxies.Failed" xml:space="preserve"><value>Proxies not received</value></data>
<data name="Editor.Proxies.Fetching" xml:space="preserve"><value>Getting the proxies</value></data>
<data name="Editor.Regions.Auto" xml:space="preserve"><value>Auto</value></data>
<data name="Editor.Regions.Horizon" xml:space="preserve"><value>Horizon</value></data>
<data name="Editor.Regions.Luminance" xml:space="preserve"><value>Luminance</value></data>
<data name="Editor.Remote.Outdated" xml:space="preserve"><value>{0} · proxies outdated</value></data>
<data name="Editor.Remote.ReadOnly" xml:space="preserve"><value>{0} · read-only</value></data>
<data name="Editor.Render" xml:space="preserve"><value>Render · {0}</value></data>
<data name="Editor.Render.Done" xml:space="preserve"><value>Render finished</value></data>
<data name="Editor.Render.Queued" xml:space="preserve"><value>Render queued</value></data>
<data name="Editor.Render.QueuedServer" xml:space="preserve"><value>Render queued on {0}</value></data>
<data name="Editor.Render.Reveal" xml:space="preserve"><value>Show in folder</value></data>
<data name="Editor.RenderButton" xml:space="preserve"><value>Render</value></data>
<data name="Editor.Reset" xml:space="preserve"><value>Reset</value></data>
@@ -181,6 +201,9 @@
<data name="Editor.Save.Failed" xml:space="preserve"><value>Changes not saved</value></data>
<data name="Editor.Save.Retry" xml:space="preserve"><value>Retry</value></data>
<data name="Editor.Sections" xml:space="preserve"><value>Sections</value></data>
<data name="Editor.ServerJob.Cancel" xml:space="preserve"><value>Cancel job</value></data>
<data name="Editor.ServerJob.Ended" xml:space="preserve"><value>{0} {1} on {2}</value></data>
<data name="Editor.ServerJob.Left" xml:space="preserve"><value>{0} left</value></data>
<data name="Editor.Shot.Aperture" xml:space="preserve"><value>f/{0}</value><comment>invariant</comment></data>
<data name="Editor.Shot.Focal" xml:space="preserve"><value>{0} mm</value><comment>invariant</comment></data>
<data name="Editor.Shot.Iso" xml:space="preserve"><value>ISO {0}</value><comment>invariant</comment></data>
+27 -1
View File
@@ -126,16 +126,22 @@
<data name="Tooltips.Editor.Chart.Seek" xml:space="preserve"><value>Click or drag to show that frame</value></data>
<data name="Tooltips.Editor.Chart.Waveform" xml:space="preserve"><value>Luma waveform of the frame on screen: exposure and clipping at a glance</value></data>
<data name="Tooltips.Editor.Chart.WaveformView" xml:space="preserve"><value>Luma of the corrected frame across the picture: white at the top, black at the bottom</value></data>
<data name="Tooltips.Editor.Conflict.KeepMine" xml:space="preserve"><value>Save your values of these settings over those on {0}</value><comment>{0} server name</comment></data>
<data name="Tooltips.Editor.Conflict.TakeServer" xml:space="preserve"><value>Use the values from {0} in the editor; Ctrl+Z brings yours back</value><comment>{0} server name</comment></data>
<data name="Tooltips.Editor.Copy.Undo" xml:space="preserve"><value>Bring back the project as it was before the restore · Ctrl+Z</value></data>
<data name="Tooltips.Editor.Export.AddToQueue" xml:space="preserve"><value>Add this render to the queue and keep editing</value></data>
<data name="Tooltips.Editor.Export.ApplyPreset" xml:space="preserve"><value>Apply this sequence preset to every section · {0}</value></data>
<data name="Tooltips.Editor.Export.Batch" xml:space="preserve"><value>Queue every ticked preset as one job; the sequence is prepared once</value></data>
<data name="Tooltips.Editor.Export.BatchEmpty" xml:space="preserve"><value>Tick presets on the cards first</value></data>
<data name="Tooltips.Editor.Export.BatchServer" xml:space="preserve"><value>Queue every ticked preset on {0}, one job each</value></data>
<data name="Tooltips.Editor.Export.BitRate" xml:space="preserve"><value>Average bit rate; more keeps detail and gradients, files grow</value></data>
<data name="Tooltips.Editor.Export.Codec" xml:space="preserve"><value>Video or image codec; 10-bit HEVC keeps sky gradients clean</value></data>
<data name="Tooltips.Editor.Export.Colour" xml:space="preserve"><value>Rec.709 colour; 10-bit avoids banding in skies, HDR is not offered</value></data>
<data name="Tooltips.Editor.Export.Container" xml:space="preserve"><value>MP4, AVI, GIF, APNG or a folder of images; the codec list follows</value></data>
<data name="Tooltips.Editor.Export.Encoder" xml:space="preserve"><value>Encoder on this PC; Auto prefers hardware</value></data>
<data name="Tooltips.Editor.Export.EncoderServer" xml:space="preserve"><value>{0} or its render node picks the encoder</value></data>
<data name="Tooltips.Editor.Export.Folder" xml:space="preserve"><value>Where renders go: {0}</value></data>
<data name="Tooltips.Editor.Export.FolderServer" xml:space="preserve"><value>Renders of a server sequence go to its exports folder on the server</value></data>
<data name="Tooltips.Editor.Export.FrameRate" xml:space="preserve"><value>Frames per second of the video file</value></data>
<data name="Tooltips.Editor.Export.FrameRateAuto" xml:space="preserve"><value>Auto: the preset’s {0} fps</value></data>
<data name="Tooltips.Editor.Export.FrameRateReset" xml:space="preserve"><value>Return to the preset’s frame rate</value></data>
@@ -146,7 +152,14 @@
<data name="Tooltips.Editor.Export.Preset" xml:space="preserve"><value>Render with {0}; editing a value makes it Custom</value></data>
<data name="Tooltips.Editor.Export.Quality" xml:space="preserve"><value>Image quality; 95 looks lossless, lower makes smaller files</value></data>
<data name="Tooltips.Editor.Export.Recommended" xml:space="preserve"><value>Advisor pick: {0}</value></data>
<data name="Tooltips.Editor.Export.Restore" xml:space="preserve"><value>Use this PC’s settings saved on {0} as the project · Ctrl+Z undoes</value></data>
<data name="Tooltips.Editor.Export.RestoreChoice" xml:space="preserve"><value>Choose another copy of this PC’s settings, kept when a sync conflict was settled</value></data>
<data name="Tooltips.Editor.Export.SizeInvalid" xml:space="preserve"><value>Enter a size between 16 and 16384 pixels</value></data>
<data name="Tooltips.Editor.Export.Sync" xml:space="preserve"><value>After each render on this PC, also send the file to the server; large files take time</value></data>
<data name="Tooltips.Editor.Export.SyncNoUpload" xml:space="preserve"><value>Your account cannot send files to the server</value></data>
<data name="Tooltips.Editor.Export.SyncNotLinked" xml:space="preserve"><value>The server does not have this sequence: upload it from the Server screen first</value></data>
<data name="Tooltips.Editor.Export.SyncRemote" xml:space="preserve"><value>Renders of a server sequence are made on the server and stay there</value></data>
<data name="Tooltips.Editor.Export.SyncSignedOut" xml:space="preserve"><value>Connect to the server first to send renders to it</value></data>
<data name="Tooltips.Editor.Export.Width" xml:space="preserve"><value>Output width in pixels; empty uses the preset or the source · Enter applies, Esc reverts</value></data>
<data name="Tooltips.Editor.Exposure.Deflicker" xml:space="preserve"><value>Removes frame-to-frame brightness flicker; off keeps the camera’s own exposure</value></data>
<data name="Tooltips.Editor.Exposure.HolyGrail" xml:space="preserve"><value>Turns ISO, shutter and aperture steps into smooth ramps; off keeps the jumps</value></data>
@@ -160,7 +173,7 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Click or drag to show a frame; markers show exposure steps, warnings and keyframes</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Leave this frame out of every render; the photo is not deleted</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Show the first frame concerned</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Make this the hero frame; the editor opens on it</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Use the frame as the sequence thumbnail</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Use this frame in renders again</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Sort by this column; click again to reverse</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Click a row to show the frame</value></data>
@@ -181,6 +194,8 @@
<data name="Tooltips.Editor.OptimiseAll" xml:space="preserve"><value>Let the advisor set every section from the analysis and list what changed</value></data>
<data name="Tooltips.Editor.OptimiseNone" xml:space="preserve"><value>The advisor never stacks on its own: a median erases moving stars</value></data>
<data name="Tooltips.Editor.OptimiseSection" xml:space="preserve"><value>Apply the advisor’s heavier choices for this section and list what changed · Ctrl+Z undoes</value></data>
<data name="Tooltips.Editor.Outdated" xml:space="preserve"><value>Frames were added or removed on {0} since the proxies were fetched; get them again to edit or render</value></data>
<data name="Tooltips.Editor.Outdated.Fetch" xml:space="preserve"><value>Fetch the proxies again and reopen the sequence; the job bar shows the download</value></data>
<data name="Tooltips.Editor.Pause" xml:space="preserve"><value>Pause · Space</value></data>
<data name="Tooltips.Editor.Play" xml:space="preserve"><value>Play the frames · Space; arrows step one frame</value></data>
<data name="Tooltips.Editor.Preview.ActualSize" xml:space="preserve"><value>Show pixels at 1:1 without interpolation · Ctrl+1; Ctrl+0 fits</value></data>
@@ -195,15 +210,26 @@
<data name="Tooltips.Editor.Preview.ShotData" xml:space="preserve"><value>Show or hide the shot data</value></data>
<data name="Tooltips.Editor.Preview.Vectors" xml:space="preserve"><value>Overlay the motion to the next frame measured by the engine</value></data>
<data name="Tooltips.Editor.Preview.View" xml:space="preserve"><value>Drag the line to compare · drag to pan · wheel zooms · double-click 1:1</value></data>
<data name="Tooltips.Editor.ReadOnly" xml:space="preserve"><value>Your account can look at this server sequence but not change it</value></data>
<data name="Tooltips.Editor.Remote" xml:space="preserve"><value>Edited with proxies on this PC; changes are saved on {0} and analyses and renders run there</value></data>
<data name="Tooltips.Editor.RemoteReadOnly" xml:space="preserve"><value>Shown from {0}; your account can look at this sequence but not change it</value></data>
<data name="Tooltips.Editor.Render" xml:space="preserve"><value>Render with the selected preset; progress in the job bar · Ctrl+R</value></data>
<data name="Tooltips.Editor.Render.NameError" xml:space="preserve"><value>Fix the file name first: {0}</value></data>
<data name="Tooltips.Editor.Render.NoFrames" xml:space="preserve"><value>Every frame is excluded: include some in the Frames tab</value></data>
<data name="Tooltips.Editor.Render.NoRight" xml:space="preserve"><value>Your account cannot render on {0}</value></data>
<data name="Tooltips.Editor.Render.NoSource" xml:space="preserve"><value>The frame size is unknown: the frames could not be read</value></data>
<data name="Tooltips.Editor.Render.Planning" xml:space="preserve"><value>Working out the render; ready in a moment</value></data>
<data name="Tooltips.Editor.Render.Reveal" xml:space="preserve"><value>Show the rendered file in Explorer</value></data>
<data name="Tooltips.Editor.RenderChoice" xml:space="preserve"><value>Choose another preset</value></data>
<data name="Tooltips.Editor.RenderChoiceReadOnly" xml:space="preserve"><value>Choose the preset to render; the project keeps its own</value></data>
<data name="Tooltips.Editor.RenderServer" xml:space="preserve"><value>Render on {0} with the selected preset; progress beside the title · Ctrl+R</value></data>
<data name="Tooltips.Editor.ResetSection" xml:space="preserve"><value>Return every control of this section to Auto · Ctrl+Z undoes</value></data>
<data name="Tooltips.Editor.Save.Retry" xml:space="preserve"><value>Try to save now; saving is also retried automatically</value></data>
<data name="Tooltips.Editor.ServerJob" xml:space="preserve"><value>{0} running on {1}</value></data>
<data name="Tooltips.Editor.ServerJob.Cancel" xml:space="preserve"><value>Cancel the job on {0}; Retry in the notice that follows queues it again from its last checkpoint</value></data>
<data name="Tooltips.Editor.ServerJob.Paused" xml:space="preserve"><value>{0} paused on {1}</value></data>
<data name="Tooltips.Editor.ServerJob.Queued" xml:space="preserve"><value>{0} waiting on {1}</value></data>
<data name="Tooltips.Editor.ServerJob.Retry" xml:space="preserve"><value>Queue the job on {0} again from its last checkpoint</value></data>
<data name="Tooltips.Editor.Stack.Length" xml:space="preserve"><value>Frames combined into each output frame; trails and smoothing grow with it</value></data>
<data name="Tooltips.Editor.Stack.Mode" xml:space="preserve"><value>Median and mean remove noise and moving things; star trails keep the brightest pixels</value></data>
<data name="Tooltips.Editor.Tab.Camera" xml:space="preserve"><value>Crop, aspect, virtual camera moves</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copiar en la estructura…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indexar en su sitio…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} secuencia cambiada</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} secuencias cambiadas</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Haz clic o arrastra para mostrar un fotograma; las marcas indican pasos de exposición, advertencias y fotogramas clave</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Deja este fotograma fuera de todos los renderizados; la foto no se elimina</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Muestra el primer fotograma afectado</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Convierte este fotograma en el de portada; el editor se abre en él</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Vuelve a usar este fotograma en los renderizados</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Ordena por esta columna; vuelve a hacer clic para invertir</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Haz clic en una fila para mostrar el fotograma</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copier dans l'arborescence…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indexer sur place…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} séquence modifiée</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} séquences modifiées</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Cliquez ou faites glisser pour afficher une image ; les repères indiquent les paliers d'exposition, les avertissements et les images clés</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Exclure cette image de tous les rendus ; la photo n'est pas supprimée</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Afficher la première image concernée</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>En faire l'image de couverture ; l'éditeur s'ouvre sur elle</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Utiliser de nouveau cette image dans les rendus</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Trier selon cette colonne ; cliquez de nouveau pour inverser l'ordre</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Cliquez sur une ligne pour afficher l'image</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Kopiraj u strukturu arhive…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indeksiraj na mjestu…</value></data>
<data name="Archive.Applied.few" xml:space="preserve"><value>Promijenjene su {0:N0} sekvence</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>Promijenjena je {0:N0} sekvenca</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Kliknite ili povucite za prikaz kadra; oznake prikazuju korake ekspozicije, upozorenja i ključne kadrove</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Izostavlja ovaj kadar iz svih rendera; fotografija se ne briše</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Prikazuje prvi kadar na koji se to odnosi</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Postavlja ovaj kadar kao naslovni; uređivač se otvara na njemu</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Ponovno upotrebljava ovaj kadar u renderima</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Sortira po ovom stupcu; ponovni klik obrće redoslijed</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Klik na redak prikazuje kadar</value></data>
+23
View File
@@ -6,6 +6,7 @@
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Editor.Analyse" xml:space="preserve"><value>Analizza</value></data>
<data name="Editor.Analyse.Queued" xml:space="preserve"><value>Analisi in coda</value></data>
<data name="Editor.Analyse.QueuedServer" xml:space="preserve"><value>Analisi in coda su {0}</value></data>
<data name="Editor.Aspect.Source" xml:space="preserve"><value>Sorgente</value></data>
<data name="Editor.Back" xml:space="preserve"><value>Indietro</value></data>
<data name="Editor.Camera.AddKey" xml:space="preserve"><value>Aggiungi chiave</value></data>
@@ -44,11 +45,20 @@
<data name="Editor.Chart.Target" xml:space="preserve"><value>curva obiettivo</value></data>
<data name="Editor.Chart.Waveform" xml:space="preserve"><value>Forma d’onda</value></data>
<data name="Editor.Chart.WaveformOf" xml:space="preserve"><value>luma del fotogramma {0}</value></data>
<data name="Editor.Conflict.Message" xml:space="preserve"><value>{0} è stata modificata su {1} mentre la modificavi. Le impostazioni qui sotto sono diverse: tieni i tuoi valori sul server o usa qui quelli del server.</value></data>
<data name="Editor.Conflict.Title" xml:space="preserve"><value>Modificata anche su {0}</value></data>
<data name="Editor.Copy.Restored" xml:space="preserve"><value>Progetto ripristinato</value></data>
<data name="Editor.Copy.Same" xml:space="preserve"><value>Niente da ripristinare</value></data>
<data name="Editor.Copy.Undo" xml:space="preserve"><value>Annulla</value></data>
<data name="Editor.Empty" xml:space="preserve"><value>Scegli una sequenza in Libreria</value></data>
<data name="Editor.Error.FramesChanged" xml:space="preserve"><value>I fotogrammi di questa sequenza sono cambiati sul server; scarica di nuovo i proxy.</value></data>
<data name="Editor.Error.Missing" xml:space="preserve"><value>Questa sequenza non è più nell’archivio.</value></data>
<data name="Editor.Error.NoEngine" xml:space="preserve"><value>I lavori non possono partire finché l’indice dell’archivio non è aperto.</value></data>
<data name="Editor.Error.Project" xml:space="preserve"><value>Le impostazioni di questa sequenza non sono leggibili.</value></data>
<data name="Editor.Error.RemoteReadOnly" xml:space="preserve"><value>Il tuo account non può modificare le sequenze di questo server.</value></data>
<data name="Editor.Error.SaveConflict" xml:space="preserve"><value>Le impostazioni di questa sequenza sono state modificate altrove nello stesso momento.</value></data>
<data name="Editor.Error.SavedCopy" xml:space="preserve"><value>Le impostazioni salvate {0} non si possono leggere.</value></data>
<data name="Editor.Error.SignedOut" xml:space="preserve"><value>Connettiti al server per aprire questa sequenza.</value></data>
<data name="Editor.Export.About" xml:space="preserve"><value>circa {0}</value></data>
<data name="Editor.Export.AddToQueue" xml:space="preserve"><value>Metti in coda</value></data>
<data name="Editor.Export.Batch" xml:space="preserve"><value>In serie…</value></data>
@@ -74,12 +84,15 @@
<data name="Editor.Export.Recommended" xml:space="preserve"><value>Consigliato</value></data>
<data name="Editor.Export.RenderNow" xml:space="preserve"><value>Renderizza ora</value></data>
<data name="Editor.Export.Resolution" xml:space="preserve"><value>Risoluzione</value></data>
<data name="Editor.Export.Restore" xml:space="preserve"><value>Ripristina impostazioni · {0}</value></data>
<data name="Editor.Export.RestoreName" xml:space="preserve"><value>Ripristina copia</value></data>
<data name="Editor.Export.Result" xml:space="preserve"><value>Risultato</value></data>
<data name="Editor.Export.Reveal" xml:space="preserve"><value>mostra file</value></data>
<data name="Editor.Export.SaveTo" xml:space="preserve"><value>Salva in</value></data>
<data name="Editor.Export.SequenceFolder" xml:space="preserve"><value>exports/ della sequenza</value></data>
<data name="Editor.Export.Size" xml:space="preserve"><value>Dimensione stimata</value></data>
<data name="Editor.Export.Software" xml:space="preserve"><value>software</value></data>
<data name="Editor.Export.Sync" xml:space="preserve"><value>Sincronizza</value></data>
<data name="Editor.Export.Time" xml:space="preserve"><value>Tempo stimato</value></data>
<data name="Editor.Export.Unavailable" xml:space="preserve"><value>Nessun encoder qui</value></data>
<data name="Editor.Export.Width" xml:space="preserve"><value>Larghezza</value></data>
@@ -142,6 +155,8 @@
<data name="Editor.Optimise.Nothing" xml:space="preserve"><value>Niente da cambiare</value></data>
<data name="Editor.OptimiseAll" xml:space="preserve"><value>Ottimizza tutto</value></data>
<data name="Editor.OptimiseSection" xml:space="preserve"><value>Ottimizza sezione</value></data>
<data name="Editor.Outdated.Fetch" xml:space="preserve"><value>Scarica i proxy</value></data>
<data name="Editor.Outdated.Title" xml:space="preserve"><value>Fotogrammi cambiati su {0}</value></data>
<data name="Editor.Preview" xml:space="preserve"><value>Anteprima</value></data>
<data name="Editor.Preview.Clip" xml:space="preserve"><value>Anteprima 10 s</value></data>
<data name="Editor.Preview.Compare" xml:space="preserve"><value>Confronta</value></data>
@@ -158,12 +173,17 @@
<data name="Editor.Preview.Unreadable" xml:space="preserve"><value>Questo fotogramma non si può leggere.</value></data>
<data name="Editor.Preview.Vectors" xml:space="preserve"><value>Vettori</value></data>
<data name="Editor.Preview.Wipe" xml:space="preserve"><value>originale | corretto</value></data>
<data name="Editor.Proxies.Failed" xml:space="preserve"><value>Proxy non ricevuti</value></data>
<data name="Editor.Proxies.Fetching" xml:space="preserve"><value>Scaricamento dei proxy</value></data>
<data name="Editor.Regions.Auto" xml:space="preserve"><value>Auto</value></data>
<data name="Editor.Regions.Horizon" xml:space="preserve"><value>Orizzonte</value></data>
<data name="Editor.Regions.Luminance" xml:space="preserve"><value>Luminanza</value></data>
<data name="Editor.Remote.Outdated" xml:space="preserve"><value>{0} · proxy superati</value></data>
<data name="Editor.Remote.ReadOnly" xml:space="preserve"><value>{0} · sola lettura</value></data>
<data name="Editor.Render" xml:space="preserve"><value>Renderizza · {0}</value></data>
<data name="Editor.Render.Done" xml:space="preserve"><value>Render completato</value></data>
<data name="Editor.Render.Queued" xml:space="preserve"><value>Render in coda</value></data>
<data name="Editor.Render.QueuedServer" xml:space="preserve"><value>Render in coda su {0}</value></data>
<data name="Editor.Render.Reveal" xml:space="preserve"><value>Mostra nella cartella</value></data>
<data name="Editor.RenderButton" xml:space="preserve"><value>Renderizza</value></data>
<data name="Editor.Reset" xml:space="preserve"><value>Ripristina</value></data>
@@ -171,6 +191,9 @@
<data name="Editor.Save.Failed" xml:space="preserve"><value>Modifiche non salvate</value></data>
<data name="Editor.Save.Retry" xml:space="preserve"><value>Riprova</value></data>
<data name="Editor.Sections" xml:space="preserve"><value>Sezioni</value></data>
<data name="Editor.ServerJob.Cancel" xml:space="preserve"><value>Annulla attività</value></data>
<data name="Editor.ServerJob.Ended" xml:space="preserve"><value>{0} su {2}: {1}</value></data>
<data name="Editor.ServerJob.Left" xml:space="preserve"><value>mancano {0}</value></data>
<data name="Editor.Stack.Length" xml:space="preserve"><value>Lunghezza</value></data>
<data name="Editor.Stack.Mean" xml:space="preserve"><value>Media</value></data>
<data name="Editor.Stack.Median" xml:space="preserve"><value>Mediana</value></data>
+27 -1
View File
@@ -126,16 +126,22 @@
<data name="Tooltips.Editor.Chart.Seek" xml:space="preserve"><value>Clic o trascina per mostrare quel fotogramma</value></data>
<data name="Tooltips.Editor.Chart.Waveform" xml:space="preserve"><value>Forma d’onda della luma del fotogramma a schermo: esposizione e clipping a colpo d’occhio</value></data>
<data name="Tooltips.Editor.Chart.WaveformView" xml:space="preserve"><value>Luma del fotogramma corretto lungo l’immagine: bianco in alto, nero in basso</value></data>
<data name="Tooltips.Editor.Conflict.KeepMine" xml:space="preserve"><value>Salva i tuoi valori di queste impostazioni al posto di quelli su {0}</value></data>
<data name="Tooltips.Editor.Conflict.TakeServer" xml:space="preserve"><value>Usa nell’editor i valori di {0}; Ctrl+Z riporta i tuoi</value></data>
<data name="Tooltips.Editor.Copy.Undo" xml:space="preserve"><value>Riporta il progetto com’era prima del ripristino · Ctrl+Z</value></data>
<data name="Tooltips.Editor.Export.AddToQueue" xml:space="preserve"><value>Mette in coda questo render; puoi continuare a modificare</value></data>
<data name="Tooltips.Editor.Export.ApplyPreset" xml:space="preserve"><value>Applica questo preset di sequenza a tutte le sezioni · {0}</value></data>
<data name="Tooltips.Editor.Export.Batch" xml:space="preserve"><value>Mette in coda i preset spuntati come un unico lavoro; la sequenza si prepara una volta</value></data>
<data name="Tooltips.Editor.Export.BatchEmpty" xml:space="preserve"><value>Spunta prima i preset sulle schede</value></data>
<data name="Tooltips.Editor.Export.BatchServer" xml:space="preserve"><value>Mette in coda su {0} i preset spuntati, un lavoro per ciascuno</value></data>
<data name="Tooltips.Editor.Export.BitRate" xml:space="preserve"><value>Bit rate medio; di più conserva dettagli e sfumature, i file crescono</value></data>
<data name="Tooltips.Editor.Export.Codec" xml:space="preserve"><value>Codec video o immagine; HEVC a 10 bit mantiene pulite le sfumature del cielo</value></data>
<data name="Tooltips.Editor.Export.Colour" xml:space="preserve"><value>Colore Rec.709; 10 bit evitano il banding nel cielo, l’HDR non è disponibile</value></data>
<data name="Tooltips.Editor.Export.Container" xml:space="preserve"><value>MP4, AVI, GIF, APNG o una cartella di immagini; l’elenco dei codec si adegua</value></data>
<data name="Tooltips.Editor.Export.Encoder" xml:space="preserve"><value>Encoder di questo PC; Auto preferisce l’hardware</value></data>
<data name="Tooltips.Editor.Export.EncoderServer" xml:space="preserve"><value>L’encoder lo sceglie {0} o il suo nodo di rendering</value></data>
<data name="Tooltips.Editor.Export.Folder" xml:space="preserve"><value>Dove vanno i render: {0}</value></data>
<data name="Tooltips.Editor.Export.FolderServer" xml:space="preserve"><value>I render di una sequenza del server vanno nella sua cartella exports sul server</value></data>
<data name="Tooltips.Editor.Export.FrameRate" xml:space="preserve"><value>Fotogrammi al secondo del file video</value></data>
<data name="Tooltips.Editor.Export.FrameRateAuto" xml:space="preserve"><value>Auto: i {0} fps del preset</value></data>
<data name="Tooltips.Editor.Export.FrameRateReset" xml:space="preserve"><value>Torna ai fotogrammi al secondo del preset</value></data>
@@ -146,7 +152,14 @@
<data name="Tooltips.Editor.Export.Preset" xml:space="preserve"><value>Renderizza con {0}; modificare un valore lo rende Personalizzato</value></data>
<data name="Tooltips.Editor.Export.Quality" xml:space="preserve"><value>Qualità dell’immagine; 95 sembra senza perdite, meno fa file più piccoli</value></data>
<data name="Tooltips.Editor.Export.Recommended" xml:space="preserve"><value>Scelta del consulente: {0}</value></data>
<data name="Tooltips.Editor.Export.Restore" xml:space="preserve"><value>Usa come progetto le impostazioni di questo PC salvate il {0} · Ctrl+Z annulla</value></data>
<data name="Tooltips.Editor.Export.RestoreChoice" xml:space="preserve"><value>Scegli un’altra copia delle impostazioni di questo PC, conservata quando un conflitto di sincronizzazione è stato risolto</value></data>
<data name="Tooltips.Editor.Export.SizeInvalid" xml:space="preserve"><value>Inserisci una dimensione tra 16 e 16384 pixel</value></data>
<data name="Tooltips.Editor.Export.Sync" xml:space="preserve"><value>Dopo ogni render su questo PC invia il file anche al server; i file grandi richiedono tempo</value></data>
<data name="Tooltips.Editor.Export.SyncNoUpload" xml:space="preserve"><value>Il tuo account non può inviare file al server</value></data>
<data name="Tooltips.Editor.Export.SyncNotLinked" xml:space="preserve"><value>Il server non ha questa sequenza: caricala prima dalla schermata Server</value></data>
<data name="Tooltips.Editor.Export.SyncRemote" xml:space="preserve"><value>I render di una sequenza del server si fanno sul server e restano lì</value></data>
<data name="Tooltips.Editor.Export.SyncSignedOut" xml:space="preserve"><value>Connettiti prima al server per inviargli i render</value></data>
<data name="Tooltips.Editor.Export.Width" xml:space="preserve"><value>Larghezza in pixel; vuoto usa il preset o la sorgente · Invio applica, Esc annulla</value></data>
<data name="Tooltips.Editor.Exposure.Deflicker" xml:space="preserve"><value>Elimina lo sfarfallio di luminosità tra fotogrammi; spento lascia l’esposizione della fotocamera</value></data>
<data name="Tooltips.Editor.Exposure.HolyGrail" xml:space="preserve"><value>Trasforma i salti di ISO, tempo e diaframma in rampe morbide; spento li lascia</value></data>
@@ -160,7 +173,7 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Clic o trascina per mostrare un fotogramma; i segni indicano salti di esposizione, avvisi e fotogrammi chiave</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Lascia fuori questo fotogramma da ogni render; la foto non viene eliminata</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Mostra il primo fotogramma interessato</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Rende questo fotogramma la copertina; l’editor si apre qui</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Usa il fotogramma come copertina della sequenza</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Usa di nuovo questo fotogramma nei render</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Ordina per questa colonna; un altro clic inverte</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Fai clic su una riga per mostrare il fotogramma</value></data>
@@ -181,6 +194,8 @@
<data name="Tooltips.Editor.OptimiseAll" xml:space="preserve"><value>Lascia che il consulente imposti ogni sezione dall’analisi ed elenchi cosa è cambiato</value></data>
<data name="Tooltips.Editor.OptimiseNone" xml:space="preserve"><value>Il consulente non fa mai stacking da solo: una mediana cancella le stelle in movimento</value></data>
<data name="Tooltips.Editor.OptimiseSection" xml:space="preserve"><value>Applica le scelte più incisive del consulente per questa sezione ed elenca cosa è cambiato · Ctrl+Z annulla</value></data>
<data name="Tooltips.Editor.Outdated" xml:space="preserve"><value>Su {0} sono stati aggiunti o tolti fotogrammi dopo lo scaricamento dei proxy; scaricali di nuovo per modificare o renderizzare</value></data>
<data name="Tooltips.Editor.Outdated.Fetch" xml:space="preserve"><value>Scarica di nuovo i proxy e riapri la sequenza; la barra delle attività mostra lo scaricamento</value></data>
<data name="Tooltips.Editor.Pause" xml:space="preserve"><value>Pausa · Spazio</value></data>
<data name="Tooltips.Editor.Play" xml:space="preserve"><value>Riproduce i fotogrammi · Spazio; le frecce avanzano di uno</value></data>
<data name="Tooltips.Editor.Preview.ActualSize" xml:space="preserve"><value>Mostra i pixel 1:1 senza interpolazione · Ctrl+1; Ctrl+0 adatta</value></data>
@@ -195,15 +210,26 @@
<data name="Tooltips.Editor.Preview.ShotData" xml:space="preserve"><value>Mostra o nasconde i dati di scatto</value></data>
<data name="Tooltips.Editor.Preview.Vectors" xml:space="preserve"><value>Sovrappone il movimento verso il fotogramma successivo misurato dal motore</value></data>
<data name="Tooltips.Editor.Preview.View" xml:space="preserve"><value>Trascina la linea per confrontare · trascina per spostare · la rotellina ingrandisce · doppio clic 1:1</value></data>
<data name="Tooltips.Editor.ReadOnly" xml:space="preserve"><value>Il tuo account può vedere questa sequenza del server ma non modificarla</value></data>
<data name="Tooltips.Editor.Remote" xml:space="preserve"><value>Modificata con i proxy su questo PC; le modifiche si salvano su {0} e analisi e render vengono eseguiti lì</value></data>
<data name="Tooltips.Editor.RemoteReadOnly" xml:space="preserve"><value>Mostrata da {0}; il tuo account può vedere questa sequenza ma non modificarla</value></data>
<data name="Tooltips.Editor.Render" xml:space="preserve"><value>Renderizza con il preset scelto; avanzamento nella barra dei lavori · Ctrl+R</value></data>
<data name="Tooltips.Editor.Render.NameError" xml:space="preserve"><value>Correggi prima il nome del file: {0}</value></data>
<data name="Tooltips.Editor.Render.NoFrames" xml:space="preserve"><value>Tutti i fotogrammi sono esclusi: includine alcuni nella scheda Fotogrammi</value></data>
<data name="Tooltips.Editor.Render.NoRight" xml:space="preserve"><value>Il tuo account non può renderizzare su {0}</value></data>
<data name="Tooltips.Editor.Render.NoSource" xml:space="preserve"><value>La dimensione dei fotogrammi è sconosciuta: non è stato possibile leggerli</value></data>
<data name="Tooltips.Editor.Render.Planning" xml:space="preserve"><value>Calcolo del render in corso; pronto tra un attimo</value></data>
<data name="Tooltips.Editor.Render.Reveal" xml:space="preserve"><value>Mostra il file del render in Esplora file</value></data>
<data name="Tooltips.Editor.RenderChoice" xml:space="preserve"><value>Scegli un altro preset</value></data>
<data name="Tooltips.Editor.RenderChoiceReadOnly" xml:space="preserve"><value>Scegli il preset da renderizzare; il progetto mantiene il suo</value></data>
<data name="Tooltips.Editor.RenderServer" xml:space="preserve"><value>Renderizza su {0} con il preset scelto; avanzamento accanto al titolo · Ctrl+R</value></data>
<data name="Tooltips.Editor.ResetSection" xml:space="preserve"><value>Riporta in Auto ogni controllo di questa sezione · Ctrl+Z annulla</value></data>
<data name="Tooltips.Editor.Save.Retry" xml:space="preserve"><value>Prova a salvare ora; il salvataggio viene anche ritentato da solo</value></data>
<data name="Tooltips.Editor.ServerJob" xml:space="preserve"><value>{0} in corso su {1}</value></data>
<data name="Tooltips.Editor.ServerJob.Cancel" xml:space="preserve"><value>Annulla l’attività su {0}; Riprova nell’avviso che segue la rimette in coda dall’ultimo punto di ripresa</value></data>
<data name="Tooltips.Editor.ServerJob.Paused" xml:space="preserve"><value>{0} in pausa su {1}</value></data>
<data name="Tooltips.Editor.ServerJob.Queued" xml:space="preserve"><value>{0} in attesa su {1}</value></data>
<data name="Tooltips.Editor.ServerJob.Retry" xml:space="preserve"><value>Rimetti in coda l’attività su {0} dall’ultimo punto di ripresa</value></data>
<data name="Tooltips.Editor.Stack.Length" xml:space="preserve"><value>Fotogrammi combinati in ogni fotogramma d’uscita; scie e levigatura crescono con esso</value></data>
<data name="Tooltips.Editor.Stack.Mode" xml:space="preserve"><value>Mediana e media tolgono rumore e ciò che si muove; le scie stellari tengono i pixel più luminosi</value></data>
<data name="Tooltips.Editor.Tab.Camera" xml:space="preserve"><value>Ritaglio, formato, movimenti della camera virtuale</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Kopijuoti į struktūrą…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indeksuoti vietoje…</value></data>
<data name="Archive.Applied.few" xml:space="preserve"><value>Pakeistos {0:N0} sekos</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>Pakeista {0:N0} seka</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Spustelėkite arba vilkite, kad būtų parodytas kadras; žymos rodo ekspozicijos šuolius, įspėjimus ir raktinius kadrus</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Neįtraukti šio kadro į jokį atvaizdavimą; nuotrauka nenaikinama</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Rodyti pirmą susijusį kadrą</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Padaryti šį kadrą viršelio kadru; rengyklė atsidaro ties juo</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Vėl naudoti šį kadrą atvaizduojant</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Rikiuoti pagal šį stulpelį; spustelėjus dar kartą tvarka apverčiama</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Spustelėkite eilutę, kad būtų parodytas kadras</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Kopiëren naar de indeling…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Ter plaatse indexeren…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} reeks gewijzigd</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} reeksen gewijzigd</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Klik of sleep om een frame te tonen; markeringen tonen belichtingsstappen, waarschuwingen en keyframes</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Laat dit frame weg uit elke render; de foto wordt niet verwijderd</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Toon het eerste betrokken frame</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Maak dit het omslagframe; de editor opent op dit frame</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Gebruik dit frame weer in renders</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Sorteer op deze kolom; klik nogmaals om de volgorde om te keren</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Klik op een rij om het frame te tonen</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Kopiuj do struktury…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indeksuj na miejscu…</value></data>
<data name="Archive.Applied.few" xml:space="preserve"><value>Zmieniono {0:N0} sekwencje</value></data>
<data name="Archive.Applied.many" xml:space="preserve"><value>Zmieniono {0:N0} sekwencji</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Kliknij lub przeciągnij, aby pokazać klatkę; znaczniki pokazują skoki ekspozycji, ostrzeżenia i klatki kluczowe</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Pomiń tę klatkę we wszystkich renderach; zdjęcie nie zostanie usunięte</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Pokaż pierwszą klatkę, której to dotyczy</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Ustaw tę klatkę jako tytułową; edytor otwiera się na niej</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Ponownie używaj tej klatki w renderach</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Sortuj według tej kolumny; kliknij ponownie, aby odwrócić kolejność</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Kliknij wiersz, aby pokazać klatkę</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copiar para a estrutura…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indexar no local…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} sequência alterada</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} sequências alteradas</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Clique ou arraste para mostrar um quadro; os marcadores indicam mudanças de exposição, avisos e quadros-chave</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Omite este quadro de todas as renderizações; a foto não é excluída</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Mostra o primeiro quadro afetado</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Define este quadro como capa; o editor abre nele</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Volta a usar este quadro nas renderizações</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Classifica por esta coluna; clique de novo para inverter</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Clique em uma linha para mostrar o quadro</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copiar para a estrutura…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indexar no local…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} sequência alterada</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} sequências alteradas</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Clique ou arraste para mostrar um fotograma; os marcadores mostram passos de exposição, avisos e fotogramas-chave</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Deixar este fotograma de fora de todas as renderizações; a fotografia não é eliminada</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Mostrar o primeiro fotograma em causa</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Tornar este o fotograma de capa; o editor abre nele</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Voltar a utilizar este fotograma nas renderizações</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Ordenar por esta coluna; clique novamente para inverter</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Clique numa linha para mostrar o fotograma</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Kopiraj v postavitev …</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indeksiraj na mestu …</value></data>
<data name="Archive.Applied.few" xml:space="preserve"><value>Spremenjene so {0:N0} sekvence</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>Spremenjena je {0:N0} sekvenca</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Kliknite ali povlecite, da se pokaže sličica; označbe kažejo korake osvetlitve, opozorila in ključne sličice</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Izpusti to sličico iz vseh upodobitev; fotografija se ne izbriše</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>Pokaži prvo zadevno sličico</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Nastavi to sličico kot naslovno; urejevalnik se odpre na njej</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Znova uporabi to sličico pri upodabljanju</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Razvrsti po tem stolpcu; ponoven klik obrne vrstni red</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Kliknite vrstico, da se pokaže sličica</value></data>
-1
View File
@@ -4,7 +4,6 @@
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Arşiv düzenine kopyala…</value></data>
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Yerinde dizine ekle…</value></data>
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} sekans değiştirildi</value></data>
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} sekans değiştirildi</value></data>
-1
View File
@@ -148,7 +148,6 @@
<data name="Tooltips.Editor.Filmstrip" xml:space="preserve"><value>Bir kareyi göstermek için tıklayın veya sürükleyin; işaretler pozlama adımlarını, uyarıları ve anahtar kareleri gösterir</value></data>
<data name="Tooltips.Editor.Frames.Exclude" xml:space="preserve"><value>Bu kareyi tüm işlemelerin dışında bırakır; fotoğraf silinmez</value></data>
<data name="Tooltips.Editor.Frames.Finding" xml:space="preserve"><value>İlgili ilk kareyi gösterir</value></data>
<data name="Tooltips.Editor.Frames.Hero" xml:space="preserve"><value>Bu kareyi kapak karesi yapar; düzenleyici bu kareyle açılır</value></data>
<data name="Tooltips.Editor.Frames.Include" xml:space="preserve"><value>Bu kareyi işlemelerde yeniden kullanır</value></data>
<data name="Tooltips.Editor.Frames.Sort" xml:space="preserve"><value>Bu sütuna göre sıralar; ters çevirmek için yeniden tıklayın</value></data>
<data name="Tooltips.Editor.Frames.Table" xml:space="preserve"><value>Kareyi göstermek için bir satıra tıklayın</value></data>
+106 -13
View File
@@ -46,22 +46,27 @@ public sealed class SampleData
private TitanoDatabase? _db;
private Guid _sunrise;
private Guid _lakeComo;
private Permissions _permissions = RolePermissions.Default(UserRole.Editor);
private SampleData(AppServices services) => _services = services;
/// <summary>The server-only sequence whose proxies <see cref="CacheProxiesAsync"/> keeps on this PC (Sunrise over Superga).</summary>
public Guid ProxiedSequenceId => _sunrise;
/// <summary>Points the services at fakes (server, encoders, update check) for an empty first-run state.</summary>
public static SampleData Configure(AppServices services)
{
if (!services.Environment.IsCapture) throw new InvalidOperationException("Sample data only runs in a capture environment.");
var settings = services.Settings;
var sample = new SampleData(services);
services.Server.Dispose();
services.Server = new ServerSession(settings, services.SaveSettings, new SampleServerApiFactory(), new PlainTokenProtector());
services.Server = new ServerSession(settings, services.SaveSettings, new SampleServerApiFactory(sample), new PlainTokenProtector());
services.Encoders = new SampleEncoders();
services.CheckForUpdateAsync = _ => Task.FromResult<ReleaseInfo?>(null);
services.Devices.Dispose();
services.Devices = new SampleDeviceMonitor();
var sample = new SampleData(services);
services.Sync.RemoteFactory = (_, _, _) => sample._remote;
services.Sync.EditorFactory = (_, _, _) => sample._remote;
return sample;
}
@@ -170,6 +175,44 @@ public sealed class SampleData
for (var i = 0; i < 200 && await db.Jobs.GetAsync(job.Id) is { State: JobState.Queued or JobState.Running }; i++) await Task.Delay(50);
}
/// <summary>A render of Sunrise over Superga running on the sample server, 43 % done (the remote editor's server job).</summary>
public void RunServerRender() => _remote.Run(_sunrise, "render", 1_240, 2_880);
/// <summary>The sample server's jobs end (none waits or runs any more).</summary>
public void EndServerJobs() => _remote.EndJobs();
/// <summary>
/// The signed-in account keeps Read, Upload and Render but loses Edit (server sequences open read-only); the
/// session is read again so the client sees it.
/// </summary>
public async Task RestrictAccountAsync()
{
_permissions = Permissions.Read | Permissions.Upload | Permissions.Render;
await _services.Server.RestoreAsync();
}
/// <summary>
/// The editor's sample as a sequence the sample server also has (so its Export "Sync" applies), with two copies of
/// this PC's settings kept by "Save both" in its <c>.titano</c> folder.
/// </summary>
public async Task KeepEditorCopiesAsync(Guid sequenceId)
{
var db = _db ?? throw new InvalidOperationException("FillAsync first.");
var sequence = await db.Sequences.GetAsync(sequenceId) ?? throw new InvalidOperationException("FillEditorAsync first.");
var archive = await db.Archives.GetAsync(sequence.ArchiveId) ?? throw new InvalidOperationException("FillEditorAsync first.");
var meta = new ArchivePaths(archive.RootPath).Sequence(sequence.Folder).MetaDirectory;
Directory.CreateDirectory(meta);
var project = sequence.SettingsJson is { } json ? ProjectSettings.FromJson(json) : new ProjectSettings();
var copies = new (DateTime Saved, double OffsetEv)[] { (new DateTime(2026, 9, 30, 21, 14, 5), 0.3), (new DateTime(2026, 10, 2, 8, 41, 37), -0.2) };
foreach (var (saved, offset) in copies)
{
var copy = project with { Exposure = project.Exposure with { ExposureOffsetEv = offset } };
Titano.Core.IO.AtomicFile.WriteAllText(Path.Combine(meta, SyncService.SavedCopyName(saved)), copy.ToJson());
}
var remote = _remote.Add(SampleSyncRemote.Dto(sequence), sequence.SettingsJson, sequence.FrameCount);
await _services.Sync.Service!.LinkAsync(ServerAddress, remote, sequence.Id);
}
/// <summary>
/// The server's side: six sequences this PC also holds (two the same, one with settings changed on both sides, one
/// with more originals on the server, one with more here, one with renders this PC lacks) and two only on the server
@@ -600,15 +643,15 @@ public sealed class SampleData
}
/// <summary>A server that always answers as "Studio NAS" with a self-signed certificate the sample trusts.</summary>
private sealed class SampleServerApiFactory : IServerApiFactory
private sealed class SampleServerApiFactory(SampleData sample) : IServerApiFactory
{
public IServerApi Create(Uri baseAddress, IReadOnlyCollection<string> trustedFingerprints) => new SampleServerApi(baseAddress, trustedFingerprints);
public IServerApi Create(Uri baseAddress, IReadOnlyCollection<string> trustedFingerprints) => new SampleServerApi(sample, baseAddress, trustedFingerprints);
}
private sealed class SampleServerApi(Uri baseAddress, IReadOnlyCollection<string> trusted) : IServerApi
/// <summary>The sample account, an editor unless <see cref="RestrictAccountAsync"/> took the Edit right away.</summary>
private sealed class SampleServerApi(SampleData sample, Uri baseAddress, IReadOnlyCollection<string> trusted) : IServerApi
{
private static readonly UserDto User = new(Guid.Empty, "alberto", "Alberto", "editor", (long)RolePermissions.Default(UserRole.Editor), 5_000_000_000_000,
2_100_000_000_000, false, false,
private UserDto User => new(Guid.Empty, "alberto", "Alberto", "editor", (long)sample._permissions, 5_000_000_000_000, 2_100_000_000_000, false, false,
new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero), DateTimeOffset.UtcNow);
public Uri BaseAddress { get; } = baseAddress;
@@ -639,13 +682,15 @@ public sealed class SampleData
}
/// <summary>
/// The sample server's sequences for the sync table: listings, manifests (frames hashed from their index, so
/// unhashed sample frames match them by count; renders as many as the listing says), settings edits and proxies
/// (generated JPEGs); uploads and originals are not part of the screenshots.
/// The sample server's sequences for the sync table and the editor of a server sequence: listings, manifests
/// (frames hashed from their index, so unhashed sample frames match them by count; renders as many as the listing
/// says), settings edits, proxies (generated JPEGs) and jobs the editor posts (kept queued until cancelled, or run by
/// <see cref="Run"/>); uploads, originals and analysis reports are not part of the screenshots.
/// </summary>
private sealed class SampleSyncRemote : ISyncRemote
private sealed class SampleSyncRemote : ISyncRemote, IRemoteSequenceApi
{
private readonly Dictionary<Guid, (SequenceDto Dto, string? Settings, Guid[] Frames)> _sequences = [];
private readonly Dictionary<Guid, JobDto> _jobs = [];
public string Server => ServerAddress;
@@ -698,9 +743,9 @@ public sealed class SampleData
{
lock (_sequences)
{
var (dto, _, frames) = _sequences[id];
var (dto, settings, frames) = _sequences[id];
var updated = dto with { SettingsVersion = dto.SettingsVersion + 1, UpdatedAt = DateTimeOffset.UtcNow };
_sequences[id] = (updated, request.SettingsJson, frames);
_sequences[id] = (updated, request.SettingsJson ?? settings, frames);
return Task.FromResult(updated);
}
}
@@ -729,6 +774,54 @@ public sealed class SampleData
yield break;
}
public Task<string?> GetAnalysisReportAsync(Guid id, CancellationToken cancellationToken) => Task.FromResult<string?>(null);
public Task<JobDto> CreateJobAsync(CreateJobRequest request, CancellationToken cancellationToken)
{
var job = new JobDto(Guid.CreateVersion7(), request.Kind, request.Target, null, "queued", "user", 0, 0, null, null, null, null, 0, null,
DateTimeOffset.UtcNow, null, null);
lock (_jobs) _jobs[job.Id] = job;
return Task.FromResult(job);
}
/// <summary>A job of <paramref name="kind"/> running for <paramref name="sequenceId"/>, <paramref name="done"/> of <paramref name="total"/> frames.</summary>
public void Run(Guid sequenceId, string kind, long done, long total)
{
var now = DateTimeOffset.UtcNow;
var job = new JobDto(Guid.CreateVersion7(), kind, [sequenceId], null, "running", "user", done, total, 11.3, (total - done) / 11.3, null, "studio-pc", 1,
null, now.AddMinutes(-2), now.AddMinutes(-2), null);
lock (_jobs) _jobs[job.Id] = job;
}
public void EndJobs()
{
lock (_jobs) _jobs.Clear();
}
public Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken)
{
lock (_jobs) return Task.FromResult(_jobs[id]);
}
public Task<IReadOnlyList<JobDto>> ListActiveJobsAsync(CancellationToken cancellationToken)
{
lock (_jobs) return Task.FromResult<IReadOnlyList<JobDto>>([.. _jobs.Values.Where(j => j.State is "queued" or "running" or "paused")]);
}
public Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken) =>
Task.FromResult(Update(id, job => job with { State = "cancelled", Finished = DateTimeOffset.UtcNow }));
public Task<JobDto> RetryJobAsync(Guid id, CancellationToken cancellationToken) =>
Task.FromResult(Update(id, job => job with { State = "queued", Error = null, Finished = null }));
public Task<JobDto> SetJobPriorityAsync(Guid id, string priority, CancellationToken cancellationToken) =>
Task.FromResult(Update(id, job => job with { Priority = priority }));
private JobDto Update(Guid id, Func<JobDto, JobDto> change)
{
lock (_jobs) return _jobs[id] = change(_jobs[id]);
}
public void Dispose()
{
}
+7 -7
View File
@@ -45,8 +45,8 @@ public sealed class CameraTab : EditorTab
new NumberRow(s, "Editor.Camera.OffsetY", "Tooltips.Editor.Camera.OffsetY", -1, 1, 0.05, p => p.Camera.OffsetY,
(p, v) => p with { Camera = p.Camera with { OffsetY = v } }, EditorText.Placement),
];
AddKeyCommand = new RelayCommand(AddKey, () => !Editor.IsBusy && Keys.All(k => k.Frame != Editor.CurrentIndex));
RemoveKeyCommand = new RelayCommand(RemoveKey, () => !Editor.IsBusy && SelectedKey >= 0);
AddKeyCommand = new RelayCommand(AddKey, () => !Editor.IsLocked && Keys.All(k => k.Frame != Editor.CurrentIndex));
RemoveKeyCommand = new RelayCommand(RemoveKey, () => !Editor.IsLocked && SelectedKey >= 0);
CommitCurveCommand = new RelayCommand(CommitCurve);
Refresh();
}
@@ -103,13 +103,13 @@ public sealed class CameraTab : EditorTab
public ICommand RemoveKeyCommand { get; }
/// <summary>What Add keyframe does, or why it cannot run now.</summary>
public string AddKeyToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy"
: Keys.Any(k => k.Frame == Editor.CurrentIndex) ? "Tooltips.Editor.Camera.KeyExists" : "Tooltips.Editor.Camera.AddKey");
public string AddKeyToolTip => Editor.LockedToolTip
?? Loc.L(Keys.Any(k => k.Frame == Editor.CurrentIndex) ? "Tooltips.Editor.Camera.KeyExists" : "Tooltips.Editor.Camera.AddKey");
/// <summary>How to edit the keyframe curve, or why it waits.</summary>
public string CurveToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.Camera.Curve");
public string CurveToolTip => Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Camera.Curve");
public string RemoveKeyToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : HasSelectedKey ? "Tooltips.Editor.Camera.RemoveKey" : "Tooltips.Editor.Camera.NoKey");
public string RemoveKeyToolTip => Editor.LockedToolTip ?? Loc.L(HasSelectedKey ? "Tooltips.Editor.Camera.RemoveKey" : "Tooltips.Editor.Camera.NoKey");
/// <summary>Run by the curve editor after each finished edit.</summary>
public ICommand CommitCurveCommand { get; }
@@ -248,7 +248,7 @@ public sealed class TimeTab : EditorTab
public ICommand CommitCurveCommand { get; }
/// <summary>How to edit the remap curve, or why it waits.</summary>
public string CurveToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.Time.Curve");
public string CurveToolTip => Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Time.Curve");
/// <summary>"3,600 frames → 2 min 30 s · 24 fps".</summary>
public string? PlanText { get => _planText; private set => Set(ref _planText, value); }
+3 -2
View File
@@ -228,8 +228,9 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type e:PresetCard}">
<!-- Disabled while a job runs or the project cannot change: the card's tooltip says why. -->
<Button Style="{StaticResource Button.PresetCard}" Command="{Binding SelectCommand}" CommandParameter="{Binding}" ToolTip="{Binding ToolTip}"
AutomationProperties.Name="{Binding Name}">
ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{Binding Name}">
<DockPanel>
<!-- The chip moves under the name when both do not fit on one line. -->
<WrapPanel DockPanel.Dock="Top">
@@ -240,7 +241,7 @@
</WrapPanel>
<DockPanel DockPanel.Dock="Bottom">
<CheckBox DockPanel.Dock="Right" IsChecked="{Binding IsInBatch}" Visibility="{Binding CanBatch, Converter={StaticResource BoolToVisibility}}"
ToolTip="{l:Loc Tooltips.Editor.Export.InBatch}" AutomationProperties.Name="{l:Loc Editor.Export.InBatch}" Margin="6,0,0,0" />
ToolTip="{Binding BatchToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Export.InBatch}" Margin="6,0,0,0" />
<TextBlock Text="{Binding Estimate}" FontSize="{StaticResource Size.Secondary}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" />
</DockPanel>
+28 -8
View File
@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
xmlns:v="clr-namespace:Titano.Ui.Visuals;assembly=Titano.Ui"
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
xmlns:shell="clr-namespace:Titano.App.Shell"
xmlns:e="clr-namespace:Titano.App.Editor">
@@ -149,7 +150,7 @@
ToolTip="{Binding ResetToolTip}" Visibility="{Binding CanReset, Converter={StaticResource BoolToVisibility}}" />
</Grid>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
<StackPanel IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.BusyToolTip}" ToolTipService.ShowOnDisabled="True">
<StackPanel IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.LockedToolTip}" ToolTipService.ShowOnDisabled="True">
<ItemsControl ItemsSource="{Binding Rows}" Focusable="False" />
<ContentPresenter />
</StackPanel>
@@ -286,15 +287,21 @@
ToolTip="{Binding Editor.RenderToolTip}" ToolTipService.ShowOnDisabled="True" />
<DockPanel Margin="0,8,0,0">
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Export.HistoryLink}" Command="{Binding HistoryCommand}"
ToolTip="{l:Loc Tooltips.Editor.Export.History}" Margin="6,0,0,0" />
ToolTip="{l:Loc Tooltips.Editor.Export.History}" Margin="6,0,0,0" Visibility="{Binding CanOpenHistory, Converter={StaticResource BoolToVisibility}}" />
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Editor.Export.Reveal}" Command="{Binding RevealLastCommand}"
ToolTip="{l:Loc Tooltips.Editor.Render.Reveal}" Margin="6,0,0,0" Visibility="{Binding HasHistory, Converter={StaticResource BoolToVisibility}}" />
ToolTip="{l:Loc Tooltips.Editor.Render.Reveal}" Margin="6,0,0,0" Visibility="{Binding CanReveal, Converter={StaticResource BoolToVisibility}}" />
<TextBlock Text="{Binding HistoryText}" Style="{StaticResource Text.Faint}" FontSize="{StaticResource Size.Chip}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
ToolTip="{Binding HistoryText}" />
</DockPanel>
<!-- This PC's settings kept by "Save both" (sync conflicts): the newest, or another from the menu, becomes the project as one undo step. -->
<v:SplitButton Margin="0,8,0,0" HorizontalAlignment="Left" Content="{Binding RestoreText}" Command="{Binding RestoreCommand}"
ItemsSource="{Binding SavedCopies}" DisplayMemberPath="Label" SelectedItem="{Binding SelectedCopy}" ToolTip="{Binding RestoreToolTip}"
ToolTipService.ShowOnDisabled="True"
DropDownToolTip="{l:Loc Tooltips.Editor.Export.RestoreChoice}" AutomationProperties.Name="{l:Loc Editor.Export.RestoreName}"
Visibility="{Binding HasSavedCopies, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Focusable="False">
<StackPanel IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.BusyToolTip}" ToolTipService.ShowOnDisabled="True">
<StackPanel IsEnabled="{Binding Editor.IsEditable}" ToolTip="{Binding Editor.LockedToolTip}" ToolTipService.ShowOnDisabled="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource Editor.Grid.Label}" />
@@ -310,6 +317,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.Container}" ToolTip="{l:Loc Editor.Export.Container}" />
<ComboBox Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Containers}" SelectedItem="{Binding SelectedContainer}" DisplayMemberPath="Label"
@@ -373,8 +381,8 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding Encoders}" SelectedItem="{Binding SelectedEncoder}" DisplayMemberPath="Label"
ToolTip="{l:Loc Tooltips.Editor.Export.Encoder}" AutomationProperties.Name="{l:Loc Editor.Export.Encoder}" />
<ComboBox ItemsSource="{Binding Encoders}" SelectedItem="{Binding SelectedEncoder}" DisplayMemberPath="Label" IsEnabled="{Binding CanChooseEncoder}"
ToolTip="{Binding EncoderToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Export.Encoder}" />
<TextBlock Grid.Column="1" Text="{Binding EncoderKind}" FontSize="{StaticResource Size.Secondary}" VerticalAlignment="Center" Margin="8,0,0,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
@@ -399,8 +407,20 @@
shell:EditBehavior.Field="{Binding NameTemplate}" ToolTip="{Binding NameTemplate.ToolTip}" AutomationProperties.Name="{l:Loc Editor.Export.FileName}" />
<TextBlock Grid.Row="8" Style="{StaticResource Text.Label}" Text="{l:Loc Editor.Export.SaveTo}" ToolTip="{l:Loc Editor.Export.SaveTo}" />
<ComboBox Grid.Row="8" Grid.Column="1" ItemsSource="{Binding SaveChoices}" SelectedItem="{Binding SelectedSave}" DisplayMemberPath="Label"
ToolTip="{Binding SaveToolTip}" AutomationProperties.Name="{l:Loc Editor.Export.SaveTo}" />
<!-- The folder ends in an ellipsis (its full path is in the tooltip). -->
<ComboBox Grid.Row="8" Grid.Column="1" ItemsSource="{Binding SaveChoices}" SelectedItem="{Binding SelectedSave}" IsEnabled="{Binding CanChooseFolder}"
ToolTip="{Binding SaveToolTip}" ToolTipService.ShowOnDisabled="True" AutomationProperties.Name="{l:Loc Editor.Export.SaveTo}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type e:SaveChoice}">
<TextBlock Text="{Binding Label}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Export.html "Sync" (12 px): also send the render to the server the sequence is linked to. Under the folder rather than beside
it, as in the mockup, so that neither is cut in the 194 px field column in longer languages. -->
<CheckBox Grid.Row="9" Grid.Column="1" Margin="0,6,0,0" HorizontalAlignment="Left" FontSize="{StaticResource Size.Secondary}"
Content="{l:Loc Editor.Export.Sync}" IsChecked="{Binding SyncToServer}" IsEnabled="{Binding CanSync}" ToolTip="{Binding SyncToolTip}"
ToolTipService.ShowOnDisabled="True" />
</Grid>
<Border Style="{StaticResource Border.Card}" Margin="0,12,0,0" Padding="12,10">
+105 -9
View File
@@ -12,7 +12,8 @@ namespace Titano.App.Editor;
/// One sequence open in the editor (BRIEF §12.3): its content, the advisor's view of it (§10.3), the project with undo
/// and redo, and the actions of every section — edit, Optimise (§10.4), Reset, exclusions and hero, analysis and render
/// jobs. Every change is saved shortly after it is made (<see cref="ProjectSaver"/>); a change stored meanwhile by
/// someone else (an analysis job, another client) is merged in. Call from one thread (the UI thread).
/// someone else (an analysis job, another client) is merged in. On a server sequence, settings both sides changed to
/// different values wait for the user's choice (<see cref="Conflict"/>). Call from one thread (the UI thread).
/// </summary>
public sealed class EditorSession : IAsyncDisposable
{
@@ -46,11 +47,23 @@ public sealed class EditorSession : IAsyncDisposable
/// <summary>The sequence was read again (after an analysis): frames, reports, advice and presets.</summary>
public event Action? ContentChanged;
/// <summary>Saving the project failed (raised once per run of failures; the save is retried until it succeeds).</summary>
/// <summary>
/// Saving the project failed (raised once per run of failures; the save is retried until it succeeds). A conflict
/// raises <see cref="ConflictFound"/> instead.
/// </summary>
public event Action<Exception>? SaveFailed;
/// <summary>A save met settings changed on the server too (<see cref="Conflict"/> was null): the user picks a side.</summary>
public event Action<ProjectConflictException>? ConflictFound;
public ISequenceSource Source { get; }
/// <summary>A server sequence edited with proxies: saved, analysed and rendered on the server.</summary>
public bool IsRemote => Source.IsRemote;
/// <summary>The project is shown, not changed (<see cref="ISequenceSource.IsReadOnly"/>): edits, undo and redo do nothing.</summary>
public bool IsReadOnly => Source.IsReadOnly;
public SequenceContent Content { get; private set; }
public SequenceContext Context { get; private set; }
@@ -71,20 +84,26 @@ public sealed class EditorSession : IAsyncDisposable
/// <summary>Why the pending change could not be stored; null when the last save succeeded.</summary>
public Exception? LastSaveError => _saver.LastError;
/// <summary>
/// Settings this editor and someone on the server changed to different values, as the last save found them; null
/// when there are none. Saves wait (they are retried and meet it again) until <see cref="ResolveConflict"/>.
/// </summary>
public ProjectConflictException? Conflict { get; private set; }
/// <summary>Applies <paramref name="change"/> as an undoable step; false when it changes nothing.</summary>
/// <param name="mergeKey">Consecutive edits with the same key are one undo step (a slider drag).</param>
public bool Edit(Func<ProjectSettings, ProjectSettings> change, string? mergeKey = null)
{
ArgumentNullException.ThrowIfNull(change);
return History.Apply(change(Project), mergeKey);
return !IsReadOnly && History.Apply(change(Project), mergeKey);
}
/// <summary>The drag or key press behind a run of merged edits ended (<see cref="ProjectHistory.EndRun"/>).</summary>
public void EndEditRun() => History.EndRun();
public bool Undo() => History.Undo();
public bool Undo() => !IsReadOnly && History.Undo();
public bool Redo() => History.Redo();
public bool Redo() => !IsReadOnly && History.Redo();
/// <summary>"Optimise section": the advisor's heavier decisions for <paramref name="section"/>, one undo step; returns what changed.</summary>
public IReadOnlyList<SettingChange> Optimise(AdvisorSection section) => Optimise([section]);
@@ -133,6 +152,47 @@ public sealed class EditorSession : IAsyncDisposable
public ArchiveJobRequest RenderRequest(ExportSettings export, bool useProxies = false) =>
ProcessingJobs.Render(Content.Sequence, export, Content.SourceWidth, Content.SourceHeight, Project with { Export = export }, useProxies);
/// <summary>
/// The jobs that render <paramref name="export"/> 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).
/// </summary>
public IReadOnlyList<ArchiveJobRequest> RenderRequests(ExportSettings export) => IsRemote
? ProcessingJobs.RenderEach(Content.Sequence, export, Content.SourceWidth, Content.SourceHeight, Project with { Export = export })
: [RenderRequest(export)];
/// <summary>
/// Makes a "Save both" copy of this PC's settings the project, as one undoable step; null when it stores the same values.
/// </summary>
/// <returns>The restore, which its toast can take back while it is the last change.</returns>
/// <exception cref="System.IO.InvalidDataException">The copy cannot be read.</exception>
public async Task<ProjectRestore?> RestoreAsync(SavedCopy copy)
{
ArgumentNullException.ThrowIfNull(copy);
var restored = await Task.Run(() => SavedCopies.Read(copy));
var before = Project;
return Edit(_ => restored) ? new ProjectRestore(this, before, Project) : null;
}
/// <summary>
/// Settles <see cref="Conflict"/> against the server's settings as the last save read them. Both choices first take
/// in what only the server changed (like any merge, without an undo step). <paramref name="keepMine"/> then saves
/// the editor's values of the settings both changed; otherwise the server's values become the project as one
/// undoable step, so Ctrl+Z brings the editor's back (and saves them).
/// </summary>
/// <returns>False when there is no conflict to settle (a later save already went through).</returns>
public bool ResolveConflict(bool keepMine)
{
if (Conflict is not { Server: var theirs }) return false;
Conflict = null;
var basis = _basis;
_basis = theirs;
History.Replace(ProjectMerge.Merge(basis, Project, theirs));
if (!keepMine) History.Apply(ProjectMerge.Merge(basis, theirs, Project));
// The change waiting for its retry goes now, on top of the server's settings.
_ = _saver.FlushAsync();
return true;
}
/// <summary>The export of the project with preset <paramref name="presetId"/> chosen (own values, no batch).</summary>
public ExportSettings ExportFor(string presetId) =>
Project.Export with { Preset = Project.Export.Preset.WithManual(presetId), Overrides = new ExportOverrides(), Batch = [] };
@@ -146,10 +206,15 @@ public sealed class EditorSession : IAsyncDisposable
{
await _saver.FlushAsync();
var content = await Source.LoadAsync(cancellationToken);
var merged = ProjectMerge.Merge(_basis, Project, content.Project);
_basis = content.Project;
(Content, Context, Advice, Presets) = Analyse(content, _codecs);
History.Replace(merged);
// A server's settings that conflict with the editor's waiting change are not merged over it: that change's
// retry meets them and asks (Conflict).
if (Conflict is null && (!IsRemote || ProjectMerge.Conflicts(_basis, Project, content.Project).Count == 0))
{
var merged = ProjectMerge.Merge(_basis, Project, content.Project);
_basis = content.Project;
History.Replace(merged);
}
ContentChanged?.Invoke();
}
@@ -177,6 +242,7 @@ public sealed class EditorSession : IAsyncDisposable
private IReadOnlyList<SettingChange> Optimise(IReadOnlyList<AdvisorSection> sections)
{
if (IsReadOnly) return [];
var settings = Project;
var changes = new List<SettingChange>();
foreach (var section in sections)
@@ -191,6 +257,8 @@ public sealed class EditorSession : IAsyncDisposable
private void OnSaveFailed(Exception ex, int failures)
{
// A conflict is retried without the network until the user settles it: noted once, when it is found.
if (ex is ProjectConflictException) return;
Log.Warning("editor", $"Saving the project of {Content.Sequence.DisplayTitle} failed (attempt {failures})", ex);
if (failures == 1) SaveFailed?.Invoke(ex);
}
@@ -203,9 +271,37 @@ public sealed class EditorSession : IAsyncDisposable
private async Task SaveAsync(ProjectSettings project)
{
var stored = await Source.SaveProjectAsync(project, _basis, CancellationToken.None);
ProjectSettings stored;
try
{
stored = await Source.SaveProjectAsync(project, _basis, CancellationToken.None);
}
catch (ProjectConflictException ex)
{
var found = Conflict is null;
Conflict = ex;
if (found)
{
Log.Info("editor", $"Settings of {Content.Sequence.DisplayTitle} changed on the server too: {string.Join(", ", ex.Differences.Select(d => d.Path))}");
ConflictFound?.Invoke(ex);
}
throw;
}
Conflict = null;
_basis = stored;
// Someone else's change was merged in: show it without an undo step (edits made since the save are kept).
if (!ProjectMerge.SameValues(stored, project)) History.Replace(ProjectMerge.Merge(project, Project, stored));
}
}
/// <summary>
/// A "Save both" copy made the project (<see cref="EditorSession.RestoreAsync"/>). Its Undo brings back the project from
/// before as a new step, and only while the restore is still the last change: after another edit, an undo or a merged
/// save it would take that change back instead.
/// </summary>
public sealed class ProjectRestore(EditorSession session, ProjectSettings before, ProjectSettings restored)
{
public bool CanUndo => ReferenceEquals(session.Project, restored);
public bool Undo() => CanUndo && session.Edit(_ => before);
}
+9 -4
View File
@@ -16,8 +16,8 @@ public abstract class EditorTab : LocalizedViewModel
Editor = editor;
Key = key;
Section = section;
OptimiseCommand = new RelayCommand(() => Editor.Optimise(Section), () => CanOptimise && !Editor.IsBusy);
ResetCommand = new RelayCommand(() => Editor.Session.ResetSection(Section), () => CanReset && !Editor.IsBusy);
OptimiseCommand = new RelayCommand(() => Editor.Optimise(Section), () => CanOptimise && !Editor.IsLocked);
ResetCommand = new RelayCommand(() => Editor.Session.ResetSection(Section), () => CanReset && !Editor.IsLocked);
}
public EditorViewModel Editor { get; }
@@ -40,9 +40,9 @@ public abstract class EditorTab : LocalizedViewModel
public virtual bool CanReset => true;
/// <summary>What Optimise section does, or why it cannot run now.</summary>
public string OptimiseToolTip => Loc.L(!CanOptimise ? "Tooltips.Editor.OptimiseNone" : Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.OptimiseSection");
public string OptimiseToolTip => !CanOptimise ? Loc.L("Tooltips.Editor.OptimiseNone") : Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.OptimiseSection");
public string ResetToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.ResetSection");
public string ResetToolTip => Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.ResetSection");
public ICommand OptimiseCommand { get; }
@@ -84,6 +84,11 @@ public abstract class EditorTab : LocalizedViewModel
{
}
/// <summary>Whether this sequence can send its renders to the server changed (<see cref="EditorViewModel.SyncGate"/>).</summary>
public virtual void OnSyncGateChanged()
{
}
public override void Dispose()
{
foreach (var row in Rows) row.Dispose();
+33
View File
@@ -1,6 +1,7 @@
using System.Collections;
using System.Globalization;
using Titano.App.Infrastructure;
using Titano.App.Jobs;
using Titano.Core.Advice;
using Titano.Core.Export;
using Titano.Core.Localization;
@@ -28,6 +29,38 @@ public static class EditorText
return string.Join(Separator, parts);
}
/// <summary>
/// "Render · 46 %", "Render · queued", "Deep analysis · paused": a job the server runs for a server sequence (the job
/// bar shows this PC's jobs only).
/// </summary>
public static string ServerJob(Job job)
{
ArgumentNullException.ThrowIfNull(job);
return job switch
{
{ State: JobState.Running, ProgressTotal: > 0 } => JobText.Kind(job.Kind) + Separator + Formatting.Percent((double)job.ProgressDone / job.ProgressTotal),
{ State: JobState.Running } => JobText.Kind(job.Kind),
_ => JobText.Kind(job.Kind) + Separator + Loc.L("Jobs.State." + job.State),
};
}
/// <summary>"Render running on Studio NAS · 1,240 / 3,600 · 11.3 fps · 3 min left"; "Render waiting on Studio NAS".</summary>
public static string ServerJobDetail(Job job, string server)
{
ArgumentNullException.ThrowIfNull(job);
var key = job.State switch
{
JobState.Queued => "Tooltips.Editor.ServerJob.Queued",
JobState.Paused => "Tooltips.Editor.ServerJob.Paused",
_ => "Tooltips.Editor.ServerJob",
};
var parts = new List<string> { Loc.L(key, JobText.Kind(job.Kind), server) };
if (JobText.Counter(job.ProgressDone, job.ProgressTotal) is { Length: > 0 } counter) parts.Add(counter);
if (JobText.Speed(job.Kind, job.ItemsPerSecond) is { Length: > 0 } speed) parts.Add(speed);
if (job.Eta is { } eta) parts.Add(Loc.L("Editor.ServerJob.Left", Formatting.Duration(eta)));
return string.Join(Separator, parts);
}
/// <summary>"3,600 frames · 24 fps · 2 min 30 s · 3840×2160 · source 8192×5464": what the export makes of the sequence (Export.html header).</summary>
public static string OutputSummary(SequenceContent content, ExportPlan plan)
{
+295 -53
View File
@@ -3,6 +3,8 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using Titano.App.Infrastructure;
using Titano.App.Jobs;
using Titano.App.Server;
using Titano.App.Shell;
using Titano.Core.Advice;
using Titano.Core.Analysis;
@@ -39,9 +41,10 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
private readonly LatestRunner _corrections = new(Debounce);
private readonly LatestRunner _plans = new(Debounce);
private readonly DispatcherTimer _player;
private readonly Dictionary<Guid, Job> _jobs = [];
private readonly SequenceJobs _jobs;
private readonly AsyncRelayCommand _analyse;
private readonly AsyncRelayCommand _render;
private readonly AsyncRelayCommand _cancelServerJob;
private PreviewRenderer _renderer;
private int _currentIndex;
private EditorTab _selectedTab;
@@ -64,11 +67,14 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
private bool _previewBusy;
private RenderCorrections? _correctionsValue;
private ExportPlan? _plan;
private int _planVersion;
private bool _planned;
private string? _renderPreset;
private IReadOnlyList<TimelineMarker> _markers = [];
private IThumbnailSource _thumbnails;
private int _playLimit;
private double? _analysisSecondsPerFrame;
private ExportSyncGate _syncGate;
private bool _disposed;
public EditorViewModel(ShellViewModel shell, EditorSession session, IReadOnlyList<IVideoEncoderProvider> encoders, EncoderHost host)
@@ -78,6 +84,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
_encoders = encoders;
_host = host;
_dispatcher = Dispatcher.CurrentDispatcher;
_jobs = new SequenceJobs(session.Content.Sequence.Id);
_renderer = new PreviewRenderer(session.Content, session.Source);
Planner = new ExportPlanner(session.Content, encoders, host);
_thumbnails = new EditorThumbnails(session.Source, session.Content.Count);
@@ -85,11 +92,12 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
_player.Tick += (_, _) => Advance();
BackCommand = new RelayCommand(() => Shell.Navigate(SectionKey.Library));
_analyse = new AsyncRelayCommand(AnalyseAsync, () => !IsBusy && !IsAnalysing);
OptimiseAllCommand = new RelayCommand(OptimiseAll, () => !IsBusy);
_analyse = new AsyncRelayCommand(AnalyseAsync, () => !IsLocked && !IsAnalysing);
OptimiseAllCommand = new RelayCommand(OptimiseAll, () => !IsLocked);
_render = new AsyncRelayCommand(() => RenderAsync(JobPriority.User, batch: false), () => CanRender);
UndoCommand = new RelayCommand(() => Session.Undo(), () => !IsBusy && Session.History.CanUndo);
RedoCommand = new RelayCommand(() => Session.Redo(), () => !IsBusy && Session.History.CanRedo);
_cancelServerJob = new AsyncRelayCommand(CancelServerJobAsync, () => ServerJob is not null);
UndoCommand = new RelayCommand(() => Session.Undo(), () => !IsLocked && Session.History.CanUndo);
RedoCommand = new RelayCommand(() => Session.Redo(), () => !IsLocked && Session.History.CanRedo);
PlayCommand = new RelayCommand(() => TogglePlay(limit: 0));
PreviewClipCommand = new RelayCommand(() => TogglePlay(limit: ClipFrames()));
StepBackCommand = new RelayCommand(() => CurrentIndex--);
@@ -102,12 +110,17 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Tabs = [Frames, Exposure, new MotionTab(this), new CameraTab(this), new TimeTab(this), new StackTab(this), new ExportTab(this)];
_selectedTab = Exposure;
_currentIndex = session.Project.HeroFrame is { } hero && (uint)hero < (uint)FrameCount ? hero : 0;
// Until the link is read (AttachJobsAsync), a sequence of this PC cannot send its renders.
_syncGate = session.IsRemote ? ExportSyncGate.Remote : ExportSyncGate.SignedOut;
RenderChoices = [.. ExportPresets.BuiltIn.Select(p => new Choice(p.Id, p.NameKey))];
session.ProjectChanged += OnProjectChanged;
session.ContentChanged += OnContentChanged;
session.SaveFailed += OnSaveFailed;
if (shell.Services.Jobs is { } jobs) jobs.JobChanged += OnJobChanged;
session.ConflictFound += OnConflictFound;
session.Source.JobChanged += OnJobChanged;
session.Source.ReadOnlyChanged += OnReadOnlyChanged;
shell.Services.Sync.Changed += OnSyncChanged;
UpdateMarkers();
RequestCorrections();
RequestPlan();
@@ -122,6 +135,58 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
public string Title => Session.Content.Sequence.DisplayTitle;
/// <summary>A server sequence edited with proxies (the header says where it lives).</summary>
public bool IsRemote => Session.IsRemote;
/// <summary>The server a server sequence lives on ("Studio NAS"); null for a sequence of this PC.</summary>
public string? ServerName => IsRemote ? Shell.Services.Server.ServerName ?? Loc.L("Server.Label.Server") : null;
/// <summary>"Studio NAS" beside the title of a server sequence; "Studio NAS · read-only" when it is only shown.</summary>
public string? RemoteText => !IsRemote ? null
: IsOutdated ? Loc.L("Editor.Remote.Outdated", ServerName)
: IsReadOnly ? Loc.L("Editor.Remote.ReadOnly", ServerName)
: ServerName;
public string? RemoteToolTip => !IsRemote ? null
: IsOutdated ? Loc.L("Tooltips.Editor.Outdated", ServerName)
: IsReadOnly ? Loc.L("Tooltips.Editor.RemoteReadOnly", ServerName)
: Loc.L("Tooltips.Editor.Remote", ServerName);
/// <summary>
/// "Render · 46 %", "Render · queued": the analysis or render of a server sequence the server runs or holds (the job
/// bar shows this PC's jobs); null when there is none.
/// </summary>
public string? ServerJobText => ServerJob is { } job ? EditorText.ServerJob(job) : null;
/// <summary>Frames, speed and time left of the server job.</summary>
public string? ServerJobToolTip => ServerJob is { } job ? EditorText.ServerJobDetail(job, ServerName ?? string.Empty) : null;
/// <summary>The glyph of the server job (DESIGN §4): ◐ an analysis running, ● a render running, ○ waiting, paused.</summary>
public StatusKind ServerJobKind => ServerJob switch
{
{ State: JobState.Running, Kind: JobKind.DeepAnalyse or JobKind.LightAnalyse } => StatusKind.Analysing,
{ State: JobState.Running } => StatusKind.Running,
{ State: JobState.Paused } => StatusKind.Paused,
_ => StatusKind.Queued,
};
/// <summary>The server job runs and reports how far it is (its progress bar shows).</summary>
public bool HasServerJobProgress => ServerJob is { State: JobState.Running, ProgressTotal: > 0 };
/// <summary>Fraction of the server job done (0–1).</summary>
public double ServerJobProgress => ServerJob is { State: JobState.Running, ProgressTotal: > 0 } job ? (double)job.ProgressDone / job.ProgressTotal : 0;
/// <summary>Cancels the server job (BRIEF §11.5: cancel is always available); the toast that follows offers Retry.</summary>
public ICommand CancelServerJobCommand => _cancelServerJob;
public string? CancelServerJobToolTip => IsRemote ? Loc.L("Tooltips.Editor.ServerJob.Cancel", ServerName) : null;
/// <summary>The Export "Sync" option: available, or why not.</summary>
public ExportSyncGate SyncGate { get => _syncGate; private set => Set(ref _syncGate, value); }
/// <summary>The server job the header shows (<see cref="SequenceJobs.Shown"/>).</summary>
private Job? ServerJob => IsRemote ? _jobs.Shown : null;
/// <summary>
/// "3,600 frames · Canon EOS R5 · 2 s interval · 2 h 00 m · 3 warnings"; on the Export tab what the video will be:
/// "3,600 frames · 24 fps · 2 min 30 s · 3840×2160 · source 8192×5464" (Export.html).
@@ -309,22 +374,38 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
public ExportPlan? Plan { get => _plan; private set => Set(ref _plan, value); }
/// <summary>An analysis or render of this sequence is running: settings wait, viewing tools stay live.</summary>
public bool IsBusy => _jobs.Values.Any(j => j.State == JobState.Running);
public bool IsBusy => _jobs.IsBusy;
/// <summary>A deep analysis of this sequence is queued or running (Analyse would queue it twice).</summary>
public bool IsAnalysing => _jobs.Values.Any(j => j.Kind == JobKind.DeepAnalyse);
/// <summary>A deep analysis of this sequence is queued, running or paused (Analyse would queue it twice).</summary>
public bool IsAnalysing => _jobs.IsAnalysing;
public bool IsEditable => !IsBusy;
/// <summary>
/// The project is shown, not changed: a server sequence for an account without the Edit right, or one whose frames
/// changed on the server (<see cref="IsOutdated"/>).
/// </summary>
public bool IsReadOnly => Session.IsReadOnly;
public string? BusyToolTip => IsBusy ? Loc.L("Tooltips.Editor.Busy") : null;
/// <summary>The frames on the server are no longer the proxies this PC shows: nothing is saved or rendered until they are fetched again.</summary>
public bool IsOutdated => Session.Source.IsOutdated;
/// <summary>Changes to the project wait (a job runs) or are not allowed (<see cref="IsReadOnly"/>); viewing tools stay live.</summary>
public bool IsLocked => IsReadOnly || IsBusy;
public bool IsEditable => !IsLocked;
/// <summary>Why the controls that change the project are disabled; null while they are not.</summary>
public string? LockedToolTip => IsOutdated ? Loc.L("Tooltips.Editor.Outdated", ServerName)
: IsReadOnly ? Loc.L("Tooltips.Editor.ReadOnly")
: IsBusy ? Loc.L("Tooltips.Editor.Busy")
: null;
/// <summary>What Analyse does and costs ("about 6 min" from the speed of the last analysis), or why it is disabled.</summary>
public string AnalyseToolTip => IsBusy ? Loc.L("Tooltips.Editor.Busy")
: IsAnalysing ? Loc.L("Tooltips.Editor.AnalyseQueued")
public string AnalyseToolTip => LockedToolTip
?? (IsAnalysing ? Loc.L("Tooltips.Editor.AnalyseQueued")
: _analysisSecondsPerFrame is { } perFrame ? Loc.L("Tooltips.Editor.AnalyseCost", Formatting.Duration(TimeSpan.FromSeconds(perFrame * FrameCount)))
: Loc.L("Tooltips.Editor.Analyse");
: Loc.L("Tooltips.Editor.Analyse"));
public string OptimiseAllToolTip => Loc.L(IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.OptimiseAll");
public string OptimiseAllToolTip => LockedToolTip ?? Loc.L("Tooltips.Editor.OptimiseAll");
public bool IsPlaying => _player.IsEnabled;
@@ -339,32 +420,60 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
public IReadOnlyList<Choice> RenderChoices { get; }
/// <summary>The export preset the Render button renders (choosing another one sets it).</summary>
/// <summary>
/// The export preset the Render button renders: choosing another one sets it in the project, or, for an account that
/// may render but not edit (<see cref="IsReadOnly"/>), only in this editor.
/// </summary>
public Choice? SelectedRenderChoice
{
get => RenderChoices.FirstOrDefault(c => string.Equals((string)c.Value, Plan?.Export.PresetId ?? EditorSettings.ExportPreset.Effective(Session.Project, null),
StringComparison.OrdinalIgnoreCase));
get
{
var id = (IsReadOnly ? _renderPreset : null) ?? Plan?.Export.PresetId ?? EditorSettings.ExportPreset.Effective(Session.Project, null);
return RenderChoices.FirstOrDefault(c => string.Equals((string)c.Value, id, StringComparison.OrdinalIgnoreCase));
}
set
{
if (value?.Value is not string id) return;
Session.Edit(p => p with { Export = p.Export with { Preset = p.Export.Preset.WithManual(id), Overrides = new ExportOverrides() } });
if (!IsReadOnly)
{
Session.Edit(p => p with { Export = p.Export with { Preset = p.Export.Preset.WithManual(id), Overrides = new ExportOverrides() } });
return;
}
if (string.Equals(id, _renderPreset, StringComparison.OrdinalIgnoreCase)) return;
_renderPreset = id;
OnPropertyChanged();
RequestPlan();
}
}
/// <summary>
/// The export Render renders: the project's, or with the preset chosen in the Render menu of a read-only session
/// (the project keeps its own; the batch stays the project's).
/// </summary>
public ExportSettings RenderExport => IsReadOnly && _renderPreset is { } id
? Session.ExportFor(id) with { Batch = Session.Project.Export.Batch }
: Session.Project.Export;
/// <summary>"Render · 4K archive".</summary>
public string RenderText => Loc.L("Editor.Render", Plan?.PresetName ?? string.Empty);
public string RenderToolTip => RenderBlockedReason ?? Loc.L("Tooltips.Editor.Render");
public string RenderToolTip => RenderBlockedReason ?? (IsRemote ? Loc.L("Tooltips.Editor.RenderServer", ServerName) : Loc.L("Tooltips.Editor.Render"));
/// <summary>The ▾ part of Render: another preset for the project, or only for this render when the project cannot change.</summary>
public string RenderChoiceToolTip => Loc.L(IsReadOnly ? "Tooltips.Editor.RenderChoiceReadOnly" : "Tooltips.Editor.RenderChoice");
public bool CanRender => RenderBlockedReason is null;
/// <summary>Why the project's export cannot be rendered now, localised; null when it can.</summary>
public string? RenderBlockedReason => Plan switch
{
_ when IsRemote && !Shell.Services.Sync.CanRender => Loc.L("Tooltips.Editor.Render.NoRight", ServerName),
_ when IsOutdated => Loc.L("Tooltips.Editor.Outdated", ServerName),
null when _planned => Loc.L("Tooltips.Editor.Render.NoSource"),
null => Loc.L("Tooltips.Editor.Render.Planning"),
{ NameError: { } error } => Loc.L("Tooltips.Editor.Render.NameError", error),
{ Setup.Encoder.IsReady: false } plan => plan.Setup.Encoder.Notices.LastOrDefault() is { } notice
// The server picks its encoder (a render node, or its managed fallback): this PC's encoders do not decide.
{ Setup.Encoder.IsReady: false } plan when !IsRemote => plan.Setup.Encoder.Notices.LastOrDefault() is { } notice
? Loc.L(notice.Key, [.. notice.Args])
: Loc.L("Editor.Export.Unavailable"),
{ Setup.Plan.Frames.Count: 0 } => Loc.L("Tooltips.Editor.Render.NoFrames"),
@@ -399,13 +508,17 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
/// <summary>"Optimise section": the advisor's heavier decisions, reported in a toast (what changed, from what to what).</summary>
public void Optimise(AdvisorSection section) => Report(Session.Optimise(section));
/// <summary>Queues a render of the project's export (with its batch presets when <paramref name="batch"/>).</summary>
/// <summary>
/// Queues a render of the project's export (with its batch presets when <paramref name="batch"/>): on this PC's
/// engine, or one server job per preset for a server sequence.
/// </summary>
public async Task RenderAsync(JobPriority priority, bool batch)
{
var export = batch ? Session.Project.Export : Session.Project.Export with { Batch = [] };
var request = Session.RenderRequest(export) with { Priority = priority };
await Session.SubmitAsync(request);
Shell.Notify(Loc.L("Editor.Render.Queued"), request.Label, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
var export = batch ? RenderExport : RenderExport with { Batch = [] };
var requests = Session.RenderRequests(export);
foreach (var request in requests) await Session.SubmitAsync(request with { Priority = priority });
if (IsRemote) Shell.Notify(Loc.L("Editor.Render.QueuedServer", ServerName), requests[0].Label);
else Shell.Notify(Loc.L("Editor.Render.Queued"), requests[0].Label, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
}
/// <summary>Re-reads the enabled state of every command (the async ones keep their own event).</summary>
@@ -413,6 +526,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
_analyse.RaiseCanExecuteChanged();
_render.RaiseCanExecuteChanged();
_cancelServerJob.RaiseCanExecuteChanged();
foreach (var tab in Tabs) tab.RefreshCommands();
CommandManager.InvalidateRequerySuggested();
}
@@ -452,16 +566,31 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Task[] Work() => [_preview.Idle, _corrections.Idle, _plans.Idle, .. Tabs.OfType<ExportTab>().Select(t => t.EstimatesIdle)];
}
/// <summary>Loads the jobs of this sequence already queued or running (busy state) and the speed of the last analysis.</summary>
/// <summary>
/// Loads the jobs of this sequence already queued or running (busy state), the speed of the last analysis and
/// whether the Export "Sync" option applies.
/// </summary>
public async Task AttachJobsAsync()
{
if (Shell.Services.Jobs is not { } jobs) return;
var page = await jobs.ListAsync(null, 200);
foreach (var job in page.Items) Track(job);
foreach (var job in page.Items.OrderBy(j => j.Finished)) LearnAnalysisSpeed(job);
await RefreshSyncGateAsync();
var jobs = await Session.Source.ListJobsAsync(CancellationToken.None);
foreach (var job in jobs) _jobs.Track(job);
foreach (var job in jobs.OrderBy(j => j.Finished)) LearnAnalysisSpeed(job);
OnBusyChanged();
}
/// <summary>Reads again whether this sequence can send its renders to the signed-in server (session, link, rights).</summary>
public async Task RefreshSyncGateAsync()
{
var sync = Shell.Services.Sync;
var server = sync.Server;
var linked = !IsRemote && server is not null && sync.Service is { } service
&& await service.LinkOfAsync(server, Session.Content.Sequence.Id) is not null;
if (_disposed) return;
SyncGate = ExportSync.Gate(IsRemote, server, linked, sync.CanUpload);
foreach (var tab in Tabs) tab.OnSyncGateChanged();
}
public async ValueTask DisposeAsync()
{
if (_disposed) return;
@@ -473,7 +602,10 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Session.ProjectChanged -= OnProjectChanged;
Session.ContentChanged -= OnContentChanged;
Session.SaveFailed -= OnSaveFailed;
if (Shell.Services.Jobs is { } jobs) jobs.JobChanged -= OnJobChanged;
Session.ConflictFound -= OnConflictFound;
Session.Source.JobChanged -= OnJobChanged;
Session.Source.ReadOnlyChanged -= OnReadOnlyChanged;
Shell.Services.Sync.Changed -= OnSyncChanged;
foreach (var tab in Tabs) tab.Dispose();
base.Dispose();
await Session.DisposeAsync();
@@ -572,9 +704,9 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
foreach (var tab in Tabs) tab.OnCorrectionsChanged();
}
private void RequestPlan() => _ = RunPlanAsync(Planner, Session.Project);
private void RequestPlan() => _ = RunPlanAsync(Planner, Session.Project, RenderExport, ++_planVersion);
private async Task RunPlanAsync(ExportPlanner planner, ProjectSettings project)
private async Task RunPlanAsync(ExportPlanner planner, ProjectSettings project, ExportSettings export, int version)
{
ExportPlan? plan = null;
// A superseded request ends quietly without planning; undo and redo bring back the very same project instance,
@@ -584,7 +716,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
await _plans.Schedule(_ =>
{
plan = planner.Plan(project);
plan = planner.Plan(project, export);
ran = true;
return Task.CompletedTask;
});
@@ -594,13 +726,11 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
Log.Warning("editor", "Planning the export failed", ex);
ran = true;
}
if (!ran || _disposed || !ReferenceEquals(planner, Planner) || !ReferenceEquals(project, Session.Project)) return;
// A later request (a new project, another render choice) owns the plan.
if (!ran || _disposed || !ReferenceEquals(planner, Planner) || version != _planVersion) return;
_planned = true;
Plan = plan;
OnPropertyChanged(nameof(RenderText));
OnPropertyChanged(nameof(RenderToolTip));
OnPropertyChanged(nameof(RenderBlockedReason));
OnPropertyChanged(nameof(CanRender));
OnRenderStateChanged();
OnPropertyChanged(nameof(SelectedRenderChoice));
OnPropertyChanged(nameof(Summary));
foreach (var tab in Tabs) tab.OnPlanChanged();
@@ -694,6 +824,32 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
ActionCommand = new RelayCommand(() => _ = Session.FlushAsync()),
});
/// <summary>
/// A save met settings someone changed to other values on the server (BRIEF §14.5 "explicit conflict prompt"): the
/// dialog lists them; Keep mine overwrites the server's, Take server (the safe default, also on Esc) shows theirs as
/// one undoable step. Saving waits until then.
/// </summary>
private void OnConflictFound(ProjectConflictException conflict) => _dispatcher.BeginInvoke(() =>
{
if (_disposed || Session.Conflict is null) return;
var keepMine = Shell.Services.Dialogs.Confirm(ConflictRequest(conflict, Title, ServerName ?? string.Empty));
if (!_disposed) Session.ResolveConflict(keepMine);
});
/// <summary>The conflict prompt: what differs (the editor's value, then the server's) and what each choice replaces.</summary>
internal static ConfirmRequest ConflictRequest(ProjectConflictException conflict, string title, string server) => new()
{
Heading = Loc.L("Editor.Conflict.Title", server),
Message = Loc.L("Editor.Conflict.Message", title, server),
Detail = string.Join(Environment.NewLine, SyncText.Differences(conflict.Differences, 10)),
DetailToolTip = Loc.L("Tooltips.Server.Conflict.Detail"),
SafeText = Loc.L("Server.Sync.Action.TakeServer"),
SafeToolTip = Loc.L("Tooltips.Editor.Conflict.TakeServer", server),
ActionText = Loc.L("Server.Sync.Action.KeepMine"),
ActionToolTip = Loc.L("Tooltips.Editor.Conflict.KeepMine", server),
IsDestructive = true,
};
private void UpdateMarkers()
{
var content = Session.Content;
@@ -745,28 +901,87 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
private async Task AnalyseAsync()
{
await Session.SubmitAsync(Session.AnalysisRequest());
Shell.Notify(Loc.L("Editor.Analyse.Queued"), Title, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
// The Jobs screen lists this PC's jobs; a server's analysis shows beside the title.
if (IsRemote) Shell.Notify(Loc.L("Editor.Analyse.QueuedServer", ServerName), Title);
else Shell.Notify(Loc.L("Editor.Analyse.Queued"), Title, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
}
private void OnJobChanged(Job job)
{
if (!job.TargetIds.Contains(Session.Content.Sequence.Id) || job.Kind is not (JobKind.DeepAnalyse or JobKind.LightAnalyse or JobKind.Render)) return;
if (!_jobs.Concerns(job)) return;
_dispatcher.BeginInvoke(() =>
{
if (_disposed) return;
var wasActive = _jobs.ContainsKey(job.Id);
Track(job);
var wasActive = _jobs.IsActive(job.Id);
// Progress alone (several times a second on a server) only moves the server job's text and bar.
if (_jobs.Track(job)) OnBusyChanged();
else OnServerJobChanged();
LearnAnalysisSpeed(job);
OnBusyChanged();
if (wasActive && job.State == JobState.Done) _ = ReloadAsync(job.Kind == JobKind.Render ? job : null);
if (!wasActive) return;
if (job.State == JobState.Done) _ = ReloadAsync(job.Kind == JobKind.Render ? job : null);
else if (IsRemote && job.State is JobState.Failed or JobState.Cancelled) ReportServerJobEnded(job);
});
}
private void Track(Job job)
/// <summary>
/// The frames of the server sequence changed while it is open (any thread): everything that changes the project is
/// disabled and says why, and a toast offers to fetch the proxies again.
/// </summary>
private void OnReadOnlyChanged() => _dispatcher.BeginInvoke(() =>
{
if (!job.TargetIds.Contains(Session.Content.Sequence.Id) || job.Kind is not (JobKind.DeepAnalyse or JobKind.LightAnalyse or JobKind.Render)) return;
if (job.State is JobState.Queued or JobState.Running) _jobs[job.Id] = job;
else _jobs.Remove(job.Id);
if (_disposed) return;
OnPropertyChanged(nameof(IsReadOnly));
OnPropertyChanged(nameof(IsOutdated));
OnPropertyChanged(nameof(RemoteText));
OnPropertyChanged(nameof(RemoteToolTip));
OnPropertyChanged(nameof(RenderChoiceToolTip));
OnRenderStateChanged();
OnBusyChanged();
if (!IsOutdated) return;
var (id, title) = (Session.Content.Sequence.Id, Title);
Shell.ShowToast(new Toast
{
Title = Loc.L("Editor.Outdated.Title", ServerName),
Message = title,
ActionText = Loc.L("Editor.Outdated.Fetch"),
ActionToolTip = Loc.L("Tooltips.Editor.Outdated.Fetch"),
ActionCommand = new AsyncRelayCommand(() => Shell.Sequence.FetchProxiesAsync(id, title)),
});
});
/// <summary>A server job of this sequence failed or was cancelled: what happened, and Retry (BRIEF §11.5).</summary>
private void ReportServerJobEnded(Job job)
{
var server = ServerName ?? string.Empty;
Shell.ShowToast(new Toast
{
Title = Loc.L("Editor.ServerJob.Ended", JobText.Kind(job.Kind), Loc.L("Jobs.State." + job.State), server),
Message = job.Error ?? job.TargetLabel ?? Title,
ActionText = Loc.L("Jobs.Action.Retry"),
ActionToolTip = Loc.L("Tooltips.Editor.ServerJob.Retry", server),
ActionCommand = new AsyncRelayCommand(() => Session.Source.RetryJobAsync(job.Id, CancellationToken.None), () => !_disposed),
});
}
private async Task CancelServerJobAsync()
{
if (ServerJob is { } job) await Session.Source.CancelJobAsync(job.Id, CancellationToken.None);
}
/// <summary>The session, the sync links or the rights changed (any thread): whether the Export "Sync" option applies.</summary>
private void OnSyncChanged() => _dispatcher.BeginInvoke(() => _ = OnSyncChangedAsync());
private async Task OnSyncChangedAsync()
{
if (_disposed) return;
try
{
await RefreshSyncGateAsync();
}
catch (Data.DatabaseException ex)
{
Log.Warning("editor", "The sync state of the sequence could not be read", ex);
}
}
/// <summary>Seconds per frame of the latest finished deep analysis (any sequence): the cost Analyse announces.</summary>
@@ -782,13 +997,18 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
await Session.ReloadAsync();
}
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException or UnauthorizedAccessException)
catch (Exception ex) when (ex is System.IO.IOException or System.IO.InvalidDataException or InvalidOperationException or UnauthorizedAccessException
or System.Net.Http.HttpRequestException or Protocol.Client.TitanoApiException or OperationCanceledException)
{
// A server that does not answer in time cancels the request (OperationCanceledException).
Shell.ReportError(ex);
return;
}
if (render is null || _disposed) return;
var output = Session.Content.Renders.FirstOrDefault(r => render.Started is not { } started || r.Created >= started)?.OutputPath;
// A server's render stays on the server: nothing to show in Explorer.
var output = Session.Content.Renders.FirstOrDefault(r => render.Started is not { } started || r.Created >= started)?.OutputPath is { Length: > 0 } path
? path
: null;
Shell.ShowToast(new Toast
{
Title = Loc.L("Editor.Render.Done"),
@@ -803,14 +1023,36 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
{
OnPropertyChanged(nameof(IsBusy));
OnPropertyChanged(nameof(IsAnalysing));
OnPropertyChanged(nameof(IsLocked));
OnPropertyChanged(nameof(IsEditable));
OnPropertyChanged(nameof(BusyToolTip));
OnPropertyChanged(nameof(LockedToolTip));
OnPropertyChanged(nameof(AnalyseToolTip));
OnPropertyChanged(nameof(OptimiseAllToolTip));
OnServerJobChanged();
foreach (var tab in Tabs) tab.OnBusyChanged();
RefreshCommands();
}
private void OnServerJobChanged()
{
if (!IsRemote) return;
OnPropertyChanged(nameof(ServerJobText));
OnPropertyChanged(nameof(ServerJobToolTip));
OnPropertyChanged(nameof(ServerJobKind));
OnPropertyChanged(nameof(HasServerJobProgress));
OnPropertyChanged(nameof(ServerJobProgress));
_cancelServerJob.RaiseCanExecuteChanged();
}
/// <summary>What Render renders and whether it can (the plan, the rights or the frames changed).</summary>
private void OnRenderStateChanged()
{
OnPropertyChanged(nameof(RenderText));
OnPropertyChanged(nameof(RenderToolTip));
OnPropertyChanged(nameof(RenderBlockedReason));
OnPropertyChanged(nameof(CanRender));
}
/// <summary>A rendered preview as frozen bitmaps and overlays in picture pixels (built off the UI thread).</summary>
private sealed record PreviewResult(ImageSource Corrected, ImageSource Original, Rect Crop, IReadOnlyList<Point> Horizon, IReadOnlyList<MotionVector> Vectors,
ImageSource? Waveform)
+79
View File
@@ -0,0 +1,79 @@
using System.IO;
using Titano.Core.Model;
using Titano.Data;
using Titano.Data.Jobs;
using Titano.Data.Processing;
using Titano.Data.Sync;
namespace Titano.App.Editor;
/// <summary>Whether the Export "Sync" option can be used, or why not (its tooltip says which).</summary>
public enum ExportSyncGate
{
Available,
/// <summary>A server sequence: its renders are made on the server and stay there.</summary>
Remote,
/// <summary>No server session is open.</summary>
SignedOut,
/// <summary>The server does not have this sequence.</summary>
NotLinked,
/// <summary>The account may not send files to the server.</summary>
NoUpload,
}
/// <summary>What became of the Export "Sync" of a finished render.</summary>
/// <param name="Gate">Why the render was not sent, or <see cref="ExportSyncGate.Available"/>.</param>
/// <param name="Send">The queued send job; null when it was not queued.</param>
public sealed record ExportSyncResult(ExportSyncGate Gate, Job? Send);
/// <summary>
/// Export "Sync" (Export.html "register the export on the server when connected", BRIEF §14.5): a render made on this
/// PC whose export asked for it is sent to the server the sequence is linked to once it is done
/// (<see cref="SyncService.EnqueueSendExportsAsync"/>). The choice travels inside the render job (its export), so it
/// holds after the editor closes; a render that ends while the session is down is queued for the last session's server
/// and its send waits for the session (and fails visibly on the Jobs screen when it does not come back).
/// </summary>
public sealed class ExportSync(TitanoDatabase db, SyncService sync, JobEngine engine)
{
/// <summary>The option's state for a sequence.</summary>
/// <param name="server">Key of the signed-in server; null while signed out.</param>
/// <param name="linked">The server has the sequence (a sync link joins them).</param>
public static ExportSyncGate Gate(bool isRemote, string? server, bool linked, bool canUpload) =>
isRemote ? ExportSyncGate.Remote
: server is null ? ExportSyncGate.SignedOut
: !linked ? ExportSyncGate.NotLinked
: !canUpload ? ExportSyncGate.NoUpload
: ExportSyncGate.Available;
/// <summary>Queues sending a finished render's output.</summary>
/// <param name="server">Key of the server: the signed-in one, else the one of the saved session; null without either.</param>
/// <param name="canUpload">The account may send files (assumed while the session is down: the server refuses the send otherwise).</param>
/// <returns>The send job or why there is none; null when the job is not a finished render of this PC that asked for it.</returns>
public async Task<ExportSyncResult?> SendAsync(Job job, string? server, bool canUpload, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(job);
if (job is not { Kind: JobKind.Render, State: JobState.Done, TargetIds: [var target] } || !Wanted(job)) return null;
if (await db.Sequences.GetAsync(target, cancellationToken) is not { } local) return null;
var linked = server is not null && await sync.LinkOfAsync(server, local.Id, cancellationToken) is not null;
var gate = Gate(false, server, linked, canUpload);
return gate == ExportSyncGate.Available
? new ExportSyncResult(gate, await sync.EnqueueSendExportsAsync(engine, server!, local, cancellationToken))
: new ExportSyncResult(gate, null);
}
private static bool Wanted(Job job)
{
try
{
return ProcessingJobs.ReadRender(job.ParametersJson).Export.SyncToServer;
}
catch (InvalidDataException)
{
return false;
}
}
}
+181 -25
View File
@@ -10,6 +10,7 @@ using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Core.Video;
using Titano.Data.Processing;
using Titano.Ui.Controls;
using Titano.Ui.Mvvm;
namespace Titano.App.Editor;
@@ -31,9 +32,12 @@ public sealed class PresetCard(ExportTab owner, ExportChoice choice) : Observabl
/// <summary>Sequence presets apply full settings; export presets only choose the output.</summary>
public bool IsSequencePreset => Choice.Sequence is not null;
public string ToolTip => Choice.Reason is { } reason
/// <summary>What choosing the card does, or why it cannot be chosen now (a job runs, the project cannot change).</summary>
public string ToolTip => owner.Editor.LockedToolTip ?? (Choice.Reason is { } reason
? Loc.L(IsSequencePreset ? "Tooltips.Editor.Export.ApplyPreset" : "Tooltips.Editor.Export.Recommended", reason)
: Loc.L("Tooltips.Editor.Export.Preset", Name);
: Loc.L("Tooltips.Editor.Export.Preset", Name));
public string BatchToolTip => owner.Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Export.InBatch");
/// <summary>"MP4 · HEVC Main10 · 3840×2160 · 24 fps".</summary>
public string? Format { get => _format; private set => Set(ref _format, value); }
@@ -57,6 +61,7 @@ public sealed class PresetCard(ExportTab owner, ExportChoice choice) : Observabl
public ICommand SelectCommand => owner.SelectCommand;
/// <remarks>A server sequence renders on the server: this PC's encoders neither name nor rule out the encoding.</remarks>
public void Update(ExportPlan? plan)
{
if (plan is null)
@@ -65,12 +70,20 @@ public sealed class PresetCard(ExportTab owner, ExportChoice choice) : Observabl
return;
}
var settings = plan.Setup.Encoder.Settings;
var remote = owner.Editor.IsRemote;
Format = EditorText.Format(plan.Export, settings.Width, settings.Height);
Encoding = EditorText.Encoding(plan.Export, settings.BitRate, plan.Setup.Encoder.Capability?.Name);
Estimate = plan.Setup.Encoder.IsReady ? EditorText.Estimate(plan.Estimate) : Loc.L("Editor.Export.Unavailable");
Encoding = EditorText.Encoding(plan.Export, settings.BitRate, remote ? null : plan.Setup.Encoder.Capability?.Name);
Estimate = remote || plan.Setup.Encoder.IsReady ? EditorText.Estimate(plan.Estimate) : Loc.L("Editor.Export.Unavailable");
}
public void RefreshBatch() => OnPropertyChanged(nameof(IsInBatch));
/// <summary>A job of the sequence started or ended, or the project became read-only: the tooltips say why the card waits.</summary>
public void RefreshLocked()
{
OnPropertyChanged(nameof(ToolTip));
OnPropertyChanged(nameof(BatchToolTip));
}
}
/// <summary>A codec choice of the Output panel with the profile and depth it implies.</summary>
@@ -106,6 +119,8 @@ public sealed class ExportTab : EditorTab
private readonly AsyncRelayCommand _renderNow;
private readonly AsyncRelayCommand _addToQueue;
private readonly AsyncRelayCommand _batch;
private readonly AsyncRelayCommand _restore;
private SavedCopy? _selectedCopy;
private IReadOnlyList<PresetCard> _cards = [];
private IReadOnlyList<CodecChoice> _codecChoices = [];
private IReadOnlyList<Choice> _encoders = [];
@@ -117,16 +132,18 @@ public sealed class ExportTab : EditorTab
public ExportTab(EditorViewModel editor)
: base(editor, "Export", AdvisorSection.Export)
{
SelectCommand = new RelayCommand(p => Select(p as PresetCard), _ => !Editor.IsBusy);
SelectCommand = new RelayCommand(p => Select(p as PresetCard), _ => !Editor.IsLocked);
_renderNow = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: false), () => Editor.CanRender);
_addToQueue = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.Normal, batch: false), () => Editor.CanRender);
_batch = new AsyncRelayCommand(() => Editor.RenderAsync(JobPriority.User, batch: true), () => Editor.CanRender && Batch.Count > 0);
HistoryCommand = new RelayCommand(OpenHistory);
RevealLastCommand = new RelayCommand(() => ShellActions.Reveal(Editor.Session.Content.Renders[0].OutputPath), () => Editor.Session.Content.Renders.Count > 0);
RevealLastCommand = new RelayCommand(() => ShellActions.Reveal(Editor.Session.Content.Renders[0].OutputPath), () => CanReveal);
_restore = new AsyncRelayCommand(RestoreAsync, () => !Editor.IsLocked && SelectedCopy is not null);
ResetFrameRateCommand = new RelayCommand(() => EditOverrides(o => o with { FrameRate = null }));
Width = new EditableField(string.Empty, ValidateSize, v => EditOverrides(o => o with { Width = ParseSize(v) }), () => Loc.L("Tooltips.Editor.Export.Width"));
Height = new EditableField(string.Empty, ValidateSize, v => EditOverrides(o => o with { Height = ParseSize(v) }), () => Loc.L("Tooltips.Editor.Export.Height"));
NameTemplate = new EditableField(string.Empty, ValidateTemplate, v => EditExport(e => e with { NameTemplate = v }), () => Loc.L("Tooltips.Editor.Export.Name"));
_selectedCopy = SavedCopies.FirstOrDefault();
LoadCards();
Refresh();
}
@@ -149,10 +166,71 @@ public sealed class ExportTab : EditorTab
public string AddToQueueToolTip => Editor.RenderBlockedReason ?? Loc.L("Tooltips.Editor.Export.AddToQueue");
public string BatchToolTip => Editor.RenderBlockedReason ?? Loc.L(Batch.Count > 0 ? "Tooltips.Editor.Export.Batch" : "Tooltips.Editor.Export.BatchEmpty");
public string BatchToolTip => Editor.RenderBlockedReason ?? (Batch.Count == 0 ? Loc.L("Tooltips.Editor.Export.BatchEmpty")
: Editor.IsRemote ? Loc.L("Tooltips.Editor.Export.BatchServer", Editor.ServerName)
: Loc.L("Tooltips.Editor.Export.Batch"));
public bool HasHistory => Editor.Session.Content.Renders.Count > 0;
/// <summary>The "history" link opens this PC's Jobs screen, which does not list a server's jobs.</summary>
public bool CanOpenHistory => !Editor.IsRemote;
/// <summary>The newest render is a file on this PC (a server's renders stay on the server).</summary>
public bool CanReveal => Editor.Session.Content.Renders is [{ OutputPath.Length: > 0 }, ..];
// ---- Export "Sync" (Export.html, next to Save to) ----
/// <summary>Send each render made on this PC to the server the sequence is linked to; remembered in the project.</summary>
public bool SyncToServer
{
get => Export.SyncToServer;
set
{
if (!_refreshing && value != Export.SyncToServer) EditExport(e => e with { SyncToServer = value });
}
}
public bool CanSync => Editor.SyncGate == ExportSyncGate.Available;
/// <summary>What Sync does, or why it cannot be used for this sequence now.</summary>
public string SyncToolTip => Loc.L(Editor.SyncGate switch
{
ExportSyncGate.Remote => "Tooltips.Editor.Export.SyncRemote",
ExportSyncGate.SignedOut => "Tooltips.Editor.Export.SyncSignedOut",
ExportSyncGate.NotLinked => "Tooltips.Editor.Export.SyncNotLinked",
ExportSyncGate.NoUpload => "Tooltips.Editor.Export.SyncNoUpload",
_ => "Tooltips.Editor.Export.Sync",
});
/// <summary>A server sequence renders into its exports folder on the server.</summary>
public bool CanChooseFolder => !Editor.IsRemote;
// ---- "Save both" copies of this PC's settings ----
public IReadOnlyList<SavedCopy> SavedCopies => Editor.Session.Content.SavedCopies;
public bool HasSavedCopies => SavedCopies.Count > 0;
/// <summary>The copy Restore makes the project: the newest unless another is chosen in the menu.</summary>
public SavedCopy? SelectedCopy
{
get => _selectedCopy;
set
{
if (!Set(ref _selectedCopy, value)) return;
OnPropertyChanged(nameof(RestoreText));
OnPropertyChanged(nameof(RestoreToolTip));
_restore.RaiseCanExecuteChanged();
}
}
/// <summary>"Restore settings · 03/10/2026 14:22".</summary>
public string RestoreText => Loc.L("Editor.Export.Restore", SelectedCopy?.Label ?? string.Empty);
public string RestoreToolTip => Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Export.Restore", SelectedCopy?.Label ?? string.Empty);
public ICommand RestoreCommand => _restore;
public ICommand ResetFrameRateCommand { get; }
/// <summary>"Output · 4K archive".</summary>
@@ -234,6 +312,11 @@ public sealed class ExportTab : EditorTab
public IReadOnlyList<Choice> Encoders { get => _encoders; private set => Set(ref _encoders, value); }
/// <summary>The encoder is this PC's choice only for its own renders; the server or its render node picks its own.</summary>
public bool CanChooseEncoder => !Editor.IsRemote;
public string EncoderToolTip => Editor.IsRemote ? Loc.L("Tooltips.Editor.Export.EncoderServer", Editor.ServerName) : Loc.L("Tooltips.Editor.Export.Encoder");
public Choice? SelectedEncoder
{
get => Encoders.FirstOrDefault(e => Equals(e.Value, Export.Overrides.Encoder ?? string.Empty));
@@ -243,10 +326,12 @@ public sealed class ExportTab : EditorTab
}
}
/// <summary>"hardware", "software" (the word, not a colour, carries the state).</summary>
public string? EncoderKind => Editor.Plan?.Setup.Encoder.Capability is { } c ? Loc.L(c.Hardware ? "Editor.Export.Hardware" : "Editor.Export.Software") : null;
/// <summary>"hardware", "software" for this PC's encoder (the word, not a colour, carries the state).</summary>
public string? EncoderKind => !Editor.IsRemote && Editor.Plan?.Setup.Encoder.Capability is { } c
? Loc.L(c.Hardware ? "Editor.Export.Hardware" : "Editor.Export.Software")
: null;
public bool IsHardware => Editor.Plan?.Setup.Encoder.Capability?.Hardware == true;
public bool IsHardware => !Editor.IsRemote && Editor.Plan?.Setup.Encoder.Capability?.Hardware == true;
public IReadOnlyList<Choice> Depths { get => _depths; private set => Set(ref _depths, value); }
@@ -270,9 +355,10 @@ public sealed class ExportTab : EditorTab
public IReadOnlyList<SaveChoice> SaveChoices { get => _saveChoices; private set => Set(ref _saveChoices, value); }
/// <summary>The project's folder; a server sequence always renders into its exports folder on the server.</summary>
public SaveChoice? SelectedSave
{
get => SaveChoices.FirstOrDefault(c => !c.Browse && c.Folder == Export.Folder);
get => SaveChoices.FirstOrDefault(c => !c.Browse && c.Folder == (CanChooseFolder ? Export.Folder : null));
set
{
if (_refreshing || value is null) return;
@@ -287,12 +373,15 @@ public sealed class ExportTab : EditorTab
}
}
public string SaveToolTip => Loc.L("Tooltips.Editor.Export.Folder", Export.Folder ?? Editor.Session.Content.ExportsFolder ?? string.Empty);
public string SaveToolTip => Editor.IsRemote
? Loc.L("Tooltips.Editor.Export.FolderServer")
: Loc.L("Tooltips.Editor.Export.Folder", Export.Folder ?? Editor.Session.Content.ExportsFolder ?? string.Empty);
public string? EstimatedSize => Editor.Plan is { Setup.Encoder.IsReady: true } plan ? Formatting.Bytes(plan.Estimate.Bytes) : null;
public string? EstimatedSize => Estimated is { } plan ? Formatting.Bytes(plan.Estimate.Bytes) : null;
public string? EstimatedTime => Editor.Plan is { Setup.Encoder.IsReady: true } plan
? Loc.L("Editor.Export.About", Formatting.Duration(plan.Estimate.Time)) + (plan.Setup.Encoder.Capability is { } c ? " · " + c.Name : string.Empty)
/// <summary>"about 5 min · NVENC"; without this PC's encoder for a server sequence.</summary>
public string? EstimatedTime => Estimated is { } plan
? Loc.L("Editor.Export.About", Formatting.Duration(plan.Estimate.Time)) + (!Editor.IsRemote && plan.Setup.Encoder.Capability is { } c ? " · " + c.Name : string.Empty)
: null;
public string? ResultName => Editor.Plan?.FileName;
@@ -314,6 +403,9 @@ public sealed class ExportTab : EditorTab
private ResolvedExport Resolved => Editor.Plan?.Export ?? ExportResolver.Resolve(Export);
/// <summary>The plan when its estimates mean something: this PC can encode it, or the server renders it.</summary>
private ExportPlan? Estimated => Editor.Plan is { } plan && (Editor.IsRemote || plan.Setup.Encoder.IsReady) ? plan : null;
public bool IsInBatch(string presetId) => Export.Batch.Contains(presetId, StringComparer.OrdinalIgnoreCase);
public void SetInBatch(string presetId, bool value)
@@ -329,8 +421,8 @@ public sealed class ExportTab : EditorTab
try
{
UpdateLists();
SaveChoices = Export.Folder is { } folder
? [new SaveChoice(null), new SaveChoice(folder), new SaveChoice(null, Browse: true)]
SaveChoices = !CanChooseFolder ? [new SaveChoice(null)]
: Export.Folder is { } folder ? [new SaveChoice(null), new SaveChoice(folder), new SaveChoice(null, Browse: true)]
: [new SaveChoice(null), new SaveChoice(null, Browse: true)];
if (!NameTemplate.IsDirty) NameTemplate.Load(Export.NameTemplate);
OnAllPropertiesChanged();
@@ -339,11 +431,8 @@ public sealed class ExportTab : EditorTab
{
_refreshing = false;
}
foreach (var card in Cards)
{
card.IsSelected = card.Choice.Sequence is null && string.Equals(card.Choice.ExportPresetId, Resolved.PresetId, StringComparison.OrdinalIgnoreCase);
card.RefreshBatch();
}
SelectCards();
foreach (var card in Cards) card.RefreshBatch();
_ = EstimateCardsAsync();
}
@@ -356,20 +445,27 @@ public sealed class ExportTab : EditorTab
if (!Width.IsDirty) Width.Load(settings?.Width.ToString(CultureInfo.InvariantCulture) ?? string.Empty);
if (!Height.IsDirty) Height.Load(settings?.Height.ToString(CultureInfo.InvariantCulture) ?? string.Empty);
UpdateLists();
Notices = Editor.Plan is { } plan
? [.. plan.Setup.Warnings.Select(w => Loc.L(w.Key, [.. w.Args])).Concat(plan.Export.Warnings.Select(k => Loc.L(k))).Distinct()]
: [];
Notices = Editor.Plan is { } plan ? PlanNotices(plan) : [];
OnAllPropertiesChanged();
}
finally
{
_refreshing = false;
}
// The plan follows the preset a read-only session chose to render.
SelectCards();
}
public override void OnBusyChanged()
{
base.OnBusyChanged();
foreach (var card in Cards) card.RefreshLocked();
}
public override void OnContentChanged()
{
LoadCards();
if (SelectedCopy is null || !SavedCopies.Contains(SelectedCopy)) SelectedCopy = SavedCopies.FirstOrDefault();
base.OnContentChanged();
}
@@ -378,8 +474,16 @@ public sealed class ExportTab : EditorTab
_renderNow.RaiseCanExecuteChanged();
_addToQueue.RaiseCanExecuteChanged();
_batch.RaiseCanExecuteChanged();
_restore.RaiseCanExecuteChanged();
OnPropertyChanged(nameof(AddToQueueToolTip));
OnPropertyChanged(nameof(BatchToolTip));
OnPropertyChanged(nameof(RestoreToolTip));
}
public override void OnSyncGateChanged()
{
OnPropertyChanged(nameof(CanSync));
OnPropertyChanged(nameof(SyncToolTip));
}
public override void Dispose()
@@ -406,6 +510,24 @@ public sealed class ExportTab : EditorTab
private void LoadCards() => Cards = [.. ExportPlanner.Choices(Editor.Session.Presets, Editor.Session.Advice).Select(c => new PresetCard(this, c))];
/// <summary>The card of the export preset the plan renders.</summary>
private void SelectCards()
{
foreach (var card in Cards)
card.IsSelected = card.Choice.Sequence is null && string.Equals(card.Choice.ExportPresetId, Resolved.PresetId, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// What the plan changed or cannot do, localised; for a server sequence without this PC's encoder notices (the server
/// or its render node picks the encoder).
/// </summary>
private IReadOnlyList<string> PlanNotices(ExportPlan plan)
{
var encoder = Editor.IsRemote ? plan.Setup.Encoder.Notices.Select(n => n.Key).ToHashSet(StringComparer.Ordinal) : [];
return [.. plan.Setup.Warnings.Where(w => !encoder.Contains(w.Key)).Select(w => Loc.L(w.Key, [.. w.Args]))
.Concat(plan.Export.Warnings.Select(k => Loc.L(k))).Distinct()];
}
/// <summary>Estimates every card off the UI thread for the project as it is now (latest request wins).</summary>
private async Task EstimateCardsAsync()
{
@@ -437,6 +559,40 @@ public sealed class ExportTab : EditorTab
for (var i = 0; i < cards.Count; i++) cards[i].Update(plans[i]);
}
/// <summary>
/// Makes the chosen copy the project as one undo step. The toast's Undo brings back the project as it was before, as
/// a new step, while the restore is still the last change of this editor (a later edit would otherwise be undone).
/// </summary>
private async Task RestoreAsync()
{
if (SelectedCopy is not { } copy) return;
ProjectRestore? restore;
try
{
restore = await Editor.Session.RestoreAsync(copy);
}
catch (InvalidDataException ex)
{
Editor.Shell.ReportError(ex);
return;
}
if (restore is null)
{
Editor.Shell.Notify(Loc.L("Editor.Copy.Same"), copy.Label);
return;
}
var editor = Editor;
editor.Shell.ShowToast(new Toast
{
Title = Loc.L("Editor.Copy.Restored"),
Message = copy.Label,
ActionText = Loc.L("Editor.Copy.Undo"),
ActionToolTip = Loc.L("Tooltips.Editor.Copy.Undo"),
// Only in the editor that made it: another sequence opened meanwhile has its own project.
ActionCommand = new RelayCommand(() => restore.Undo(), () => ReferenceEquals(editor.Shell.Sequence.Editor, editor) && restore.CanUndo),
});
}
private void OpenHistory()
{
Editor.Shell.Jobs.Filter = Jobs.JobFilter.All;
+5 -5
View File
@@ -89,7 +89,7 @@ public sealed class FrameRow(FramesTab owner, Frame frame, int index) : Observab
public string ExcludeText => Loc.L(IsExcluded ? "Editor.Frames.Include" : "Editor.Frames.Exclude");
public string ExcludeToolTip => Loc.L(owner.Editor.IsBusy ? "Tooltips.Editor.Busy" : IsExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
public string ExcludeToolTip => owner.Editor.LockedToolTip ?? Loc.L(IsExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
/// <summary>A job of the sequence started or ended: the action tooltips say why they wait.</summary>
public void RefreshBusy() => OnPropertyChanged(nameof(ExcludeToolTip));
@@ -125,8 +125,8 @@ public sealed class FramesTab : EditorTab
public FramesTab(EditorViewModel editor)
: base(editor, "Frames", AdvisorSection.Frames)
{
ToggleExcludeCommand = new RelayCommand(p => ToggleExcluded(p is FrameRow row ? row.Index : Editor.CurrentIndex), _ => !Editor.IsBusy);
SetHeroCommand = new RelayCommand(p => Editor.Session.SetHero(p is FrameRow row ? row.Index : Editor.CurrentIndex), _ => !Editor.IsBusy);
ToggleExcludeCommand = new RelayCommand(p => ToggleExcluded(p is FrameRow row ? row.Index : Editor.CurrentIndex), _ => !Editor.IsLocked);
SetHeroCommand = new RelayCommand(p => Editor.Session.SetHero(p is FrameRow row ? row.Index : Editor.CurrentIndex), _ => !Editor.IsLocked);
SeekCommand = new RelayCommand(p =>
{
if (p is FindingItem { Frame: { } frame }) Editor.CurrentIndex = frame;
@@ -179,10 +179,10 @@ public sealed class FramesTab : EditorTab
public string CurrentExcludeText => Loc.L(IsCurrentExcluded ? "Editor.Frames.IncludeFrame" : "Editor.Frames.ExcludeFrame");
public string CurrentExcludeToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : IsCurrentExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
public string CurrentExcludeToolTip => Editor.LockedToolTip ?? Loc.L(IsCurrentExcluded ? "Tooltips.Editor.Frames.Include" : "Tooltips.Editor.Frames.Exclude");
/// <summary>What Set hero does, or why it waits.</summary>
public string HeroToolTip => Loc.L(Editor.IsBusy ? "Tooltips.Editor.Busy" : "Tooltips.Editor.Frames.Hero");
public string HeroToolTip => Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Frames.Hero");
public override bool CanReset => false;
@@ -0,0 +1,42 @@
using Titano.Protocol;
using Titano.Protocol.Client;
namespace Titano.App.Editor;
/// <summary>
/// The server calls the editor of a server sequence makes (BRIEF §14.3): the sequence and its settings with their
/// version, the analysis report, jobs and events. Failures are <see cref="TitanoApiException"/>s (404 gone, 409 settings
/// changed meanwhile) or network exceptions. The editor disposes its connection when it closes.
/// </summary>
public interface IRemoteSequenceApi : IDisposable
{
Task<SequenceDto> GetSequenceAsync(Guid id, CancellationToken cancellationToken);
/// <summary>The settings JSON and its version, the frames and the renders.</summary>
Task<SequenceManifest> GetManifestAsync(Guid id, CancellationToken cancellationToken);
/// <summary>A 409 <see cref="TitanoApiException"/> means the settings version moved on the server.</summary>
Task<SequenceDto> UpdateSequenceAsync(Guid id, UpdateSequenceRequest request, CancellationToken cancellationToken);
/// <summary>The full deep-analysis report (<c>analysis.json</c>); null when the sequence was never deep-analysed.</summary>
Task<string?> GetAnalysisReportAsync(Guid id, CancellationToken cancellationToken);
Task<JobDto> CreateJobAsync(CreateJobRequest request, CancellationToken cancellationToken);
Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken);
/// <summary>Every analysis and render job waiting, running or paused on the server (all pages).</summary>
Task<IReadOnlyList<JobDto>> ListActiveJobsAsync(CancellationToken cancellationToken);
/// <summary>Cancels a waiting or running job; returns it as the server now has it.</summary>
Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken);
/// <summary>Queues a failed or cancelled job again from its checkpoint; returns it as the server now has it.</summary>
Task<JobDto> RetryJobAsync(Guid id, CancellationToken cancellationToken);
/// <summary>Moves a waiting job up or down the queue (<paramref name="priority"/>: background, normal or user).</summary>
Task<JobDto> SetJobPriorityAsync(Guid id, string priority, CancellationToken cancellationToken);
/// <summary>Server events until cancelled or the socket closes.</summary>
IAsyncEnumerable<ServerEvent> EventsAsync(CancellationToken cancellationToken);
}
+41 -4
View File
@@ -9,11 +9,37 @@ namespace Titano.App.Editor;
/// <summary>
/// Where the sequence open in the editor lives: the local archive (<see cref="LocalSequenceSource"/>) or a server the
/// client is connected to (a source that reads proxies and posts jobs to the API). The editor reads frames, saves the
/// project and queues jobs only through this interface.
/// client is connected to (<see cref="RemoteSequenceSource"/>: proxies from the cache, project and jobs through the
/// API). The editor reads frames, saves the project, queues jobs and follows them only through this interface.
/// </summary>
public interface ISequenceSource : IAsyncDisposable
{
/// <summary>
/// The sequence lives on a server (BRIEF §14.5 "edit with proxies, render where the originals are"): its project is
/// saved there and its renders and analyses run there, one job per preset.
/// </summary>
bool IsRemote { get; }
/// <summary>
/// The project is shown, not changed: a server sequence for an account without the Edit right, or one whose frames
/// changed on the server (<see cref="IsOutdated"/>). The editor disables every change and the source refuses to
/// store one. It can turn true while the sequence is open (<see cref="ReadOnlyChanged"/>).
/// </summary>
bool IsReadOnly { get; }
/// <summary>
/// The frames this PC shows are no longer the sequence's (frames added or removed on the server since its proxies
/// were fetched): frame positions in the project would point at other frames, so nothing is saved or rendered until
/// the sequence is opened again with fresh proxies.
/// </summary>
bool IsOutdated { get; }
/// <summary><see cref="IsReadOnly"/> changed (any thread).</summary>
event Action? ReadOnlyChanged;
/// <summary>A job that may concern the sequence changed (any thread): this PC's engine, or the server's events.</summary>
event Action<Job>? JobChanged;
/// <summary>Everything the editor shows of the sequence; read off the UI thread.</summary>
/// <exception cref="InvalidDataException">The project cannot be read (corrupt, or written by a newer Titano).</exception>
Task<SequenceContent> LoadAsync(CancellationToken cancellationToken);
@@ -33,6 +59,15 @@ public interface ISequenceSource : IAsyncDisposable
/// <summary>Queues an analysis or render job for the sequence; returns the job id.</summary>
Task<Guid> SubmitAsync(ArchiveJobRequest request, CancellationToken cancellationToken);
/// <summary>Recent jobs that may concern the sequence (queued, running, finished), for the busy state and the cost of Analyse.</summary>
Task<IReadOnlyList<Job>> ListJobsAsync(CancellationToken cancellationToken);
/// <summary>Cancels a job of the sequence that waits or runs; its new state arrives through <see cref="JobChanged"/>.</summary>
Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken);
/// <summary>Queues a failed or cancelled job of the sequence again from its checkpoint.</summary>
Task RetryJobAsync(Guid jobId, CancellationToken cancellationToken);
}
/// <summary>A sequence as the editor opens it.</summary>
@@ -41,7 +76,8 @@ public interface ISequenceSource : IAsyncDisposable
/// <param name="Deep">The saved deep analysis when it describes the current frames, else null.</param>
/// <param name="SourceWidth">Dominant oriented full-resolution width (0 when unknown).</param>
/// <param name="ExportsFolder">Default output folder of renders; null when the sequence is not on this PC.</param>
/// <param name="Renders">Finished renders, newest first.</param>
/// <param name="Renders">Finished renders, newest first (an empty output path when the file is not on this PC).</param>
/// <param name="SavedCopies">This PC's projects kept by "Save both" when a sync conflict was settled, newest first.</param>
public sealed record SequenceContent(
Sequence Sequence,
IReadOnlyList<Frame> Frames,
@@ -51,7 +87,8 @@ public sealed record SequenceContent(
int SourceWidth,
int SourceHeight,
string? ExportsFolder,
IReadOnlyList<Render> Renders)
IReadOnlyList<Render> Renders,
IReadOnlyList<SavedCopy> SavedCopies)
{
/// <summary>Flags of frames that never reach a render (as the render job skips them).</summary>
public const FrameFlags NotRendered = FrameFlags.Missing | FrameFlags.Corrupt | FrameFlags.Excluded | FrameFlags.Undecodable;
+75 -20
View File
@@ -20,33 +20,67 @@ namespace Titano.App.Editor;
/// <summary>
/// A sequence of an archive on this PC: rows from the index, originals decoded by the client's decoder chain, the
/// project in <c>.titano/project.json</c> mirrored in the index's settings column, jobs on this PC's engine. Project
/// writes follow the archive engine's protocol: under the sequence's lease file (so the server and the job engine wait
/// for it), file first (atomically), then the index with its settings version as an optimistic check.
/// project in <c>.titano/project.json</c> mirrored in the index's settings column (with its hero frame, which the
/// Library shows), jobs on this PC's engine. Project writes follow the archive engine's protocol: under the sequence's
/// lease file (so the server and the job engine wait for it), file first (atomically), then the index with its settings
/// version as an optimistic check.
/// </summary>
public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, ImageDecoder decoder, JobEngine? engine, ArchiveServiceOptions? lease = null)
: ISequenceSource
public sealed class LocalSequenceSource : ISequenceSource
{
private const int PageSize = 1000;
private const int SaveAttempts = 3;
private const int JobsListed = 200;
private readonly ArchiveServiceOptions _lease = lease ?? new ArchiveServiceOptions();
private readonly TitanoDatabase _db;
private readonly Guid _sequenceId;
private readonly ImageDecoder _decoder;
private readonly JobEngine? _engine;
private readonly ArchiveServiceOptions _lease;
private string?[] _files = [];
private Guid[] _frameIds = [];
private ArchivePaths? _paths;
private SequencePaths? _folder;
public LocalSequenceSource(TitanoDatabase db, Guid sequenceId, ImageDecoder decoder, JobEngine? engine, ArchiveServiceOptions? lease = null)
{
_db = db;
_sequenceId = sequenceId;
_decoder = decoder;
_engine = engine;
_lease = lease ?? new ArchiveServiceOptions();
if (engine is not null) engine.JobChanged += OnJobChanged;
}
public bool IsRemote => false;
public bool IsReadOnly => false;
public bool IsOutdated => false;
/// <summary>A sequence of this PC is never read-only.</summary>
public event Action? ReadOnlyChanged
{
add { }
remove { }
}
public event Action<Job>? JobChanged;
/// <summary>A save changed the frame the Library shows for the sequence: the stored row (any thread).</summary>
public event Action<Sequence>? HeroChanged;
public async Task<SequenceContent> LoadAsync(CancellationToken cancellationToken)
{
var sequence = await db.Sequences.GetAsync(sequenceId, cancellationToken) ?? throw Missing();
var archive = await db.Archives.GetAsync(sequence.ArchiveId, cancellationToken) ?? throw Missing();
var sequence = await _db.Sequences.GetAsync(_sequenceId, cancellationToken) ?? throw Missing();
var archive = await _db.Archives.GetAsync(sequence.ArchiveId, cancellationToken) ?? throw Missing();
var frames = new List<Frame>();
while (true)
{
var page = await db.Frames.ListBySequenceAsync(sequenceId, frames.Count > 0 ? frames[^1].Index : -1, PageSize, cancellationToken);
var page = await _db.Frames.ListBySequenceAsync(_sequenceId, frames.Count > 0 ? frames[^1].Index : -1, PageSize, cancellationToken);
frames.AddRange(page);
if (page.Count < PageSize) break;
}
var renders = await db.Renders.ListBySequenceAsync(sequenceId, cancellationToken);
var renders = await _db.Renders.ListBySequenceAsync(_sequenceId, cancellationToken);
return await Task.Run(() =>
{
var paths = new ArchivePaths(archive.RootPath);
@@ -56,10 +90,10 @@ public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, Imag
{
if ((frames[i].Flags & FrameFlags.Missing) == 0) files[i] = paths.FromRelative(frames[i].RelativePath);
}
(_paths, _folder, _files) = (paths, folder, files);
(_paths, _folder, _files, _frameIds) = (paths, folder, files, [.. frames.Select(f => f.Id)]);
var context = SequenceContext.FromFrames(frames);
return new SequenceContent(sequence, frames, ReadProject(sequence, folder), LightAnalyzer.Analyze(frames), ReadReport(folder, frames.Count),
context.SourceWidth, context.SourceHeight, folder.Exports, [.. renders.OrderByDescending(r => r.Created)]);
context.SourceWidth, context.SourceHeight, folder.Exports, [.. renders.OrderByDescending(r => r.Created)], SavedCopies.List(folder.MetaDirectory));
}, cancellationToken);
}
@@ -72,7 +106,7 @@ public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, Imag
{
// Thumbnails take an embedded preview when it is large enough (no RAW development for a filmstrip cell).
var request = new DecodeRequest(file, maxLongEdge, purpose, ForcePreview: purpose == DecodePurpose.Thumbnail);
return decoder.Decode(request, cancellationToken)?.Pixels;
return _decoder.Decode(request, cancellationToken)?.Pixels;
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
@@ -86,25 +120,27 @@ public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, Imag
{
ArgumentNullException.ThrowIfNull(project);
ArgumentNullException.ThrowIfNull(basis);
var (paths, folder) = (_paths, _folder);
var (paths, folder, frameIds) = (_paths, _folder, _frameIds);
if (paths is null || folder is null) throw new InvalidOperationException("LoadAsync first.");
return Task.Run(async () =>
{
ArchiveVolume.EnsureWritable(paths);
using var held = await LeaseFile.AcquireAsync(paths.LocksDirectory, $"seq-{sequenceId:N}", _lease.Owner, _lease.LeaseWait, _lease.LeaseDuration,
using var held = await LeaseFile.AcquireAsync(paths.LocksDirectory, $"seq-{_sequenceId:N}", _lease.Owner, _lease.LeaseWait, _lease.LeaseDuration,
cancellationToken);
for (var attempt = 1; ; attempt++)
{
var row = await db.Sequences.GetAsync(sequenceId, cancellationToken) ?? throw Missing();
var row = await _db.Sequences.GetAsync(_sequenceId, cancellationToken) ?? throw Missing();
var stored = ReadProject(row, folder);
var merged = ProjectMerge.SameValues(stored, basis) ? project : ProjectMerge.Merge(basis, project, stored);
var json = merged.ToJson();
if (json == stored.ToJson()) return merged;
AtomicFile.WriteAllText(folder.ProjectPath, json);
var result = await db.Sequences.EditAsync(sequenceId, new SequenceEdit { SettingsJson = json }, row.SettingsVersion, cancellationToken);
var edit = new SequenceEdit { SettingsJson = json, HeroFrameId = merged.HeroFrame == stored.HeroFrame ? null : HeroFrameId(merged, frameIds) };
var result = await _db.Sequences.EditAsync(_sequenceId, edit, row.SettingsVersion, cancellationToken);
switch (result.Outcome)
{
case SequenceEditOutcome.Updated:
if (result.Sequence is { } updated && updated.HeroFrameId != row.HeroFrameId) HeroChanged?.Invoke(updated);
return merged;
case SequenceEditOutcome.NotFound:
throw Missing();
@@ -118,12 +154,25 @@ public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, Imag
public async Task<Guid> 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);
if (_engine is null) throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine"));
var job = await _engine.EnqueueAsync(request, cancellationToken: cancellationToken);
return job.Id;
}
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
public async Task<IReadOnlyList<Job>> 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);
public ValueTask DisposeAsync()
{
if (_engine is not null) _engine.JobChanged -= OnJobChanged;
return ValueTask.CompletedTask;
}
/// <summary>The settings in force: the index copy, else <c>project.json</c>, else defaults.</summary>
/// <exception cref="InvalidDataException">The settings are not a project or come from a newer Titano.</exception>
@@ -141,6 +190,10 @@ public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, Imag
}
}
/// <summary>The frame of the project's hero, or <see cref="Guid.Empty"/> (the first frame shows) without one.</summary>
private static Guid HeroFrameId(ProjectSettings project, Guid[] frameIds) =>
project.HeroFrame is { } hero && (uint)hero < (uint)frameIds.Length ? frameIds[hero] : Guid.Empty;
/// <summary>The saved deep report when it describes the current frames.</summary>
private static DeepAnalysisReport? ReadReport(SequencePaths folder, int frameCount)
{
@@ -157,5 +210,7 @@ public sealed class LocalSequenceSource(TitanoDatabase db, Guid sequenceId, Imag
}
}
private void OnJobChanged(Job job) => JobChanged?.Invoke(job);
private static InvalidOperationException Missing() => new(Loc.L("Editor.Error.Missing"));
}
+31 -1
View File
@@ -1,5 +1,6 @@
using System.Text.Json.Nodes;
using Titano.Core.Project;
using Titano.Data.Sync;
namespace Titano.App.Editor;
@@ -7,7 +8,8 @@ namespace Titano.App.Editor;
/// Three-way merge of projects: the editor's edit (<c>ours</c>) and a change stored meanwhile by someone else
/// (<c>theirs</c>: an analysis filling Auto values, another client through the server), both made from <c>basis</c>.
/// Values are compared member by member down the JSON tree; a member only one side changed takes that side's value, a
/// member both changed takes the editor's (the user is looking at it).
/// member both changed takes the editor's (the user is looking at it). <see cref="Conflicts"/> lists those members for
/// a source that asks the user instead (a server sequence, BRIEF §14.5).
/// </summary>
public static class ProjectMerge
{
@@ -19,6 +21,20 @@ public static class ProjectMerge
return new Rebase(basis, theirs).Apply(ours);
}
/// <summary>
/// The members both sides changed to different values, in document order: the path below the project
/// ("exposure.deflickerWindow.manual"), the editor's value and theirs as JSON (null when absent).
/// </summary>
public static IReadOnlyList<SettingsDifference> Conflicts(ProjectSettings basis, ProjectSettings ours, ProjectSettings theirs)
{
ArgumentNullException.ThrowIfNull(basis);
ArgumentNullException.ThrowIfNull(ours);
ArgumentNullException.ThrowIfNull(theirs);
var conflicts = new List<SettingsDifference>();
Collect(JsonNode.Parse(basis.ToJson()), JsonNode.Parse(ours.ToJson()), JsonNode.Parse(theirs.ToJson()), string.Empty, conflicts);
return conflicts;
}
/// <summary>True when both projects store the same values.</summary>
public static bool SameValues(ProjectSettings a, ProjectSettings b) => a.ToJson() == b.ToJson();
@@ -37,6 +53,20 @@ public static class ProjectMerge
return merged;
}
/// <summary>The members <see cref="Merge(JsonNode?, JsonNode?, JsonNode?)"/> settles for the editor although both sides changed them.</summary>
private static void Collect(JsonNode? basis, JsonNode? ours, JsonNode? theirs, string path, List<SettingsDifference> conflicts)
{
if (JsonNode.DeepEquals(ours, basis) || JsonNode.DeepEquals(theirs, basis) || JsonNode.DeepEquals(theirs, ours)) return;
if (ours is JsonObject mine && theirs is JsonObject other)
{
var common = basis as JsonObject;
foreach (var name in mine.Select(p => p.Key).Union(other.Select(p => p.Key)))
Collect(common?[name], mine[name], other[name], path.Length == 0 ? name : path + "." + name, conflicts);
return;
}
conflicts.Add(new SettingsDifference(path.Length == 0 ? "settings" : path, ours?.ToJsonString(), theirs?.ToJsonString()));
}
/// <summary>One outside change (<paramref name="basis"/> → <paramref name="theirs"/>) applied to any number of projects made from the basis.</summary>
public sealed class Rebase(ProjectSettings basis, ProjectSettings theirs)
{
@@ -0,0 +1,426 @@
using System.Collections.Concurrent;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using Titano.Core.Advice;
using Titano.Core.Analysis;
using Titano.Core.Analysis.Deep;
using Titano.Core.Diagnostics;
using Titano.Core.Imaging;
using Titano.Core.Localization;
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Core.Render;
using Titano.Data.Archiving.Jobs;
using Titano.Data.Jobs;
using Titano.Data.Sync;
using Titano.Protocol;
using Titano.Protocol.Client;
namespace Titano.App.Editor;
/// <summary>
/// A server sequence opened with proxies (BRIEF §4.4, §14.5 "edit with proxies, render where the originals are"):
/// frames and thumbnails from this PC's proxy cache (<see cref="RemoteSequence.OpenFrames"/>), the project from the
/// server's settings with their version, the deep analysis from the server's report. Saves send the settings with the
/// version they were made from; a 409 (someone changed them meanwhile) reads the server's settings and merges again
/// (<see cref="ProjectMerge"/>) when the two changes touch different settings. A setting both changed to different
/// values is a conflict the user settles (BRIEF §14.5 "explicit conflict prompt"): <see cref="ProjectConflictException"/>,
/// and nothing is sent until the editor's next save names the server's settings as its basis. Nothing is written to a
/// local archive. Analyses and renders are server jobs; their state and progress come from the server's events.
/// Project settings name frames by position, so the cached frames must be the server's: a load that finds other frames
/// throws <see cref="ProxiesOutdatedException"/>, and frames that change on the server while the sequence is open make
/// it <see cref="IsOutdated"/> (read-only, nothing saved or rendered).
/// </summary>
public sealed class RemoteSequenceSource : ISequenceSource
{
private const int SaveAttempts = 3;
private static readonly TimeSpan MinBackoff = TimeSpan.FromSeconds(2);
private static readonly TimeSpan MaxBackoff = TimeSpan.FromMinutes(1);
private readonly RemoteSequence _remote;
private readonly IRemoteSequenceApi _api;
private readonly IRenderFrameSource _frames;
private readonly IFrameSource _pixels;
private readonly ConcurrentDictionary<Guid, Job> _jobs = new();
private readonly ConcurrentDictionary<Guid, byte> _foreign = new();
private readonly CancellationTokenSource _stopping = new();
private readonly Task _listening;
private readonly bool _noEditRight;
private Stored? _stored;
private int _framesVersion = -1;
private int _outdated;
private int _disposed;
/// <param name="readOnly">The account may look at the sequence but not change it (no Edit right on the server).</param>
public RemoteSequenceSource(RemoteSequence remote, IRemoteSequenceApi api, ImageDecoder decoder, bool readOnly = false)
{
ArgumentNullException.ThrowIfNull(remote);
ArgumentNullException.ThrowIfNull(api);
ArgumentNullException.ThrowIfNull(decoder);
_remote = remote;
_api = api;
_noEditRight = readOnly;
_frames = remote.OpenFrames(decoder);
_pixels = (IFrameSource)_frames;
var stopping = _stopping.Token;
_listening = Task.Run(() => ListenAsync(stopping), CancellationToken.None);
}
public bool IsRemote => true;
public bool IsReadOnly => _noEditRight || IsOutdated;
public bool IsOutdated => Volatile.Read(ref _outdated) == 1;
public event Action? ReadOnlyChanged;
public event Action<Job>? JobChanged;
/// <summary>The server sequence's id.</summary>
public Guid Id => _remote.Sequence.Id;
public async Task<SequenceContent> LoadAsync(CancellationToken cancellationToken)
{
var dto = await Call(() => _api.GetSequenceAsync(Id, cancellationToken));
var manifest = await Call(() => _api.GetManifestAsync(Id, cancellationToken));
if (!SameFrames(manifest)) throw Outdated();
Volatile.Write(ref _framesVersion, manifest.FramesVersion);
var report = await Call(() => _api.GetAnalysisReportAsync(Id, cancellationToken));
return await Task.Run(() =>
{
var project = Parse(manifest.SettingsJson);
Volatile.Write(ref _stored, new Stored(project, manifest.SettingsVersion));
var frames = _remote.Frames;
var sequence = _remote.Sequence with
{
Title = dto.Title,
Tags = dto.Tags,
Rating = dto.Rating,
Notes = dto.Notes,
Status = (SequenceStatus)dto.Status,
RenderedCount = dto.RenderedCount,
HeroFrameId = dto.HeroFrameId,
WarningCount = dto.WarningCount,
SettingsJson = manifest.SettingsJson,
SettingsVersion = manifest.SettingsVersion,
UpdatedAt = dto.UpdatedAt,
};
var context = SequenceContext.FromFrames(frames);
var renders = manifest.Renders.OrderByDescending(r => r.Created).Select(r => new Render
{
Id = r.Id,
SequenceId = Id,
PresetName = r.PresetName,
OutputPath = string.Empty,
Codec = r.Codec,
Width = r.Width,
Height = r.Height,
Fps = r.Fps,
DurationSeconds = r.DurationSeconds,
Bytes = r.Bytes,
Created = r.Created,
ProducedBy = r.ProducedBy,
}).ToList();
return new SequenceContent(sequence, frames, project, LightAnalyzer.Analyze(frames), Report(report, frames.Count), context.SourceWidth,
context.SourceHeight, null, renders, []);
}, cancellationToken);
}
public async ValueTask<ImageBuffer?> DecodeAsync(int index, int maxLongEdge, DecodePurpose purpose, CancellationToken cancellationToken)
{
if ((uint)index >= (uint)_remote.Frames.Count) return null;
return await Task.Run(() => _pixels.LoadAsync(index, maxLongEdge, cancellationToken).AsTask(), cancellationToken);
}
public async Task<ProjectSettings> SaveProjectAsync(ProjectSettings project, ProjectSettings basis, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(project);
ArgumentNullException.ThrowIfNull(basis);
for (var attempt = 1; ; attempt++)
{
var (stored, version) = Volatile.Read(ref _stored) ?? throw new InvalidOperationException("LoadAsync first.");
var changedThere = !ProjectMerge.SameValues(stored, basis);
var merged = changedThere ? ProjectMerge.Merge(basis, project, stored) : project;
if (ProjectMerge.SameValues(merged, stored)) return merged;
if (IsOutdated) throw new ProxiesOutdatedException(Loc.L("Editor.Error.FramesChanged"));
if (_noEditRight) throw new InvalidOperationException(Loc.L("Editor.Error.RemoteReadOnly"));
if (changedThere && ProjectMerge.Conflicts(basis, project, stored) is { Count: > 0 } conflicts)
throw new ProjectConflictException(Loc.L("Editor.Error.SaveConflict"), stored, conflicts);
var hero = merged.HeroFrame == stored.HeroFrame ? (Guid?)null : HeroFrameId(merged);
try
{
var updated = await Call(() => _api.UpdateSequenceAsync(Id, new UpdateSequenceRequest(null, null, null, null, merged.ToJson(), version, hero),
cancellationToken));
Volatile.Write(ref _stored, new Stored(merged, updated.SettingsVersion));
return merged;
}
catch (TitanoApiException ex) when (ex.Status == HttpStatusCode.Conflict)
{
// Changed on the server since this editor read it: merge again on top of the server's settings.
if (attempt == SaveAttempts) throw new IOException(Loc.L("Editor.Error.SaveConflict"), ex);
var manifest = await Call(() => _api.GetManifestAsync(Id, cancellationToken));
if (!SameFrames(manifest)) throw Outdated();
Volatile.Write(ref _stored, new Stored(Parse(manifest.SettingsJson), manifest.SettingsVersion));
}
}
}
/// <remarks>
/// The server queues every job at the user's priority; another priority ("Add to queue") is set right after. A
/// render embeds the project, whose frame positions mean nothing once the frames changed: refused while outdated.
/// </remarks>
public async Task<Guid> SubmitAsync(ArchiveJobRequest request, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(request);
if (request.Kind == JobKind.Render && IsOutdated) throw new ProxiesOutdatedException(Loc.L("Editor.Error.FramesChanged"));
var dto = await Call(() => _api.CreateJobAsync(new CreateJobRequest(JobWire.Kind(request.Kind), request.Targets, request.ParametersJson), cancellationToken));
if (request.Priority != JobPriority.User) dto = await PrioritiseAsync(dto, request.Priority, cancellationToken);
// The server's events may have reported the job already; its first state never replaces a later one.
if (JobWire.FromDto(dto) is { } job && _jobs.TryAdd(job.Id, job)) JobChanged?.Invoke(job);
return dto.Id;
}
public async Task<IReadOnlyList<Job>> ListJobsAsync(CancellationToken cancellationToken)
{
var active = await Call(() => _api.ListActiveJobsAsync(cancellationToken));
var mine = active.Select(JobWire.FromDto).OfType<Job>().Where(Concerns).ToList();
foreach (var job in mine) _jobs[job.Id] = job;
return mine;
}
public async Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken)
{
if (JobWire.FromDto(await _api.CancelJobAsync(jobId, cancellationToken)) is { } job) Publish(job);
}
public async Task RetryJobAsync(Guid jobId, CancellationToken cancellationToken)
{
if (JobWire.FromDto(await _api.RetryJobAsync(jobId, cancellationToken)) is { } job) Publish(job);
}
public async ValueTask DisposeAsync()
{
if (Interlocked.Exchange(ref _disposed, 1) == 1) return;
try
{
await _stopping.CancelAsync();
await _listening;
}
finally
{
_stopping.Dispose();
if (_frames is IAsyncDisposable frames) await frames.DisposeAsync();
_api.Dispose();
}
}
/// <summary>
/// Follows the server's events until the editor closes, reconnecting with a growing delay (job states lost meanwhile
/// are read back from the jobs). Nothing that fails on the way ends it.
/// </summary>
private async Task ListenAsync(CancellationToken cancellationToken)
{
var failures = 0;
while (true)
{
try
{
await foreach (var e in _api.EventsAsync(cancellationToken).ConfigureAwait(false))
{
failures = 0;
await OnEventAsync(e, cancellationToken).ConfigureAwait(false);
}
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
if (cancellationToken.IsCancellationRequested) return;
Log.Info("editor", $"Events of the server lost for {_remote.Sequence.DisplayTitle}: {ex.Message}");
}
try
{
var delay = Math.Min(MaxBackoff.Ticks, MinBackoff.Ticks << Math.Min(failures++, 10));
await Task.Delay(TimeSpan.FromTicks(delay), cancellationToken).ConfigureAwait(false);
await RefreshTrackedAsync(cancellationToken).ConfigureAwait(false);
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
if (cancellationToken.IsCancellationRequested) return;
Log.Info("editor", $"Jobs of {_remote.Sequence.DisplayTitle} could not be read again: {ex.Message}");
}
}
}
private async Task OnEventAsync(ServerEvent e, CancellationToken cancellationToken)
{
switch (e)
{
case SequenceChangedEvent changed when changed.SequenceId == Id && changed.FramesVersion != Volatile.Read(ref _framesVersion):
await CheckFramesAsync(cancellationToken).ConfigureAwait(false);
break;
// A late progress event never brings a finished job back to running.
case JobProgressEvent progress when _jobs.TryGetValue(progress.JobId, out var job) && job.State is JobState.Queued or JobState.Running:
Publish(job with
{
State = JobState.Running,
ProgressDone = progress.Done,
ProgressTotal = progress.Total,
ItemsPerSecond = progress.ItemsPerSecond,
Eta = progress.EtaSeconds is { } eta ? TimeSpan.FromSeconds(eta) : null,
});
break;
case JobStateEvent state when !_foreign.ContainsKey(state.JobId):
await FetchAsync(state.JobId, cancellationToken).ConfigureAwait(false);
break;
}
}
/// <summary>Reads a job the events named: tracked when it concerns this sequence, remembered as foreign otherwise.</summary>
private async Task FetchAsync(Guid jobId, CancellationToken cancellationToken)
{
try
{
if (JobWire.FromDto(await _api.GetJobAsync(jobId, cancellationToken).ConfigureAwait(false)) is { } job && Concerns(job)) Publish(job);
else _foreign[jobId] = 0;
}
catch (Exception ex) when (ex is TitanoApiException or HttpRequestException or JsonException
|| (ex is OperationCanceledException && !cancellationToken.IsCancellationRequested))
{
Log.Info("editor", $"Job {jobId} could not be read: {ex.Message}");
}
}
/// <summary>Frames added or removed on the server: whether this PC's frames are still the sequence's.</summary>
private async Task CheckFramesAsync(CancellationToken cancellationToken)
{
try
{
var manifest = await _api.GetManifestAsync(Id, cancellationToken).ConfigureAwait(false);
if (SameFrames(manifest)) Volatile.Write(ref _framesVersion, manifest.FramesVersion);
else MarkOutdated();
}
catch (Exception ex) when (ex is TitanoApiException or HttpRequestException or JsonException
|| (ex is OperationCanceledException && !cancellationToken.IsCancellationRequested))
{
Log.Info("editor", $"The frames of {_remote.Sequence.DisplayTitle} could not be compared: {ex.Message}");
}
}
/// <summary>Sets a priority other than the user's on a job the server just queued; the job stays queued if that fails.</summary>
private async Task<JobDto> PrioritiseAsync(JobDto dto, JobPriority priority, CancellationToken cancellationToken)
{
try
{
return await _api.SetJobPriorityAsync(dto.Id, JobWire.Priority(priority), cancellationToken);
}
catch (Exception ex) when (ex is TitanoApiException or HttpRequestException)
{
// Already claimed (409) or refused: the job runs at the user's priority, which is never later than asked.
Log.Info("editor", $"Job {dto.Id} keeps the user's priority on the server: {ex.Message}");
return dto;
}
}
/// <summary>After a lost event socket: the tracked jobs as the server has them now.</summary>
private async Task RefreshTrackedAsync(CancellationToken cancellationToken)
{
foreach (var job in _jobs.Values.Where(j => j.State is JobState.Queued or JobState.Running or JobState.Paused).ToList())
await FetchAsync(job.Id, cancellationToken).ConfigureAwait(false);
}
private void Publish(Job job)
{
_jobs[job.Id] = job;
JobChanged?.Invoke(job);
}
/// <summary>The server's frames are the cached ones, in the same order (frame positions in the project mean the same frames).</summary>
private bool SameFrames(SequenceManifest manifest) =>
manifest.Frames.OrderBy(f => f.Index).Select(f => f.Id).SequenceEqual(_remote.Frames.Select(f => f.Id));
/// <summary>The frames changed on the server: from now on the project is only shown.</summary>
private ProxiesOutdatedException Outdated()
{
MarkOutdated();
return new ProxiesOutdatedException(Loc.L("Editor.Error.FramesChanged"));
}
private void MarkOutdated()
{
if (Interlocked.Exchange(ref _outdated, 1) == 1) return;
Log.Info("editor", $"The frames of {_remote.Sequence.DisplayTitle} changed on the server; its proxies are out of date");
ReadOnlyChanged?.Invoke();
}
private bool Concerns(Job job) => job.TargetIds.Contains(Id) && job.Kind is JobKind.DeepAnalyse or JobKind.LightAnalyse or JobKind.Render;
/// <summary>The frame of the project's hero, or <see cref="Guid.Empty"/> (the first frame shows) without one.</summary>
private Guid HeroFrameId(ProjectSettings project) =>
project.HeroFrame is { } hero && (uint)hero < (uint)_remote.Frames.Count ? _remote.Frames[hero].Id : Guid.Empty;
/// <exception cref="InvalidDataException">The settings are not a project or come from a newer Titano.</exception>
private static ProjectSettings Parse(string? json)
{
if (string.IsNullOrWhiteSpace(json)) return new ProjectSettings();
try
{
return ProjectSettings.FromJson(json);
}
catch (JsonException ex)
{
throw new InvalidDataException(Loc.L("Editor.Error.Project"), ex);
}
}
/// <summary>The server's deep report when it describes the frames this PC has.</summary>
private DeepAnalysisReport? Report(string? json, int frameCount)
{
if (json is null) return null;
try
{
var report = DeepAnalysisReport.FromJson(json);
return report.FrameCount == frameCount ? report : null;
}
catch (Exception ex) when (ex is JsonException or InvalidDataException)
{
Log.Warning("editor", $"The analysis of {_remote.Sequence.DisplayTitle} on the server cannot be read", ex);
return null;
}
}
/// <summary>A sequence deleted on the server reads as gone, like a local one removed from the index.</summary>
private static async Task<T> Call<T>(Func<Task<T>> call)
{
try
{
return await call();
}
catch (TitanoApiException ex) when (ex.Status == HttpStatusCode.NotFound)
{
throw new InvalidOperationException(Loc.L("Editor.Error.Missing"), ex);
}
}
/// <summary>The server's settings as last read or written, with the version a save must name.</summary>
private sealed record Stored(ProjectSettings Project, int Version);
}
/// <summary>
/// Settings the editor changed were changed to other values on the server meanwhile (BRIEF §14.5): nothing is saved
/// until the user keeps the editor's values or takes the server's (<see cref="EditorSession.ResolveConflict"/>).
/// </summary>
/// <param name="server">The server's project now.</param>
/// <param name="differences">The settings both changed: the editor's value, then the server's.</param>
public sealed class ProjectConflictException(string message, ProjectSettings server, IReadOnlyList<SettingsDifference> differences) : IOException(message)
{
public ProjectSettings Server { get; } = server;
public IReadOnlyList<SettingsDifference> Differences { get; } = differences;
}
/// <summary>
/// The proxies of a server sequence are for frames the server no longer has (added or removed since they were fetched):
/// they must be fetched again before the sequence can be edited.
/// </summary>
public sealed class ProxiesOutdatedException(string message) : IOException(message);
+51
View File
@@ -0,0 +1,51 @@
using System.IO;
using System.Text.Json;
using Titano.Core.Diagnostics;
using Titano.Core.Localization;
using Titano.Core.Project;
using Titano.Data.Sync;
namespace Titano.App.Editor;
/// <summary>This PC's project kept by "Save both" when a sync conflict was settled (BRIEF §12.7), local time of the choice.</summary>
public sealed record SavedCopy(string Path, DateTime SavedAt)
{
/// <summary>"03/10/2026 14:22" in the user's format.</summary>
public string Label => SavedAt.ToString("g", Loc.Culture);
}
/// <summary>The "Save both" copies of a sequence: <c>.titano/project.this-pc-&lt;time&gt;.json</c> beside <c>project.json</c>.</summary>
public static class SavedCopies
{
/// <summary>The copies in a sequence's <c>.titano</c> folder, newest first; none when the folder cannot be read.</summary>
public static IReadOnlyList<SavedCopy> List(string metaDirectory)
{
try
{
if (!Directory.Exists(metaDirectory)) return [];
return [.. Directory.EnumerateFiles(metaDirectory, SyncService.SavedCopyPattern)
.Select(path => new SavedCopy(path, SyncService.SavedCopyTime(path) ?? File.GetLastWriteTime(path)))
.OrderByDescending(c => c.SavedAt)];
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
Log.Warning("editor", $"The saved projects in {metaDirectory} cannot be listed", ex);
return [];
}
}
/// <summary>The project of a copy.</summary>
/// <exception cref="InvalidDataException">The copy is gone, unreadable, or not a project of this Titano.</exception>
public static ProjectSettings Read(SavedCopy copy)
{
ArgumentNullException.ThrowIfNull(copy);
try
{
return ProjectSettings.FromJson(File.ReadAllText(copy.Path));
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException)
{
throw new InvalidDataException(Loc.L("Editor.Error.SavedCopy", System.IO.Path.GetFileName(copy.Path)), ex);
}
}
}
+46
View File
@@ -0,0 +1,46 @@
using Titano.Core.Model;
namespace Titano.App.Editor;
/// <summary>
/// The analyses and renders of the open sequence that wait, run or are paused, as the source reports them (BRIEF §12.3
/// "while a job runs on this sequence, settings are disabled", §11.5): the editor's busy lock, whether Analyse would
/// queue a second analysis, and the server job the header of a server sequence shows. Call from one thread.
/// </summary>
public sealed class SequenceJobs(Guid sequenceId)
{
private readonly Dictionary<Guid, Job> _active = [];
/// <summary>An analysis or render runs: settings wait.</summary>
public bool IsBusy => _active.Values.Any(j => j.State == JobState.Running);
/// <summary>A deep analysis waits, runs or is paused.</summary>
public bool IsAnalysing => _active.Values.Any(j => j.Kind == JobKind.DeepAnalyse);
/// <summary>The job to show: one running, else one paused, else the oldest waiting; null when there is none.</summary>
public Job? Shown => _active.Values
.OrderBy(j => j.State switch { JobState.Running => 0, JobState.Paused => 1, _ => 2 })
.ThenBy(j => j.Started ?? j.Created)
.FirstOrDefault();
/// <summary>An analysis or render of this sequence.</summary>
public bool Concerns(Job job)
{
ArgumentNullException.ThrowIfNull(job);
return job.TargetIds.Contains(sequenceId) && job.Kind is JobKind.DeepAnalyse or JobKind.LightAnalyse or JobKind.Render;
}
/// <summary>The job is one of those that wait, run or are paused.</summary>
public bool IsActive(Guid jobId) => _active.ContainsKey(jobId);
/// <summary>Takes in a job's new state.</summary>
/// <returns>Whether a job joined or left the active ones or changed state; progress alone does not count.</returns>
public bool Track(Job job)
{
if (!Concerns(job)) return false;
if (job.State is not (JobState.Queued or JobState.Running or JobState.Paused)) return _active.Remove(job.Id);
var changed = !_active.TryGetValue(job.Id, out var known) || known.State != job.State;
_active[job.Id] = job;
return changed;
}
}
+2 -1
View File
@@ -255,13 +255,14 @@ public sealed class AppServices : IAsyncDisposable
var handlers = CreateJobHandlers(this);
var kinds = handlers.Select(h => h.Kind).Distinct().ToArray();
Engine = new JobEngine(database, handlers, new JobEngineOptions { WorkerId = WorkerId, Kinds = kinds });
// Sync follows the engine's jobs before it runs any: a render resumed at start that finishes at once is still sent (Export "Sync").
Sync.Update();
// With no handler the engine must not run: an empty kind list would let workers claim (and fail) every job.
var started = startEngine && handlers.Count > 0;
if (started) await Engine.StartAsync(ct);
Jobs = new EngineJobQueue(database, Engine, started);
Log.Info("jobs", started ? $"Job engine started with {Engine.Options.Workers} worker(s) for {string.Join(", ", kinds)}" : "No job handlers registered; jobs stay queued");
UpdateRenderNode();
Sync.Update();
}
/// <summary>Media Foundation (hardware first, software H.264; hardware as Settings › Rendering allows) then managed
+25 -3
View File
@@ -47,15 +47,37 @@
ToolTip="{l:Loc Tooltips.Editor.Back}" AutomationProperties.Name="{l:Loc Editor.Back}" Margin="-6,0,0,0" />
<TextBlock Grid.Column="1" Text="{Binding Title}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" Margin="6,0,12,0" MaxWidth="320"
TextTrimming="CharacterEllipsis" />
<TextBlock Grid.Column="2" Text="{Binding Summary}" Style="{StaticResource Text.Secondary}" FontSize="{StaticResource Size.Body}" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" ToolTip="{Binding Summary}" />
<!-- A server sequence edited with proxies: where it lives (read-only or out of date says so) and its analysis or render on the server,
before the summary; all of it shares the space the actions leave and ends in an ellipsis. -->
<DockPanel Grid.Column="2" VerticalAlignment="Center">
<ui:StatusGlyph DockPanel.Dock="Left" Kind="Remote" Text="{Binding RemoteText}" ToolTip="{Binding RemoteToolTip}" FontSize="{StaticResource Size.Body}" Margin="0,0,12,0"
MaxWidth="220" VerticalAlignment="Center" Visibility="{Binding IsRemote, Converter={StaticResource BoolToVisibility}}" />
<!-- The server job: its bar, what it is and how far (the text gives way first), and Cancel, which always stays (BRIEF §11.5). -->
<Grid DockPanel.Dock="Left" Margin="0,0,12,0" MaxWidth="300" VerticalAlignment="Center"
Visibility="{Binding ServerJobText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ProgressBar Width="48" Maximum="1" Value="{Binding ServerJobProgress, Mode=OneWay}" VerticalAlignment="Center" Margin="0,0,8,0"
AutomationProperties.Name="{Binding ServerJobText}" Visibility="{Binding HasServerJobProgress, Converter={StaticResource BoolToVisibility}}" />
<ui:StatusGlyph Grid.Column="1" Kind="{Binding ServerJobKind}" Text="{Binding ServerJobText}" ToolTip="{Binding ServerJobToolTip}"
FontSize="{StaticResource Size.Body}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
<Button Grid.Column="2" Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="4,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Cancel}"
Command="{Binding CancelServerJobCommand}" ToolTip="{Binding CancelServerJobToolTip}" ToolTipService.ShowOnDisabled="True"
AutomationProperties.Name="{l:Loc Editor.ServerJob.Cancel}" />
</Grid>
<TextBlock Text="{Binding Summary}" Style="{StaticResource Text.Secondary}" FontSize="{StaticResource Size.Body}" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" ToolTip="{Binding Summary}" />
</DockPanel>
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center" Margin="12,0,0,0">
<Button Content="{l:Loc Editor.Analyse}" Command="{Binding AnalyseCommand}" ToolTip="{Binding AnalyseToolTip}" ToolTipService.ShowOnDisabled="True" />
<Button Content="{l:Loc Editor.OptimiseAll}" Command="{Binding OptimiseAllCommand}" ToolTip="{Binding OptimiseAllToolTip}"
ToolTipService.ShowOnDisabled="True" Margin="12,0,0,0" />
<v:SplitButton x:Name="RenderButton" IsPrimary="True" Margin="12,0,0,0" Content="{Binding RenderText}" Command="{Binding RenderCommand}"
ItemsSource="{Binding RenderChoices}" DisplayMemberPath="Label" SelectedItem="{Binding SelectedRenderChoice}" ToolTip="{Binding RenderToolTip}"
ToolTipService.ShowOnDisabled="True" DropDownToolTip="{l:Loc Tooltips.Editor.RenderChoice}"
ToolTipService.ShowOnDisabled="True" DropDownToolTip="{Binding RenderChoiceToolTip}"
AutomationProperties.Name="{l:Loc Editor.RenderButton}" />
</StackPanel>
</Grid>
+150 -12
View File
@@ -1,5 +1,7 @@
using System.ComponentModel;
using System.Net;
using System.Windows.Input;
using System.Windows.Threading;
using Titano.App.Editor;
using Titano.App.Infrastructure;
using Titano.App.Shell;
@@ -7,22 +9,29 @@ using Titano.Core.Diagnostics;
using Titano.Core.Export;
using Titano.Core.Imaging.Decoders;
using Titano.Core.Localization;
using Titano.Data.Archiving;
using Titano.Core.Model;
using Titano.Data.Jobs;
using Titano.Data.Sync;
using Titano.Protocol.Client;
using Titano.Ui.Mvvm;
namespace Titano.App.Sections;
/// <summary>
/// The Sequence section (BRIEF §12.3): opens the sequence the Library (or Jobs) chose into an <see cref="EditorViewModel"/>
/// and closes the previous one after saving it; without a sequence it shows the empty state. A failed open is reported
/// and leaves the section usable; an edit that cannot be saved is never dropped without the user's confirmation.
/// The Sequence section (BRIEF §12.3): opens the sequence the Library, Jobs or the Server screen chose into an
/// <see cref="EditorViewModel"/> (from this PC's archive, or a server sequence with this PC's proxies) and closes the
/// previous one after saving it; without a sequence it shows the empty state. A server sequence whose proxies are
/// missing or out of date fetches them first and opens once they are here. A failed open is reported and leaves the
/// section usable; an edit that cannot be saved is never dropped without the user's confirmation.
/// </summary>
public sealed class SequenceViewModel : SectionViewModel
{
private readonly Dispatcher _dispatcher = Dispatcher.CurrentDispatcher;
private EditorViewModel? _editor;
private Guid? _openId;
private bool _isLoading;
private Task _switch = Task.CompletedTask;
private ProxyFetch? _fetch;
public SequenceViewModel(ShellViewModel shell)
: base(SectionKey.Sequence, "Icon.Sequence")
@@ -59,12 +68,36 @@ public sealed class SequenceViewModel : SectionViewModel
public override string Title => _editor?.Title ?? Label;
/// <summary>Opens <paramref name="sequenceId"/> (the editor of another sequence is saved and closed first).</summary>
public Task OpenAsync(Guid sequenceId)
/// <param name="reload">Opens it again even when it is the open one (its proxies were fetched again).</param>
public Task OpenAsync(Guid sequenceId, bool reload = false)
{
_switch = SwitchAsync(_switch, sequenceId);
_switch = SwitchAsync(_switch, sequenceId, reload);
return _switch;
}
/// <summary>
/// Fetches the proxies of server sequence <paramref name="remoteId"/> into this PC's cache (a download job, shown in
/// the job bar and on the Jobs screen) and opens it in the editor once they are here, if it is still the sequence
/// asked for.
/// </summary>
public async Task FetchProxiesAsync(Guid remoteId, string title)
{
var services = Shell.Services;
var sync = services.Sync;
if (sync.Server is not { } server || sync.Service is not { } service) throw new InvalidOperationException(Loc.L("Editor.Error.SignedOut"));
if (services.Engine is not { } engine || services.Database is not { } db) throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine"));
StopFetch();
var fetch = new ProxyFetch(remoteId, title, engine);
fetch.Handler = job => _dispatcher.BeginInvoke(() => OnFetchChanged(fetch, job));
engine.JobChanged += fetch.Handler;
_fetch = fetch;
var job = await service.EnqueueDownloadAsync(engine, server, remoteId, title, SyncDownloadMode.Proxies, null);
fetch.JobId = job.Id;
Shell.Notify(Loc.L("Editor.Proxies.Fetching"), title, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs));
// A download that ended before its id was known here is handled now.
if (await db.Jobs.GetAsync(job.Id) is { State: JobState.Done or JobState.Failed or JobState.Cancelled } ended) OnFetchChanged(fetch, ended);
}
/// <summary>
/// Stores the open sequence's last edit. When the save fails (archive offline, read-only, busy), asks whether to
/// discard the edit (BRIEF §12.1: modals only for destructive confirmations).
@@ -98,6 +131,7 @@ public sealed class SequenceViewModel : SectionViewModel
public override void Dispose()
{
Shell.PropertyChanged -= OnShellChanged;
StopFetch();
Editor?.Dispose();
base.Dispose();
}
@@ -112,6 +146,75 @@ public sealed class SequenceViewModel : SectionViewModel
if (e.PropertyName == nameof(ShellViewModel.CurrentSequenceId) && IsSelected) OnActivated();
}
/// <summary>
/// Where <paramref name="sequenceId"/> lives: this PC's index, else a sequence of the signed-in server whose proxies
/// this PC keeps (Server screen, "Open with proxies"), edited through the server (BRIEF §14.5), or only shown when the
/// account may not change it. Null when the proxies are not here yet: they are being fetched (<see cref="FetchProxiesAsync"/>).
/// </summary>
private async Task<(ISequenceSource Source, string Title)?> OpenSourceAsync(AppServices services, Guid sequenceId)
{
if (services.Database is not { } db) throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine"));
var processing = services.Processing?.Options;
var decoder = processing?.Archive.Decoder ?? DecoderFactory.CreateClient(null);
if (await db.Sequences.GetAsync(sequenceId) is { } row)
{
var local = new LocalSequenceSource(db, sequenceId, decoder, services.Engine, processing?.Archive);
local.HeroChanged += OnHeroChanged;
return (local, row.DisplayTitle);
}
var sync = services.Sync;
if (sync.Server is not { } server || sync.Service is not { } service || sync.ConnectEditor() is not { } api)
throw new InvalidOperationException(Loc.L("Editor.Error.SignedOut"));
// The proxy cache's index and files are read off the UI thread.
if (await Task.Run(() => service.OpenRemote(server, sequenceId)) is { } remote)
return (new RemoteSequenceSource(remote, api, decoder, readOnly: !sync.Policy.CanEdit), remote.Sequence.DisplayTitle);
using (api)
{
string title;
try
{
title = (await api.GetSequenceAsync(sequenceId, CancellationToken.None)).DisplayTitle;
}
catch (TitanoApiException ex) when (ex.Status == HttpStatusCode.NotFound)
{
throw new InvalidOperationException(Loc.L("Editor.Error.Missing"), ex);
}
await FetchProxiesAsync(sequenceId, title);
return null;
}
}
/// <summary>The proxy download for an open waiting on it moved: opens the sequence once it is done, says why not when it failed.</summary>
private void OnFetchChanged(ProxyFetch fetch, Job job)
{
if (!ReferenceEquals(fetch, _fetch) || job.Id != fetch.JobId || job.State is not (JobState.Done or JobState.Failed or JobState.Cancelled)) return;
StopFetch();
switch (job.State)
{
// Opened only when it is still the sequence asked for; otherwise the next visit opens it from the cache.
case JobState.Done when Shell.CurrentSequenceId == fetch.RemoteId && IsSelected:
_ = OpenAsync(fetch.RemoteId, reload: true);
break;
case JobState.Failed:
Shell.Notify(Loc.L("Editor.Proxies.Failed"), job.Error ?? fetch.Title, Loc.L("Shell.Nav.Jobs"), Loc.L("Tooltips.Nav.Jobs"),
() => Shell.Navigate(SectionKey.Jobs));
break;
}
}
private void StopFetch()
{
if (_fetch is not { } fetch) return;
_fetch = null;
if (fetch.Handler is { } handler) fetch.Engine.JobChanged -= handler;
}
/// <summary>Set hero changed the frame the Library shows (any thread): its card loads the new thumbnail.</summary>
private void OnHeroChanged(Sequence row) => _dispatcher.BeginInvoke(() =>
{
if (Shell.Library.Items.FirstOrDefault(i => i.Id == row.Id) is { } item) item.Update(row);
});
/// <summary>Waits for <paramref name="task"/>; its failure was reported where it happened.</summary>
private static async Task Settled(Task task)
{
@@ -125,10 +228,10 @@ public sealed class SequenceViewModel : SectionViewModel
}
}
private async Task SwitchAsync(Task previous, Guid sequenceId)
private async Task SwitchAsync(Task previous, Guid sequenceId, bool reload)
{
await Settled(previous);
if (sequenceId == _openId) return;
if (sequenceId == _openId && !reload) return;
// The open sequence keeps its editor while its last edit is neither stored nor deliberately discarded.
if (!await ConfirmCloseAsync()) return;
var services = Shell.Services;
@@ -142,11 +245,32 @@ public sealed class SequenceViewModel : SectionViewModel
await old.DisposeAsync();
}
_openId = sequenceId;
if (services.Database is not { } db) throw new InvalidOperationException(Loc.L("Editor.Error.NoEngine"));
if (await OpenSourceAsync(services, sequenceId) is not { } opened)
{
// The proxies are on their way; the sequence opens when they are here.
_openId = null;
return;
}
var (source, title) = opened;
SequenceContent content;
try
{
content = await source.LoadAsync(CancellationToken.None);
}
catch (ProxiesOutdatedException)
{
// The server's frames are no longer these proxies: fetch them again, then open.
await source.DisposeAsync();
_openId = null;
await FetchProxiesAsync(sequenceId, title);
return;
}
catch
{
await source.DisposeAsync();
throw;
}
var processing = services.Processing?.Options;
var source = new LocalSequenceSource(db, sequenceId, processing?.Archive.Decoder ?? DecoderFactory.CreateClient(null), services.Engine,
processing?.Archive);
var content = await source.LoadAsync(CancellationToken.None);
var encoders = processing?.Encoders ?? [];
var session = new EditorSession(source, content, [.. encoders.SelectMany(e => e.Capabilities)]);
var editor = new EditorViewModel(Shell, session, encoders, processing?.Host ?? EncoderHost.Client);
@@ -167,4 +291,18 @@ public sealed class SequenceViewModel : SectionViewModel
OnPropertyChanged(nameof(IsEmpty));
}
}
/// <summary>A proxy download an open waits on, with its engine subscription.</summary>
private sealed class ProxyFetch(Guid remoteId, string title, JobEngine engine)
{
public Guid RemoteId { get; } = remoteId;
public string Title { get; } = title;
public JobEngine Engine { get; } = engine;
public Guid JobId { get; set; }
public Action<Job>? Handler { get; set; }
}
}
@@ -0,0 +1,62 @@
using Titano.App.Editor;
using Titano.Core.Model;
using Titano.Data.Jobs;
using Titano.Protocol;
using Titano.Protocol.Client;
namespace Titano.App.Server;
/// <summary>Makes the connection of the editor of a server sequence for a signed-in session.</summary>
public delegate IRemoteSequenceApi RemoteSequenceApiFactory(Uri address, string token, IReadOnlyCollection<string> trustedFingerprints);
/// <summary><see cref="IRemoteSequenceApi"/> over a signed-in <see cref="TitanoClient"/>, which it owns.</summary>
public sealed class TitanoRemoteSequenceApi(TitanoClient client) : IRemoteSequenceApi
{
private static readonly JobState[] ActiveStates = [JobState.Queued, JobState.Running, JobState.Paused];
private static readonly JobKind[] EditorKinds = [JobKind.DeepAnalyse, JobKind.LightAnalyse, JobKind.Render];
public Task<SequenceDto> GetSequenceAsync(Guid id, CancellationToken cancellationToken) => client.GetSequenceAsync(id, cancellationToken);
public Task<SequenceManifest> GetManifestAsync(Guid id, CancellationToken cancellationToken) => client.GetManifestAsync(id, cancellationToken);
public Task<SequenceDto> UpdateSequenceAsync(Guid id, UpdateSequenceRequest request, CancellationToken cancellationToken) =>
client.UpdateSequenceAsync(id, request, cancellationToken);
public Task<string?> GetAnalysisReportAsync(Guid id, CancellationToken cancellationToken) => client.GetAnalysisReportAsync(id, cancellationToken);
public Task<JobDto> CreateJobAsync(CreateJobRequest request, CancellationToken cancellationToken) => client.CreateJobAsync(request, cancellationToken);
public Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken) => client.GetJobAsync(id, cancellationToken);
/// <summary>Filtered by state and kind and read to the last page: a busy server queues thumbnails and proxies by the thousand.</summary>
public async Task<IReadOnlyList<JobDto>> ListActiveJobsAsync(CancellationToken cancellationToken)
{
var jobs = new List<JobDto>();
foreach (var state in ActiveStates)
{
foreach (var kind in EditorKinds)
{
string? cursor = null;
do
{
var page = await client.ListJobsAsync(JobWire.State(state), JobWire.Kind(kind), cursor, cancellationToken);
jobs.AddRange(page.Items);
cursor = page.NextCursor;
}
while (cursor is not null);
}
}
return jobs;
}
public Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken) => client.CancelJobAsync(id, cancellationToken);
public Task<JobDto> RetryJobAsync(Guid id, CancellationToken cancellationToken) => client.RetryJobAsync(id, cancellationToken);
public Task<JobDto> SetJobPriorityAsync(Guid id, string priority, CancellationToken cancellationToken) =>
client.SetJobPriorityAsync(id, priority, cancellationToken);
public IAsyncEnumerable<ServerEvent> EventsAsync(CancellationToken cancellationToken) => client.EventsAsync(cancellationToken);
public void Dispose() => client.Dispose();
}
+69 -6
View File
@@ -1,8 +1,10 @@
using System.IO;
using Titano.App.Editor;
using Titano.App.Infrastructure;
using Titano.Core.Diagnostics;
using Titano.Core.Model;
using Titano.Data;
using Titano.Data.Jobs;
using Titano.Data.Sync;
using Titano.Protocol.Client;
@@ -14,9 +16,11 @@ public delegate ISyncRemote SyncRemoteFactory(Uri address, string token, IReadOn
/// <summary>
/// This PC's sync with the signed-in server (BRIEF §4.4, §14.5): the <see cref="SyncService"/> of the index, the
/// connection of upload and download jobs (<see cref="ISyncConnector"/>), a <see cref="SyncAgent"/> that keeps the
/// table current while a session is open, started and stopped in order as the session changes, and the
/// <see cref="UploadHold"/> for metered connections. Options come from <see cref="AppSettings.SyncSettingsAutomatically"/>,
/// <see cref="AppSettings.KeepProxiesOffline"/> and <see cref="AppSettings.PauseUploadsOnMetered"/>.
/// table current while a session is open, started and stopped in order as the session changes, the
/// <see cref="UploadHold"/> for metered connections, the connections of editors of server sequences
/// (<see cref="ConnectEditor"/>) and the Export "Sync" of finished renders (<see cref="ExportSync"/>). Options come from
/// <see cref="AppSettings.SyncSettingsAutomatically"/>, <see cref="AppSettings.KeepProxiesOffline"/> and
/// <see cref="AppSettings.PauseUploadsOnMetered"/>.
/// </summary>
public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDisposable
{
@@ -26,11 +30,16 @@ public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDispo
private Task _switch = Task.CompletedTask;
private Credentials? _credentials;
private (SyncAgent Agent, ISyncRemote Remote, Credentials Credentials)? _running;
private JobEngine? _renders;
/// <summary>Connections over <see cref="TitanoClient"/>; screenshots substitute a fake server.</summary>
public SyncRemoteFactory RemoteFactory { get; set; } = (address, token, trusted) =>
new TitanoSyncRemote(new TitanoClient(address, new CertificatePinning(trusted), $"Titano ({Environment.MachineName})") { Token = token }, ownsClient: true);
/// <summary>Connections of editors of server sequences over <see cref="TitanoClient"/>; screenshots substitute a fake server.</summary>
public RemoteSequenceApiFactory EditorFactory { get; set; } = (address, token, trusted) =>
new TitanoRemoteSequenceApi(new TitanoClient(address, new CertificatePinning(trusted), $"Titano ({Environment.MachineName})") { Token = token });
/// <summary>The engine; null until the index is open.</summary>
public SyncService? Service { get; private set; }
@@ -44,8 +53,13 @@ public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDispo
public string? Server => Volatile.Read(ref _credentials) is { } c ? SyncService.ServerKey(c.Address) : null;
/// <summary>The options, and whether the account may change server sequences (without it this PC's edits are not sent).</summary>
public SyncPolicy Policy => new(services.Settings.SyncSettingsAutomatically, services.Settings.KeepProxiesOffline,
services.Server.User is { } user && (user.Permissions & (long)Permissions.Edit) != 0);
public SyncPolicy Policy => new(services.Settings.SyncSettingsAutomatically, services.Settings.KeepProxiesOffline, Allows(Permissions.Edit));
/// <summary>The signed-in account may send files (originals, renders) to the server.</summary>
public bool CanUpload => Allows(Permissions.Upload);
/// <summary>The signed-in account may queue renders on the server.</summary>
public bool CanRender => Allows(Permissions.Render);
/// <summary>Pauses uploads while the connection is metered and the option is on.</summary>
public UploadHold Uploads { get; } = new(services);
@@ -74,9 +88,18 @@ public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDispo
: null;
Volatile.Write(ref _credentials, wanted);
_switch = SwitchAsync(_switch, wanted);
if (services.Engine is { } engine) Uploads.Attach(engine);
if (services.Engine is not { } engine) return;
Uploads.Attach(engine);
if (ReferenceEquals(_renders, engine)) return;
if (_renders is not null) _renders.JobChanged -= OnJobChanged;
_renders = engine;
engine.JobChanged += OnJobChanged;
}
/// <summary>A connection for the editor of a sequence of the signed-in server; null while signed out.</summary>
public IRemoteSequenceApi? ConnectEditor() =>
Volatile.Read(ref _credentials) is { } c ? EditorFactory(c.Address, c.Token, c.Fingerprints) : null;
/// <summary>Compares now, once the session switch in progress settled; null while signed out.</summary>
public async Task<SyncSnapshot?> RefreshAsync(CancellationToken ct = default)
{
@@ -116,10 +139,50 @@ public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDispo
{
Volatile.Write(ref _credentials, null);
Uploads.Dispose();
if (_renders is not null) _renders.JobChanged -= OnJobChanged;
await _switch;
await StopAsync();
}
private bool Allows(Permissions permission) => services.Server.User is { } user && (user.Permissions & (long)permission) != 0;
/// <summary>
/// Export "Sync": a render of this PC that asked for it is sent to the server once done (<see cref="ExportSync"/>),
/// also when it ends while the session is down: the send is queued for the saved session's server and waits for it.
/// </summary>
private void OnJobChanged(Job job)
{
if (job is not { Kind: JobKind.Render, State: JobState.Done } || Service is not { } service || services.Database is not { } db || _renders is not { } engine)
return;
var signedIn = Server;
_ = SendRenderAsync(new ExportSync(db, service, engine), job, signedIn ?? SavedServer(), signedIn is null || CanUpload);
}
/// <summary>Key of the server of the saved session (Disconnect keeps it); null without one.</summary>
private string? SavedServer() =>
services.Server.HasSavedSession && ServerAddress.TryParse(services.Settings.ServerUrl, out var address) ? SyncService.ServerKey(address) : null;
private static async Task SendRenderAsync(ExportSync exports, Job job, string? server, bool canUpload)
{
try
{
switch (await exports.SendAsync(job, server, canUpload))
{
case { Send: { } send }:
Log.Info("sync", $"{job.TargetLabel} will be sent to the server (job {send.Id})");
break;
case { Gate: var gate }:
Log.Warning("sync", $"{job.TargetLabel} asked to be sent to the server but was not ({gate})");
break;
}
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
// Nobody awaits this: the render itself succeeded, and the send can be asked for again on the Server screen.
Log.Warning("sync", $"The render {job.TargetLabel} could not be queued for the server", ex);
}
}
private async Task SwitchAsync(Task previous, Credentials? wanted)
{
await previous;
+11 -3
View File
@@ -157,12 +157,20 @@ public static class SyncText
/// What differs, one line per setting or sequence field in project order ("Deflicker window 41 here, 33 on the
/// server", "Tags differ"), at most <paramref name="max"/>.
/// </summary>
public static IReadOnlyList<string> Conflict(SyncEntry entry, int max)
public static IReadOnlyList<string> Conflict(SyncEntry entry, int max) => entry is { Local: { } local, Link.ConflictRemote: { } theirs }
? Differences(SyncRules.Differences(SyncPayload.Of(local), theirs, 64), max)
: [];
/// <summary>
/// One line per setting or sequence field among <paramref name="differences"/> ("Deflicker window 41 here, 33 on the
/// server", "Tags differ"), at most <paramref name="max"/>; the editor's settings conflicts read the same.
/// </summary>
public static IReadOnlyList<string> Differences(IEnumerable<SettingsDifference> differences, int max)
{
if (entry is not { Local: { } local, Link.ConflictRemote: { } theirs }) return [];
ArgumentNullException.ThrowIfNull(differences);
var lines = new List<string>();
var shown = new HashSet<string>(StringComparer.Ordinal);
foreach (var difference in SyncRules.Differences(SyncPayload.Of(local), theirs, 64))
foreach (var difference in differences)
{
var (key, field) = Setting(difference.Path);
if (!shown.Add(key)) continue;
+83 -4
View File
@@ -19,9 +19,10 @@ namespace Titano.App.Shell;
/// <summary>
/// <c>Titano.exe --capture &lt;dir&gt;</c>: renders every client screen at 1440×900 in the dark and light themes to
/// <c>&lt;screen&gt;-&lt;theme&gt;.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
/// one, then the sync table with transfers, a conflict and its confirmation), plus the Library, the editor's Exposure
/// tab and the import plan in Arabic (<c>*-rtl-dark.png</c>, right to left), for visual review and phase reports
/// (BRIEF §20.2), then exits.
/// one, then the sync table with transfers, a conflict and its confirmation, then the sequence editor on an archive
/// sequence and on a server sequence with proxies, its server job and a read-only account), plus the Library, the
/// editor's Exposure tab and the import plan in Arabic (<c>*-rtl-dark.png</c>, right to left), for visual review and
/// phase reports (BRIEF §20.2), then exits.
/// </summary>
public static class ScreenCapture
{
@@ -144,6 +145,7 @@ public static class ScreenCapture
}
written += await CaptureEditorAsync(window, shell, sample, directory);
written += await CaptureRemoteEditorAsync(window, shell, sample, directory);
Log.Info("capture", $"{written} screenshot(s) written to {Path.GetFullPath(directory)}");
if (written == 0) Environment.ExitCode = 1;
}
@@ -207,7 +209,8 @@ public static class ScreenCapture
/// <summary>
/// The sequence editor on the synthetic sunset: every section in both themes (<c>sequence-&lt;tab&gt;-&lt;theme&gt;.png</c>,
/// the Camera tab with a keyframe selected, the Export tab as Export.html with the crop mask and no compare), then
/// the preview overlays, the waveform, the "what changed" toast of Optimise all and the busy state.
/// the preview overlays, the waveform, the "what changed" toast of Optimise all, the Export tab of the sequence once
/// the server has it (Sync on) with two "Save both" copies to restore, and the busy state.
/// </summary>
private static async Task<int> CaptureEditorAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
{
@@ -247,6 +250,23 @@ public static class ScreenCapture
foreach (var toast in window.Toasts.Toasts.ToList()) window.Toasts.Dismiss(toast);
}
// The server has the sequence (Sync can be ticked) and two copies of this PC's settings were kept by "Save both".
await sample.KeepEditorCopiesAsync(id);
await editor.Session.ReloadAsync();
await editor.RefreshSyncGateAsync();
var export = editor.Tabs.OfType<ExportTab>().Single();
export.SyncToServer = true;
editor.SelectedTab = export;
editor.IsCompare = false;
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
written += await SaveEditorAsync(window, editor, directory, "sequence-export-copies", theme);
}
export.SyncToServer = false;
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
written += await CaptureRightToLeftAsync(window, shell, editor, directory);
// Last, as it stays: an analysis of the sequence running (settings disabled, viewing tools live).
@@ -295,6 +315,65 @@ public static class ScreenCapture
return written;
}
/// <summary>
/// A server sequence open with this PC's proxies (Sunrise over Superga, cached by the sync captures): the server in
/// the header, the preview from the proxies, the project from the server (<c>sequence-remote</c>); its Export tab,
/// where the server picks the encoder and keeps the renders (<c>sequence-remote-export</c>); a render running on the
/// server with its bar and Cancel (<c>sequence-remote-running</c>); then, last as it stays, the sequence opened by an
/// account without the Edit right (<c>sequence-remote-readonly</c>).
/// </summary>
private static async Task<int> CaptureRemoteEditorAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
{
var written = 0;
var id = sample.ProxiedSequenceId;
shell.OpenSequence(id);
await shell.Sequence.OpenAsync(id);
if (shell.Sequence.Editor is not { IsRemote: true } editor)
{
Log.Warning("capture", "The server sequence did not open in the editor");
return 0;
}
DismissToasts(window);
var export = editor.Tabs.OfType<ExportTab>().Single();
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
written += await SaveEditorAsync(window, editor, directory, "sequence-remote", theme);
editor.SelectedTab = export;
editor.IsCompare = false;
written += await SaveEditorAsync(window, editor, directory, "sequence-remote-export", theme);
}
sample.RunServerRender();
await editor.AttachJobsAsync();
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
written += await SaveEditorAsync(window, editor, directory, "sequence-remote-running", theme);
}
sample.EndServerJobs();
await sample.RestrictAccountAsync();
await shell.Sequence.OpenAsync(id, reload: true);
if (shell.Sequence.Editor is not { IsReadOnly: true } viewer)
{
Log.Warning("capture", "The server sequence did not open read-only");
return written;
}
DismissToasts(window);
viewer.SelectedTab = viewer.Exposure;
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
written += await SaveEditorAsync(window, viewer, directory, "sequence-remote-readonly", theme);
}
return written;
}
private static async Task<int> SaveEditorAsync(Window window, EditorViewModel editor, string directory, string screen, AppTheme theme)
{
await Settle(window);
@@ -158,6 +158,12 @@ public sealed record ExportSettings
/// <summary>Presets queued together by "Render another preset" / batch.</summary>
public IReadOnlyList<string> Batch { get; init; } = [];
/// <summary>
/// Export "Sync": a render made on this PC is sent to the server the sequence is linked to once it is done. Off
/// unless chosen, as renders travel on request (BRIEF §14.5).
/// </summary>
public bool SyncToServer { get; init; }
}
/// <summary>
+75
View File
@@ -0,0 +1,75 @@
using System.Text;
using Titano.Core.Model;
using Titano.Protocol;
namespace Titano.Data.Jobs;
/// <summary>
/// Wire names of job kinds, states and priorities in API v1: kebab-case (<c>deep-analyse</c>) and lower-case
/// (<c>running</c>). The server writes them; clients read the server's jobs back with <see cref="FromDto"/>.
/// </summary>
public static class JobWire
{
public static string Kind(JobKind kind)
{
var name = kind.ToString();
var sb = new StringBuilder(name.Length + 4);
for (var i = 0; i < name.Length; i++)
{
if (i > 0 && char.IsUpper(name[i])) sb.Append('-');
sb.Append(char.ToLowerInvariant(name[i]));
}
return sb.ToString();
}
public static bool TryParseKind(string? text, out JobKind kind) => TryParse(text, Kind, out kind);
public static string State(JobState state) => state.ToString().ToLowerInvariant();
public static bool TryParseState(string? text, out JobState state) => TryParse(text, State, out state);
public static string Priority(JobPriority priority) => priority.ToString().ToLowerInvariant();
public static bool TryParsePriority(string? text, out JobPriority priority) => TryParse(text, Priority, out priority);
/// <summary>A server job as the client's job model; null for a kind or state this build does not know.</summary>
public static Job? FromDto(JobDto dto)
{
ArgumentNullException.ThrowIfNull(dto);
if (!TryParseKind(dto.Kind, out var kind) || !TryParseState(dto.State, out var state)) return null;
return new Job
{
Id = dto.Id,
Kind = kind,
TargetIds = dto.TargetIds,
TargetLabel = dto.TargetLabel,
State = state,
Priority = TryParsePriority(dto.Priority, out var priority) ? priority : JobPriority.Normal,
ProgressDone = dto.ProgressDone,
ProgressTotal = dto.ProgressTotal,
ItemsPerSecond = dto.ItemsPerSecond,
Eta = dto.EtaSeconds is { } eta ? TimeSpan.FromSeconds(eta) : null,
LogTail = dto.LogTail,
NodeId = dto.NodeId,
Attempts = dto.Attempts,
Error = dto.Error,
Created = dto.Created,
Started = dto.Started,
Finished = dto.Finished,
};
}
private static bool TryParse<T>(string? text, Func<T, string> name, out T value) where T : struct, Enum
{
foreach (var candidate in Enum.GetValues<T>())
{
if (string.Equals(name(candidate), text, StringComparison.OrdinalIgnoreCase))
{
value = candidate;
return true;
}
}
value = default;
return false;
}
}
+26
View File
@@ -0,0 +1,26 @@
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Data.Repositories;
namespace Titano.Data.Processing;
/// <summary>
/// The index's hero frame (<see cref="Sequence.HeroFrameId"/>, the frame the Library shows) follows the project's hero
/// (<see cref="ProjectSettings.HeroFrame"/>, a frame index; frame indices are positions).
/// </summary>
public static class HeroFrame
{
/// <summary>
/// The <see cref="SequenceEdit.HeroFrameId"/> of a project whose hero went from <paramref name="before"/> to
/// <paramref name="after"/>: null when it did not change, else the frame at the new index, or <see cref="Guid.Empty"/>
/// (the first frame shows) when there is none.
/// </summary>
public static async Task<Guid?> EditAsync(TitanoDatabase db, Guid sequenceId, int? before, int? after, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(db);
if (before == after) return null;
if (after is not >= 0) return Guid.Empty;
var frames = await db.Frames.ListBySequenceAsync(sequenceId, after.Value - 1, 1, cancellationToken).ConfigureAwait(false);
return frames is [{ } frame] && frame.Index == after ? frame.Id : Guid.Empty;
}
}
+1 -1
View File
@@ -110,7 +110,7 @@ public static class ProcessingJobs
/// <summary>The parameters of a render job and the export they select.</summary>
/// <exception cref="InvalidDataException">The job has no valid render parameters.</exception>
internal static (RenderJobParameters Parameters, ExportSettings Export) ReadRender(string? parametersJson)
public static (RenderJobParameters Parameters, ExportSettings Export) ReadRender(string? parametersJson)
{
var parameters = ReadParameters(parametersJson);
return (parameters, ReadExport(parameters.PresetJson));
+6 -3
View File
@@ -48,11 +48,14 @@ internal sealed class ProjectStore(TitanoDatabase db, SequenceWriter writer)
var row = await db.Sequences.GetAsync(sequence.Id, cancellationToken).ConfigureAwait(false) ?? sequence;
var current = Read(row, folder);
var before = current.ToJson();
var after = edit(current).ToJson();
var edited = edit(current);
var after = edited.ToJson();
if (after == before) return false;
AtomicFile.WriteAllText(folder.ProjectPath, after);
var result = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { SettingsJson = after }, row.SettingsVersion, cancellationToken)
.ConfigureAwait(false);
// The Library shows the project's hero frame (advice fills it, a sync takes another PC's).
var hero = await HeroFrame.EditAsync(db, sequence.Id, current.HeroFrame, edited.HeroFrame, cancellationToken).ConfigureAwait(false);
var result = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { SettingsJson = after, HeroFrameId = hero }, row.SettingsVersion,
cancellationToken).ConfigureAwait(false);
// A conflict means the API changed the settings meanwhile: apply the edit again on top of them.
if (result.Outcome != SequenceEditOutcome.Conflict || attempt == Attempts) return true;
}
@@ -74,6 +74,12 @@ public sealed record SequenceEdit
public int? Rating { get; init; }
public string? Notes { get; init; }
public string? SettingsJson { get; init; }
/// <summary>
/// The frame the Library shows for the sequence (the project's hero frame); <see cref="Guid.Empty"/> clears it, so
/// the first frame shows. A frame of another sequence is ignored.
/// </summary>
public Guid? HeroFrameId { get; init; }
}
public enum SequenceEditOutcome
@@ -233,12 +239,17 @@ public sealed class SequenceRepository
if (current is null) return new SequenceEditResult(SequenceEditOutcome.NotFound, null);
if (expectedSettingsVersion is { } expected && expected != current.SettingsVersion)
return new SequenceEditResult(SequenceEditOutcome.Conflict, current);
var hero = current.HeroFrameId;
if (edit.HeroFrameId == Guid.Empty) hero = null;
else if (edit.HeroFrameId is { } frame && await session.ScalarAsync<long>("SELECT count(*) FROM frames WHERE id = $1 AND sequence_id = $2",
[frame, id], cancellationToken).ConfigureAwait(false) > 0) hero = frame;
var updated = current with
{
Title = edit.Title is null ? current.Title : NullIfEmpty(edit.Title),
Notes = edit.Notes is null ? current.Notes : NullIfEmpty(edit.Notes),
Rating = edit.Rating ?? current.Rating,
SettingsJson = edit.SettingsJson ?? current.SettingsJson,
HeroFrameId = hero,
SettingsVersion = current.SettingsVersion + 1,
UpdatedAt = DateTimeOffset.UtcNow,
};
+3 -1
View File
@@ -20,8 +20,10 @@ namespace Titano.Data.Sync;
/// </summary>
public sealed class RemoteSequence
{
internal RemoteSequence(string server, Sequence sequence, IReadOnlyList<Frame> frames, IReadOnlyList<string?> files)
/// <param name="files">Absolute path of each frame's proxy in frame order; null (and the frame flagged missing) when it is not cached.</param>
public RemoteSequence(string server, Sequence sequence, IReadOnlyList<Frame> frames, IReadOnlyList<string?> files)
{
if (files.Count != frames.Count) throw new ArgumentException("One file entry per frame is required.", nameof(files));
Server = server;
Sequence = sequence;
Frames = frames;
+23 -1
View File
@@ -270,6 +270,10 @@ public sealed class SyncService
/// <summary>A server sequence from the proxy cache, for the editor; null when its proxies were never fetched or were cleared.</summary>
public RemoteSequence? OpenRemote(string server, Guid remoteId) => Proxies.Load(server, remoteId);
/// <summary>The link of a local sequence to a sequence of <paramref name="server"/>; null when the server does not have it.</summary>
public Task<SyncLink?> LinkOfAsync(string server, Guid localId, CancellationToken cancellationToken = default) =>
_links.FindByLocalAsync(server, localId, cancellationToken);
// ---------------- Engine ----------------
/// <summary>Server ids of the sequences an upload or download job is working on.</summary>
@@ -649,7 +653,25 @@ public sealed class SyncService
return path;
}
internal static string SavedCopyName(DateTime localTime) => string.Create(CultureInfo.InvariantCulture, $"project.this-pc-{localTime:yyyyMMdd-HHmmss}.json");
/// <summary>The file name of a "Save both" copy kept at <paramref name="localTime"/>.</summary>
public static string SavedCopyName(DateTime localTime) =>
string.Create(CultureInfo.InvariantCulture, $"{SavedCopyPrefix}{localTime.ToString(SavedCopyTimeFormat, CultureInfo.InvariantCulture)}.json");
/// <summary>File name pattern of "Save both" copies in a sequence's <c>.titano</c> folder.</summary>
public const string SavedCopyPattern = SavedCopyPrefix + "*.json";
private const string SavedCopyPrefix = "project.this-pc-";
private const string SavedCopyTimeFormat = "yyyyMMdd-HHmmss";
/// <summary>When a "Save both" copy was kept (local time, from its name); null for a name of another shape.</summary>
public static DateTime? SavedCopyTime(string fileName)
{
var name = Path.GetFileNameWithoutExtension(fileName);
return name.StartsWith(SavedCopyPrefix, StringComparison.Ordinal)
&& DateTime.TryParseExact(name[SavedCopyPrefix.Length..], SavedCopyTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out var time)
? time
: null;
}
private async Task ForgetAsync(SyncLink link, CancellationToken cancellationToken)
{
+20 -1
View File
@@ -99,6 +99,21 @@ public sealed class TitanoClient : IDisposable
public Task<SequenceManifest> GetManifestAsync(Guid id, CancellationToken ct = default) =>
GetAsync($"api/v1/sequences/{id}/manifest", ProtocolJson.Default.SequenceManifest, ct);
/// <summary>The full deep-analysis report of a sequence (<c>analysis.json</c>); null when it was never deep-analysed.</summary>
public async Task<string?> GetAnalysisReportAsync(Guid sequenceId, CancellationToken ct = default)
{
using var response = await SendRawAsync(new HttpRequestMessage(HttpMethod.Get, $"api/v1/sequences/{sequenceId}/analysis/report"), ct).ConfigureAwait(false);
try
{
await EnsureSuccessAsync(response, ct).ConfigureAwait(false);
}
catch (TitanoApiException ex) when (ex.Status == HttpStatusCode.NotFound && ex.Error.Details == "analysis")
{
return null;
}
return await response.Content.ReadAsStringAsync(ct).ConfigureAwait(false);
}
public Task<Page<FrameDto>> ListFramesAsync(Guid sequenceId, string? cursor = null, int limit = 1000, CancellationToken ct = default) =>
GetAsync($"api/v1/sequences/{sequenceId}/frames?limit={limit}{Q("cursor", cursor)}", ProtocolJson.Default.PageFrameDto, ct);
@@ -258,7 +273,11 @@ public sealed class TitanoClient : IDisposable
// ---------------- Jobs and render nodes ----------------
public Task<Page<JobDto>> ListJobsAsync(string? state = null, string? cursor = null, CancellationToken ct = default) =>
GetAsync($"api/v1/jobs?limit=200{Q("state", state)}{Q("cursor", cursor)}", ProtocolJson.Default.PageJobDto, ct);
ListJobsAsync(state, null, cursor, ct);
/// <summary>A page of jobs, newest first, in <paramref name="state"/> and of <paramref name="kind"/> (wire names; null for any).</summary>
public Task<Page<JobDto>> ListJobsAsync(string? state, string? kind, string? cursor, CancellationToken ct = default) =>
GetAsync($"api/v1/jobs?limit=200{Q("state", state)}{Q("kind", kind)}{Q("cursor", cursor)}", ProtocolJson.Default.PageJobDto, ct);
public Task<JobDto> CreateJobAsync(CreateJobRequest request, CancellationToken ct = default) =>
SendAsync(HttpMethod.Post, "api/v1/jobs", request, ProtocolJson.Default.CreateJobRequest, ProtocolJson.Default.JobDto, ct);
+6 -2
View File
@@ -32,14 +32,18 @@ public sealed record Page<T>(IReadOnlyList<T> Items, string? NextCursor, long? T
/// <summary><c>POST /api/v1/sequences</c>.</summary>
public sealed record CreateSequenceRequest(string? Title, string? CameraHint);
/// <summary><c>PATCH /api/v1/sequences/{id}</c>. <see cref="ExpectedSettingsVersion"/> enables conflict detection (409).</summary>
/// <summary>
/// <c>PATCH /api/v1/sequences/{id}</c>. <see cref="ExpectedSettingsVersion"/> enables conflict detection (409).
/// <see cref="HeroFrameId"/> names the frame the sequence shows (one of its own; <see cref="Guid.Empty"/> clears it).
/// </summary>
public sealed record UpdateSequenceRequest(
string? Title,
IReadOnlyList<string>? Tags,
int? Rating,
string? Notes,
string? SettingsJson,
int? ExpectedSettingsVersion);
int? ExpectedSettingsVersion,
Guid? HeroFrameId = null);
public sealed record FrameDto(
Guid Id,
@@ -1,6 +1,7 @@
using Titano.Core.Model;
using Titano.Core.Naming;
using Titano.Data;
using Titano.Data.Jobs;
using Titano.Data.Repositories;
using Titano.Protocol;
using Titano.Server.Jobs;
+1 -41
View File
@@ -1,6 +1,6 @@
using System.Text;
using System.Text.Json;
using Titano.Core.Model;
using Titano.Data.Jobs;
using Titano.Protocol;
namespace Titano.Server.Api;
@@ -48,43 +48,3 @@ public static class Dto
}
}
}
/// <summary>Wire names of job kinds, states and priorities: kebab-case (<c>deep-analyse</c>) and lower-case (<c>running</c>).</summary>
public static class JobWire
{
public static string Kind(JobKind kind)
{
var name = kind.ToString();
var sb = new StringBuilder(name.Length + 4);
for (var i = 0; i < name.Length; i++)
{
if (i > 0 && char.IsUpper(name[i])) sb.Append('-');
sb.Append(char.ToLowerInvariant(name[i]));
}
return sb.ToString();
}
public static bool TryParseKind(string? text, out JobKind kind) => TryParse(text, Kind, out kind);
public static string State(JobState state) => state.ToString().ToLowerInvariant();
public static bool TryParseState(string? text, out JobState state) => TryParse(text, State, out state);
public static string Priority(JobPriority priority) => priority.ToString().ToLowerInvariant();
public static bool TryParsePriority(string? text, out JobPriority priority) => TryParse(text, Priority, out priority);
private static bool TryParse<T>(string? text, Func<T, string> name, out T value) where T : struct, Enum
{
foreach (var candidate in Enum.GetValues<T>())
{
if (string.Equals(name(candidate), text, StringComparison.OrdinalIgnoreCase))
{
value = candidate;
return true;
}
}
value = default;
return false;
}
}
+1
View File
@@ -1,6 +1,7 @@
using System.Text.Json;
using Titano.Core.Model;
using Titano.Data;
using Titano.Data.Jobs;
using Titano.Data.Processing;
using Titano.Protocol;
using Titano.Server.Jobs;
+44 -2
View File
@@ -2,10 +2,12 @@ using System.Buffers.Text;
using System.Globalization;
using System.Text;
using System.Text.Json;
using Titano.Core.Model;
using Microsoft.AspNetCore.Mvc;
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Data;
using Titano.Data.Archiving;
using Titano.Data.Processing;
using Titano.Data.Repositories;
using Titano.Protocol;
using Titano.Server.Configuration;
@@ -37,6 +39,7 @@ public static class SequenceEndpoints
sequences.MapGet("/{id:guid}/manifest", ManifestAsync).Requires(Permissions.Read);
sequences.MapGet("/{id:guid}/frames", FramesAsync).Requires(Permissions.Read);
sequences.MapGet("/{id:guid}/analysis", AnalysisAsync).Requires(Permissions.Read);
sequences.MapGet("/{id:guid}/analysis/report", ReportAsync).Requires(Permissions.Read);
sequences.MapGet("/{id:guid}/stats", StatsAsync).Requires(Permissions.Read);
sequences.MapGet("/{id:guid}/renders", RendersAsync).Requires(Permissions.Read);
// Renders made on a client, sent on request (BRIEF §14.5); chunks go through /uploads.
@@ -125,7 +128,17 @@ public static class SequenceEndpoints
if (request.SettingsJson is not null && !IsJson(request.SettingsJson)) return ApiErrors.BadRequest(context, "invalid_settings");
var expected = request.ExpectedSettingsVersion ?? IfMatchVersion(context);
var edit = new SequenceEdit { Title = request.Title, Tags = request.Tags, Rating = request.Rating, Notes = request.Notes, SettingsJson = request.SettingsJson };
var edit = new SequenceEdit
{
Title = request.Title,
Tags = request.Tags,
Rating = request.Rating,
Notes = request.Notes,
SettingsJson = request.SettingsJson,
// A client that sends only the settings (the sync of a local copy) moves the hero frame with the project's hero.
HeroFrameId = request.HeroFrameId
?? (request.SettingsJson is { } settings ? await SettingsHeroAsync(db, id, settings, context.RequestAborted) : null),
};
var result = await db.Sequences.EditAsync(id, edit, expected, context.RequestAborted);
switch (result.Outcome)
{
@@ -245,6 +258,18 @@ public static class SequenceEndpoints
_ => ApiErrors.NotFound(context, "analysis"),
};
/// <summary>The full deep-analysis report (<c>.titano/analysis.json</c>) a client's editor shows for a server sequence.</summary>
private static async Task<IResult> ReportAsync(HttpContext context, Guid id, TitanoDatabase db, ServerArchive archive)
{
if (await db.Sequences.GetAsync(id, context.RequestAborted) is not { } sequence) return ApiErrors.NotFound(context, "sequence");
if (string.IsNullOrEmpty(sequence.Folder)) return ApiErrors.NotFound(context, "analysis");
var path = new Core.Archiving.ArchivePaths(archive.Root).Sequence(sequence.Folder).AnalysisPath;
var file = new FileInfo(path);
if (!file.Exists || file.LinkTarget is not null || !ArchivePathGuard.IsInside(archive.Root, path)) return ApiErrors.NotFound(context, "analysis");
var etag = string.Create(CultureInfo.InvariantCulture, $"a-{file.Length}-{file.LastWriteTimeUtc.Ticks}");
return FileResponses.Serve(context, file, 0, file.Length, "application/json; charset=utf-8", "no-cache", etag) ?? ApiErrors.NotFound(context, "analysis");
}
private static async Task<IResult> StatsAsync(HttpContext context, Guid id, TitanoDatabase db)
{
if (await db.Sequences.GetAsync(id, context.RequestAborted) is not { } s) return ApiErrors.NotFound(context, "sequence");
@@ -305,6 +330,22 @@ public static class SequenceEndpoints
return false;
}
/// <summary>The hero frame edit of new settings: the frame of their hero when it is not the stored settings' hero.</summary>
private static async Task<Guid?> SettingsHeroAsync(TitanoDatabase db, Guid id, string settingsJson, CancellationToken ct)
{
if (await db.Sequences.GetAsync(id, ct) is not { } current) return null;
try
{
var before = string.IsNullOrWhiteSpace(current.SettingsJson) ? null : ProjectSettings.FromJson(current.SettingsJson).HeroFrame;
return await HeroFrame.EditAsync(db, id, before, ProjectSettings.FromJson(settingsJson).HeroFrame, ct);
}
catch (Exception ex) when (ex is JsonException or InvalidDataException)
{
// Not a project of this Titano (a newer one, or free JSON): its hero is unknown here, the stored one stays.
return null;
}
}
private static bool IsJson(string text)
{
try
@@ -326,6 +367,7 @@ public static class SequenceEndpoints
if (r.Rating is not null) fields.Add("rating");
if (r.Notes is not null) fields.Add("notes");
if (r.SettingsJson is not null) fields.Add("settings");
if (r.HeroFrameId is not null) fields.Add("hero");
return string.Join(", ", fields);
}
+44 -1
View File
@@ -54,7 +54,7 @@ internal static class EditorFixture
};
var report = deep ? DeepAnalyzer.AnalyzeAsync(new Frames(sequence)).GetAwaiter().GetResult() : null;
return new SequenceContent(row, frames, project ?? new ProjectSettings(), LightAnalyzer.Analyze(frames), report, sequence.Options.Width,
sequence.Options.Height, null, []);
sequence.Options.Height, null, [], []);
}
/// <summary>Synthetic frames as the deep analysis reads them.</summary>
@@ -83,6 +83,21 @@ internal sealed class FakeSequenceSource(SyntheticSequence sequence, SequenceCon
public List<ArchiveJobRequest> Submitted { get; } = [];
/// <summary>A server sequence: renders become one job per preset.</summary>
public bool IsRemote { get; init; }
public bool IsReadOnly { get; set; }
public bool IsOutdated { get; private set; }
/// <summary>Jobs cancelled and retried through the source.</summary>
public List<Guid> Cancelled { get; } = [];
public List<Guid> Retried { get; } = [];
/// <summary>Jobs <see cref="ListJobsAsync"/> returns.</summary>
public List<Job> Jobs { get; } = [];
public int Saves { get; private set; }
public int Decodes { get; private set; }
@@ -128,5 +143,33 @@ internal sealed class FakeSequenceSource(SyntheticSequence sequence, SequenceCon
return Task.FromResult(Guid.CreateVersion7());
}
public event Action<Job>? JobChanged;
public event Action? ReadOnlyChanged;
/// <summary>The server's frames changed under the proxies (as a server sequence finds out).</summary>
public void MarkOutdated()
{
IsOutdated = IsReadOnly = true;
ReadOnlyChanged?.Invoke();
}
public Task CancelJobAsync(Guid jobId, CancellationToken cancellationToken)
{
Cancelled.Add(jobId);
return Task.CompletedTask;
}
public Task RetryJobAsync(Guid jobId, CancellationToken cancellationToken)
{
Retried.Add(jobId);
return Task.CompletedTask;
}
public Task<IReadOnlyList<Job>> ListJobsAsync(CancellationToken cancellationToken) => Task.FromResult<IReadOnlyList<Job>>([.. Jobs]);
/// <summary>A job of the sequence changed (as the engine or the server reports it).</summary>
public void Report(Job job) => JobChanged?.Invoke(job);
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
}
@@ -9,8 +9,12 @@ using Titano.App.Infrastructure;
using Titano.App.Sections;
using Titano.App.Shell;
using Titano.App.Tests.Windows;
using Titano.Core.Export;
using Titano.Core.Localization;
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Testing;
using Titano.Ui.Controls;
using Titano.Ui.Theming;
using Titano.Ui.Visuals;
@@ -139,6 +143,88 @@ public sealed class EditorSmokeTests
}
});
/// <summary>
/// A server sequence opened with this PC's proxies (the sample server's Sunrise over Superga): the header names the
/// server, the preview shows a proxy, Save to and Sync wait for the server, and Render posts a server job.
/// </summary>
[Test]
public Task AServerSequenceOpensWithItsProxies() => ScreenHost.RunAsync(async () =>
{
var environment = AppEnvironment.ForCapture();
UiLanguage.Apply("en");
ThemeManager.Apply(AppTheme.Dark);
var services = new AppServices(environment, new AppSettings { Language = "en", FirstRunCompleted = true }, () => { }, new NoDialogs());
var sample = SampleData.Configure(services);
var shell = new ShellViewModel(services);
var window = new MainWindow(shell)
{
WindowStartupLocation = WindowStartupLocation.Manual,
Left = -20000,
Top = -20000,
Width = 1200,
Height = 788,
ShowActivated = false,
ShowInTaskbar = false,
};
window.Show();
try
{
await sample.OpenEmptyAsync();
await shell.StartAsync();
await sample.FillAsync();
await services.Server.RestoreAsync();
await services.Sync.RefreshAsync();
await sample.CacheProxiesAsync();
var id = sample.ProxiedSequenceId;
shell.OpenSequence(id);
await shell.Sequence.OpenAsync(id);
var editor = Assert.NotNull(shell.Sequence.Editor);
Assert.True(editor.IsRemote);
Assert.Equal("Studio NAS", editor.RemoteText);
Assert.Equal(3, editor.FrameCount);
Assert.True(await editor.WhenIdleAsync(TimeSpan.FromSeconds(60)), "the editor settled");
await SettleAsync(window);
Assert.NotNull(editor.PreviewImage, "the preview shows a proxy");
var view = Find<SequenceView>(window).Single(v => v.IsVisible);
Assert.True(Find<StatusGlyph>(view).Any(g => g is { Kind: StatusKind.Remote, IsVisible: true, Text: "Studio NAS" }), "the header names the server");
Assert.Greater(Distinct(Render(window)), 40, "the remote editor drew almost nothing");
var export = editor.Tabs.OfType<ExportTab>().Single();
editor.SelectedTab = export;
await SettleAsync(window);
Assert.Equal(ExportSyncGate.Remote, editor.SyncGate);
Assert.False(Find<CheckBox>(view).Single(c => ReferenceEquals(c.DataContext, export) && c.IsVisible).IsEnabled, "Sync: the server's renders stay there");
Assert.False(Find<ComboBox>(view).Single(c => ReferenceEquals(c.ItemsSource, export.SaveChoices)).IsEnabled, "Save to: the server's exports folder");
Assert.True(editor.CanRender, editor.RenderBlockedReason ?? "renderable");
await editor.RenderAsync(JobPriority.User, batch: false);
var queued = Assert.Contains(await editor.Session.Source.ListJobsAsync(CancellationToken.None), _ => true);
Assert.Equal(JobKind.Render, queued.Kind);
// Without the Edit right a server sequence is only shown: every change is disabled and says why.
var content = EditorFixture.Content(EditorFixture.Sunset);
var looking = new EditorSession(new FakeSequenceSource(EditorFixture.Sunset, content) { IsRemote = true, IsReadOnly = true }, content, []);
var viewer = new EditorViewModel(shell, looking, [], EncoderHost.Client);
await using (viewer)
{
Assert.False(viewer.IsEditable);
Assert.Equal(Loc.L("Tooltips.Editor.ReadOnly"), viewer.LockedToolTip);
Assert.Equal(Loc.L("Tooltips.Editor.ReadOnly"), viewer.Frames.HeroToolTip);
Assert.False(viewer.Frames.SetHeroCommand.CanExecute(null));
Assert.False(viewer.OptimiseAllCommand.CanExecute(null));
Assert.False(viewer.AnalyseCommand.CanExecute(null));
}
}
finally
{
window.Close();
await shell.Sequence.CloseAsync();
shell.Dispose();
await services.DisposeAsync();
environment.DeleteCaptureData();
}
});
/// <summary>The measuring tool of each section has content.</summary>
private static void ExpectMeasure(SequenceView view, EditorTab tab)
{
@@ -1,12 +1,13 @@
using Titano.App.Editor;
using Titano.Core.Advice;
using Titano.Core.Imaging;
using Titano.Core.Localization;
using Titano.Core.Project;
using Titano.Testing;
namespace Titano.App.Tests.Editor;
/// <summary>Composed texts of the editor, crop margins and the waveform monitor.</summary>
/// <summary>Composed texts of the editor (the conflict prompt among them), crop margins and the waveform monitor.</summary>
public sealed class EditorTextTests
{
static EditorTextTests() => _ = EditorFixture.Sunset;
@@ -67,4 +68,21 @@ public sealed class EditorTextTests
Assert.LessOrEqual(Math.Abs(lit[0] - (LumaWaveform.Levels - 1) / 2.0), 1.0, "half grey sits halfway up");
Assert.Equal(255, waveform.Density[lit[0] * waveform.Columns], "every pixel of the column there");
}
[Test]
public void TheConflictPromptSaysWhatDiffersAndTakesTheServersValuesUnlessAsked()
{
var basis = new ProjectSettings();
var mine = basis with { Exposure = basis.Exposure with { ExposureOffsetEv = 0.5 }, HeroFrame = 3 };
var theirs = basis with { Exposure = basis.Exposure with { ExposureOffsetEv = 0.3 } };
var conflict = new ProjectConflictException("changed", theirs, ProjectMerge.Conflicts(basis, mine, theirs));
var request = EditorViewModel.ConflictRequest(conflict, "Harbour sunset", "Studio NAS");
Assert.Equal(Loc.L("Server.Conflict.Difference", Loc.L("Server.Setting.ExposureOffset"), 0.5.ToString("0.###", Loc.Culture),
0.3.ToString("0.###", Loc.Culture)), request.Detail, "only the setting both changed; the editor's value first");
Assert.Equal(Loc.L("Server.Sync.Action.TakeServer"), request.SafeText, "the safe default loses nothing: Ctrl+Z brings the editor's values back");
Assert.Equal(Loc.L("Server.Sync.Action.KeepMine"), request.ActionText);
Assert.True(request.IsDestructive, "Keep mine overwrites the server's values");
Assert.Contains("Studio NAS", request.Heading);
}
}
@@ -0,0 +1,76 @@
using System.IO;
using Titano.App.Editor;
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Data;
using Titano.Data.Archiving;
using Titano.Data.Jobs;
using Titano.Data.Processing;
using Titano.Data.Sync;
using Titano.Testing;
namespace Titano.App.Tests.Editor;
/// <summary>Export "Sync" (Export.html): when it applies, how the project remembers it, and the send it queues after a render.</summary>
public sealed class ExportSyncTests(TestContext context)
{
private const string Server = "https://nas.test:8443";
[Test]
public void TheOptionSaysWhyItCannotBeUsed()
{
Assert.Equal(ExportSyncGate.Available, ExportSync.Gate(false, Server, linked: true, canUpload: true));
Assert.Equal(ExportSyncGate.Remote, ExportSync.Gate(true, Server, linked: true, canUpload: true));
Assert.Equal(ExportSyncGate.SignedOut, ExportSync.Gate(false, null, linked: false, canUpload: false));
Assert.Equal(ExportSyncGate.NotLinked, ExportSync.Gate(false, Server, linked: false, canUpload: true));
Assert.Equal(ExportSyncGate.NoUpload, ExportSync.Gate(false, Server, linked: true, canUpload: false));
}
[Test]
public void TheProjectRemembersTheChoiceAndOlderProjectsReadItOff()
{
Assert.False(new ProjectSettings().Export.SyncToServer, "renders travel on request");
Assert.False(ProjectSettings.FromJson("""{"export":{"nameTemplate":"{title}"}}""").Export.SyncToServer);
var chosen = new ProjectSettings { Export = new ExportSettings { SyncToServer = true } };
Assert.Contains("\"syncToServer\": true", chosen.ToJson());
Assert.True(ProjectSettings.FromJson(chosen.ToJson()).Export.SyncToServer);
}
[Test]
public async Task AFinishedRenderIsSentOnlyWhenAskedLinkedAndAllowed()
{
var directory = context.CreateTempDirectory("export-sync");
await using var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(directory, "index.db")));
var archives = new ArchiveService(db, new ArchiveServiceOptions { Owner = "test" });
var archive = await archives.CreateAsync(Path.Combine(directory, "archive"), "Test");
var sequence = new Sequence { Id = Guid.CreateVersion7(), ArchiveId = archive.Id, Title = "Harbour sunset", Folder = "Harbour", FrameCount = 1 };
await db.Sequences.UpsertAsync(sequence);
var sync = new SyncService(db, archives, new SyncOptions { ProxyCacheDirectory = Path.Combine(directory, "proxies") });
await using var engine = new JobEngine(db, [], new JobEngineOptions { WorkerId = "test" });
var exports = new ExportSync(db, sync, engine);
Job Render(bool syncToServer, JobState state = JobState.Done) => new()
{
Id = Guid.CreateVersion7(),
Kind = JobKind.Render,
TargetIds = [sequence.Id],
ParametersJson = ProcessingJobs.Render(sequence, new ExportSettings { SyncToServer = syncToServer }, 1920, 1080).ParametersJson,
State = state,
};
Assert.Equal(ExportSyncGate.NotLinked, (await exports.SendAsync(Render(true), Server, canUpload: true))?.Gate, "the server does not have the sequence");
await sync.LinkAsync(Server, Guid.CreateVersion7(), sequence.Id);
Assert.Null(await exports.SendAsync(Render(false), Server, canUpload: true), "the export did not ask for it");
Assert.Equal(ExportSyncGate.SignedOut, (await exports.SendAsync(Render(true), null, canUpload: true))?.Gate, "no session, saved or open");
Assert.Equal(ExportSyncGate.NoUpload, (await exports.SendAsync(Render(true), Server, canUpload: false))?.Gate, "no Upload right");
Assert.Null(await exports.SendAsync(Render(true, JobState.Failed), Server, canUpload: true), "nothing was rendered");
var result = Assert.NotNull(await exports.SendAsync(Render(true), Server, canUpload: true));
Assert.Equal(ExportSyncGate.Available, result.Gate);
var send = Assert.NotNull(result.Send);
Assert.Equal(JobKind.UploadCommit, send.Kind);
Assert.Equal(SyncTransferKind.SendExports, SyncService.TransferKind(send));
Assert.SequenceEqual([sequence.Id], send.TargetIds);
Assert.Equal(send.Id, (await exports.SendAsync(Render(true), Server, canUpload: true))?.Send?.Id, "a send already waiting takes the next render too");
}
}
@@ -0,0 +1,188 @@
using System.Net;
using System.Runtime.CompilerServices;
using System.Threading.Channels;
using Titano.App.Editor;
using Titano.Core.Model;
using Titano.Protocol;
using Titano.Protocol.Client;
namespace Titano.App.Tests.Editor;
/// <summary>
/// One server sequence as the API serves it to an editor: its frames, settings with a version that refuses stale edits
/// (409), recorded edits and posted jobs (with their priority, cancel and retry), jobs other clients run, an analysis
/// report and an event stream the test feeds.
/// </summary>
internal sealed class FakeRemoteSequenceApi(Sequence sequence, IReadOnlyList<Guid> frames) : IRemoteSequenceApi
{
private readonly Lock _gate = new();
private readonly Channel<ServerEvent> _events = Channel.CreateUnbounded<ServerEvent>();
/// <summary>The server's frames in order (another list when frames are added or removed on the server).</summary>
public IReadOnlyList<Guid> Frames { get; set; } = frames;
public int FramesVersion { get; set; } = 1;
public string? SettingsJson { get; set; }
public int SettingsVersion { get; set; } = 3;
public string? Report { get; set; }
public bool Gone { get; set; }
/// <summary>Every edit the server accepted or refused, in order.</summary>
public List<(UpdateSequenceRequest Request, bool Accepted)> Edits { get; } = [];
public List<CreateJobRequest> Posted { get; } = [];
/// <summary>Priorities set after jobs were posted (job, wire name).</summary>
public List<(Guid Job, string Priority)> Priorities { get; } = [];
public Dictionary<Guid, JobDto> Jobs { get; } = [];
/// <summary>Thrown by the next read of a job (a failure the editor's event listener does not expect).</summary>
public Exception? FailNextJobRead { get; set; }
/// <summary>Thrown by the next edit before it reaches the server (the connection dropped).</summary>
public Exception? FailNextEdit { get; set; }
/// <summary>Someone else edits the settings before each of the next edits reaches the server (it is refused with 409).</summary>
public Queue<Func<string?, string>> EditsBefore { get; } = new();
public bool Disposed { get; private set; }
/// <summary>A job of the server, as <c>GET /jobs/{id}</c> returns it.</summary>
public JobDto Job(Guid id, string kind, string state, Guid? target = null, long done = 0, long total = 0) =>
new(id, kind, [target ?? sequence.Id], sequence.DisplayTitle, state, "user", done, total, null, null, null, null, 0, null, DateTimeOffset.UtcNow,
state == "queued" ? null : DateTimeOffset.UtcNow, state is "done" or "failed" ? DateTimeOffset.UtcNow : null);
public void Publish(ServerEvent e) => _events.Writer.TryWrite(e);
public Task<SequenceDto> GetSequenceAsync(Guid id, CancellationToken cancellationToken)
{
lock (_gate) return Task.FromResult(Dto(id));
}
public Task<SequenceManifest> GetManifestAsync(Guid id, CancellationToken cancellationToken)
{
lock (_gate)
{
Check(id);
return Task.FromResult(new SequenceManifest(id, FramesVersion, SettingsVersion, SettingsJson, [],
[.. Frames.Select((frame, i) => new ManifestFrame(frame, i, $"IMG_{i:0000}.JPG", 1_000, "00", true, true))], [
new RenderDto(Guid.CreateVersion7(), "4K archive", "hevc", 3840, 2160, 24, 5, 2_000_000_000, DateTimeOffset.UtcNow.AddDays(-1), "studio-pc"),
]));
}
}
public Task<SequenceDto> UpdateSequenceAsync(Guid id, UpdateSequenceRequest request, CancellationToken cancellationToken)
{
lock (_gate)
{
Check(id);
if (FailNextEdit is { } failure)
{
FailNextEdit = null;
throw failure;
}
if (EditsBefore.TryDequeue(out var theirs))
{
SettingsJson = theirs(SettingsJson);
SettingsVersion++;
}
if (request.ExpectedSettingsVersion is { } expected && expected != SettingsVersion)
{
Edits.Add((request, false));
throw new TitanoApiException(HttpStatusCode.Conflict, new ApiError("settings_conflict", "changed", SettingsVersion.ToString()));
}
Edits.Add((request, true));
SettingsJson = request.SettingsJson ?? SettingsJson;
SettingsVersion++;
return Task.FromResult(Dto(id));
}
}
public Task<string?> GetAnalysisReportAsync(Guid id, CancellationToken cancellationToken)
{
lock (_gate)
{
Check(id);
return Task.FromResult(Report);
}
}
public Task<JobDto> CreateJobAsync(CreateJobRequest request, CancellationToken cancellationToken)
{
lock (_gate)
{
Posted.Add(request);
var job = Job(Guid.CreateVersion7(), request.Kind, "queued", request.Target[0]);
Jobs[job.Id] = job;
return Task.FromResult(job);
}
}
public Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken)
{
lock (_gate)
{
if (FailNextJobRead is { } failure)
{
FailNextJobRead = null;
throw failure;
}
return Jobs.TryGetValue(id, out var job)
? Task.FromResult(job)
: throw new TitanoApiException(HttpStatusCode.NotFound, new ApiError("not_found", "job", "job"));
}
}
public Task<IReadOnlyList<JobDto>> ListActiveJobsAsync(CancellationToken cancellationToken)
{
lock (_gate) return Task.FromResult<IReadOnlyList<JobDto>>([.. Jobs.Values.Where(j => j.State is "queued" or "running" or "paused")]);
}
public Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken) =>
Change(id, job => job with { State = "cancelled", Finished = DateTimeOffset.UtcNow });
public Task<JobDto> RetryJobAsync(Guid id, CancellationToken cancellationToken) => Change(id, job => job with { State = "queued", Error = null, Finished = null });
public Task<JobDto> SetJobPriorityAsync(Guid id, string priority, CancellationToken cancellationToken)
{
lock (_gate) Priorities.Add((id, priority));
return Change(id, job => job with { Priority = priority });
}
public async IAsyncEnumerable<ServerEvent> EventsAsync([EnumeratorCancellation] CancellationToken cancellationToken)
{
while (await _events.Reader.WaitToReadAsync(cancellationToken))
{
while (_events.Reader.TryRead(out var e)) yield return e;
}
}
public void Dispose() => Disposed = true;
private SequenceDto Dto(Guid id)
{
Check(id);
return new SequenceDto(id, sequence.Title, sequence.DisplayTitle, sequence.Folder, sequence.CameraMake, sequence.CameraModel, null,
sequence.FirstCapture, sequence.LastCapture, sequence.FrameCount, sequence.MedianInterval, 0, (long)SequenceStatus.ProxiesBuilt, 1, null, [], 0,
null, SettingsVersion, 1, 0, null, DateTimeOffset.UtcNow);
}
private Task<JobDto> Change(Guid id, Func<JobDto, JobDto> change)
{
lock (_gate)
{
if (!Jobs.TryGetValue(id, out var job)) throw new TitanoApiException(HttpStatusCode.NotFound, new ApiError("not_found", "job", "job"));
return Task.FromResult(Jobs[id] = change(job));
}
}
private void Check(Guid id)
{
if (Gone || id != sequence.Id) throw new TitanoApiException(HttpStatusCode.NotFound, new ApiError("not_found", "gone", "sequence"));
}
}
@@ -101,6 +101,42 @@ public sealed class ProjectStoreTests(TestContext context)
}
}
[Test]
public async Task SetHeroReachesTheLibraryThumbnail()
{
var (db, sequenceId, root) = await ArchiveAsync(6);
await using (db)
{
await using var source = new LocalSequenceSource(db, sequenceId, DecoderFactory.CreateClient(null), null,
new ArchiveServiceOptions { Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) });
var changed = new List<Sequence>();
source.HeroChanged += changed.Add;
var content = await source.LoadAsync(context.Cancellation);
var session = new EditorSession(source, content, [], TimeSpan.FromMilliseconds(20));
await using (session)
{
Assert.True(session.SetHero(4));
Assert.True(await session.FlushAsync());
Assert.Equal(content.Frames[4].Id, (await db.Sequences.GetAsync(sequenceId))!.HeroFrameId, "the index names the hero frame");
Assert.Equal(content.Frames[4].Id, Assert.Contains(changed, _ => true).HeroFrameId, "the Library is told");
session.Edit(p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.2 } });
Assert.True(await session.FlushAsync());
Assert.Count(1, changed);
Assert.True(session.Undo());
Assert.True(session.Undo());
Assert.True(await session.FlushAsync());
Assert.Null((await db.Sequences.GetAsync(sequenceId))!.HeroFrameId, "undoing Set hero brings back the first frame");
Assert.Count(2, changed);
}
// "Save both" copies kept by a sync conflict are listed with the sequence.
File.WriteAllText(Path.Combine(root, "Synthetic", ".titano", "project.this-pc-20261003-142200.json"), new ProjectSettings().ToJson());
Assert.Equal(new DateTime(2026, 10, 3, 14, 22, 0), Assert.Contains((await source.LoadAsync(context.Cancellation)).SavedCopies, _ => true).SavedAt);
}
}
[Test]
public async Task ASaveThatDoesNotReachTheIndexThrows()
{
@@ -0,0 +1,559 @@
using System.IO;
using System.Net.Http;
using Titano.App.Editor;
using Titano.Core.Codecs.Jpeg;
using Titano.Core.Diagnostics.Synthetic;
using Titano.Core.Imaging;
using Titano.Core.Imaging.Decoders;
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Data.Processing;
using Titano.Data.Sync;
using Titano.Protocol;
using Titano.Testing;
namespace Titano.App.Tests.Editor;
/// <summary>
/// A server sequence in the editor (BRIEF §14.5): proxies from the cache, the project from the server with its
/// version, saves that merge a change made meanwhile on the server, and analyses and renders posted as server jobs.
/// </summary>
public sealed class RemoteSequenceSourceTests(TestContext context)
{
private const string Server = "https://nas.test:8443";
[Test]
public async Task TheProjectComesFromTheServerAndFramesFromTheProxies()
{
var (source, api, _) = Open(frames: 6, cached: 5);
await using (source)
{
api.SettingsJson = new ProjectSettings { Exposure = new ExposureSettings { ExposureOffsetEv = 0.4 } }.ToJson();
var content = await source.LoadAsync(context.Cancellation);
Assert.True(source.IsRemote);
Assert.Equal(6, content.Count);
Assert.Equal(0.4, content.Project.Exposure.ExposureOffsetEv);
Assert.Equal(3, content.Sequence.SettingsVersion);
Assert.Null(content.ExportsFolder, "renders of a server sequence are not on this PC");
Assert.Equal(string.Empty, content.Renders.Single().OutputPath);
Assert.Empty(content.SavedCopies);
Assert.Null(content.Deep, "never analysed on the server");
using (var frame = await source.DecodeAsync(2, 32, DecodePurpose.Thumbnail, context.Cancellation))
{
Assert.NotNull(frame);
Assert.LessOrEqual(Math.Max(frame!.Width, frame.Height), 32);
}
Assert.Null(await source.DecodeAsync(5, 32, DecodePurpose.Render, context.Cancellation), "a frame without a cached proxy");
Assert.Null(await source.DecodeAsync(9, 32, DecodePurpose.Render, context.Cancellation));
}
}
[Test]
public async Task TheServersAnalysisIsUsedWhenItDescribesTheseFrames()
{
var sunset = EditorFixture.Sequence(8);
var (source, api, _) = Open(sunset);
await using (source)
{
api.Report = EditorFixture.Content(sunset).Deep!.ToJson();
Assert.NotNull((await source.LoadAsync(context.Cancellation)).Deep);
api.Report = EditorFixture.Content(EditorFixture.Sequence(9)).Deep!.ToJson();
Assert.Null((await source.LoadAsync(context.Cancellation)).Deep, "a report of other frames is not shown");
}
}
[Test]
public async Task SavesSendTheVersionTheyWereMadeFrom()
{
var (source, api, _) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
var first = content.Project with { Exposure = content.Project.Exposure with { ExposureOffsetEv = 0.5 } };
var stored = await source.SaveProjectAsync(first, content.Project, context.Cancellation);
Assert.True(ProjectMerge.SameValues(first, stored));
var second = stored with { Exposure = stored.Exposure with { ExposureOffsetEv = 0.7 } };
await source.SaveProjectAsync(second, stored, context.Cancellation);
Assert.SequenceEqual([3, 4], api.Edits.Select(e => e.Request.ExpectedSettingsVersion ?? -1));
Assert.True(api.Edits.All(e => e.Accepted));
Assert.Equal(5, api.SettingsVersion);
Assert.Equal(0.7, ProjectSettings.FromJson(api.SettingsJson!).Exposure.ExposureOffsetEv);
Assert.Null(api.Edits[0].Request.Title, "only the settings travel");
Assert.Null(api.Edits[0].Request.Tags);
// Nothing changed, nothing sent.
Assert.True(ProjectMerge.SameValues(second, await source.SaveProjectAsync(second, second, context.Cancellation)));
Assert.Count(2, api.Edits);
}
}
[Test]
public async Task AChangeMadeOnTheServerMeanwhileIsMergedNotOverwritten()
{
var (source, api, _) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
api.EditsBefore.Enqueue(json =>
{
var theirs = ProjectSettings.FromJson(json ?? "{}");
return (theirs with { Camera = theirs.Camera with { OffsetY = -0.2 } }).ToJson();
});
var mine = content.Project with { Exposure = content.Project.Exposure with { ExposureOffsetEv = 0.5 } };
var merged = await source.SaveProjectAsync(mine, content.Project, context.Cancellation);
Assert.Equal(0.5, merged.Exposure.ExposureOffsetEv);
Assert.Equal(-0.2, merged.Camera.OffsetY, "the server's change is kept");
Assert.SequenceEqual([false, true], api.Edits.Select(e => e.Accepted), "the 409 is followed by a merged edit");
Assert.Equal(4, api.Edits[1].Request.ExpectedSettingsVersion);
var stored = ProjectSettings.FromJson(api.SettingsJson!);
Assert.Equal(0.5, stored.Exposure.ExposureOffsetEv);
Assert.Equal(-0.2, stored.Camera.OffsetY);
}
}
[Test]
public async Task ASettingBothChangedWaitsForTheUsersChoice()
{
var (source, api, _) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
api.EditsBefore.Enqueue(json =>
{
var theirs = ProjectSettings.FromJson(json ?? "{}");
return (theirs with { Exposure = theirs.Exposure with { ExposureOffsetEv = 0.3 } }).ToJson();
});
var mine = content.Project with { Exposure = content.Project.Exposure with { ExposureOffsetEv = 0.5 } };
var conflict = await Assert.ThrowsAsync<ProjectConflictException>(() => source.SaveProjectAsync(mine, content.Project, context.Cancellation));
var difference = Assert.Contains(conflict.Differences, _ => true);
Assert.Equal(("exposure.exposureOffsetEv", "0.5", "0.3"), (difference.Path, difference.Mine, difference.Theirs));
Assert.Equal(0.3, conflict.Server.Exposure.ExposureOffsetEv);
// Asked again without overwriting anything until the editor names the server's settings as its basis.
await Assert.ThrowsAsync<ProjectConflictException>(() => source.SaveProjectAsync(mine, content.Project, context.Cancellation));
Assert.SequenceEqual([false], api.Edits.Select(e => e.Accepted));
Assert.Equal(0.3, ProjectSettings.FromJson(api.SettingsJson!).Exposure.ExposureOffsetEv);
var kept = await source.SaveProjectAsync(mine, conflict.Server, context.Cancellation);
Assert.Equal(0.5, kept.Exposure.ExposureOffsetEv);
Assert.Equal(0.5, ProjectSettings.FromJson(api.SettingsJson!).Exposure.ExposureOffsetEv);
}
}
[Test]
public async Task KeepMineSavesTheEditorsValuesWithTheServersOtherChanges()
{
var (source, api, _) = Open();
var content = await source.LoadAsync(context.Cancellation);
await using var session = new EditorSession(source, content, [], TimeSpan.FromMilliseconds(20));
var found = new TaskCompletionSource<ProjectConflictException>(TaskCreationOptions.RunContinuationsAsynchronously);
session.ConflictFound += conflict => found.TrySetResult(conflict);
api.EditsBefore.Enqueue(ChangedOnTheServer);
session.Edit(p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.5 } });
var conflict = await found.Task.WaitAsync(TimeSpan.FromSeconds(10));
Assert.Same(conflict, session.Conflict);
Assert.False(await session.FlushAsync(), "the change waits for the choice");
Assert.True(session.ResolveConflict(keepMine: true));
Assert.True(await session.FlushAsync());
Assert.Null(session.Conflict);
var stored = ProjectSettings.FromJson(api.SettingsJson!);
Assert.Equal((0.5, -0.2), (stored.Exposure.ExposureOffsetEv, stored.Camera.OffsetY), "the editor's offset and the server's framing");
Assert.True(ProjectMerge.SameValues(stored, session.Project));
Assert.False(session.ResolveConflict(keepMine: false), "settled once");
}
[Test]
public async Task TakeServerShowsTheServersValuesAndCtrlZBringsTheEditorsBack()
{
var (source, api, _) = Open();
var content = await source.LoadAsync(context.Cancellation);
await using var session = new EditorSession(source, content, [], TimeSpan.FromMilliseconds(20));
var found = new TaskCompletionSource<ProjectConflictException>(TaskCreationOptions.RunContinuationsAsynchronously);
session.ConflictFound += conflict => found.TrySetResult(conflict);
api.EditsBefore.Enqueue(ChangedOnTheServer);
session.Edit(p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.5 }, HeroFrame = 2 });
await found.Task.WaitAsync(TimeSpan.FromSeconds(10));
Assert.True(session.ResolveConflict(keepMine: false));
Assert.True(await session.FlushAsync());
var stored = ProjectSettings.FromJson(api.SettingsJson!);
Assert.Equal((0.3, -0.2, (int?)2), (stored.Exposure.ExposureOffsetEv, stored.Camera.OffsetY, stored.HeroFrame),
"the server's values where both changed; the editor's other change is saved");
Assert.True(ProjectMerge.SameValues(stored, session.Project));
Assert.True(session.Undo());
Assert.True(await session.FlushAsync());
stored = ProjectSettings.FromJson(api.SettingsJson!);
Assert.Equal((0.5, -0.2), (stored.Exposure.ExposureOffsetEv, stored.Camera.OffsetY), "undo brings the editor's value back, the server's framing stays");
}
[Test]
public async Task AReloadDoesNotMergeOverAConflictingChange()
{
var (source, api, _) = Open();
var content = await source.LoadAsync(context.Cancellation);
await using var session = new EditorSession(source, content, [], TimeSpan.FromHours(1));
session.Edit(p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.5 } });
// An analysis ends on the server while someone there set the same setting; this editor's change was not sent yet.
api.SettingsJson = ChangedOnTheServer(api.SettingsJson);
api.SettingsVersion++;
api.FailNextEdit = new HttpRequestException("offline");
var found = 0;
session.ConflictFound += _ => Interlocked.Increment(ref found);
await session.ReloadAsync(context.Cancellation);
Assert.Equal(0.5, session.Project.Exposure.ExposureOffsetEv, "not merged over");
Assert.False(await session.FlushAsync(), "the retry meets the server's change and asks");
Assert.Equal(1, Volatile.Read(ref found));
Assert.Equal(0.3, ProjectSettings.FromJson(api.SettingsJson!).Exposure.ExposureOffsetEv);
}
[Test]
public async Task ConflictsThatKeepComingAreReported()
{
var (source, api, _) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
for (var i = 1; i <= 3; i++)
{
var offset = i / 10.0;
api.EditsBefore.Enqueue(json =>
{
var theirs = ProjectSettings.FromJson(json ?? "{}");
return (theirs with { Camera = theirs.Camera with { OffsetX = offset } }).ToJson();
});
}
await Assert.ThrowsAsync<IOException>(() => source.SaveProjectAsync(content.Project with { HeroFrame = 2 }, content.Project, context.Cancellation));
Assert.False(api.Edits.Any(e => e.Accepted));
}
}
[Test]
public async Task TheHeroTravelsAsAFrameOfTheSequence()
{
var (source, api, remote) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
var hero = await source.SaveProjectAsync(content.Project with { HeroFrame = 2 }, content.Project, context.Cancellation);
var other = await source.SaveProjectAsync(hero with { Exposure = hero.Exposure with { ExposureOffsetEv = 0.1 } }, hero, context.Cancellation);
await source.SaveProjectAsync(other with { HeroFrame = null }, other, context.Cancellation);
Assert.SequenceEqual([remote.Frames[2].Id, (Guid?)null, Guid.Empty], api.Edits.Select(e => e.Request.HeroFrameId));
}
}
[Test]
public async Task AnAccountWithoutTheEditRightOnlyLooks()
{
var (source, api, _) = Open(readOnly: true);
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
Assert.True(source.IsReadOnly);
var session = new EditorSession(source, content, [], TimeSpan.FromMilliseconds(20));
await using (session)
{
Assert.True(session.IsReadOnly);
Assert.False(session.Edit(p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.5 } }));
Assert.False(session.SetHero(3));
Assert.Empty(session.OptimiseAll());
Assert.False(session.Undo());
Assert.True(await session.FlushAsync(), "nothing waits for a save");
}
// The source refuses a change as well; the same project is no change.
await Assert.ThrowsAsync<InvalidOperationException>(() =>
source.SaveProjectAsync(content.Project with { HeroFrame = 1 }, content.Project, context.Cancellation));
Assert.True(ProjectMerge.SameValues(content.Project, await source.SaveProjectAsync(content.Project, content.Project, context.Cancellation)));
Assert.Empty(api.Edits);
}
}
[Test]
public async Task AnalysesAndRendersArePostedToTheServerOnePerPreset()
{
var (source, api, remote) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
var session = new EditorSession(source, content, [], TimeSpan.FromMilliseconds(20));
await using (session)
{
Assert.True(session.IsRemote);
await session.SubmitAsync(session.AnalysisRequest());
var export = session.Project.Export with { Preset = new Auto<string>().WithManual("4k-hevc"), Batch = ["1440p-h264", "4k-h264"] };
// The preset, then each batch preset.
var renders = session.RenderRequests(export);
Assert.Count(3, renders);
foreach (var request in renders) await session.SubmitAsync(request);
Assert.SequenceEqual(["deep-analyse", "render", "render", "render"], api.Posted.Select(p => p.Kind));
Assert.True(api.Posted.All(p => p.Target.SequenceEqual([remote.Sequence.Id])));
var presets = api.Posted.Skip(1).Select(p => ProcessingJobs.ReadRender(p.ParametersJson).Export).ToList();
Assert.True(presets.All(e => e.Batch.Count == 0), "a server job renders one preset");
Assert.SequenceEqual(["4k-hevc", "1440p-h264", "4k-h264"], presets.Select(e => e.Preset.Manual));
}
}
}
[Test]
public void ThisPcRendersABatchAsOneJob()
{
var content = EditorFixture.Content(EditorFixture.Sunset);
var session = new EditorSession(new FakeSequenceSource(EditorFixture.Sunset, content), content, []);
var requests = session.RenderRequests(session.Project.Export with { Batch = ["1440p-h264", "4k-h264"] });
Assert.Count(1, requests);
Assert.Count(2, ProcessingJobs.ReadRender(requests[0].ParametersJson).Export.Batch);
}
[Test]
public async Task TheServersJobEventsReachTheEditor()
{
var (source, api, remote) = Open();
await using (source)
{
await source.LoadAsync(context.Cancellation);
var seen = new List<Job>();
source.JobChanged += job =>
{
lock (seen) seen.Add(job);
};
var id = await source.SubmitAsync(ProcessingJobs.DeepAnalysis([remote.Sequence.Id]), context.Cancellation);
Assert.Equal(JobState.Queued, Last(seen).State);
api.Jobs[id] = api.Job(id, "deep-analyse", "running");
api.Publish(new JobStateEvent(id, "running", null));
await WaitAsync(() => Last(seen).State == JobState.Running);
api.Publish(new JobProgressEvent(id, 10, 20, 2.5, 4));
await WaitAsync(() => Last(seen).ProgressDone == 10);
Assert.Equal(TimeSpan.FromSeconds(4), Last(seen).Eta);
// Another client's job on another sequence is not this editor's business.
var foreign = Guid.CreateVersion7();
api.Jobs[foreign] = api.Job(foreign, "render", "running", Guid.CreateVersion7());
api.Publish(new JobStateEvent(foreign, "running", null));
api.Jobs[id] = api.Job(id, "deep-analyse", "done", done: 20, total: 20);
api.Publish(new JobStateEvent(id, "done", null));
await WaitAsync(() => Last(seen).State == JobState.Done);
lock (seen) Assert.False(seen.Any(j => j.Id == foreign));
var other = Guid.CreateVersion7();
api.Jobs[other] = api.Job(other, "render", "queued");
api.Jobs[foreign] = api.Job(foreign, "render", "queued", Guid.CreateVersion7());
Assert.SequenceEqual([other], (await source.ListJobsAsync(context.Cancellation)).Select(j => j.Id), "active jobs of this sequence only");
// A late progress event of the finished job does not bring it back to running.
api.Publish(new JobProgressEvent(id, 19, 20, 2.5, 1));
api.Jobs[other] = api.Job(other, "render", "running");
api.Publish(new JobStateEvent(other, "running", null));
await WaitAsync(() => Last(seen).Id == other);
lock (seen) Assert.Equal(JobState.Done, seen.Last(j => j.Id == id).State);
}
Assert.True(api.Disposed, "closing the editor closes its connection");
}
[Test]
public async Task ASequenceGoneFromTheServerReadsAsMissing()
{
var (source, api, _) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
api.Gone = true;
await Assert.ThrowsAsync<InvalidOperationException>(() => source.LoadAsync(context.Cancellation));
await Assert.ThrowsAsync<InvalidOperationException>(() => source.SaveProjectAsync(content.Project with { HeroFrame = 1 }, content.Project, context.Cancellation));
}
}
[Test]
public async Task ProxiesOfOtherFramesAreNotEdited()
{
var (source, api, remote) = Open();
await using (source)
{
// A frame added on the server since the proxies were fetched: positions in the project would point elsewhere.
api.Frames = [.. remote.Frames.Select(f => f.Id), Guid.CreateVersion7()];
await Assert.ThrowsAsync<ProxiesOutdatedException>(() => source.LoadAsync(context.Cancellation));
Assert.True(source.IsOutdated);
Assert.True(source.IsReadOnly);
}
(source, api, remote) = Open();
await using (source)
{
// The same frames in another order are other frames too.
api.Frames = [.. remote.Frames.Select(f => f.Id).Reverse()];
await Assert.ThrowsAsync<ProxiesOutdatedException>(() => source.LoadAsync(context.Cancellation));
}
}
[Test]
public async Task FramesChangedOnTheServerWhileOpenStopSavesAndRenders()
{
var (source, api, remote) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
var changes = 0;
source.ReadOnlyChanged += () => Interlocked.Increment(ref changes);
// A change that keeps the frames (settings, a new version number) changes nothing.
api.FramesVersion = 2;
api.Publish(new SequenceChangedEvent(remote.Sequence.Id, "settings", 2, api.SettingsVersion));
await Task.Delay(200);
Assert.False(source.IsOutdated, "the same frames");
api.Frames = [.. remote.Frames.Skip(1).Select(f => f.Id)];
api.FramesVersion = 3;
api.Publish(new SequenceChangedEvent(Guid.CreateVersion7(), "frames", 7, 1));
api.Publish(new SequenceChangedEvent(remote.Sequence.Id, "frames", 3, api.SettingsVersion));
await WaitAsync(() => source.IsOutdated);
Assert.True(source.IsReadOnly);
Assert.Equal(1, Volatile.Read(ref changes));
await Assert.ThrowsAsync<ProxiesOutdatedException>(() =>
source.SaveProjectAsync(content.Project with { HeroFrame = 2 }, content.Project, context.Cancellation));
await Assert.ThrowsAsync<ProxiesOutdatedException>(() =>
source.SubmitAsync(ProcessingJobs.Render(remote.Sequence, new ExportSettings(), 1920, 1080), context.Cancellation));
await source.SubmitAsync(ProcessingJobs.DeepAnalysis([remote.Sequence.Id]), context.Cancellation);
Assert.Empty(api.Edits);
Assert.SequenceEqual(["deep-analyse"], api.Posted.Select(p => p.Kind), "an analysis reads the server's own frames");
}
}
[Test]
public async Task AConflictFoundOnOtherFramesIsNotMergedOntoThem()
{
var (source, api, remote) = Open();
await using (source)
{
var content = await source.LoadAsync(context.Cancellation);
api.EditsBefore.Enqueue(json =>
{
api.Frames = [.. remote.Frames.Select(f => f.Id), Guid.CreateVersion7()];
return json ?? "{}";
});
await Assert.ThrowsAsync<ProxiesOutdatedException>(() =>
source.SaveProjectAsync(content.Project with { ExcludedFrames = [1] }, content.Project, context.Cancellation));
Assert.SequenceEqual([false], api.Edits.Select(e => e.Accepted));
Assert.True(source.IsOutdated);
}
}
[Test]
public async Task QueuedRendersKeepTheirPriorityAndJobsCanBeCancelledAndRetried()
{
var (source, api, remote) = Open();
await using (source)
{
await source.LoadAsync(context.Cancellation);
var seen = new List<Job>();
source.JobChanged += job =>
{
lock (seen) seen.Add(job);
};
var render = ProcessingJobs.Render(remote.Sequence, new ExportSettings(), 1920, 1080);
var now = await source.SubmitAsync(render, context.Cancellation);
var later = await source.SubmitAsync(render with { Priority = JobPriority.Normal }, context.Cancellation);
Assert.SequenceEqual([(later, "normal")], api.Priorities, "Render now stays at the user's priority; Add to queue waits behind it");
await source.CancelJobAsync(now, context.Cancellation);
Assert.Equal(JobState.Cancelled, Last(seen).State);
Assert.Equal("cancelled", api.Jobs[now].State);
await source.RetryJobAsync(now, context.Cancellation);
Assert.Equal((now, JobState.Queued), (Last(seen).Id, Last(seen).State));
}
}
[Test]
public async Task TheEventListenerOutlivesAFailureAndClosingReleasesTheConnection()
{
var (source, api, remote) = Open();
await using (source)
{
await source.LoadAsync(context.Cancellation);
var seen = new List<Job>();
source.JobChanged += job =>
{
lock (seen) seen.Add(job);
};
var id = await source.SubmitAsync(ProcessingJobs.DeepAnalysis([remote.Sequence.Id]), context.Cancellation);
api.Jobs[id] = api.Job(id, "deep-analyse", "running");
// A failure the listener has no special case for (a body that is not a job) does not end it.
api.FailNextJobRead = new ArgumentNullException("dto");
api.Publish(new JobStateEvent(id, "running", null));
api.Publish(new JobStateEvent(id, "running", null));
await WaitAsync(() => Last(seen).State == JobState.Running);
}
Assert.True(api.Disposed);
}
private (RemoteSequenceSource Source, FakeRemoteSequenceApi Api, RemoteSequence Remote) Open(int frames = 6, int cached = int.MaxValue,
bool readOnly = false) =>
Open(EditorFixture.Sequence(frames), cached, readOnly);
/// <summary>A server sequence whose first <paramref name="cached"/> proxies are on this PC (synthetic JPEGs).</summary>
private (RemoteSequenceSource Source, FakeRemoteSequenceApi Api, RemoteSequence Remote) Open(SyntheticSequence sunset, int cached = int.MaxValue,
bool readOnly = false)
{
var folder = context.CreateTempDirectory("proxies");
var sequence = new Sequence
{
Id = Guid.CreateVersion7(),
ArchiveId = Guid.Empty,
Title = "Harbour sunset",
Folder = "2026/2026-09-28 Synthetic",
FrameCount = sunset.Count,
Origin = SequenceOrigin.Server,
SyncState = SyncState.RemoteOnly,
};
var frames = sunset.Frames.Select((f, i) => f with { Id = Guid.CreateVersion7(), SequenceId = sequence.Id, Flags = i < cached ? f.Flags : f.Flags | FrameFlags.Missing })
.ToList();
var files = new string?[frames.Count];
for (var i = 0; i < files.Length && i < cached; i++)
{
using var image = sunset.Render(i);
files[i] = Path.Combine(folder, frames[i].Id.ToString("N") + ".jpg");
File.WriteAllBytes(files[i]!, JpegEncoder.Encode(image, new JpegEncodeOptions { Quality = 90 }));
}
var remote = new RemoteSequence(Server, sequence, frames, files);
var api = new FakeRemoteSequenceApi(sequence, [.. frames.Select(f => f.Id)]) { SettingsJson = new ProjectSettings().ToJson() };
return (new RemoteSequenceSource(remote, api, DecoderFactory.CreateClient(null), readOnly), api, remote);
}
/// <summary>Someone on the server sets the exposure offset to 0.3 and moves the framing.</summary>
private static string ChangedOnTheServer(string? json)
{
var theirs = ProjectSettings.FromJson(json ?? "{}");
return (theirs with { Exposure = theirs.Exposure with { ExposureOffsetEv = 0.3 }, Camera = theirs.Camera with { OffsetY = -0.2 } }).ToJson();
}
private static Job Last(List<Job> seen)
{
lock (seen) return seen[^1];
}
private static async Task WaitAsync(Func<bool> condition)
{
for (var i = 0; i < 200; i++)
{
try
{
if (condition()) return;
}
catch (ArgumentOutOfRangeException)
{
// Nothing seen yet.
}
await Task.Delay(25);
}
Assert.True(condition(), "timed out waiting");
}
}
@@ -0,0 +1,91 @@
using System.IO;
using Titano.App.Editor;
using Titano.Core.Project;
using Titano.Testing;
namespace Titano.App.Tests.Editor;
/// <summary>"Save both" copies of this PC's settings: listed newest first and restored as one undoable step.</summary>
public sealed class SavedCopiesTests(TestContext context)
{
[Test]
public void CopiesAreListedNewestFirst()
{
var meta = context.CreateTempDirectory("meta");
File.WriteAllText(Path.Combine(meta, "project.this-pc-20261001-090000.json"), new ProjectSettings().ToJson());
File.WriteAllText(Path.Combine(meta, "project.this-pc-20261003-142200.json"), new ProjectSettings().ToJson());
File.WriteAllText(Path.Combine(meta, "project.json"), new ProjectSettings().ToJson());
File.WriteAllText(Path.Combine(meta, "analysis.json"), "{}");
var copies = SavedCopies.List(meta);
Assert.SequenceEqual([new DateTime(2026, 10, 3, 14, 22, 0), new DateTime(2026, 10, 1, 9, 0, 0)], copies.Select(c => c.SavedAt));
Assert.Empty(SavedCopies.List(Path.Combine(meta, "missing")));
}
[Test]
public void AnUnreadableCopyIsReported()
{
var meta = context.CreateTempDirectory("meta");
var path = Path.Combine(meta, "project.this-pc-20261003-142200.json");
File.WriteAllText(path, "{ not json");
Assert.Throws<InvalidDataException>(() => SavedCopies.Read(new SavedCopy(path, DateTime.Now)));
Assert.Throws<InvalidDataException>(() => SavedCopies.Read(new SavedCopy(Path.Combine(meta, "gone.json"), DateTime.Now)));
}
[Test]
public async Task RestoringACopyIsOneUndoableStep()
{
var meta = context.CreateTempDirectory("meta");
var kept = new ProjectSettings { HeroFrame = 7, Exposure = new ExposureSettings { ExposureOffsetEv = -0.3 } };
var path = Path.Combine(meta, "project.this-pc-20261003-142200.json");
File.WriteAllText(path, kept.ToJson());
var copy = Assert.Contains(SavedCopies.List(meta), _ => true);
var content = EditorFixture.Content(EditorFixture.Sunset) with { SavedCopies = [copy] };
var source = new FakeSequenceSource(EditorFixture.Sunset, content);
await using var session = new EditorSession(source, content, [], TimeSpan.FromMilliseconds(20));
var before = session.Project;
session.Edit(p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.6 } });
var edited = session.Project;
Assert.NotNull(await session.RestoreAsync(copy));
Assert.True(ProjectMerge.SameValues(kept, session.Project));
Assert.Null(await session.RestoreAsync(copy), "the same values again change nothing");
await session.FlushAsync();
Assert.True(ProjectMerge.SameValues(kept, source.Stored), "the restored project is saved");
Assert.True(session.Undo());
Assert.True(ProjectMerge.SameValues(edited, session.Project), "undo brings back the project before the restore");
Assert.True(session.Undo());
Assert.True(ProjectMerge.SameValues(before, session.Project));
}
[Test]
public async Task TheUndoOfARestoreTakesBackOnlyTheRestore()
{
var meta = context.CreateTempDirectory("meta");
var path = Path.Combine(meta, "project.this-pc-20261003-142200.json");
File.WriteAllText(path, new ProjectSettings { Exposure = new ExposureSettings { ExposureOffsetEv = -0.3 } }.ToJson());
var copy = Assert.Contains(SavedCopies.List(meta), _ => true);
var content = EditorFixture.Content(EditorFixture.Sunset);
await using var session = new EditorSession(new FakeSequenceSource(EditorFixture.Sunset, content), content, [], TimeSpan.FromMilliseconds(20));
session.Edit(p => p with { HeroFrame = 4 });
var before = session.Project;
var restore = Assert.NotNull(await session.RestoreAsync(copy));
Assert.True(restore.CanUndo);
Assert.True(restore.Undo());
Assert.True(ProjectMerge.SameValues(before, session.Project), "the project from before the restore");
Assert.False(restore.CanUndo, "taken back once");
Assert.True(session.Undo(), "the undo of the restore is a step of its own");
Assert.Equal(-0.3, session.Project.Exposure.ExposureOffsetEv);
// An edit after the restore: its Undo would take that edit back, so it no longer applies.
session.Edit(p => p with { HeroFrame = 5 });
restore = Assert.NotNull(await session.RestoreAsync(copy));
session.Edit(p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.9 } });
Assert.False(restore.CanUndo);
Assert.False(restore.Undo());
Assert.Equal(0.9, session.Project.Exposure.ExposureOffsetEv);
}
}
@@ -0,0 +1,81 @@
using Titano.App.Editor;
using Titano.Core.Model;
using Titano.Testing;
namespace Titano.App.Tests.Editor;
/// <summary>The jobs of the open sequence: the busy lock, Analyse queued twice, and the server job the header shows.</summary>
public sealed class SequenceJobsTests
{
private static readonly Guid Sunset = Guid.CreateVersion7();
[Test]
public void OnlyAnalysesAndRendersOfTheSequenceCount()
{
var jobs = new SequenceJobs(Sunset);
Assert.False(jobs.Track(Job(JobKind.Render, JobState.Running, Guid.CreateVersion7())), "another sequence");
Assert.False(jobs.Track(Job(JobKind.Proxies, JobState.Running)), "not an analysis or a render");
Assert.Null(jobs.Shown);
Assert.False(jobs.IsBusy);
}
[Test]
public void StatesChangeTheLockProgressAloneDoesNot()
{
var jobs = new SequenceJobs(Sunset);
var render = Job(JobKind.Render, JobState.Queued);
Assert.True(jobs.Track(render), "joined");
Assert.True(jobs.IsActive(render.Id));
Assert.False(jobs.IsBusy, "waiting does not lock the settings");
Assert.True(jobs.Track(render with { State = JobState.Running }), "started");
Assert.True(jobs.IsBusy);
Assert.False(jobs.Track(render with { State = JobState.Running, ProgressDone = 40, ProgressTotal = 96 }), "progress only");
Assert.Equal(40, jobs.Shown!.ProgressDone);
Assert.True(jobs.Track(render with { State = JobState.Paused }));
Assert.False(jobs.IsBusy, "a paused render holds nothing");
Assert.True(jobs.Track(render with { State = JobState.Failed }), "left");
Assert.False(jobs.IsActive(render.Id));
Assert.False(jobs.Track(render with { State = JobState.Failed }), "an ended job that is not tracked changes nothing");
}
[Test]
public void AnAnalysisWaitingOrPausedStillCountsAsQueued()
{
var jobs = new SequenceJobs(Sunset);
var analysis = Job(JobKind.DeepAnalyse, JobState.Paused);
jobs.Track(analysis);
Assert.True(jobs.IsAnalysing, "Analyse would queue a second one");
jobs.Track(analysis with { State = JobState.Done });
Assert.False(jobs.IsAnalysing);
}
[Test]
public void TheHeaderShowsTheRunningJobThenThePausedThenTheOldestWaiting()
{
var jobs = new SequenceJobs(Sunset);
var now = DateTimeOffset.UtcNow;
var later = Job(JobKind.Render, JobState.Queued) with { Created = now };
var first = Job(JobKind.Render, JobState.Queued) with { Created = now.AddMinutes(-5) };
var paused = Job(JobKind.DeepAnalyse, JobState.Paused) with { Created = now.AddMinutes(-9), Started = now.AddMinutes(-8) };
var running = Job(JobKind.Render, JobState.Running) with { Created = now.AddMinutes(-1), Started = now };
foreach (var job in new[] { later, first }) jobs.Track(job);
Assert.Equal(first.Id, jobs.Shown!.Id);
jobs.Track(paused);
Assert.Equal(paused.Id, jobs.Shown!.Id);
jobs.Track(running);
Assert.Equal(running.Id, jobs.Shown!.Id);
jobs.Track(running with { State = JobState.Done });
Assert.Equal(paused.Id, jobs.Shown!.Id);
}
private static Job Job(JobKind kind, JobState state, Guid? target = null) => new()
{
Id = Guid.CreateVersion7(),
Kind = kind,
TargetIds = [target ?? Sunset],
State = state,
Created = DateTimeOffset.UtcNow,
};
}
@@ -0,0 +1,108 @@
using Titano.Core.Diagnostics.Synthetic;
using Titano.Data.Archiving;
using Titano.Data.Processing;
using Titano.Data.Repositories;
using Titano.Data.Tests.Infrastructure;
using Titano.Data.Tests.Processing;
using Titano.Testing;
namespace Titano.Data.Tests.Repositories;
/// <summary>Client edits of a sequence row (<see cref="SequenceRepository.EditAsync"/>) on both dialects: the hero frame the Library shows.</summary>
public abstract class SequenceEditTests(TestContext context) : RepositoryTest(context)
{
[Test]
public async Task TheHeroFrameIsSetKeptAndCleared()
{
var db = await OpenTitanoAsync();
var archive = TestData.Archive();
await db.Archives.UpsertAsync(archive, Ct);
var sequence = TestData.Sequence(archive.Id);
await db.Sequences.UpsertAsync(sequence, Ct);
var frames = Enumerable.Range(0, 5).Select(i => TestData.Frame(sequence.Id, i)).ToList();
await db.Frames.BulkInsertAsync(frames, Ct);
var set = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { SettingsJson = "{\"heroFrame\":3}", HeroFrameId = frames[3].Id }, null, Ct);
Assert.Equal(SequenceEditOutcome.Updated, set.Outcome);
Assert.Equal(frames[3].Id, set.Sequence!.HeroFrameId);
Assert.Equal(frames[3].Id, (await db.Sequences.GetAsync(sequence.Id, Ct))!.HeroFrameId);
var kept = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { Rating = 4 }, set.Sequence.SettingsVersion, Ct);
Assert.Equal(frames[3].Id, kept.Sequence!.HeroFrameId, "an edit without a hero leaves it alone");
var cleared = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { HeroFrameId = Guid.Empty }, null, Ct);
Assert.Null(cleared.Sequence!.HeroFrameId, "Guid.Empty goes back to the first frame");
}
[Test]
public async Task AFrameOfAnotherSequenceIsNotAHero()
{
var db = await OpenTitanoAsync();
var archive = TestData.Archive();
await db.Archives.UpsertAsync(archive, Ct);
var mine = TestData.Sequence(archive.Id, title: "Mine");
var other = TestData.Sequence(archive.Id, title: "Other");
await db.Sequences.UpsertAsync(mine, Ct);
await db.Sequences.UpsertAsync(other, Ct);
var own = TestData.Frame(mine.Id, 0);
var foreign = TestData.Frame(other.Id, 0);
await db.Frames.BulkInsertAsync([own, foreign], Ct);
await db.Sequences.EditAsync(mine.Id, new SequenceEdit { HeroFrameId = own.Id }, null, Ct);
var result = await db.Sequences.EditAsync(mine.Id, new SequenceEdit { HeroFrameId = foreign.Id }, null, Ct);
Assert.Equal(SequenceEditOutcome.Updated, result.Outcome);
Assert.Equal(own.Id, result.Sequence!.HeroFrameId);
}
[Test]
public async Task AConflictLeavesTheHeroAsItWas()
{
var db = await OpenTitanoAsync();
var archive = TestData.Archive();
await db.Archives.UpsertAsync(archive, Ct);
var sequence = TestData.Sequence(archive.Id);
await db.Sequences.UpsertAsync(sequence, Ct);
var frame = TestData.Frame(sequence.Id, 0);
await db.Frames.BulkInsertAsync([frame], Ct);
var result = await db.Sequences.EditAsync(sequence.Id, new SequenceEdit { HeroFrameId = frame.Id }, sequence.SettingsVersion + 7, Ct);
Assert.Equal(SequenceEditOutcome.Conflict, result.Outcome);
Assert.Null((await db.Sequences.GetAsync(sequence.Id, Ct))!.HeroFrameId);
}
}
public sealed class SqliteSequenceEditTests(TestContext context) : SequenceEditTests(context)
{
protected override Backend Backend => Backend.SqliteMemory;
}
[RequiresEnvironment(PgTestServer.Variable)]
public sealed class PostgresSequenceEditTests(TestContext context) : SequenceEditTests(context)
{
protected override Backend Backend => Backend.Postgres;
}
/// <summary>Project writes of the engine (advice, sync) carry the project's hero frame to the index, so the Library shows it.</summary>
public sealed class ProjectStoreHeroTests(TestContext context)
{
[Test]
public async Task AdviceThatPicksAHeroReachesTheIndex()
{
await using var fixture = await ProcessingFixture.CreateAsync(context);
var sequence = await fixture.AddAsync(SyntheticSequence.Create(new SyntheticSequenceOptions { Width = 64, Height = 48, FrameCount = 6 }));
var frames = await fixture.Db.Frames.ListBySequenceAsync(sequence.Id, cancellationToken: fixture.Ct);
var store = new ProjectStore(fixture.Db, new SequenceWriter(new ArchiveServiceOptions { Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) }));
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { HeroFrame = 4 }, fixture.Ct));
Assert.Equal(frames[4].Id, (await fixture.Db.Sequences.GetAsync(sequence.Id, fixture.Ct))!.HeroFrameId);
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { Exposure = p.Exposure with { ExposureOffsetEv = 0.5 } }, fixture.Ct));
Assert.Equal(frames[4].Id, (await fixture.Db.Sequences.GetAsync(sequence.Id, fixture.Ct))!.HeroFrameId, "other changes keep the hero");
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { HeroFrame = null }, fixture.Ct));
Assert.Null((await fixture.Db.Sequences.GetAsync(sequence.Id, fixture.Ct))!.HeroFrameId);
Assert.True(await store.UpdateAsync(fixture.Archive.Paths, sequence, p => p with { HeroFrame = 99 }, fixture.Ct));
Assert.Null((await fixture.Db.Sequences.GetAsync(sequence.Id, fixture.Ct))!.HeroFrameId, "an index past the last frame shows the first");
}
}
@@ -0,0 +1,214 @@
using System.Net;
using Microsoft.Extensions.DependencyInjection;
using Titano.Core.Archiving;
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Data.Jobs;
using Titano.Data.Processing;
using Titano.Protocol;
using Titano.Protocol.Client;
using Titano.Testing;
namespace Titano.Server.Tests.Api;
/// <summary>
/// What a desktop editor of a server sequence asks of the API (BRIEF §14.5 "edit with proxies, render where the
/// originals are"): the full analysis report, settings edits carrying their version and the hero frame, and the jobs
/// it posts and reads back.
/// </summary>
[Category("server")]
public sealed class RemoteEditingTests(TestContext context)
{
[Test]
public async Task TheAnalysisReportIsServedOnceTheSequenceWasAnalysed()
{
await using var server = await TestServer.StartAsync(context);
var (editor, _, token) = await server.UserAsync("alberto", "editor");
using var client = Client(server, token);
var frame = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 41));
Assert.Null(await client.GetAnalysisReportAsync(frame.SequenceId, context.Cancellation), "never deep-analysed");
var sequence = (await server.Database.Sequences.GetAsync(frame.SequenceId))!;
var path = new ArchivePaths(server.Options.ArchivePath).Sequence(sequence.Folder).AnalysisPath;
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
const string report = """{"version":1,"frameCount":1}""";
await File.WriteAllTextAsync(path, report, context.Cancellation);
Assert.Equal(report, await client.GetAnalysisReportAsync(frame.SequenceId, context.Cancellation));
var gone = await Assert.ThrowsAsync<TitanoApiException>(() => client.GetAnalysisReportAsync(Guid.CreateVersion7(), context.Cancellation));
Assert.Equal(HttpStatusCode.NotFound, gone.Status);
}
[Test]
public async Task AnEditCarriesItsVersionAndTheHeroFrame()
{
await using var server = await TestServer.StartAsync(context);
var (editor, _, token) = await server.UserAsync("alberto", "editor");
using var client = Client(server, token);
var first = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 42), "a.CR3", sessionKey: "harbour");
var second = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 43), "b.CR3", sessionKey: "harbour");
var foreign = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 44), "c.CR3", sessionKey: "elsewhere");
var id = first.SequenceId;
Assert.Equal(id, second.SequenceId);
var read = await client.GetSequenceAsync(id, context.Cancellation);
var settings = new ProjectSettings { HeroFrame = second.Index }.ToJson();
var hero = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, settings, read.SettingsVersion, second.FrameId),
context.Cancellation);
Assert.Equal(second.FrameId, hero.HeroFrameId);
Assert.Equal(read.SettingsVersion + 1, hero.SettingsVersion);
// An edit made from an older version is refused and changes nothing (the editor merges and sends again).
var stale = await Assert.ThrowsAsync<TitanoApiException>(() =>
client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, settings, read.SettingsVersion, first.FrameId), context.Cancellation));
Assert.Equal(HttpStatusCode.Conflict, stale.Status);
Assert.Equal(second.FrameId, (await client.GetSequenceAsync(id, context.Cancellation)).HeroFrameId);
var other = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, null, hero.SettingsVersion, foreign.FrameId),
context.Cancellation);
Assert.Equal(second.FrameId, other.HeroFrameId, "a frame of another sequence is not its hero");
var cleared = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, null, other.SettingsVersion, Guid.Empty),
context.Cancellation);
Assert.Null(cleared.HeroFrameId);
}
[Test]
public async Task SettingsAloneMoveTheHeroFrameWithTheProjectsHero()
{
await using var server = await TestServer.StartAsync(context);
var (editor, _, token) = await server.UserAsync("alberto", "editor");
using var client = Client(server, token);
await Uploads.UploadAsync(editor, Uploads.Photo(2000, 46), "a.CR3", sessionKey: "pier");
var second = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 47), "b.CR3", sessionKey: "pier");
var id = second.SequenceId;
var read = await client.GetSequenceAsync(id, context.Cancellation);
// The sync of a local copy sends the project only.
var project = new ProjectSettings { HeroFrame = second.Index };
var hero = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, project.ToJson(), read.SettingsVersion),
context.Cancellation);
Assert.Equal(second.FrameId, hero.HeroFrameId);
var exposure = project with { Exposure = project.Exposure with { ExposureOffsetEv = 0.3 } };
var kept = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, exposure.ToJson(), hero.SettingsVersion),
context.Cancellation);
Assert.Equal(second.FrameId, kept.HeroFrameId, "other changes keep the hero");
var cleared = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, (exposure with { HeroFrame = null }).ToJson(),
kept.SettingsVersion), context.Cancellation);
Assert.Null(cleared.HeroFrameId, "no hero shows the first frame");
}
[Test]
public async Task JobsPostedOnePerPresetReadBackAsTheClientsJobs()
{
var handler = new BlockingJobHandler(JobKind.DeepAnalyse);
await using var server = await TestServer.StartAsync(context, services: s => s.AddSingleton<IJobHandler>(handler));
var (editor, _, token) = await server.UserAsync("alberto", "editor");
using var client = Client(server, token);
var frame = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 45));
var dto = await client.GetSequenceAsync(frame.SequenceId, context.Cancellation);
var sequence = new Sequence { Id = dto.Id, ArchiveId = Guid.Empty, Folder = dto.Folder, Title = dto.Title };
var export = new ExportSettings { Preset = new Auto<string>().WithManual("4k-hevc"), Batch = ["1440p-h264"] };
var posted = new List<Job>();
foreach (var request in ProcessingJobs.RenderEach(sequence, export, 3840, 2160, new ProjectSettings { Export = export }))
{
var job = await client.CreateJobAsync(new CreateJobRequest(JobWire.Kind(request.Kind), request.Targets, request.ParametersJson), context.Cancellation);
posted.Add(Assert.NotNull(JobWire.FromDto(job)));
}
Assert.Count(2, posted);
Assert.True(posted.All(j => j is { Kind: JobKind.Render, State: JobState.Queued } && j.TargetIds.SequenceEqual([sequence.Id])));
var analysis = Assert.NotNull(JobWire.FromDto(await client.CreateJobAsync(
new CreateJobRequest(JobWire.Kind(JobKind.DeepAnalyse), [sequence.Id], null), context.Cancellation)));
Assert.Equal(JobKind.DeepAnalyse, analysis.Kind);
await handler.Started.Task.WaitAsync(TimeSpan.FromSeconds(10));
handler.Release();
for (var i = 0; i < 200 && JobWire.FromDto(await client.GetJobAsync(analysis.Id, context.Cancellation))!.State != JobState.Done; i++)
await Task.Delay(50);
var done = Assert.NotNull(JobWire.FromDto(await client.GetJobAsync(analysis.Id, context.Cancellation)));
Assert.Equal(JobState.Done, done.State);
Assert.Equal((4L, 4L), (done.ProgressDone, done.ProgressTotal));
Assert.NotNull(done.Finished);
var queued = (await client.ListJobsAsync("queued", null, context.Cancellation)).Items.Select(JobWire.FromDto).OfType<Job>().ToList();
Assert.SequenceEqual(posted.Select(j => j.Id).Order(), queued.Where(j => j.Kind == JobKind.Render).Select(j => j.Id).Order());
}
[Test]
public async Task TheJobListFiltersByKindAndGoesOnPastThePage()
{
await using var server = await TestServer.StartAsync(context);
var (_, _, token) = await server.UserAsync("alberto", "editor");
using var client = Client(server, token);
var target = Guid.CreateVersion7();
var created = DateTimeOffset.UtcNow;
// Paused, so no worker claims them: a render of the editor's sequence behind a busy server's thumbnails.
Job Paused(JobKind kind, int age) => new()
{
Id = Guid.CreateVersion7(),
Kind = kind,
TargetIds = [target],
State = JobState.Paused,
Created = created.AddSeconds(-age),
};
var render = Paused(JobKind.Render, 300);
await server.Database.Jobs.EnqueueAsync(render);
for (var i = 0; i < 205; i++) await server.Database.Jobs.EnqueueAsync(Paused(JobKind.Thumbs, i));
var renders = await client.ListJobsAsync("paused", "render", null, context.Cancellation);
Assert.SequenceEqual([render.Id], renders.Items.Select(j => j.Id));
Assert.Null(renders.NextCursor);
var first = await client.ListJobsAsync("paused", null, null, context.Cancellation);
Assert.NotNull(first.NextCursor, "more than a page");
Assert.False(first.Items.Any(j => j.Id == render.Id), "the oldest job is past the first page");
var rest = await client.ListJobsAsync("paused", null, first.NextCursor, context.Cancellation);
Assert.Null(rest.NextCursor);
Assert.Equal(206, first.Items.Concat(rest.Items).Select(j => j.Id).Distinct().Count());
}
[Test]
public async Task AnEditorHearsFramesAddedAndSettingsChangedOverItsEventSocket()
{
await using var server = await TestServer.StartAsync(context);
var (editor, _, token) = await server.UserAsync("alberto", "editor");
using var client = Client(server, token);
var first = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 48), "a.CR3", sessionKey: "quay");
var id = first.SequenceId;
var opened = await client.GetManifestAsync(id, context.Cancellation);
using var listening = CancellationTokenSource.CreateLinkedTokenSource(context.Cancellation);
listening.CancelAfter(TimeSpan.FromSeconds(20));
var received = new List<SequenceChangedEvent>();
var reader = Task.Run(async () =>
{
await foreach (var e in client.EventsAsync(listening.Token))
{
if (e is not SequenceChangedEvent changed || changed.SequenceId != id) continue;
received.Add(changed);
if (changed.Change == "settings") return;
}
});
var hub = server.Services.GetRequiredService<Titano.Server.Events.EventHub>();
for (var i = 0; i < 200 && hub.SubscriberCount == 0; i++) await Task.Delay(25);
// Someone uploads another frame, then someone edits the project: the editor checks its frames, then its settings.
await Uploads.UploadAsync(editor, Uploads.Photo(2000, 49), "b.CR3", sessionKey: "quay");
var read = await client.GetSequenceAsync(id, context.Cancellation);
await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, new ProjectSettings { HeroFrame = 1 }.ToJson(), read.SettingsVersion),
context.Cancellation);
await reader.WaitAsync(TimeSpan.FromSeconds(20));
var now = await client.GetManifestAsync(id, context.Cancellation);
var frames = Assert.Contains(received, e => e.Change == "frames");
Assert.Equal(now.FramesVersion, frames.FramesVersion);
Assert.True(frames.FramesVersion > opened.FramesVersion, "a frames version the editor has not seen");
Assert.Count(2, now.Frames);
Assert.Equal(("settings", now.SettingsVersion), (received[^1].Change, received[^1].SettingsVersion));
}
private static TitanoClient Client(TestServer server, string token) => new(server.HttpBase, new CertificatePinning([]), "tests") { Token = token };
}