# Hacking A-La-Karte This document is intended for contributors who want to build, run, and debug A-La-Karte locally. ## Build ### Configure ```bash cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug ``` ### Build ```bash cmake --build build ``` ### Run from the build directory ```bash ./build/bin/alakarte ``` ## Code Map - `src/main.cpp` - Application entry point, `KAboutData`, and QML engine setup. - `src/app.*` - Singleton exposed to QML. Owns `GameModel`, `GameLauncher`, `Config`, and `SteamGridDB`. - `src/game.*` - In-memory game object + JSON serialization. - `src/gamemodel.*`, `src/gamesortfiltermodel.*` - Model + filtering/sorting used by the UI. - `src/*importer.*` - Importers for different sources (Steam, Lutris, Heroic, Bottles, Desktop Entries, Flatpak, etc.). - `src/gamelauncher.*` - Launches games and records last played on launch. - `src/qml/` - Kirigami/Qt Quick UI. ## Repeatable Local Smoke Tests (No real library required) ### Run with isolated XDG dirs This avoids touching your real config and library: ```bash export XDG_CONFIG_HOME="$(mktemp -d)" export XDG_DATA_HOME="$(mktemp -d)" ./build/bin/alakarte ``` ### Desktop Entries importer fixture You can create a temporary desktop entry under the isolated `$XDG_DATA_HOME`: ```bash mkdir -p "$XDG_DATA_HOME/applications" cat > "$XDG_DATA_HOME/applications/alakarte-test-game.desktop" <<'EOF' [Desktop Entry] Type=Application Name=A-La-Karte Test Game Exec=sh -lc 'sleep 1' Icon=applications-games Categories=Game; EOF ``` Then: - Use the import sheet and run the Desktop Entries import. - Verify the entry appears and launches. - Verify `Last played` updates after launch. ### Manual entry / launcher smoke test - Create a manual entry with a harmless command, e.g. `sh -lc 'sleep 2'`. - Launch it. - Confirm the app stays responsive and the game transitions out of the running state. ## Notes - SteamGridDB cover fetching requires an API key. - KRunner integration and gamepad navigation are optional at build time (depending on available dependencies).