game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
Contributing

Welcome! This file is the developer onboarding doc — what to install, how to build, how to run tests and lint, what the commit conventions are. For the high-level design, see ARCHITECTURE.md. For end-user docs, see docs/.

TL;DR

# One-time setup (Arch / CachyOS)
sudo pacman -S --needed base-devel cmake ninja git ccache pkgconf \
qt6-base qt6-tools qt6-webengine \
sqlite openssl libglvnd util-linux-libs curl nlohmann-json \
clang-tools-extra # for clang-tidy / clang-format
# Configure + build (debug, with tests enabled)
cmake --preset qt-debug
cmake --build out/build/qt-debug --parallel
# Run the launcher
./out/build/qt-debug/gamelauncher_qt_debug
# Run the test suite
ctest --preset qt-debug --output-on-failure
# Lint
cmake --build out/build/qt-debug --target tidy # read-only
cmake --build out/build/qt-debug --target tidy-fix # apply auto-fixes
# Format
cmake --build out/build/qt-debug --target format

VSCode users: open the repo and accept the recommended-extensions prompt (CMake Tools, C++ TestMate, clangd). Copy .vscode/settings.json.example → .vscode/settings.json so the preset wiring picks up automatically. Tests then appear in the Testing panel as individually-runnable entries.

Branching model

  • main — release branch. Only updated via merges from develop. Never push to it directly.
  • develop — default branch. Day-to-day work lands here, either via feature branch + merge request or (for trivial fixes) direct commit.
  • feature/<short-description>-YYYY-MM — feature branches. Merged back to develop via a merge request when ready.

Commits

Look at recent history for the house style. Commit messages are descriptive prose, not rigid type(scope): Conventional Commits.

  • Subject line ≤ ~72 chars, present-tense imperative, no trailing period. Examples from history:
    • fix Steam game stuck in "Stopping..." after stop request
    • harden RunnerDownloadService — libcurl, RAII, atomics, disk-full
    • remove legacy .game-file migration code (789 LoC dead removal)
  • Body explains why the change is correct, not what changed. Reference upstream docs / GitHub issues / standards specs when relevant. Multi-paragraph bodies are normal for non-trivial changes.
  • Co-authored-by trailer: include the AI assistant attribution when the change was AI-assisted, matching the recent-history format.

The commit body is where audit reasoning lives, not in inline comments. See git log --format=fuller for examples — most commits explain what was wrong, what the fix is, and what spec / project memory it's backed by.

Project structure

game_launcher/
├── core/ # UI-agnostic library (gamelauncher_core)
│ ├── include/ # Public headers
│ │ ├── controllers/ # Coordinators between models/services and UI
│ │ ├── models/ # Data classes (Game, GameLibrary, FrameMetrics, …)
│ │ ├── services/ # Abstract Qt-bridge interfaces +
│ │ │ # concrete domain services (~22 file pairs)
│ │ ├── integrations/ # 3rd-party adapters (Steam, GOG, Lutris, UMU, …)
│ │ ├── util/ # Cross-cutting helpers (logger, atomic_write, …)
│ │ └── platform/ # Platform abstraction headers
│ └── src/ # Mirrors include/<x>/ for every <x>
│ └── platform/{linux,windows}/
├── ui/qt/ # Qt 6 frontend (gamelauncher_qt[_debug])
│ ├── managers/ # Composition managers (Toolbar, Sidebar, MenuBar,
│ │ # ContextMenu, GameAction, DetailsPanel, ThumbnailCache)
│ ├── dialogs/ # All *_dialog files + first-run wizard
│ ├── widgets/ # Custom widgets / models / delegates
│ ├── services/ # Qt service-interface implementations
│ └── shortcuts_controller.{h,cpp} # Keyboard shortcuts + command-palette registration
├── tests/ # GoogleTest suite (gtest 1.15.2 fetched, 449 tests)
├── docs/ # End-user documentation
├── cmake/ # CMake helper modules + .desktop template
├── scripts/ # Install / fresh-install / Windows setup helpers
├── resources/ # Icons, fonts, .desktop template
├── data/ # Bundled JSON (game_fixes.json)
├── translations/ # Qt .ts translation source files
├── .gitlab/ # GitLab issue + merge-request templates
├── ARCHITECTURE.md # Layered design, thread model, invariants
├── CONTRIBUTING.md # This file
├── README.md # User-facing entry point
├── SECURITY.md # Vulnerability disclosure policy
├── CHANGELOG.md # Release history (Keep a Changelog 1.1.0)
├── CODE_OF_CONDUCT.md # Contributor Covenant 2.1
├── PKGBUILD # Arch / CachyOS package recipe
├── CMakeLists.txt # Top-level build
├── CMakePresets.json # Build / test presets
├── .clang-format # LLVM/Allman, 4-space indent, 100 cols
├── .clang-tidy # Curated check set (bugprone+cert+perf+modernize)
├── .editorconfig # Cross-IDE indent / EOL / charset baseline
└── .gitlab-ci.yml # CI: build + test + lint + ASan + Renovate

Build

The project uses CMake presets. Don't invoke cmake with manual -D flags except for one-off overrides — the presets pin the build dir, generator, and option set.

Preset Generator Build type Notes
qt-debug Ninja Debug Default for development. BUILD_TESTS=ON, debug symbols.
qt-release Ninja Release Optimised. Used for daily-driver installs and CI release.
qt-debug-make Make Debug Fallback if Ninja is unavailable.
qt-release-make Make Release Fallback if Ninja is unavailable.
win-qt-debug Ninja Debug Windows + vcpkg (experimental).
win-qt-release Ninja Release Windows + vcpkg (experimental).
cmake --preset qt-debug # configure
cmake --build --preset qt-debug # build all targets
# Or build a specific target:
cmake --build out/build/qt-debug --target gamelauncher_qt --parallel
cmake --build out/build/qt-debug --target test_steam_integration

Build options

Option Default Notes
BUILD_QT_UI ON Build the Qt frontend. Required for the launcher binary.
BUILD_TESTS ON (qt-debug presets) / OFF otherwise Build the GoogleTest suite.
BUILD_CORE_ONLY OFF Skip the UI target — useful for CI test jobs that don't need Qt.
ENABLE_PCH ON Precompiled headers. Big speedup for incremental rebuilds.
ENABLE_CLANG_TIDY OFF Run clang-tidy in front of every compile. Doubles incremental build time.
ENABLE_ASAN OFF AddressSanitizer build. Use for debugging memory issues.
ENABLE_UBSAN OFF UndefinedBehaviorSanitizer.

Quick install

For a real install you can launch from ~/.local:

cmake --build --preset qt-release
cmake --install out/build/qt-release --prefix ~/.local

For a packaged Arch install:

makepkg -si # uses PKGBUILD; builds + installs as a real pacman package

The VSCode Install: Update (pacman, preserve data) task wraps this plus a process-kill step so iterative testing doesn't require manually restarting Steam-running games.

Tests

The test suite uses GoogleTest 1.15.2, fetched at configure time via FetchContent. Each TEST() is registered as its own CTest entry via gtest_discover_tests (in tests/CMakeLists.txt), so IDE test panels (VSCode CMake Tools, JetBrains, Qt Creator) get per-test pass/fail.

# Run all tests
ctest --preset qt-debug --output-on-failure
# Run only one test suite
ctest --preset qt-debug -R NormalizeProtonName --output-on-failure
# Re-run only the previously-failing tests
ctest --preset qt-debug --rerun-failed --output-on-failure

Adding a test

  1. Drop a tests/test_<thing>.cpp containing one or more TEST(Suite, Case) blocks. Follow the style of existing files like tests/test_steam_integration.cpp — one TEST per behaviour, descriptive Suite + Case names, doc comment block above each TEST explaining the regression / spec it locks down.
  2. Add an entry to tests/CMakeLists.txt using the project-local helper:
    _gl_add_unit_test(test_<thing> test_<thing>.cpp)
    The helper sets default link libs (gamelauncher_core + GTest::gtest_main) and registers each TEST() via gtest_discover_tests with DISCOVERY_MODE=PRE_TEST and a 30s timeout.
  3. For Qt-dependent tests (anything pulling in QApplication / QAbstractItemModel / etc.), follow the test_game_list_model pattern in tests/CMakeLists.txt — add the necessary ui/qt/*.cpp files manually, set AUTOMOC ON, link Qt6::Widgets, and set the QT_QPA_PLATFORM=offscreen env var in test properties so the test runs without a display server.
  4. Reconfigure (cmake --preset qt-debug), then build + run:
    cmake --build out/build/qt-debug --target test_<thing>
    ./out/build/qt-debug/tests/test_<thing>

What's appropriate for a unit test

  • ✅ Pure functions / parsers / serialisers
  • ✅ State machines exercised via their public API
  • ✅ Filesystem operations against a temp directory
  • ✅ Headless Qt models using offscreen platform plugin
  • ❌ UI rendering (would need a display server)
  • ❌ Real network calls (mock or skip)
  • ❌ Real Steam / Lutris integrations (would need installed services)
  • ❌ Subprocess fork+exec round-trips (filesystem fakery is too brittle)

When in doubt, look at what tests/CMakeLists.txt already covers. The suite is deliberately narrow and high-signal — tests that need elaborate fixtures usually aren't worth the maintenance.

Code style

Formatting (clang-format)

.clang-format pins LLVM-based style with Allman braces, 4-space indent, 100-column width, sorted includes. Run formatting before submitting any change:

cmake --build out/build/qt-debug --target format

VSCode users with the C++ extension can format on save (the workspace inherits .clang-format automatically).

Linting (clang-tidy)

.clang-tidy pins a curated check set (bugprone-*, cert-*, clang-analyzer-*, plus targeted modernize-* / performance-* / portability-* rules). Disabled checks each have a one-line rationale comment in the config — read it before disabling more.

# Read-only sweep across all sources
cmake --build out/build/qt-debug --target tidy
# Apply auto-fixable suggestions in-place (review the diff after!)
cmake --build out/build/qt-debug --target tidy-fix
# Per-file from the command line
clang-tidy -p out/build/qt-debug --quiet core/src/integrations/game_process.cpp

For a build that runs clang-tidy in front of every compile (slow but catches issues as you type):

cmake --preset qt-debug -DENABLE_CLANG_TIDY=ON

API documentation (Doxygen)

cmake/Doxyfile.in is configured by CMake at build time. With doxygen and graphviz installed (pacman -S doxygen graphviz):

cmake --build out/build/qt-debug --target docs
xdg-open out/build/qt-debug/docs/html/index.html

CI publishes the same output to GitLab Pages on develop via the pages job in .gitlab-ci.yml. README front-page is wired in as the Doxygen main page (USE_MDFILE_AS_MAINPAGE). Qt-specific Q_OBJECT / Q_PROPERTY / signals: macros are pre-defined in the Doxyfile so headers parse cleanly without moc.

Code coverage (gcovr)

The build supports -DENABLE_COVERAGE=ON to add --coverage flags to every target. With gcovr installed (pacman -S gcovr):

cmake --preset qt-debug -DENABLE_COVERAGE=ON
cmake --build out/build/qt-debug --parallel
ctest --preset qt-debug --output-on-failure # generates .gcda
cmake --build out/build/qt-debug --target coverage-html
xdg-open out/build/qt-debug/coverage-html/index.html

coverage produces a Cobertura XML at coverage.xml (consumed by GitLab CI for the MR coverage diff widget) plus a text summary at coverage.txt. coverage-html produces a browsable per-file report.

The CI test:coverage job runs the same flow and the coverage_report artifact feeds GitLab's pipeline coverage badge (parsed from gcovr --print-summary via the regex /^lines:\s+(\d+\.\d+)%/).

Coverage is incompatible with PCH (CMake auto-disables PCH when ENABLE_COVERAGE=ON) and with the sanitisers (gcov + ASan miscount blocks). The configure step rejects the combination.

Coverage philosophy

Global coverage on this codebase will not hit 80% — and that's a deliberate scope choice, not a goal to chase blindly. About 70% of core/ is integration glue around external systems (fork/exec launches, popen of curl / sha256sum / lspci / legendary, Steam VDF files on disk, sqlite, libcurl HTTP), and the project's test policy (see "What's appropriate for a unit test" above) explicitly excludes those paths. Reaching 80% would require either:

  1. A mock infrastructure project (HTTP fakes, fake-Steam, fake fork
    • exec) that's bigger than several of the integration modules themselves, or
  2. An end-to-end suite that needs a real Steam install, real games on disk, and a display server.

Neither is a near-term priority for a hobby launcher. Instead, the target is per-file coverage on testable subsystems:

Tier Target Files
Pure helpers / parsers / data structures 80–95% lru_cache.h, safe_enum_cast.h, atomic_write.cpp, lutris_config.cpp, desktop_entry_utils.cpp, paths_linux.cpp, shell_utils.h (escape paths)
State models / serialisers 60–75% game.cpp (formatters + JSON round-trip), game_database.cpp (schema lifecycle + safeEnumCast paths)
Validators / hardening best-effort path-traversal containment in installation_executor.cpp, Zip-Slip in prefix_snapshot_service.cpp
Integration glue not measured fork/exec, popen, libcurl HTTP, Steam VDF live data

Running the suite as of writing covers ~10% globally but 65%+ on every file in the top tier above. The CI test:coverage job publishes both the global number and the per-file breakdown so a regression on a tier-1 file is visible in the MR diff widget.

When adding new code: if it lands in tier 1 or 2, add tests in the same MR. Tier 3 hardening should land with a focused regression test even when the surrounding code is integration-only.

House conventions

  • Comments explain WHY, not WHAT. Don't paraphrase the code; explain the constraint, the regression history, the spec citation. If removing the comment wouldn't confuse a future reader, don't write it. (See the existing .cpp files for the cadence.)
  • No backwards-compatibility shims when you can change the code. We're not exporting an ABI; rename freely, drop unused exports.
  • Don't validate at internal call sites. Trust framework + caller guarantees. Validate at system boundaries (user input, parsed config files, network) and not at every internal layer.
  • Singletons that hold this pointers must clear callbacks in ~MainWindow. Several services (GameProcessManager, SteamProcessMonitor) use callback setters; if the launcher tears down with stale callbacks pointing at deleted widgets, you crash. See MainWindow::~MainWindow for the established pattern.
  • Detached threads → storeFuture pattern. When a service spawns background work, store the std::future via the per-service storeFuture helper (see runner_download_service.cpp, game_scanner_service.cpp, etc.) rather than .detach(). Two intentional .detach()s remain in legendary_integration.cpp with explanatory comments.

Pull / merge requests

  1. Fork the repository (or push to a branch on the main repo if you have access).
  2. Create a feature branch off develop:
    git checkout develop && git pull
    git checkout -b feature/whatever-2026-04
  3. Make your change. Keep commits small and self-explanatory; the merge request body can summarise across them.
  4. Run the lint + test gauntlet. format and tidy are two separate CMake custom targets — invoke each individually:
    cmake --build out/build/qt-debug --target format
    cmake --build out/build/qt-debug --target tidy
    ctest --preset qt-debug --output-on-failure
  5. Push and open a merge request against develop.
  6. CI will run build + tests + ASan automatically (see .gitlab-ci.yml). Local-green doesn't mean CI-green; check the pipeline before merging.

Reporting bugs

Open an issue on the GitLab project. Useful info to include:

  • Distro + kernel version (the launcher does kernel-version-aware dispatch in several places — uname -a output is helpful).
  • The launcher's log output (default ${XDG_STATE_HOME:-~/.local/state}/gamelauncher/logs/).
  • Steps to reproduce.
  • Whether the bug appears under both qt-debug and qt-release builds (ASan / UBSan can catch issues that release-mode optimises away).

Project conventions cheatsheet

Question Answer
Where do I put a new pure-data model? core/include/models/foo.h + core/src/models/foo.cpp
Where do I put a new domain service? core/include/services/foo_service.h + core/src/services/foo_service.cpp
Where do I put a 3rd-party integration? core/include/integrations/foo.h + core/src/integrations/foo.cpp
Where do I put a cross-cutting helper? core/include/util/foo.h (+ core/src/util/foo.cpp if not header-only)
Where do I put a Qt-only widget? ui/qt/foo_widget.{h,cpp} (and add to ui/qt/CMakeLists.txt glob if needed)
Where do I put a CMake helper? cmake/Foo.cmake and include(Foo) in CMakeLists.txt
Header guards or #pragma once? #pragma once (every shipped compiler supports it; see .clang-tidy)
Commit message style? Descriptive prose. git log --format=fuller for examples.
Where do I write architectural decisions? The commit body. Inline comments only for what the code can't explain.
std::move on a const value? No-op; clang-tidy performance-move-const-arg will catch it.
signals: then deleted copy ops? Add explicit public: between them so moc doesn't treat the deleted methods as signals.

When in doubt, look at the most recent commit touching a similar area and follow that pattern.