docs: unify documentation and streamline code comments

- Translated project documentation (LEARNING-JOURNEY, CONTRIBUTORS, AI_DISCLOSURE) to English for better accessibility.
- Standardized internal code documentation by converting XML-doc blocks to standard comment format.
- Cleaned up inline comments and removed redundant versioning metadata across the codebase.
- Refactored non-functional text elements to improve readability and maintain a consistent style.
This commit is contained in:
2026-05-11 00:52:15 +02:00
parent a37882893e
commit c4c85cf4b8
33 changed files with 666 additions and 1364 deletions
+16 -38
View File
@@ -9,32 +9,23 @@ using HellionChat.Util;
namespace HellionChat.Ui;
/// <summary>
/// Bottom-Status-Bar (v1.2.0). Fix 22 px hoch, BorderTop als Trenner.
/// Slots links → rechts: Channel-Indicator (Color-Dot + Channel-Name),
/// Privacy-Badge (Lock-Icon + Privacy-Label), Counts (Tabs + Msgs),
/// Tells (Auto-Tell-Counter, hidden bei 0), Version (rechtsbündig, muted).
///
/// Update-Frequenz: 1×/Sekunde. Format-Strings werden zwischen Updates
/// gecached, damit kein Per-Frame-Format-Allocation entsteht.
/// </summary>
// Bottom status bar, 22px tall. Slots left to right: channel indicator,
// privacy badge, counts, tells (hidden at 0), version (right-aligned).
// Updates at 1Hz; format strings are cached between updates.
internal sealed class StatusBar
{
public const float Height = 22f;
private const long UpdateIntervalMs = 1000;
// Cache-State — initial outdated, damit der erste Frame frisch berechnet.
// Initially outdated so the first frame always computes fresh.
private long _lastUpdateMs = -UpdateIntervalMs;
private string _cachedCountsText = string.Empty;
private string _cachedTellsText = string.Empty;
/// <summary>
/// Reine String-Logik — testbar ohne ImGui-Init.
/// </summary>
// Pure string logic, testable without ImGui init.
public static string FormatCounts(int tabs, int messages)
{
// InvariantCulture: User-System-Locale darf das Format nicht
// verändern (de_DE würde sonst "1,2k" statt "1.2k" liefern).
// InvariantCulture so locale doesn't affect the format (e.g. de_DE "1,2k").
var msgPart =
messages >= 1000
? string.Format(CultureInfo.InvariantCulture, "{0:0.0}k msg", messages / 1000.0)
@@ -43,10 +34,7 @@ internal sealed class StatusBar
return $"{tabsPart} · {msgPart}";
}
/// <summary>
/// Reine String-Logik — testbar ohne ImGui-Init.
/// 0 Tells → Leerstring (Slot wird ausgeblendet).
/// </summary>
// Pure string logic, testable without ImGui init. Returns empty string at 0 tells.
public static string FormatTells(int count)
{
if (count <= 0)
@@ -54,8 +42,7 @@ internal sealed class StatusBar
return $"{count} {(count == 1 ? "tell" : "tells")}";
}
// Single-pass replacement for the LINQ Sum+Count pair in Draw. Pure
// helper so a future LINQ regression gets pinned by xUnit.
// Single-pass replacement for a LINQ Sum+Count pair. Pure helper for unit testing.
internal static (int messages, int tells) AggregateForStatusBar(IList<Tab> tabs)
{
int messages = 0,
@@ -69,10 +56,7 @@ internal sealed class StatusBar
return (messages, tells);
}
/// <summary>
/// Test-Hook: Cache-Logic ohne reale Time-Source verifizieren.
/// Nicht für Production-Render.
/// </summary>
// Test hook to verify cache logic without a real time source.
internal (string counts, string tells) SnapshotForTest(
long now,
int tabs,
@@ -93,24 +77,18 @@ internal sealed class StatusBar
_lastUpdateMs = now;
}
/// <summary>
/// Render-Pfad. Aufrufer pusht bereits den HellionStyle/Theme;
/// wir lesen nur die aktiven Theme-Farben und zeichnen.
/// </summary>
public void Draw(Plugin plugin)
{
var theme = plugin.ThemeRegistry.Active;
var now = Environment.TickCount64;
// Outer gate keeps the foreach out of the hot path 99% of frames.
// UpdateCacheIfDue runs the same check internally — idempotent.
if (now - _lastUpdateMs >= UpdateIntervalMs)
{
var (messages, tells) = AggregateForStatusBar(Plugin.Config.Tabs);
UpdateCacheIfDue(now, Plugin.Config.Tabs.Count, messages, tells);
}
// BorderTop als Trenner — DrawList-Line, ImGui-Separator hat zu viel Padding.
// Border top via DrawList -- ImGui.Separator has too much padding.
var cursorY = ImGui.GetCursorScreenPos().Y;
var winLeft = ImGui.GetWindowPos().X;
var winRight = winLeft + ImGui.GetWindowSize().X;
@@ -123,9 +101,9 @@ internal sealed class StatusBar
1f
);
ImGui.Dummy(new Vector2(0, 2)); // BorderTop-Spacing
ImGui.Dummy(new Vector2(0, 2));
// Slot 1: Active-Channel-Indicator
// Slot 1: active channel indicator
var inputCh = plugin.CurrentTab?.CurrentChannel?.Channel ?? InputChannel.Invalid;
var hasChannel = inputCh != InputChannel.Invalid;
var chatType = inputCh.ToChatType();
@@ -137,7 +115,7 @@ internal sealed class StatusBar
ImGui.SameLine();
ImGui.TextUnformatted(channelName);
// Slot 2: Privacy-Badge — abgeleitet aus PrivacyFilterEnabled.
// Slot 2: privacy badge
ImGui.SameLine();
DrawSeparator();
ImGui.SameLine();
@@ -151,13 +129,13 @@ internal sealed class StatusBar
: HellionStrings.StatusBar_Privacy_Open;
ImGui.TextUnformatted(privacyLabel);
// Slot 3: Counts
// Slot 3: counts
ImGui.SameLine();
DrawSeparator();
ImGui.SameLine();
ImGui.TextUnformatted(_cachedCountsText);
// Slot 4: Tells (nur wenn > 0)
// Slot 4: tells (hidden at 0)
if (!string.IsNullOrEmpty(_cachedTellsText))
{
ImGui.SameLine();
@@ -166,7 +144,7 @@ internal sealed class StatusBar
ImGui.TextUnformatted(_cachedTellsText);
}
// Slot 5: Version (rechtsbündig, muted)
// Slot 5: version, right-aligned, muted
var versionText = $"v{Plugin.Interface.Manifest.AssemblyVersion} · Hellion";
var versionWidth = ImGui.CalcTextSize(versionText).X;
var contentRegionMax = ImGui.GetContentRegionMax().X;