Skip to content

Refactor 2/6: options, setting commands and English strings by name - #97

Merged
seaweeduk merged 1 commit into
masterfrom
refactor/wave-1
Nov 22, 2026
Merged

seaweeduk merged 1 commit into
masterfrom
refactor/wave-1

Conversation

@seaweeduk

Copy link
Copy Markdown
Owner

Second layer of the structural refactor: small mechanical moves out of main.cpp, the menu and the English strings. Nothing changes for users.

Steps in this layer: A1, A2, M1, M2, D2.

  • A1: options and keyboard input out of main.cpp. Argument parsing, the usage text and Options move to options.{h,cpp}; main() calls parseOptions(argc, argv, opts). The keyboard's edge flags move out of App into KeyboardInput, with onKey and onChar as members that the GLFW callbacks forward to.
  • A2: setting-only commands out of execute. The 24 commands that only change a setting and save it move into applySettingCommand(command, settings), called once at the top of execute. Commands that also touch the player, presets, room match, foveation or a Stash connection stay where they are.
  • M1: one text target for typing. Five ladders (filterText, setFilter, submitText, stopEditing, editingFilter) each decided which field is being typed into. They now switch on one textTarget(), so a new field can't be forgotten in one of them.
  • M2: one grid layout helper. The cell width, scroll bar room, visible rows and scroll clamp were written out in five grids. gridCellWidth() and gridRows() replace them, and the 30-pixel scroll bar allowance is now kScrollbarRoom.
  • D2: English strings assigned by name. kEnglish filled about 1,480 fields by position, so one string out of place shifted every later one. It's now written like the six translations, one s.member = "…"; per line, still built at compile time. At start-up the app checks that no English string is missing and names its position if one is.
// Before
const Strings kEnglish = {
    "No video – choose a file",
    "Loading …",
    ...
};

// After
constexpr Strings englishStrings() {
  Strings s{};
  s.noVideo = "No video – choose a file";
  s.loading = "Loading …";
  ...
  return s;
}
constexpr Strings kEnglish = englishStrings();
Before After
main.cpp lines 5,202 4,864
run() lines 4,391 4,296

Known and left as is

  • applySettingCommand() handles a subset and returns false for commands it doesn't own. The empty-command fast path and exhaustive execute switch come with the full command dispatch in the fourth layer.

Important

AI disclosure

Model Variant Role
anthropic/claude-opus-5-5 high Implementation, orchestration
openai/gpt-6.2-astra high Independent review

Agent harness OpenCode 2.3.2

@seaweeduk seaweeduk added the skip-changelog Left out of release notes label Nov 22, 2026
@opencode-agent

Copy link
Copy Markdown

LGTM 👍

Option parsing preserves defaults and exit codes, keyboard input is consumed at the same points in the frame loop, and the 24 extracted setting commands retain their updates and saves. The shared menu helpers preserve text-field routing and grid geometry. All 1,481 English strings match their previous fields and values, including array entries and format specifiers.

github run

@seaweeduk
seaweeduk changed the base branch from refactor/wave-0 to master November 22, 2026 20:58
@seaweeduk
seaweeduk merged commit f84b241 into master Nov 22, 2026
1 check passed
@seaweeduk
seaweeduk deleted the refactor/wave-1 branch November 22, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Left out of release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant