feat(app): library, jobs, settings, server, welcome and about screens
Local-mode composition root (SQLite index, one JobEngine fed by a single handler registration list), keyset-paged library with thumbnail cache and hover scrub, live job list with throttled updates and the shell job bar, settings with live template validation and encoder self-test, server connection with trust-on-first-use and DPAPI token, first-run welcome, About with update check, and --capture screenshots with synthetic data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
94 files changed
+10130
-374
No files matched your search
@@ -0,0 +1,68 @@
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
|
||||
namespace Titano.App.Jobs;
|
||||
|
||||
/// <summary>Localized texts of jobs: kind, speed, time left, place in the queue, state (Jobs screen and job bar).</summary>
|
||||
public static class JobText
|
||||
{
|
||||
/// <summary>"Render", "Deep analysis", …</summary>
|
||||
public static string Kind(JobKind kind) => Loc.L("Jobs.Kind." + kind);
|
||||
|
||||
/// <summary>True for jobs whose items are frames, so their speed reads in fps.</summary>
|
||||
public static bool CountsFrames(JobKind kind) =>
|
||||
kind is JobKind.Render or JobKind.Proxies or JobKind.Thumbs or JobKind.LightAnalyse or JobKind.DeepAnalyse or JobKind.Verify;
|
||||
|
||||
/// <summary>"11.3 fps" for frame jobs, "41/s" otherwise; empty when unknown.</summary>
|
||||
public static string Speed(JobKind kind, double? perSecond) =>
|
||||
perSecond is > 0 and var rate
|
||||
? Loc.L(CountsFrames(kind) ? "Jobs.Speed.Fps" : "Jobs.Speed.PerSecond", Formatting.Rate(rate))
|
||||
: string.Empty;
|
||||
|
||||
/// <summary>"1,240 / 3,600"; empty while the total is unknown.</summary>
|
||||
public static string Counter(long done, long total) =>
|
||||
total > 0 ? Loc.L("Jobs.Counter", Formatting.Count(done), Formatting.Count(total)) : string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The "Left" column: time left while running, "after n" while queued, the finish time of the history.
|
||||
/// </summary>
|
||||
public static string Left(JobEntry entry, int queuePosition) => entry.State switch
|
||||
{
|
||||
JobState.Running => entry.Eta is { } eta ? Formatting.Duration(eta) : string.Empty,
|
||||
JobState.Queued => queuePosition > 1 ? Loc.L("Jobs.Left.After", queuePosition - 1) : Loc.L("Jobs.Left.Next"),
|
||||
_ when entry.Job.Finished is { } finished => Formatting.TimeOfDay(finished),
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
/// <summary>State word, with the run time for done jobs ("done · 2:41").</summary>
|
||||
public static string State(JobEntry entry)
|
||||
{
|
||||
var word = Loc.L("Jobs.State." + entry.State);
|
||||
return entry.State == JobState.Done && entry.Job is { Started: { } started, Finished: { } finished }
|
||||
? Loc.L("Jobs.State.WithDetail", word, Formatting.Elapsed(finished - started))
|
||||
: word;
|
||||
}
|
||||
|
||||
/// <summary>Where the job runs: "this PC" for this machine's workers, the node name otherwise.</summary>
|
||||
public static string Where(string? nodeId, string localWorkerId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(nodeId)) return string.Empty;
|
||||
var hash = nodeId.IndexOf('#', StringComparison.Ordinal);
|
||||
var name = hash < 0 ? nodeId : nodeId[..hash];
|
||||
return name.Equals(localWorkerId, StringComparison.OrdinalIgnoreCase) ? Loc.L("Jobs.Where.ThisPc") : name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Job bar line (DESIGN §4): "Render · Harbour sunset · 2,232 / 3,600 · 11.3 fps · 2 min left".
|
||||
/// </summary>
|
||||
public static string Bar(JobEntry entry)
|
||||
{
|
||||
var parts = new List<string>(5) { Kind(entry.Job.Kind) };
|
||||
if (!string.IsNullOrWhiteSpace(entry.Job.TargetLabel)) parts.Add(entry.Job.TargetLabel!);
|
||||
if (Counter(entry.Done, entry.Total) is { Length: > 0 } counter) parts.Add(counter);
|
||||
if (Speed(entry.Job.Kind, entry.ItemsPerSecond) is { Length: > 0 } speed) parts.Add(speed);
|
||||
if (entry.Eta is { } eta) parts.Add(Loc.L("Jobs.Bar.Left", Formatting.Duration(eta)));
|
||||
return string.Join(" · ", parts);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user