Add in-app log console; stop launching a separate terminal window#4
Merged
Conversation
Launching the app from a GUI no longer opens a separate console window (CMD on Windows, Terminal on macOS). All logging now appears in a docked "Log" console along the bottom of the app window, and still prints to the terminal when the app is launched from one. Logging - New LogConsole (include/Log.h, src/Log.cpp): tees std::cout/std::cerr so every line goes to both the original stream (terminal) and a bounded, thread-safe ring buffer rendered as the bottom panel. No changes needed at the ~54 existing log call sites. The render path snapshots under the lock and draws unlocked, so a worker thread logging never blocks the GUI and there is no re-entrancy path back into the lock. No separate console on launch - Windows: built as a GUI-subsystem executable (WIN32_EXECUTABLE + /ENTRY:mainCRTStartup to keep int main). AttachConsole(ATTACH_PARENT_PROCESS) reattaches stdio when started from a terminal so logs still print there. - macOS: CMake now builds an ir-tracking-app.app bundle (Info.plist.in + icon), so double-clicking in Finder does not spawn Terminal. release.yml's macOS packaging consumes the CMake bundle (dylibbundler + PlistBuddy version stamp) instead of hand-assembling it. macOS data directory - A Finder-launched .app has working directory "/", which broke the relative "Tools" folder and CSV paths. On macOS these now live under ~/Library/Application Support/IR Tracking App/ regardless of launch method; Windows and Linux keep their current working-directory behavior. The data directory is logged at startup. Layout - Default window grown to 1060x900; IR/Depth monitors lifted above the log console and clamped so they never render off the top on a short window. Tracker fixes (from code review) - UdpThreadFunction: GetToolTransform() returns 8 floats, so copying begin()+3..end() wrote 5 floats into data.quaternion[4] (out-of-bounds). Copy exactly the 4 quaternion components. - MIN_SPHERES 4 -> 3 to match the tracker, which supports 3-sphere tools in both AddTool and CalibrateTool. The old value rejected valid 3-sphere manual/ROM definitions and 3-sphere calibration results.
There was a problem hiding this comment.
Pull request overview
This PR changes the application’s launch/logging behavior so GUI launches no longer spawn an external terminal window, while still preserving terminal logging when launched from a shell. It also adds an in-app, docked ImGui log console and adjusts macOS path handling so tool/CSV data is stored in a stable per-user location when running as a .app bundle.
Changes:
- Add
LogConsoleto teestd::cout/std::cerrinto a bounded in-app log view while still forwarding output to the original streams. - Update Windows/macOS packaging to avoid spawning a separate console (Windows GUI-subsystem executable; macOS builds a
.appbundle + workflow packaging updates). - Fix tracker data handling (quaternion copy bounds) and adjust UI layout (larger default window, monitors lifted above log panel), plus macOS data directory routing.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ViewerWindow.cpp | Adds macOS data directory resolution, fixes quaternion copy bounds, adjusts default window/layout, and renders the docked Log console. |
| src/viewer_main.cpp | Attaches to parent console on Windows when available and installs/restores the log tee early in main(). |
| src/Log.cpp | Implements the in-app log console (tee streambuf + ring buffer + ImGui rendering). |
| include/Log.h | Declares LogConsole public API used by the app. |
| include/ViewerWindow.h | Lowers MIN_SPHERES to 3 to match tracker support. |
| resources/Info.plist.in | Adds CMake-templated Info.plist for the macOS .app bundle. |
| CMakeLists.txt | Builds Windows as GUI-subsystem and macOS as a bundle; wires icon/plist and adds new Log sources. |
| .github/workflows/release.yml | Updates macOS DMG packaging to consume the CMake-generated .app and version-stamp Info.plist. |
| README.md | Documents the new in-app Log console, Windows GUI launch behavior, and macOS .app usage/data directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+51
to
+58
| fs::path dir = fs::path(home) / "Library" / "Application Support" / "IR Tracking App"; | ||
| std::error_code ec; | ||
| fs::create_directories(dir, ec); | ||
| if (!ec) | ||
| { | ||
| return dir; | ||
| } | ||
| } |
| ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | | ||
| ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | | ||
| ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing; | ||
| ImGui::SetNextWindowPos(ImVec2(0.0f, logWinHeight - kLogConsoleHeight)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Launching the app from a GUI no longer opens a separate console window (CMD on Windows, Terminal on macOS). All logging now appears in a docked "Log" console along the bottom of the app window, and still prints to the terminal when the app is launched from one.
Logging
No separate console on launch
macOS data directory
Layout
Tracker fixes (from code review)