Release v4.3: speak status line (Tolk) + Logging tab with housekeeping
- New screen-reader hotkey "Speak the RemSound status information" (issue #13): reads the status line aloud through the active screen reader via Tolk, fires from anywhere (system-wide), unset by default. Built behind an IScreenReaderOutput seam so a future build can swap Tolk for Prism on Windows 10+ without touching callers. Tolk DLLs vendored under tolk/ and shipped next to the exe. - New Logging tab in Preferences: Enable logs + Write logs now moved there, plus opt-in startup "warn if logs folder exceeds N MB" and "delete logs older than N days", and a "Delete all logs" button (Yes/No confirm). New LogMaintenance helper + AppConfig settings drive it. - Manual (readme.html + regenerated MANUAL.md), About changelog and RELEASE_NOTES updated in plain English; csproj <Version> bumped to 4.3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
034a7de632
commit
fd5c31740a
@@ -0,0 +1,45 @@
|
||||
namespace RemSound.App;
|
||||
|
||||
/// <summary>
|
||||
/// Process-wide screen-reader speech. Used for feedback the screen reader can't otherwise observe —
|
||||
/// chiefly the "speak the status line" hotkey (GitHub issue #13), which must read aloud even when the
|
||||
/// global hotkey fires while RemSound isn't the focused window.
|
||||
///
|
||||
/// Holds a single backend, created once on first use. Today that is always Tolk, which works on every
|
||||
/// Windows version RemSound supports — including Windows 7. The interface seam exists so a future build
|
||||
/// can choose a different backend per OS without changing any caller: branch inside
|
||||
/// <see cref="CreateBackend"/>. (Prism is the modern successor to Tolk but requires Windows 10+, so it
|
||||
/// can't be the default while Win7 is supported — see <see cref="IScreenReaderOutput"/>.)
|
||||
/// </summary>
|
||||
internal static class ScreenReader
|
||||
{
|
||||
private static readonly object sync = new();
|
||||
private static IScreenReaderOutput? backend;
|
||||
|
||||
private static IScreenReaderOutput Backend
|
||||
{
|
||||
get { lock (sync) { return backend ??= CreateBackend(); } }
|
||||
}
|
||||
|
||||
private static IScreenReaderOutput CreateBackend()
|
||||
{
|
||||
// Win7-safe default. To adopt Prism on Windows 10+ later, branch on Environment.OSVersion
|
||||
// here and return a PrismScreenReaderOutput when the OS is >= Windows 10 — callers below stay
|
||||
// exactly as they are.
|
||||
return new TolkScreenReaderOutput();
|
||||
}
|
||||
|
||||
/// <summary>Speak text through the active screen reader (best-effort; silent if none is running).
|
||||
/// Returns true if it reached a screen reader.</summary>
|
||||
public static bool Speak(string text, bool interrupt = true) => Backend.Speak(text, interrupt);
|
||||
|
||||
/// <summary>Release the backend on app shutdown. Safe to call when nothing was ever spoken.</summary>
|
||||
public static void Shutdown()
|
||||
{
|
||||
lock (sync)
|
||||
{
|
||||
backend?.Shutdown();
|
||||
backend = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user