Skip to content

General tab: center Trim Now, 2x Preferences inset, swap Accounts/Video tabs#15

Merged
itsnateai merged 1 commit into
mainfrom
worktree-general-tab-ui-tweaks
Jun 6, 2026
Merged

General tab: center Trim Now, 2x Preferences inset, swap Accounts/Video tabs#15
itsnateai merged 1 commit into
mainfrom
worktree-general-tab-ui-tweaks

Conversation

@itsnateai

@itsnateai itsnateai commented Jun 6, 2026

Copy link
Copy Markdown
Owner

What

Three small General-tab UI tweaks (per Nate):

  1. Trim Now centered — in Log File Trimming, the Trim Now button now floats in the center of the gap between the MB label and the Async trim + archive old logs hint, with equal padding on both sides (was flush against MB with all the slack dumped on the right).
  2. Preferences inset doubledEQ Client Settings… / Process Manager… are now inset 24px (was 12px) from the card edges.
  3. Tabs reorderedGeneral · Accounts · Video · PiP · Hotkeys · Paths. Accounts moved next to General so the common General → Accounts hop is one tab over (was General → Video → Accounts).

How

  • New Bars.SplitCentered(left, center, right) helper in CardLayout.cs: a 3-column bar AutoSize | Percent 100% | AutoSize with the center group Anchor.None-centred in the stretchy middle column. That makes the padding (gap − groupWidth)/2 on both sides — mathematically equal — with zero pixel literals, so it's proportional at 100/125/150%.
  • Preferences: bumped the split-bar Margin 12→24px L/R.
  • Tab swap: swapped the Tab* constant values and the matching TabPages.Add order together. Everything else (_tabShells[], _tabBuilt[], the EnsureTabBuilt switch, prewarm) keys off the named constants, so it follows automatically.
  • Cross-file coupling fixed: TrayManager.ShowSettings(...) uses literal indices (the constants are private), so "Manage Accounts/Characters/Teams" → 1 and "Video Settings" → 2 were updated to match.
  • Hardening: the --test-lazy-save guard hardcoded _tabBuilt[1]=Video / [2]=Accounts. It now derives the indices from the Tab* constants via reflection, so a future reorder can't silently mislabel it.

Verification (no VM needed)

  • dotnet build — clean (0 warnings / 0 errors)
  • dpi-lint — clean (no new findings; pre-existing SystemAware-carveout WARNs only)
  • EQSwitch.exe --test-dpi-baselinePASS (every Form inherits the 96-DPI baseline)
  • EQSwitch.exe --test-lazy-savePASS (Video/Accounts build + 18-field round-trip clean after the swap)
  • Offscreen render of the General tab at 100% and 150% — Trim Now centered, Preferences inset doubled, tab order correct, no clipping/overlap at either scale.

Coordination note

Built in an isolated worktree branched from origin/main while another session was actively working on main (the EQ Client Settings overhaul Phase 0). This PR touches only CardLayout.cs, SettingsForm.cs, TrayManager.cs, DiagRender.csno overlap with that work, so it should merge cleanly alongside it.

Summary by CodeRabbit

Release Notes

  • Enhancements

    • Reorganized Settings interface: Accounts tab repositioned immediately after General tab for improved workflow.
    • Enhanced UI layout and spacing: increased button padding in General tab; centered Log File Trimming controls for better visual balance.
  • Bug Fixes

    • Corrected tray context menu items to open the appropriate Settings tabs when managing accounts, characters, teams, and video settings.

…inset

General tab UI polish:
- Log File Trimming: the Trim Now button now floats centered in the gap
  between the "MB" label and the "Async trim..." hint, with equal padding on
  both sides. New Bars.SplitCentered (AutoSize | Percent100 | AutoSize)
  three-section helper — Anchor.None centring, zero pixel literals, so the
  inset is proportional at 100/125/150%.
- Preferences: EQ Client Settings / Process Manager inset doubled 12->24px
  from the card edges.
- Tab order is now General, Accounts, Video, PiP, Hotkeys, Paths (Accounts
  moved next to General so the common General->Accounts hop is one tab over).
  Swapped the Tab* constant VALUES + the matching TabPages.Add order; the
  switch/prewarm/_tabShells all key off the named constants so they follow
  automatically. Updated the literal tab indices in TrayManager.ShowSettings
  (the private constants aren't visible cross-file) and made the lazy-save
  test derive its indices from the constants via reflection so a future
  reorder can't silently mislabel it again.

Verified: dotnet build clean (0/0), dpi-lint clean (no new findings),
--test-dpi-baseline PASS, --test-lazy-save PASS, offscreen render of the
General tab correct at both 100% and 150%.
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR reorders Settings tabs to place Accounts immediately after General (shifting Video to the next slot), adds a new SplitCentered layout utility to CardLayout, applies the new layout to the Log File Trimming card, and updates all dependent code—including UI padding, lazy-tab tests, and tray-menu navigation—to reflect the new tab indices.

Changes

Settings Tab Reordering with Layout Enhancement

Layer / File(s) Summary
SplitCentered layout utility
UI/CardLayout.cs
New public Bars.SplitCentered(...) factory method builds a three-column TableLayoutPanel with auto-sized left/right groups and a percent-stretch center column holding centered content.
Tab reordering and prewarm sequence
UI/SettingsForm.cs
Tab index constants are updated (Accounts → index 1, Video → index 2), lazy-tab prewarm order is swapped to match, and TabPages.Add calls are reordered to ensure lazily-built pages insert at correct indices.
UI layout refinements
UI/SettingsForm.cs
Preferences card padding is doubled horizontally (12px → 24px), and Log File Trimming card layout switches to SplitCentered to center the "Trim Now" button between the threshold controls and trailing hint.
Lazy-tab test adaptation
UI/DiagRender.cs
RunLazySave replaces hardcoded tab indices with dynamic reflection of SettingsForm's tab constants, ensuring Video/Accounts tab checks use the new positions throughout setup, verification, and subtests.
Tray menu navigation updates
UI/TrayManager.cs
Tray-context-menu "Manage Accounts/Characters/Teams" items now open tab 1 (Accounts); "Video Settings" item now opens tab 2 (Video), aligning menu navigation with the reordered tabs.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the three main UI changes: centering Trim Now, doubling Preferences inset, and swapping Accounts/Video tabs, matching the changeset across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-general-tab-ui-tweaks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@UI/DiagRender.cs`:
- Around line 304-305: The reflection calls that read SettingsForm's TabVideo
and TabAccounts constants (via typeof(SettingsForm).GetField(..., sflags) and
GetRawConstantValue()) must be validated before using them to index _tabBuilt:
ensure GetField(...) does not return null, that GetRawConstantValue() yields an
int, and that the int is within _tabBuilt's valid range; if any check fails,
fall back to a safe default index or skip accessing _tabBuilt and log a clear
diagnostic error. Update the code around the GetField usage for TabVideo and
TabAccounts to perform null/type/bounds checks and handle errors gracefully
instead of unguarded casting and indexing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aa92fb9e-563b-4269-b00a-fe28c43315f5

📥 Commits

Reviewing files that changed from the base of the PR and between b74fe27 and 755008f.

📒 Files selected for processing (4)
  • UI/CardLayout.cs
  • UI/DiagRender.cs
  • UI/SettingsForm.cs
  • UI/TrayManager.cs

Comment thread UI/DiagRender.cs
Comment on lines +304 to +305
int idxVideo = (int)typeof(SettingsForm).GetField("TabVideo", sflags)!.GetRawConstantValue()!;
int idxAccounts = (int)typeof(SettingsForm).GetField("TabAccounts", sflags)!.GetRawConstantValue()!;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Validate reflected tab constants before indexing _tabBuilt.

At Line 304 and Line 305, GetField(... )! + direct casts assume both constants exist and map to valid _tabBuilt indices. If either constant name changes or index drifts, this can crash the diagnostic run before your setup checks execute (affecting Lines 310/340/397/412).

Suggested hardening
         var sflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static;
-        int idxVideo    = (int)typeof(SettingsForm).GetField("TabVideo", sflags)!.GetRawConstantValue()!;
-        int idxAccounts = (int)typeof(SettingsForm).GetField("TabAccounts", sflags)!.GetRawConstantValue()!;
+        var fVideo = typeof(SettingsForm).GetField("TabVideo", sflags);
+        var fAccounts = typeof(SettingsForm).GetField("TabAccounts", sflags);
+        if (fVideo?.GetRawConstantValue() is not int idxVideo ||
+            fAccounts?.GetRawConstantValue() is not int idxAccounts)
+        {
+            Console.Error.WriteLine("LazySave: SETUP INVALID — could not resolve TabVideo/TabAccounts constants via reflection.");
+            form.Dispose();
+            return 2;
+        }
@@
         var built = (bool[])typeof(SettingsForm).GetField("_tabBuilt", flags)!.GetValue(form)!;
+        if (idxVideo < 0 || idxVideo >= built.Length || idxAccounts < 0 || idxAccounts >= built.Length)
+        {
+            Console.Error.WriteLine($"LazySave: SETUP INVALID — reflected tab indices out of range (Video={idxVideo}, Accounts={idxAccounts}, tabBuiltLen={built.Length}).");
+            form.Dispose();
+            return 2;
+        }
         if (built[idxVideo] || built[idxAccounts])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@UI/DiagRender.cs` around lines 304 - 305, The reflection calls that read
SettingsForm's TabVideo and TabAccounts constants (via
typeof(SettingsForm).GetField(..., sflags) and GetRawConstantValue()) must be
validated before using them to index _tabBuilt: ensure GetField(...) does not
return null, that GetRawConstantValue() yields an int, and that the int is
within _tabBuilt's valid range; if any check fails, fall back to a safe default
index or skip accessing _tabBuilt and log a clear diagnostic error. Update the
code around the GetField usage for TabVideo and TabAccounts to perform
null/type/bounds checks and handle errors gracefully instead of unguarded
casting and indexing.

@itsnateai itsnateai merged commit ebc8f96 into main Jun 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant