feat(macos): UI overhaul -- toolbar, unified log, PM windows, settings window, hotkeys

Mirrors the Windows client's UI overhaul (commit 97fa659 + 540ec13) adapted to
Mac-native conventions. The main window is now just toolbar + channels + users
+ chat; audio device settings moved to a modeless Settings window.

- NSToolbar: Join Voice, Share Screen Audio, Mute, Deafen (SF Symbol toggle
  buttons) + Output Volume slider (NSSlider 0-100, default 80). Voice actions,
  mute/deafen, and output volume moved out of the bottom panel into the toolbar
- Audio device settings (input mode, VAD sensitivity, PTT key, device picker,
  level meter) moved to a new SettingsWindowController -- a modeless window
  opened via the app menu's "Settings..." (Cmd+,) item. Source-of-truth for
  audio state lives in MainWindowController so voice start applies settings even
  before the window has been opened; SettingsWindowController reads from /
  writes back to those properties and applies changes live when voice is active.
  Level meter forwarded from handleLevel -> updateLevel(rms:)
- Unified log: chat NSTextView + activity NSTableView collapsed into a single
  NSTextView -- activity events in secondaryLabelColor (gray), chat in default
- Private messaging: scope dropdown removed; compose always sends to the
  current channel. Each PM conversation opens in its own modeless
  PrivateMessageWindowController. Incoming .textMessage with .private scope
  routed to the right window; outgoing PMs echoed by server arrive through the
  same path. "Send Private Message..." added to user context menu.
- Messages menu: "New Private Message..." (Cmd+Shift+N) opens a UserPickerSheet
  listing all server users so you can PM anyone on the server
- Channel tree now shows live user counts, e.g. "General (3)"; refreshChannelTree
  called on .userJoined/.userLeft (was missing)
- Voice menu: Join Voice (Cmd+Shift+V), Share Screen Audio (Cmd+Shift+S),
  Mute (Cmd+Shift+M), Deafen (Cmd+Shift+D) -- NSMenuItem key equivalents with
  [.command, .shift] mask, dispatched by the responder chain
- setOutputVolume(_:) wrapper added to VoiceCatClient.swift (was missing -- the
  C ABI + C# wrapper shipped in commit 97fa659 but the Swift wrapper was never
  added); wired end-to-end: toolbar slider -> client.setOutputVolume(gain)

Part A -- fixed and verified the previously-uncompiled Swift from the external
PCM feed/tap commit (615d2a8):
- Rebuilt the macOS xcframework slice (regenerated the module map from current
  voicecat.h, exposing vc_pcm_sink_cb / vc_stream_feed_pcm / vc_set_pcm_sink)
- Fixed feedPcm type bug: size_t imports as Int in Swift not UInt; the original
  UInt(samplesPerChannel) was wrong
- Added VoiceCatPcmSinkCallback typealias -- a Swift-idiomatic public alias for
  the C vc_pcm_sink_cb so consumers (tests, the macOS app) can declare a sink
  callback without directly importing the VoiceCatC C module. Mirrors the C#
  VcPcmSinkCallback delegate
- keyCodeName helper deduplicated (was in PttKeyCaptureSheet.swift +
  MainWindowController.swift -- now shared)

Platform-specific adaptations (vs. Windows): NSToolbar instead of ToolStrip;
global menu bar + NSMenuItem key equivalents (Cmd not Ctrl, responder-chain
dispatched, no custom key monitor needed); PM windows as modeless NSWindows;
picker as Mac sheet; gray = secondaryLabelColor; SF Symbols for toolbar icons.

swift test 10/10 (4 ExternalPcmTests + 6 VoiceCatClientSmokeTests against a
live server); xcodebuild Debug + Release BUILD SUCCEEDED with 0 Swift warnings.
This commit is contained in:
2026-06-20 23:30:52 +02:00
parent 615d2a8e5f
commit 6ab78fa792
9 changed files with 1135 additions and 339 deletions

View File

@@ -10,6 +10,17 @@ up instantly. Newest status at the top.
## ▶ Where we left off / next action
- **Done (2026-06-20):** **macOS client UI overhaul** — mirrors the Windows client's UI
overhaul (commit 97fa659 + 540ec13), adapted to Mac-native conventions. Also fixed and
verified the previously-uncompiled Swift changes from the external PCM feed/tap commit
(615d2a8). The main window is now just toolbar + channels + users + chat; audio device
settings (input mode, VAD, PTT key, device picker, level meter) moved to a modeless
Settings window (⌘,). Details in M5 section below. `swift test` 10/10; `xcodebuild` Debug
+ Release BUILD SUCCEEDED with 0 Swift warnings.
Next: live manual verification (toolbar toggles, unified log colors, PM windows, channel
counts, volume slider, settings window); then iOS ReplayKit and macOS ScreenCaptureKit
consumers of `vc_stream_feed_pcm`.
- **Awaiting on-device verification:** **iOS stereo mic kills headphone/A2DP output — REAL
root cause found & fixed** (2026-06-20, on Windows; verify on Mac). All prior "fixes" (the
2026-06-19 entries below) targeted the Swift `IOSAudioRouter` on the false premise that
@@ -430,6 +441,58 @@ iOS 18.0 deployment target. App Group `group.cat.voice.VoiceCat` for Keychain sh
`test_pcm_sink`), 4 Swift XCTest smoke tests, 4 C# xUnit smoke tests. Docs updated
(architecture.md §4 new subsection, voice.md §9 updated, protocol.md §8 explicit
no-protocol-change note, roadmap.md M5 entry). `ctest --preset dev` 23/23.
- [x] **macOS client UI overhaul** — done 2026-06-20. Mirrors the Windows client's UI
overhaul (toolbar, unified log, PM windows, channel counts, output volume, keyboard
shortcuts), adapted to Mac-native conventions:
- **NSToolbar**: Join Voice, Share Screen Audio, Mute, Deafen (SF Symbol toggle buttons),
and Output Volume slider (NSSlider 0100, default 80). Voice actions + mute/deafen +
output volume moved out of the bottom voice panel into the toolbar. Bottom panel keeps
input-mode segmented control / VAD slider / PTT key / device picker / level meter.
- **Unified log**: chat `NSTextView` + activity `NSTableView` collapsed into a single
`NSTextView` — activity events in `secondaryLabelColor` (gray), chat in default color.
Removed `activityTableView` and `activityLog` array.
- **Private messaging**: scope dropdown removed; compose bar always sends to the current
channel. Each PM conversation opens in its own modeless `PrivateMessageWindowController`
(NSWindow). Incoming `.textMessage` with `.private` scope routed to the right window;
outgoing PMs echoed by server arrive through the same path. "Send Private Message…"
added to user context menu. "New Private Message…" (⌘⇧N) opens `UserPickerSheet`
listing all server users.
- **Channel counts**: outline view renders `"Name (n)"` with live user counts;
`refreshChannelTree()` called on `.userJoined`/`.userLeft` (was missing).
- **Voice menu** (⌘⇧V join/leave, ⌘⇧S share screen, ⌘⇧M mute, ⌘⇧D deafen) and **Messages
menu** (⌘⇧N new PM) added to `NSApp.mainMenu` via `NSMenuItem` key equivalents with
`[.command, .shift]` mask. Removed on `windowWillClose`. Mac-native: ⌘ not Ctrl, dispatched
by the responder chain (no custom key monitor needed).
- **Output volume**: `setOutputVolume(_:)` wrapper added to `VoiceCatClient.swift` (was
missing — the C ABI + C# wrapper shipped in commit 97fa659 but the Swift wrapper was
never added). Wired end-to-end: toolbar slider → `client.setOutputVolume(gain)`.
- **Part A (uncompiled Swift fix)**: the external PCM feed/tap Swift wrapper (commit
615d2a8) was never compiled — the local xcframework predating the `voicecat.h` PCM
additions. Fixed: rebuilt xcframework (regenerated module map), fixed `UInt`→`Int` type
mismatch in `feedPcm` (Swift imports `size_t` as `Int` not `UInt`), added
`VoiceCatPcmSinkCallback` typealias (Swift-idiomatic alias for the C `vc_pcm_sink_cb`
so consumers don't need to directly import `VoiceCatC`). `swift test` 10/10 green.
- **Audio settings moved to Settings window**: the bottom voice panel (input mode, VAD
slider, PTT key, device picker, level meter) was removed from the main window and moved
into a new `SettingsWindowController` — a modeless window opened via the app menu's
"Settings…" (⌘,) item. The main window is now just toolbar + channels + users + chat.
Source-of-truth for audio settings (`selectedInputMode`, `vadThresholdValue`,
`selectedInputDeviceId`, `pttKeyCode`) lives in `MainWindowController` so voice start can
apply them even before the settings window has been opened; `SettingsWindowController`
reads from and writes back to those properties and applies changes to the client
immediately when voice is active. The level meter is forwarded from
`MainWindowController.handleLevel` → `settingsWindowController.updateLevel(rms:)`.
`keyCodeName` helper deduplicated (was duplicated in `PttKeyCaptureSheet.swift` +
`MainWindowController.swift` — now shared from `MainWindowController.swift`).
- Files: `MainWindowController.swift` (overhauled), `PrivateMessageWindowController.swift`
(new), `UserPickerSheet.swift` (new), `SettingsWindowController.swift` (new),
`VoiceCatClient.swift` (setOutputVolume + VoiceCatPcmSinkCallback typealias + feedPcm
type fix), `ExternalPcmTests.swift` (use typealias), `PttKeyCaptureSheet.swift` (removed
duplicate `keyCodeName`), `VoiceCatMac.xcodeproj/project.pbxproj` (register 3 new files).
- **Platform-specific adaptations** (vs. Windows): `NSToolbar` instead of `ToolStrip`;
global menu bar + `NSMenuItem` key equivalents (⌘ not Ctrl, responder-chain dispatched);
PM windows as modeless `NSWindow`s; picker as Mac sheet; gray = `secondaryLabelColor`;
SF Symbols for toolbar icons.
---