Black Mesa Routeview Prefix QML Files

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)

This page contains information about routeview prefix QML Black Mesa Black Mesa files and their code from Resonance Decade Update. Also includes: route.qml, router.qml, routes.qml, routeview.qml.

route.qml

route.qml is the Route data component. It defines the Route type used by routes.qml to declare every named navigation destination in the menu system. It is registered in qmldir as Route 1.0.

Route is a pure data object — it has no visual content and emits no signals. All 22 route instances in routes.qml are readonly property Route children of the Routes singleton.

Properties

Property Type Default Description
name string (empty) Unique string identifier for the route. Used as the lookup key in Routes[newRouteName] and stored in RouteView.routeName after a push or replace.
path string (empty) Dot-separated hierarchy string (e.g. "campaign.newgame"). Used exclusively by component-header.qml for tab highlighting and sub-nav visibility. Not used by the router.
qmlFile string (empty) Filename of the RouteView QML file to load (e.g. "routeview-newgame.qml"). Passed directly to outlet[config.fn](route.qmlFile, ...) in router.qml.
alert bool false If true, the route is always pushed onto the StackView (never replaced), can only be dismissed by a pop, and causes component-header.qml to hide the navigation bar.
action string (empty) If non-empty, the router executes actions[route.action]() and returns immediately without loading any RouteView. Currently only "OPEN_STEAMWORKSHOP" is defined.
passthrough bool false If true, the router immediately resolves the route to Routes[route.destination] before any further processing. Used for top-level category routes (campaign, multiplayer, options, steamworkshop) that have no view of their own.
destination string (empty) The name of the route to redirect to when passthrough is true.
rank real 0.0 Numeric rank relative to all other routes. Used by _getRouteTransitionConfig in router.qml to select a left or right slide transition: currentRoute.rank > route.rank ? 'right' : 'left'. Only applied when both the current and new routes are non-alert, non-index, non-empty routes (the replace case).

How each property is consumed

name

router.qml looks up routes by name via Routes[newRouteName]. After a push or replace, route.name is written to the new RouteView's routeName property. After a pop, currentRoute is restored by reading Routes[outlet.currentItem.routeName].

name is also compared directly in transition logic: route.name === Routes.back.name, route.name === Routes.empty.name, currentRoute.name === Routes.index.name.

path

Used only by component-header.qml in three ways:

Expression Purpose
currentRoute.path.indexOf('.') === -1 Determines whether to show the sub-nav bar. A path with no dot (e.g. "index", "achievements") means no sub-nav; a dotted path (e.g. "campaign.newgame") means show sub-nav.
currentRoute.path.split('.')[0] === routeName Determines which main nav tab (Campaign, Multiplayer, Options, etc.) is highlighted as selected.
currentRoute.path.split('.')[1] === routeName Determines which sub-nav tab (New Game, Load Game, etc.) is highlighted as selected.
alert

Checked in three places:

1. router.qml — _getRouteTransitionConfig uses the up transition for alert routes and always uses push (never replace). When going back from an alert route, the down transition is used instead of up.

2. component-header.qml — setState() sets the header state to "hidden" when currentRoute.alert is true, hiding both the main nav and sub-nav bars.

3. component-optionslist.qml — checks currentRoute.alert to suppress the settings-flush confirmation when an alert is active.

action

Checked in router.qml after passthrough resolution and same-route deduplication, but before transition logic. If route.action is non-empty, the router calls actions[route.action]() and returns without modifying the stack or currentRoute. The only defined action is OPEN_STEAMWORKSHOP, which opens the Steam Workshop overlay via BlackMesaEngine.activateSteamOverlayToWebPage.

passthrough / destination

The first check in setRoute(). If route.passthrough is true, the local route variable is immediately replaced with Routes[route.destination]. All subsequent logic (same-route check, action check, transition config, push/replace) operates on the resolved destination route, not the passthrough route. The passthrough route itself is never pushed onto the stack and never becomes currentRoute.

rank

Used only in the else branch of _getRouteTransitionConfig, which is reached when both the current and new routes are non-alert, non-index, non-empty, and non-back. In this case the router uses replace (not push) and selects a horizontal slide direction based on rank comparison. Higher rank = further right in the conceptual hierarchy. Navigating to a higher-rank route slides left (new content enters from the right); navigating to a lower-rank route slides right.

The rank values assigned in routes.qml are:

Route group Routes and ranks
Campaign campaign 1.0, newgame 1.1, loadgame 1.2, savegame 1.3
Multiplayer multiplayer 2.0, join 2.1, host 2.2
Options options 3.0, game 3.1, input 3.2, bindings 3.3, video 3.4, audio 3.5, policy 3.6, translators 3.7
Achievements achievements 4.0
Workshop steamworkshop 5.0, addons 5.1, browse 5.2
Special (no rank / 0.0) back, empty, index, quit, savebeforequit

Notable Issues

1. anchors.fill: parent on a data object. Route extends Item and sets anchors.fill: parent, making each Route instance a full-screen visual item parented to the Routes singleton Item. Since Route renders nothing, this is unnecessary overhead. The commented-out // width: parent.width and // height: parent.height lines suggest anchors.fill was a later substitution. A QtObject base would be more appropriate for a pure data type.

2. action and qmlFile are mutually exclusive but not enforced. If both are set on a route, action takes priority and qmlFile is silently ignored. No validation or warning is produced.

3. passthrough and action interaction is undefined. If a route has both passthrough: true and action set, the passthrough is resolved first, then action is checked on the resolved route — not the original. The action on the passthrough route itself is never evaluated.

4. back is a sentinel, not a real route. Routes.back has only name: "back" set. It has no path, qmlFile, rank, or any other property. The router detects it by name comparison before any other logic and converts it to a pop operation. It is never pushed onto the stack and never becomes currentRoute.

5. rank is a real, not an int. This allows fractional ranks (e.g. 1.1, 3.4) to express ordering within a group without requiring a global sequential integer scheme. However, ranks across groups (e.g. navigating from audio rank 3.5 to achievements rank 4.0) will also produce a left-slide transition, which may not always be the intended visual direction for cross-group navigation.

router.qml

router.qml is the central navigation controller for the entire menu system. It is registered in qmldir as Router 1.0 (not a singleton) and instantiated once in main.qml as Router { id: router }. It extends StackView from QtQuick.Controls 2.2, using the stack to manage the lifecycle of RouteView instances.

Properties

Property Type Description
currentRoute Route The Route object corresponding to the currently active view. Updated by setRoute() after every successful navigation.
isInGame bool Bound to appRoot.isInGame in main.qml. Passed to each new RouteView as a construction-time property.

Signals

Three signals are declared on the router and re-emitted upward to main.qml, which handles the actual engine calls:

Signal Handler in main.qml
saveGameRequest(string filename) Hides appRoot, calls BlackMesaUtils.saveGame(filename, callback), restores visibility in the callback.
loadGameRequest(variant savegame) Sets footer.levelName to savegame.chapterName, calls BlackMesaUtils.loadGame(savegame.savename).
loadMapRequest(string filename, string mapname) Sets footer.levelName to mapname, calls BlackMesaUtils.loadMap(filename).

Initialization

Component.onCompleted calls outlet.setRoute(emptyRoute.name). emptyRoute is not defined in router.qml; it resolves from the parent scope in main.qml where readonly property Route emptyRoute: Routes.empty is declared. This is an implicit scope dependency.

actions

A plain JavaScript object mapping action name strings to zero-argument functions. Currently contains one entry:

Key Behaviour
OPEN_STEAMWORKSHOP Calls BlackMesaEngine.activateSteamOverlayToWebPage("https://steamcommunity.com/app/362890/workshop").

When setRoute() encounters a Route with a non-empty action property, it looks up the action by name in this object and calls it instead of performing a stack transition.

Private signal handlers

Four private functions (prefixed _) are connected to the corresponding signals on each newly pushed RouteView. They relay the signal up the component tree:

Function Behaviour
_routeRequestHandler(routeName) Calls outlet.setRoute(routeName).
_loadGameRequestHandler(savegame) Re-emits outlet.loadGameRequest(savegame).
_loadMapRequestHandler(filename, mapname) Re-emits outlet.loadMapRequest(filename, mapname).
_saveGameRequestHandler(filename) Re-emits outlet.saveGameRequest(filename).

_getRouteTransitionConfig

Determines the StackView operation (push, pop, or replace), the animation transition pair, and the construction-time properties to pass to the new RouteView. Returns a plain JavaScript config object.

Transition selection logic

Evaluated in order; the first matching branch wins:

Condition Stack operation Transition
No currentRoute (initial navigation) push down
route.name === Routes.back.name pop down if current route is an alert; up otherwise
route.alert === true or route.name === Routes.empty.name push up
currentRoute.name === Routes.index.name or route.name === Routes.empty.name push down
currentRoute.name === Routes.empty.name push down
All other cases (rank-based lateral navigation) replace right if currentRoute.rank > route.rank; left otherwise

The operation field is set to StackView.Immediate when skipTransition is true (used during level loading), and StackView.Transition otherwise.

The properties field always contains { routeName: route.name, isInGame: outlet.isInGame }, which are passed as construction-time properties to the new RouteView.

setRoute

The main public entry point for all navigation. Signature: setRoute(newRouteName, skipTransition, allowSameRoute).

Execution order:

  1. Look up route = Routes[newRouteName].
  2. If route.passthrough is true, replace route with Routes[route.destination].
  3. If !allowSameRoute and the requested route is already the current route, return early (no-op).
  4. If outlet.currentItem has an onRouteWillChange function, call it with newRouteName. If it returns true, the navigation is intercepted and setRoute returns. (Used by routeview-video.qml to show the unsaved-changes dialog.)
  5. If route.action is non-empty, call actions[route.action]() and return. No stack transition occurs.
  6. Call _getRouteTransitionConfig to determine the config.
  7. Execute the stack operation:
    • pop: Sets popEnter/popExit, calls outlet.pop(operation), then sets currentRoute from outlet.currentItem.routeName.
    • push or replace: Sets the corresponding pushEnter/pushExit or replaceEnter/replaceExit properties, calls outlet[fn](route.qmlFile, properties, operation), then sets .
  8. Connects routeRequest, loadGameRequest, loadMapRequest, and saveGameRequest on outlet.currentItem to the four private handler functions.

parseRouteUIItems

Called from a ScriptAction at the end of every enter transition. Calls BlackMesaUtils.traverseUIElements(appRoot) followed by BlackMesaUtils.afterTraverseCallback() to rebuild the keyboard/controller navigation state for the newly visible view. appRoot is resolved from the parent scope in main.qml (implicit scope dependency).

routeTransitions

A readonly QtObject containing four named transition pairs. Each pair has an enter and an exit Transition reference:

Name Enter: slides in from Exit: slides out to Position axis Duration
down Top (y: −300 → 0) Bottom (y: 0 → 300) Y 600 ms (position), 300 ms (opacity, delayed 300 ms)
up Bottom (y: 300 → 0) Top (y: 0 → −300) Y 600 ms (position), 300 ms (opacity, delayed 300 ms)
left Right (x: 300 → 0) Left (x: 0 → −300) X 600 ms (position), 300 ms (opacity, delayed 300 ms)
right Left (x: −300 → 0) Right (x: 0 → 300) X 600 ms (position), 300 ms (opacity, delayed 300 ms)

All eight Transition objects are declared as direct children of the StackView (not inside routeTransitions); routeTransitions holds references to them by id.

Enter transition structure

Every enter transition uses a ParallelAnimation containing:

  1. A NumberAnimation on the position property (x or y), running for the full 600 ms with Easing.InOutQuint.
  2. A SequentialAnimation containing:
    1. A ScriptAction calling BlackMesaUtils.clearUIElementsData() — resets keyboard/controller navigation state immediately.
    2. A PauseAnimation of 300 ms — waits until the position animation is halfway complete before fading in.
    3. A NumberAnimation on opacity from 0.0 to 1.0 over 300 ms — fades the new view in.
    4. A ScriptAction calling parseRouteUIItems() — traverses the now-visible view to register its interactive elements.
Exit transition structure

Every exit transition uses a ParallelAnimation containing:

  1. A NumberAnimation on the position property, 600 ms, Easing.InOutQuint.
  2. A NumberAnimation on opacity from 1.0 to 0.0 over 300 ms (no delay — the exiting view fades out immediately).

Callers of setRoute

Caller Condition Route requested
main.qml Component.onCompleted Initialization emptyRoute (Routes.empty)
main.qml onGameUIActived Loading error Routes.multiplayer
main.qml onGameUIActived Initial load or UI was hidden mainMenuIndexRoute (Routes.index)
main.qml onGameUIHidden UI dismissed emptyRoute,
main.qml onLevelLoadingStarted Level load begins emptyRoute,
main.qml onLevelLoadingFinished Level finished loading mainMenuIndexRoute
main.qml autoBackgroundMusicTimer.onTriggered Fallback timer (1250 ms after startup) mainMenuIndexRoute
component-header.qml Tab click Various, via onRouteRequest: router.setRoute(routeName)
component-footer.qml Button click Various, via onRouteRequest: router.setRoute(routeName)
Any RouteView child Internal navigation Via routeRequest signal → _routeRequestHandler

Notable Issues

1. Implicit scope dependencies. emptyRoute and appRoot are referenced inside router.qml but defined in main.qml. This works because QML resolves identifiers through the visual parent scope, but it creates a hidden coupling: router.qml cannot be used outside of main.qml without breaking.

2. Dead branch: route.name === Routes.empty.name on line 65. The condition on line 62 already catches all navigations to the empty route (). The same sub-condition on line 65 is therefore unreachable. The intended down transition for navigating to the empty route via that branch is never applied through that path (though it is applied via line 62's up transition, which takes precedence).

3. isInGame is not reactively bound in the pushed RouteView. The value is captured at push time via properties: { isInGame: outlet.isInGame }. If appRoot.isInGame changes after the view is pushed (e.g. during a multiplayer disconnect), the active RouteView's isInGame property will not update until the next navigation.

4. Signal connections are never explicitly disconnected. After a pop or replace, the destroyed RouteView's signals are cleaned up automatically by the QML engine. This is safe in practice but means there is no explicit lifecycle management for signal connections.

5. allowSameRoute is never used by any caller. The parameter exists to allow reloading the same route, but no call site in the codebase passes it as true.

6. Empty stack after pop is not guarded. After outlet.pop(), currentRoute is set from outlet.currentItem.routeName. If the stack is empty after the pop (which should not happen in normal flow but is not structurally prevented), outlet.currentItem will be null and the property access will throw a TypeError.

7. actions is a plain JavaScript object. It cannot be extended or overridden from outside router.qml without modifying the file. Adding new action-type routes requires editing the actions literal directly.

routes.qml

routes.qml is registered in qmldir as the Routes singleton. It is the central route registry for the entire UI — a flat list of Route objects, each describing one navigable destination. router.qml consumes this singleton exclusively via Routes[routeName] lookups.

The file is 182 lines and contains 22 route definitions organized into six logical groups.

Route component

Each entry is an instance of Route (defined in route.qml, registered in qmldir as Route 1.0). The Route type is an Item with the following properties:

Property Type Default Purpose
name string (empty) Unique identifier used as the lookup key in Routes[name] and stored in RouteView.routeName.
path string (empty) Dot-separated logical path (e.g. "campaign.newgame"). Used by component-header.qml to determine which main-nav and sub-nav tabs to highlight.
qmlFile string (empty) Filename of the RouteView QML file to load. Passed directly to StackView.push() or StackView.replace().
alert bool false If true, the route is always pushed onto the stack (never replaced) and can only be dismissed by a pop. Alert routes use the upEnterTransition animation.
action string (empty) If set, router.qml executes actions[route.action]() instead of loading a view. No qmlFile is needed.
passthrough bool false If true, the route is immediately resolved to Routes[route.destination] before any transition logic runs.
destination string (empty) The name of the route to redirect to when passthrough is true.
rank real 0.0 Numeric position in the navigation hierarchy. When transitioning between two non-special routes, the router compares ranks to choose a left or right slide animation: higher rank slides in from the right, lower rank slides in from the left.

Route types

There are five distinct route types, distinguished by which properties are set:

Type Defining property Router behaviour Examples
Normal qmlFile set, alert false StackView.replace() with rank-based left/right transition newgame, video, achievements
Alert alert: true StackView.push() with upEnterTransition; popped (not replaced) on dismiss quit, savebeforequit
Passthrough passthrough: true Immediately resolved to Routes[destination] before any transition campaign, multiplayer, options, steamworkshop
Action action set Executes router.actions[route.action](); no view is loaded browse
Special Neither qmlFile nor action nor passthrough Handled by dedicated logic in _getRouteTransitionConfig back, empty, index

Special routes

back

A sentinel value with only name: "back" set. When router.setRoute("back") is called, _getRouteTransitionConfig detects route.name === Routes.back.name and sets . The transition direction depends on whether the current route is an alert: alert routes pop with downEnterTransition, normal routes pop with upEnterTransition. back has no path, no qmlFile, and no rank.

empty

Loads routeview-empty.qml, which is a blank RouteView {} with no content. Used as the initial state of the router (set in router.qml Component.onCompleted) and as the state during level loading and when the game UI is hidden. Has path: "empty" but no rank (defaults to 0.0); the router handles it with special-case logic rather than rank comparison.

index

Loads routeview-index.qml, the main menu hub. Has path: "index" but no rank (defaults to 0.0). The router special-cases it: any transition away from index uses downEnterTransition regardless of the destination's rank.

Route groups

Special / alert routes (no rank)
Property name name path qmlFile Notes
Routes.back back — — Pop sentinel; no view loaded
Routes.empty empty empty routeview-empty.qml Initial and loading state
Routes.index index index routeview-index.qml Main menu hub
Routes.quit quit quit routeview-quit.qml Alert; quit confirmation dialog
Routes.savebeforequit savebeforequit savebeforequit routeview-savebeforequit.qml Alert; save-before-quit dialog
Campaign routes (rank 1.x)
Property name name path qmlFile Rank Notes
Routes.campaign campaign campaign — 1.0 Passthrough → newgame
Routes.newgame newgame campaign.newgame routeview-newgame.qml 1.1
Routes.loadgame loadgame campaign.loadgame routeview-loadgame.qml 1.2
Routes.savegame savegame campaign.savegame routeview-savegame.qml 1.3
Multiplayer routes (rank 2.x)
Property name name path qmlFile Rank Notes
Routes.multiplayer multiplayer multiplayer — 2.0 Passthrough → join
Routes.join join multiplayer.join routeview-join.qml 2.1
Routes.host host multiplayer.host routeview-host.qml 2.2
Options routes (rank 3.x)
Property name name path qmlFile Rank Notes
Routes.options options options — 3.0 Passthrough → game
Routes.game game options.game routeview-game.qml 3.1
Routes.input input options.input routeview-input.qml 3.2
Routes.bindings bindings options.bindings routeview-bindings.qml 3.3
Routes.video video options.video routeview-video.qml 3.4
Routes.audio audio options.audio routeview-audio.qml 3.5
Routes.policy policy options.policy routeview-policy.qml 3.6
Routes.translators translators options.translators routeview-translators.qml 3.7
Achievements routes (rank 4.x)
Property name name path qmlFile Rank
Routes.achievements achievements achievements routeview-achievements.qml 4.0
Steam Workshop routes (rank 5.x)
Property name name path qmlFile Rank Notes
Routes.steamworkshop steamworkshop steamworkshop — 5.0 Passthrough → addons
Routes.addons addons steamworkshop.addons routeview-addons.qml 5.1
Routes.browse browse — — 5.2 Action: OPEN_STEAMWORKSHOP; opens Steam overlay to the workshop page

How routes are consumed

router.qml is the sole consumer of Routes. Its setRoute(newRouteName) function performs the following steps in order:

  1. Look up the route: var route = Routes[newRouteName].
  2. Resolve passthrough: if route.passthrough, replace with Routes[route.destination].
  3. Guard same-route: return early if the resolved route name equals currentRoute.name (unless allowSameRoute is set).
  4. Guard navigation intercept: call outlet.currentItem.onRouteWillChange(newRouteName) if it exists; return early if it returns true (used by routeview-video.qml to block navigation with unsaved changes).
  5. Execute action: if route.action is set, call actions[route.action]() and return. The only registered action is OPEN_STEAMWORKSHOP, which calls BlackMesaEngine.activateSteamOverlayToWebPage(...).
  6. Determine transition: call _getRouteTransitionConfig to select the animation direction and stack operation (push, replace, or pop).
  7. Execute transition: call outlet.push(), outlet.replace(), or outlet.pop() with the resolved qmlFile and properties.
  8. Connect signals: connect the new RouteView's routeRequest, loadGameRequest, loadMapRequest, and saveGameRequest signals to the router's handlers.

Transition direction logic

_getRouteTransitionConfig selects one of four named transitions based on the current and target route:

Condition (evaluated in order) Stack operation Transition
No current route (initial load) push down (default)
route.name === Routes.back.name pop down if current route is alert; up otherwise
route.alert || route.name === Routes.empty.name push up
currentRoute.name === Routes.index.name push down
(all other cases) replace right if currentRoute.rank > route.rank; left otherwise

Each named transition is a ParallelAnimation combining a positional slide (x or y, ±300px, 600ms, Easing.InOutQuint) with an opacity fade (0→1 or 1→0, 300ms). Enter transitions also fire two ScriptAction steps: BlackMesaUtils.clearUIElementsData() at the start and parseRouteUIItems() (which calls BlackMesaUtils.traverseUIElements() and BlackMesaUtils.afterTraverseCallback()) after the 300ms pause, so the navigation system is rebuilt for the new view once it is visible.

Notable Issues

1. rank on passthrough routes is never used. Passthrough routes are resolved to their destination before _getRouteTransitionConfig is called. The rank values on campaign (1.0), multiplayer (2.0), options (3.0), and steamworkshop (5.0) are therefore dead data.

2. Dead branch for route.name === Routes.empty.name. The condition appears twice in _getRouteTransitionConfig: once on line 62 (combined with the alert check, always matched first) and once on line 65 (unreachable). The intended down transition for navigating to the empty route via the second branch is never applied.

3. Routes is an Item, not a QtObject. The root element is Item rather than QtObject. Since Route extends Item (it uses anchors.fill: parent), each of the 22 Route children is a full visual item parented to the Routes singleton, which is itself parented to the QML engine's root. This is unnecessary overhead; QtObject children would suffice for a pure data registry.

4. browse has no path. The path property is used by component-header.qml to determine which tab to highlight. Since browse has no path, navigating to it (which opens the Steam overlay without changing the active view) leaves the header in whatever state it was in before, which is the correct visual behaviour but is implicit rather than explicit.

5. No route for routeview-campaigns.qml. The file exists in the UI directory but has no corresponding entry in routes.qml and is unreachable through any normal navigation flow.

routeview.qml

routeview.qml is the base class for every page in the Black Mesa menu system. It is registered in qmldir as the RouteView component (version 1.0) and is used as the root element of all 19 routeview-*.qml files.

The file is 28 lines. It defines no visual content of its own — it is a pure structural contract: a FocusScope that fills its parent, declares four signals, and exposes two properties that the router populates on every push.

Base Type

RouteView extends FocusScope (from QtQuick 2.9), not Item. This means:

  • Keyboard focus is scoped to the view. When a RouteView has active focus, Keys handlers inside it receive events before the parent.
  • activeFocus propagates inward to the first focusable child, which is the mechanism that allows main.qml's Keys.onPressed to delegate to BlackMesaUtils.navigationUIHandle(event).

The root element fills its parent on all four sides and also explicitly sets width and height to parent.width and parent.height, making the fill redundant but harmless.

Properties

Property Type Default Description
routeName string (empty) Set by router.qml immediately before pushing the view onto the StackView. Stores the name of the route this view was loaded for. Used by the router after a pop to recover the name of the newly-current route: currentRoute = Routes[outlet.currentItem.routeName].
isInGame bool (undefined) Set by router.qml on every push. Mirrors outlet.isInGame at the moment of navigation. Child views use this to conditionally show in-game controls (e.g. the Save Game and Disconnect buttons in routeview-index.qml).
opacity real 0 All views start fully transparent. Every enter transition in router.qml animates opacity from 0 to 1 after a 300 ms pause. Exit transitions animate it back to 0 over 300 ms. This ensures content is never visible mid-slide.

Signals

All four signals are connected by router.qml immediately after each push or replace call. The connections are not disconnected on pop, relying on QML's automatic signal disconnection when the emitting object is destroyed.

Signal Arguments Handler in router.qml Final action
routeRequest string routeName _routeRequestHandler Calls outlet.setRoute(routeName). This is the primary navigation mechanism used by every button and alert in the UI.
loadGameRequest variant savegame _loadGameRequestHandler Re-emits outlet.loadGameRequest(savegame). Propagates up to main.qml, which calls BlackMesaUtils.loadGame(savegame.savename).
loadMapRequest string filename, string mapname _loadMapRequestHandler Re-emits outlet.loadMapRequest(filename, mapname). Propagates up to main.qml, which calls BlackMesaUtils.loadMap(filename, mapname).
saveGameRequest string filename _saveGameRequestHandler Re-emits outlet.saveGameRequest(filename). Propagates up to main.qml, which calls BlackMesaUtils.saveGame(filename, callback). Passing null auto-generates a filename in the format bms-NNN.

onRouteWillChange Hook

routeview.qml does not declare an onRouteWillChange function. However, router.qml checks for it dynamically before every navigation:

  
if (outlet.currentItem && typeof outlet.currentItem.onRouteWillChange === 'function') {  
    if (outlet.currentItem.onRouteWillChange(newRouteName)) {  
        return; // navigation intercepted  
    }  
}

If the function exists on the current view and returns a truthy value, the navigation is cancelled. Only routeview-video.qml implements this hook, using it to show an unsaved-changes confirmation dialog when the user tries to navigate away with pending video settings.

Usage

Every routeview-*.qml file uses RouteView as its root element. The component is loaded dynamically by router.qml via outlet[config.fn](route.qmlFile, config.properties, config.operation), where route.qmlFile is the filename string defined in routes.qml for each route.

The full list of files that extend RouteView is:

File Route name
routeview-achievements.qml achievements
routeview-addons.qml addons
routeview-audio.qml audio
routeview-bindings.qml bindings
routeview-campaigns.qml (unregistered stub)
routeview-empty.qml empty
routeview-game.qml game
routeview-host.qml host
routeview-index.qml index
routeview-input.qml input
routeview-join.qml join
routeview-loadgame.qml loadgame
routeview-newgame.qml newgame
routeview-policy.qml policy
routeview-quit.qml quit
routeview-savebeforequit.qml savebeforequit
routeview-savegame.qml savegame
routeview-translators.qml translators
routeview-unavailable.qml (unregistered fallback)
routeview-video.qml video

Notable Issues

1. Signal connections are never explicitly disconnected. After a pop, the destroyed RouteView instance's signals are disconnected automatically by the QML engine. However, after a replace, the replaced item is also destroyed, so the same automatic cleanup applies. The comment in router.qml acknowledges this implicitly. In practice this is safe, but it means there is no explicit lifecycle management for signal connections.

2. opacity: 0 is set on the base class, not in the transition. If a RouteView is ever instantiated outside of router.qml's transition system (e.g. directly in a Loader), it will be permanently invisible unless opacity is explicitly overridden, since no transition will run to animate it to 1.

3. routeName is a writable string, not a reference to a Route object. The router stores only the name string, not the full Route object. After a pop, the router must look up the route by name via Routes[outlet.currentItem.routeName]. If routeName is ever set to a value that does not correspond to a key in Routes, currentRoute will be set to undefined, breaking all subsequent transition logic.

routeview-achievements.qml

routeview-achievements.qml is the Achievements page. It is registered in routes.qml as the achievements route at rank 4.0, with path: "achievements" (no dot separator). Because the path has no dot, component-header.qml renders it in subnav-closed state — the sub-navigation bar is hidden and the page has no sub-tabs. The route is accessed directly from the main navigation bar via the achievements entry in mainNavModel.

The file is 265 lines. It imports QtQuick.Controls 2.2 in addition to the standard QtQuick 2.9 and CrowbarCollective 1.0, making it one of the few route views to use Qt Quick Controls directly. The root RouteView has no id.

Top-level Properties

Property Type Value / Purpose
total int Total number of achievements (including hidden ones). Set in Component.onCompleted.
completed int Number of achievements where count === total (i.e. fully unlocked). Set in Component.onCompleted.
pageWidth int Math.ceil(1500 * Theme.widthScale)
pageHeight int cellH * Math.floor(Math.ceil(750 * Theme.heightScale) / cellH) — snapped downward to the nearest multiple of cellH to avoid partial rows.
headerHeight int Math.ceil(30 * Theme.widthScale) — uses widthScale, not heightScale.
cellW int Math.ceil(750 * Theme.widthScale)
cellH int Math.ceil(150 * Theme.widthScale) — uses widthScale, not heightScale.

Layout

The entire page is a single Item centered in the parent via anchors.centerIn: parent, sized pageWidth × pageHeight. It contains two children: a header strip anchored above the grid, and a GridView (id: grid) that fills the item.

header strip

A fixed-height Item (id: header) anchored to the bottom of the grid with a 10px scaled margin. It contains three elements laid out horizontally:

Element Description
headerText (Text) Displays BlackMesaEngine.getLocalizedString("#BlackMesaUI_Achievements_OverallProgress"). Bold, uppercase, 24px scaled, Theme.colors.headerText.
Progress bar (Rectangle) Fills the horizontal space between headerText and headerFraction. Transparent fill with a 2px Theme.colors.dimmedSlider border. Contains an inner Rectangle of color Theme.colors.highlight whose width is parent.width * (completed / total).
headerFraction (Text) Right-aligned. Displays completed in Theme.colors.highlight and " / " + total in Theme.colors.headerText using inline HTML tags joined into a single string.
GridView (grid)
Property Value
cellWidth / cellHeight cellW / cellH (750 × 150 nominal, width-scaled)
Columns 2 (implicit: pageWidth / cellW = 1500 / 750)
interactive true — touch/mouse drag scrolling enabled
boundsBehavior Flickable.StopAtBounds
ScrollBar.vertical VerticalScrollBar with visible: true (always shown)
anchors.rightMargin -Math.ceil(20 * Theme.widthScale) — negative margin extends the grid beyond the parent's right edge to push the scrollbar outside the centered content area

There are no Keys handlers and no objectName on any element. Keyboard and controller navigation are not supported on this page.

Delegate

Each grid cell is a MouseArea sized cellW × cellH. It has no onClicked, onEntered, or onExited handlers — it is purely a visual container with no interaction logic.

States

The delegate has three states. The initial state is set inline: state: count === total ? 'focused' : 'locked'.

State background border / color image border achievementName color achievementDescription color progressText color
locked 0px / #A6000000 0px Theme.colors.dimmedText Theme.colors.dimmedText Theme.colors.dimmedText
blurred 0px / #F2000000 1px Theme.colors.headerText Theme.colors.headerText Theme.colors.headerText
focused 2px / #F2000000 1px Theme.colors.highlight Theme.colors.headerText Theme.colors.highlight
Card Layout

Inside the MouseArea, a Rectangle (id: background, 730 × 130px scaled) is centered. It is divided into three horizontal zones:

Left zone — thumbnail (Rectangle id: image, 120 × 120px scaled, black background):

  • Contains an Image (id: achievementThumbnailImage) sourced from thumbnailPath, stretched to fill.

Center zone — text (Rectangle, 450 × 120px scaled, transparent):

  • progressBar (Rectangle) — visible when count !== total. Width = parent.width * (count / total), color #A6000000. Acts as a semi-transparent overlay proportional to progress, anchored top-left and growing rightward, covering the name and description text.
  • achievementName (Text) — name, bold, uppercase, 26px scaled.
  • achievementDescription (Text) — description, regular, word-wrap, 16px scaled.

Right zone — progress counter (Item, 140 × 120px scaled):

  • A dim overlay (Rectangle, #A6000000) visible when total > 1 && count !== total.
  • progressText (Text) — count + " / " + total, visible when total > 1, bold, 28px scaled, centered.

achievementsModel (ListModel)

The ListModel (id: achievementsModel) is populated entirely in Component.onCompleted:

  1. Calls BlackMesaEngine.listAchievementEntries() and maps each entry to a plain object: { thumbnailPath, name, description, hidden, count, total }. thumbnailPath is set to entry.imageSourceLocked when not achieved, or entry.imageSourceUnlocked when achieved. name and description are resolved immediately via BlackMesaEngine.getLocalizedString(). hidden is true when !entry.isAchieved && entry.shouldHideUntilAchieved.
  2. Sets total to achievements.length (count of all achievements, including hidden ones).
  3. Iterates the mapped array: increments hiddenCount for each hidden-and-incomplete achievement; increments completed for each achievement where count === total.
  4. Appends each achievement to the model only if it is not hidden, or if it is hidden but has been completed.
  5. If hiddenCount > 0, appends a single synthetic "hidden" card:
Field Value
image "" (empty string — note: the delegate reads thumbnailPath, not image)
name BlackMesaEngine.getLocalizedString("#BlackMesaUI_Achievements_Hidden").arg(hiddenCount)
description BlackMesaEngine.getLocalizedString("#BlackMesaUI_Achievements_HiddenDescription").arg(hiddenCount)
hidden false
count 0
total 1

The synthetic card has count: 0, total: 1, so its delegate state is locked () and its progressText is hidden (total > 1 is false).

Notable Issues

1. blurred state is unreachable. The delegate's MouseArea has no onEntered, onExited, or onClicked handler that transitions to blurred. The initial state is set directly to either focused or locked and never changes. The blurred state (white text, no background border) is defined but dead code.

2. No keyboard or controller navigation. No element has an objectName matching the patterns used by BlackMesaUtils.traverseUIElements() (ui:tab, ui:btn:*, ui:option-item). The page cannot be navigated with a keyboard or controller beyond scrolling via the GridView's built-in flick behavior, and even that requires mouse/touch since there are no Keys handlers.

3. Synthetic hidden card uses wrong field name. The synthetic card sets image: "" but the delegate reads thumbnailPath. The thumbnailPath role is absent from the synthetic card's object, so achievementThumbnailImage.source will be undefined, causing a silent image load failure.

4. pageHeight mixes widthScale and heightScale. The formula is cellH * Math.floor(Math.ceil(750 * Theme.heightScale) / cellH). cellH uses Theme.widthScale while the dividend uses Theme.heightScale. At non-square aspect ratios the snapping calculation produces an inconsistent result.

5. headerHeight, cellW, and cellH all use Theme.widthScale. None of these use Theme.heightScale, so the header strip and all cells scale uniformly with screen width. At non-standard aspect ratios, cells will be taller or shorter than intended relative to the screen height.

6. total counts hidden achievements; the grid does not. The total property (used in the header progress bar denominator and in the headerFraction text) is set to achievements.length, which includes hidden-and-incomplete achievements. However, those achievements are not appended to the model — they are replaced by a single synthetic card. The header therefore correctly shows the true total, but the number of visible cards is less than total, which may confuse players who count the cards.

7. achievementDescription uses explicit width instead of anchors.right. The width is set to parent.width - anchors.leftMargin * 2, which subtracts the left margin twice. Since there is no right margin applied, the text can overflow the right edge of the center zone by anchors.leftMargin pixels.

8. VerticalScrollBar is always visible. visible: true is hardcoded. The scrollbar is shown even when all achievements fit within pageHeight, which is uncommon but possible for games with very few achievements.

9. All strings bypass L10n. Every localized string in the file uses BlackMesaEngine.getLocalizedString() directly with #BlackMesaUI_* keys, inconsistent with all other route views which use the L10n singleton. The only L10n reference to achievements is L10n.strings.menus.achievements, used in component-header.qml for the main nav tab label.

10. No id on the root RouteView. Child elements cannot reference the root by id. The total and completed properties on the root are accessed from the ListModel's Component.onCompleted via implicit scope, which works but is fragile.

routeview-addons.qml

routeview-addons.qml is the Steam Workshop installed addons browser. It is registered in routes.qml as the addons route at path steamworkshop.addons, rank 5.1. Navigating to the parent steamworkshop route (rank 5.0) automatically redirects here because steamworkshop is a passthrough: true route with destination: "addons".

The file is 100 lines and is structurally near-identical to routeview-newgame.qml, differing only in the campaign filter predicate and the addition of an empty-state message.

Route Context

The Workshop section of the main nav (#QTUI_Menu_Workshop) exposes two sub-nav tabs via workshopNavModel in component-header.qml:

Tab label key routeName Behaviour
#QTUI_Menu_Workshop_Installed addons Loads routeview-addons.qml (this file).
#QTUI_Menu_Workshop_Browse browse Executes the OPEN_STEAMWORKSHOP action in router.qml, which calls BlackMesaEngine.activateSteamOverlayToWebPage("https://steamcommunity.com/app/362890/workshop"). No QML route view is loaded.

Empty State — gameNameText

A Text element (id: gameNameText) fills the entire parent and displays the localized string #BlackMesaUI_WorkshopList_Empty centered both horizontally and vertically. It is only visible when newGameCarousel.levels.count === 0, i.e. when no workshop campaigns are installed. It uses Theme.fonts.regular, Theme.colors.buttonText, and fontSizeMode: Text.Fit to shrink the text if it overflows.

Carousel — newGameCarousel

A Carousel (id: newGameCarousel) implements a two-phase selection flow identical in structure to routeview-newgame.qml.

Properties
Property Type Description
campaignEntries var Populated once at construction time. Calls BlackMesaEngine.listCampaignEntries().filter(function (campaign) { return !campaign.isOfficial }) — the inverse of routeview-newgame.qml, which filters for isOfficial. Contains all installed Workshop (non-official) campaigns.
currentlySelectedCampaign var Initially null. Set to a campaign entry object when the user selects a campaign card. Changing this property triggers the phase transition from campaign list to chapter list.
Component.onCompleted

Iterates campaignEntries and appends each item to the levels ListModel. Before appending, it sets item.levelName = "" on each campaign object, because campaign-level entries do not have a direct map to load — only their chapters do.

onCurrentlySelectedCampaignChanged

Fires whenever currentlySelectedCampaign changes. If the new value is null, it returns immediately (guard for the initial state). Otherwise:

  1. Clears levels and repopulates it with the selected campaign's chapters array.
  2. Sets showLeft = false and showRight = levels.count > 4 to reset carousel pagination.
  3. If the campaign has exactly one chapter, immediately fires newGame.loadMapRequest(currentlySelectedCampaign.chapters[0].levelName, BlackMesaEngine.getLocalizedString(currentlySelectedCampaign.chapters[0].title)), skipping the chapter carousel entirely.
Delegates

The active delegate is selected by itemComponent: currentlySelectedCampaign !== null ? chapterDelegate : campaignDelegate.

Delegate type label onSelected action onSelectedWithDoubleClick action
campaignDelegate BlackMesaEngine.getLocalizedString("#GameUI_NewGame") Sets newGameCarousel.currentlySelectedCampaign = newGameCarousel.campaignEntries[index], triggering the phase transition. Calls selected() — identical to single-click.
chapterDelegate BlackMesaEngine.getLocalizedString("#GameUI_Chapter") Fires newGame.loadMapRequest(model.levelName, localizedTitle). Calls selected() — identical to single-click.

Both delegates set isLocked: false unconditionally. Both use L10n.strings.buttons.startGame (#QTUI_Buttons_StartGame) as the button label and model.imageSource as the thumbnail.

Comparison with routeview-newgame.qml

Behaviour routeview-addons.qml routeview-newgame.qml
Campaign filter !campaign.isOfficial (Workshop only) campaign.isOfficial (official only)
Empty state message Yes — #BlackMesaUI_WorkshopList_Empty No
Auto-skip when one campaign No — user must click the single campaign card Yes — Component.onCompleted sets currentlySelectedCampaign immediately
Auto-skip when one chapter Yes — fires loadMapRequest immediately Yes — fires loadMapRequest immediately
Root id newGame (copy-paste artifact) newGame

Notable Issues

1. Root id is newGame. The root RouteView uses id: newGame, identical to routeview-newgame.qml. This is a copy-paste artifact. There is no runtime conflict since each file is a separate component instance, but it is misleading — child elements reference newGame.loadMapRequest(...) which correctly resolves to the local root, but the name implies this is the new-game route.

2. item.levelName = "" mutates engine-returned objects. Component.onCompleted directly sets on each object in the array returned by BlackMesaEngine.listCampaignEntries(). If the engine returns the same object references across calls (e.g. if the result is cached), this mutation persists and could corrupt the data seen by other consumers of listCampaignEntries().

3. No way to return to the campaign list. Once currentlySelectedCampaign is set, the only way to return to the campaign list is to navigate away from the route entirely. Setting would trigger onCurrentlySelectedCampaignChanged, but the if (!currentlySelectedCampaign) { return } guard prevents the levels from being repopulated with campaigns. There is no Back button or gesture within the page to undo a campaign selection.

4. onSelectedWithDoubleClick is identical to onSelected. Both delegates call selected() on double-click, making single-click and double-click indistinguishable.

5. type label bypasses L10n. Both delegates use BlackMesaEngine.getLocalizedString() directly for the type label (#GameUI_NewGame and #GameUI_Chapter) instead of routing through the L10n singleton, inconsistent with the rest of the UI.

6. L10n.strings.menus.addons is unused. l10n.qml defines addons: getString("#QTUI_Menu_Workshop_Addons") in the menus object, but workshopNavModel in component-header.qml uses labels.installed (#QTUI_Menu_Workshop_Installed) for the tab that routes to addons. The menus.addons key is never referenced anywhere in the codebase.

7. showLeft = false is hardcoded on phase transition. When switching to chapter view, showLeft is always forced to false regardless of the chapter count. This is correct for the initial display (the carousel always starts at the leftmost position), but it means the left arrow is never shown even if the user had previously scrolled right and then triggered a re-population — though in practice this scenario cannot occur since levels.clear() resets the carousel position.

routeview-audio.qml

routeview-audio.qml is the Audio Options settings page. It is registered in routes.qml as the audio route at path options.audio, rank 3.5. It is accessible via the Audio tab in the Options sub-navigation, which is populated by component-header.qml's optionsNavModel using the label L10n.strings.menus.audio (#QTUI_Menu_Options_Audio).

The file is 278 lines and follows the same structural pattern as routeview-video.qml: a single OptionsList with complex getter/setter logic, a pending-changes navigation guard, and an unsaved-changes Alert dialog.

Top-level Properties

Property Type Purpose
blockingRouteName string Stores the destination route name when navigation is blocked by the unsaved-changes guard. Cleared when the alert is dismissed via Cancel.
rtlLanguages var (array) A hardcoded list of language name strings considered right-to-left: "arabic", "aramaic", "azeri", "dhivehi", "maldivian", "hebrew", "kurdish", "sorani", "persian", "farsi", "urdu". Used by setComplex.audio_captioningLang to decide whether to set cc_rightaligned.

onRouteWillChange

Identical in structure to routeview-video.qml's guard. If audioOptions.hasPendingChanges is true and no blocking route is already set, it stores the destination in blockingRouteName, shows confirmAlert, and returns true to cancel the navigation.

audioOptions (OptionsList)

Property Value
title L10n.strings.headers.audioOptions (#QTUI_Header_Options_Audio)
batchUpdates true — all pending changes are flushed together on Apply
visibleRows 7 — exactly matches the number of items in the model; no scrolling is required
anchors.verticalCenterOffset Math.ceil(20 * Theme.heightScale) — shifts the list slightly below center
Component.onCompleted

Calls setLanguageState() once on load to set the initial enabled/disabled state of the captioning language selector.

onRequestSettingsChange

Handles two special cases when a setting changes:

  • If the changed item's key is audio_captioning, calls setLanguageState() to enable or disable the language selector.
  • If the changed item's key is audio_musicVolume, assigns Sound.ambientVolume = model.value to attempt a live volume update.
onSettingsReset

Calls setLanguageState() after a full settings reset to re-sync the language selector's disabled state.

setLanguageState()

Sets models.audio_captioningLang.disabled = (models.audio_captioning.value === "0"). When captioning is off (value "0"), the language selector is greyed out and non-interactive.

Complex Getters (getComplex)

Function CVars read Logic
audio_captioning() closecaption, cc_subtitles Returns "0" if closecaption is 0 (off); "1" if closecaption is 1 and cc_subtitles is 0 (closed captions only); "2" if both are 1 (subtitles).
audio_quality() dsp_slow_cpu, snd_pitchquality Returns "low" if dsp_slow_cpu is true; "medium" if dsp_slow_cpu is false and snd_pitchquality is false; "high" if snd_pitchquality is true.
audio_captioningLang() cc_lang Returns the raw string value of cc_lang directly.

Complex Setters (setComplex)

Function CVars written Logic
audio_captioning(value) closecaption, cc_subtitles "0" → cc=0, subs=1; "1" → cc=1, subs=0; "2" → cc=1, subs=1.
audio_quality(value) dsp_slow_cpu, snd_pitchquality "low" → dsp=1, pitch=0; "medium" → dsp=0, pitch=0; "high" → dsp=0, pitch=1.
audio_captioningLang(value) cc_lang, cc_rightaligned Writes cc_lang with the value string. Then checks rtlLanguages.indexOf(value) == 0; if true, sets cc_rightaligned to 1, otherwise 0.

Model Items

The ListModel is populated in Component.onCompleted with 7 items:

# Key Type CVar / Getter Range / Options Notes
1 audio_gameVolume slider volume 0.0 – 1.0, step 0.05, percent formatter Master game volume
2 audio_fxvolume slider snd_fxvolume 0.0 – 1.0, step 0.05, percent formatter Sound effects volume
3 audio_musicVolume slider snd_musicvolume 0.0 – 1.0, step 0.05, percent formatter Also triggers live Sound.ambientVolume update on change
4 audio_speakerConfig select snd_surround_speakers Headphones (0), 2.0 (2), 4.0 (4), 5.1 (5), 7.1 (7)
5 audio_quality select getComplex / setComplex Low, Medium, High Maps to dsp_slow_cpu + snd_pitchquality
6 audio_captioning select getComplex / setComplex No Captions (0), Closed Captions (1), Subtitles (2) Maps to closecaption + cc_subtitles; changing this triggers setLanguageState()
7 audio_captioningLang select getComplex / setComplex 30 language options (Arabic through Vietnamese) Disabled when captioning is off; writes cc_lang and cc_rightaligned
Captioning Language Options

The 30 options in audio_captioningLang are, in order: Arabic, Chinese Simplified, Chinese Traditional, Croatian, Czech, Danish, Dutch, English, Finnish, French, Georgian, German, Greek, Hungarian, Indonesian, Italian, Japanese, Korean, Lithuanian, Norwegian, Polish, Portuguese, Portuguese (Brazilian), Romanian, Russian, Spanish, Spanish (Mexico), Swedish, Turkish, Ukrainian, Vietnamese.

confirmAlert

An Alert shown when the user navigates away with unsaved changes. Identical in structure to the one in routeview-video.qml:

Button type objectName Label Action
CTAButton ui:btn:action[apply] L10n.strings.buttons.apply Calls audioOptions.flushPendingChanges(), then navigates to blockingRouteName.
WarningButton ui:btn:action[discard] L10n.strings.buttons.discard Navigates to blockingRouteName without saving.
DefaultButton ui:btn:action[cancel] L10n.strings.buttons.cancel Clears blockingRouteName and hides the alert.

Notable Issues

1. Sound.ambientVolume does not exist. The Sound singleton (sound.qml) defines no ambientVolume property — its only property is ambientId (an int handle). The assignment Sound.ambientVolume = model.value in onRequestSettingsChange creates a dynamic property on the singleton at runtime but has no effect on the volume of the currently playing ambient track. The music volume is only applied from snd_musicvolume when startAmbient() is next called. Live music volume adjustment while the menu is open does not work.

2. checks position, not membership. Array.indexOf returns the index of the element, or -1 if not found. Comparing to 0 means the condition is only true when value is the first element of the array ("arabic"). All other RTL languages in the list — aramaic, azeri, dhivehi, maldivian, hebrew, kurdish, sorani, persian, farsi, urdu — will never set cc_rightaligned to 1. The correct check is rtlLanguages.indexOf(value) !== -1.

3. audio_captioningLang declares valueType: "int" but stores strings. The option values are language name strings (e.g. "arabic", "english"). The valueType should be "string". Since this item uses a complex getter/setter and has no cvar field, the valueType is likely ignored by the OptionsList at runtime, making this a documentation/consistency issue rather than a functional bug.

4. audio_captioning declares valueType: "int" but the complex getter returns strings. The getter returns "0", "1", or "2" as string values. As with audio_captioningLang, the valueType is irrelevant for complex-getter items, but the declaration is misleading.

5. Trailing comma in audio_captioningLang options array. The last entry ("vietnamese") is followed by a trailing comma. This is valid in ES5+ JavaScript but is inconsistent with all other option arrays in the file.

6. disabled: false is explicitly set on audio_captioningLang. All other items rely on the default. This is redundant but harmless; the actual disabled state is managed dynamically by setLanguageState().

7. audio_captioning setter assigns for the "off" case. When value is "0" (no captions), the setter writes cc_subtitles as 1. This is a latent inconsistency: if closecaption is later set to 1 externally (e.g. via console), subtitles would be active even though the user selected "No Captions". The getter correctly handles this by checking closecaption first, so the UI will still display "No Captions" correctly, but the underlying CVar state is untidy.

routeview-bindings.qml

routeview-bindings.qml is the Key Bindings settings page. It is registered in routes.qml as the bindings route at path options.bindings, rank 3.3. The tab label is L10n.strings.menus.bindings (#QTUI_Menu_Options_Bindings), rendered in the Options sub-navigation bar by component-header.qml.

The file is 618 lines. It depends on three supporting files: input-bindings-manager.qml (the InputBindingsManager singleton), component-binding.qml (the BindingList component), and component-optionslist-input-bindingcell.qml (the BindingCell component). Five category files (component-binding-movement.qml through component-binding-multiplayer.qml) define the command lists for each tab.

Properties

Property Type Value / Expression Notes
headerMargin int Math.ceil(35 * Theme.widthScale)
headerFontSize int Math.ceil(32 * Theme.heightScale)
headerHeight int Math.ceil(85 * Theme.widthScale) Uses widthScale instead of heightScale. See Notable Issues.
buttonMargin int Math.ceil(17 * Theme.widthScale)
rowHeight int Math.ceil(85 * Theme.heightScale)
pageWidth int Math.ceil(1500 * Theme.widthScale)
pageHeight int visibleRows * rowHeight + headerHeight * 2 Total height: 7 rows + header + footer.
categoryWidth int Math.ceil(pageWidth * 0.28) Left panel is 28% of page width.
categoryLabelFontSize int Math.ceil(28 * Theme.heightScale)
categoryLabelFocusShapeWidth int Math.ceil(15 * Theme.widthScale) Width of the orange accent bar shown on the selected category.
visibleRows int 7
categories variant Set in Component.onCompleted Object map of category definition objects.
currentModel variant Set by outlet.setCategory() The currently active category model.

onRouteWillChange

Overrides the RouteView hook. Calls InputBindingsManager.clearSelection() whenever the user navigates away from the bindings page, ensuring no stale selection persists.

Layout

The page is a single centered Item (pageWidth × pageHeight) with three vertical sections stacked top-to-bottom:

Section Height Background
header (Item) headerHeight Theme.colors.modalBackground at Theme.opacity.modal
body (Rectangle) rowHeight * visibleRows Theme.colors.skrim at Theme.opacity.modal
footer (Item) headerHeight Theme.colors.modalBackground at Theme.opacity.modal
header

Contains a single Text element: L10n.strings.headers.bindings (#QTUI_Header_Options_Bindings), Theme.colors.highlight, bold, all-uppercase.

body

The body is divided into three horizontal elements:

  1. categoriesList (ListView, left panel, width = categoryWidth): renders the category list. interactive: false — no scrolling.
  2. border (Rectangle, 3px wide): a vertical divider between the category list and the content area, colored Theme.colors.modalBackground at Theme.opacity.modal.
  3. outlet (StackView, right panel, fills remaining width): displays the active category's binding list.
categoriesModel (ListModel)

Built in Component.onCompleted. Appends five category entries sorted by rank, then one Reset entry:

Key label (L10n key) rank action qmlFile
movement labels.binding_movement (#QTUI_Option_Binding_Movement) 0 nav component-binding-movement.qml
combat labels.binding_combat (#QTUI_Option_Binding_Combat) 1 nav component-binding-combat.qml
misc labels.binding_misc (#QTUI_Option_Binding_Misc) 2 nav component-binding-misc.qml
weapons labels.binding_weapons (#QTUI_Option_Binding_Weapons) 3 nav component-binding-weapons.qml
multiplayer labels.binding_multiplayer (#QTUI_Option_Binding_Multiplayer) 4 nav component-binding-multiplayer.qml
(Reset All Defaults) buttons.resetAllDefaults (#QTUI_Buttons_ResetAllDefaults) — reset —

After appending, calls outlet.setCategory(categories.movement, true) to initialize the right panel to the Movement category with no transition animation.

Category list delegate (MouseArea)

Each row is a MouseArea with three visual states:

State focusShape width labelText color Sound
blurred 0 (hidden) Theme.colors.buttonText (white) —
focused Full parent width (orange fill) Theme.colors.buttonText (white) Theme.sounds.buttonFocused
selected categoryLabelFocusShapeWidth (15px accent bar) Theme.colors.highlight (orange) Theme.sounds.buttonClicked

Transitions: 250ms OutQuint for blurred↔focused, 150ms for focused→selected, 100ms for selected→blurred.

The objectName is "ui:tab" for category nav items and "ui:btn:action[cancel]" for the Reset entry. The type: "sub-nav" property causes BlackMesaUtils.traverseUIElements() to register these as sub-navigation tabs.

The callback property:

  • If the item is not already selected and action is "nav": calls outlet.setCategory(model) and sets state to "selected".
  • If action is "reset": calls resetDefaultsAlert.show().
  • If already selected: sets mouse.accepted = true (no-op).
outlet (StackView)
setCategory(model, skipTransition)

Selects a transition direction by comparing currentModel.rank to model.rank:

  • Higher rank (navigating down the list) → categoryTransitions.up (new content slides in from below).
  • Lower rank (navigating up the list) → categoryTransitions.down (new content slides in from above).

Then calls InputBindingsManager.clearSelection(), sets currentModel, and calls outlet.replace(model.qmlFile, { opacity: skipTransition ? 1.0 : 0.0 }, transition).

Transitions

Four Transition objects are defined: upEnterTransition, upExitTransition, downEnterTransition, downExitTransition.

Enter transitions (600ms InOutQuint y-slide, 300ms opacity fade-in after a 300ms pause):

  1. ScriptAction: calls BlackMesaUtils.clearUIElementsData().
  2. PauseAnimation: 300ms.
  3. NumberAnimation: opacity 0.0 → 1.0 over 300ms.
  4. ScriptAction: calls BlackMesaUtils.traverseUIElements(appRoot) and BlackMesaUtils.afterTraverseCallback().

Exit transitions (600ms InOutQuint y-slide, 300ms opacity fade-out, no UI traversal).

footer

A right-aligned Row containing:

Element objectName Visible when Disabled when Action
Text (binding instructions) — InputBindingsManager.isBinding is true — Displays L10n.strings.modalMessages.bindingInstructions (#QTUI_Messages_BindingInstructions)
CTAButton (editBindingButton) ui:btn:action[apply] !InputBindingsManager.isBinding !InputBindingsManager.isSelected InputBindingsManager.startBindingRequest(); label: #QTUI_Buttons_EditBinding
WarningButton (clearBindingButton) ui:btn:action[discard] !InputBindingsManager.isBinding !InputBindingsManager.isSelected InputBindingsManager.clearSelectedBinding(); label: #QTUI_Buttons_ClearBinding

The instructions text and the two buttons are mutually exclusive: the text is shown during active key capture, the buttons are shown otherwise.

Alerts

resetDefaultsAlert
Property Value
titleText L10n.strings.headers.resetAllDefaultsWarning (#QTUI_Header_ResetAllDefaultsWarning)
messageText L10n.strings.modalMessages.resetAllDefaultsWarning (#QTUI_Messages_ResetAllDefaultsWarning)
Button type objectName Label Action
WarningButton ui:btn:action[apply] #QTUI_Buttons_ResetAllDefaults Hides the alert, then calls InputBindingsManager.restoreDefaultBindings().
DefaultButton ui:btn:action[cancel] #QTUI_Buttons_Cancel Hides the alert.
confirmBindingOverwriteAlert

Shown when the user attempts to bind a key that is already assigned to a different command.

Property Value
titleText L10n.strings.headers.confirmBindingOverwrite (#QTUI_Header_ConfirmBindingOverwrite)
messageText Set dynamically by onConflictsChanged (see below).
Button type objectName Label Action
CTAButton ui:btn:action[apply] #QTUI_Buttons_Confirm InputBindingsManager.conflictCfg.confirm() — proceeds with the rebind.
DefaultButton ui:btn:action[cancel] #QTUI_Buttons_Cancel InputBindingsManager.conflictCfg.cancel() — cancels the rebind.

Connections (InputBindingsManager)

onConflictsChanged: When InputBindingsManager.conflicts becomes non-null, formats L10n.strings.modalMessages.confirmBindingOverwrite (#QTUI_Messages_ConfirmBindingOverwrite) by replacing {0} with the pressed key and {1} with the conflicting command name(s), both wrapped in an HTML colored Theme.colors.highlight. Sets the formatted string as confirmBindingOverwriteAlert.messageText and shows the alert. When conflicts becomes null, hides the alert.

InputBindingsManager singleton (input-bindings-manager.qml)

Registered in qmldir as singleton InputBindingsManager 1.0. Manages all binding state and engine communication.

Static maps

Three read-only IIFEs built at construction time:

Property Contents
commandMap Maps engine command strings (e.g. '+forward') to localized label strings from L10n.strings.options.bindings. 34 entries total.
mouseMap Maps Qt mouse button enum values (e.g. Qt.LeftButton) to engine key name strings (e.g. 'MOUSE1'). 7 entries: MOUSE1–MOUSE5, MWHEELUP, MWHEELDOWN.
keyMap Maps Qt key enum values (e.g. Qt.Key_Escape) to engine key name strings (e.g. 'ESCAPE'). Covers A–Z, 0–9, F1–F12, modifier keys, navigation keys, and common punctuation.
State properties
Property Type Description
bindings variant Current bindings map: command → array of key strings. Populated by getBindings().
bindingsKeyMap variant Reverse map: key string → array of command strings. Used for conflict detection.
inputBindingCallback var Callback function set during active key capture; null otherwise.
isBinding bool !!inputBindingCallback
isSelected bool !!selectedCfg
selectedCfg variant The currently selected binding cell config object.
conflicts variant Array of conflicting command label strings, or null.
conflictCfg variant Object with bindingCfg, key, confirm(), cancel() for the pending conflict resolution.
Signals

bindingSet(), bindingClear(), defaultsRestored() — emitted after the corresponding operation completes. BindingList instances listen to these to call refreshBindings().

Functions
Function Description
_readConfigFile(url, callback) XHR GET of a VFS config file. Parses lines matching /bind\s+"(.*)"\s+"(.*)"/ into a command→keys map, then calls callback(map).
_saveBindingModifications() Executes exec userconfig.cfg; host_writeconfig to persist changes.
_resetConflicts() Nulls conflicts and conflictCfg.
getBindingComponentConfig(command) Returns { label: commandMap[command], type: 'binding', command, key1: '', key2: '' }.
getBindings(commands, callback) Reads vfs:///cfg/config.cfg, populates bindings and bindingsKeyMap, calls callback with a map filtered to the requested commands.
selectBinding(cfg) Sets selectedCfg.
clearSelection() Nulls selectedCfg.
handleBindingResponse(event) Calls inputBindingCallback(event) and nulls it. Called by the engine when a key is captured.
startBindingRequest() Begins key capture: calls cfg.begin(), BlackMesaEngine.requestKeyCapture(), and sets inputBindingCallback. On response: if the key is Escape, cancels; if the key conflicts with another command, sets conflictCfg and conflicts; otherwise executes unbind + bind commands and calls _saveBindingModifications().
clearSelectedBinding() Unbinds the selected key via unbind KEY, saves, emits bindingClear().
restoreDefaultBindings() Reads vfs:///cfg/config_default.cfg (result discarded), executes unbindall; exec config_default.cfg, saves, emits defaultsRestored().

BindingList component (component-binding.qml)

Registered in qmldir as BindingList 1.0. A base Item (opacity: 0 by default — made visible by the outlet transition) that wraps a ListView of binding rows.

  • commands (variant): array of binding config objects passed in by the category file.
  • refreshBindings(): calls InputBindingsManager.getBindings(keys, callback) via a 1ms timer, then updates key1/key2 on each list model item in onBindingsChanged.
  • Listens to InputBindingsManager.bindingSet, bindingClear, and defaultsRestored to call refreshBindings().
  • Component.onCompleted: calls refreshBindings().
  • The ListView delegate loads component-optionslist-row.qml with the binding model via a Loader.
  • A VerticalScrollBar is shown only when content overflows the list height.

BindingCell component (component-optionslist-input-bindingcell.qml)

Registered in qmldir as BindingCell 1.0. Renders a single key slot (key1 or key2) within a binding row. objectName: "ui:option-item", type: "binding".

Four visual states:

State Text color Background opacity Meaning
blurred Theme.colors.buttonText (white) 0 Default, unselected
focused Theme.colors.highlight (orange) 0.2 Mouse hover
selected Theme.colors.text (white) 0.5 Row selected, ready to edit
binding transparent 1.0 (solid orange) Key capture in progress

Click behavior is a two-step interaction: 1. First click (from blurred or focused): calls makeSelectionRequest(), which emits requestInputSelection(beginBinding, endBinding). The upstream handler (in component-optionslist-row.qml) calls InputBindingsManager.selectBinding(cfg) and invokes beginBinding(), transitioning the cell to "binding" state. 2. Second click (from selected): calls startBinding(), which calls InputBindingsManager.startBindingRequest() directly.

All state transitions animate over 150ms with OutQuint easing.

Category files

Each category file is a BindingList that passes a fixed commands array to the base component. All commands are resolved via InputBindingsManager.getBindingComponentConfig(command).

File Commands
component-binding-movement.qml +forward, +back, +moveleft, +moveright, +jump, +duck, +speed (7)
component-binding-combat.qml +use, +attack, +attack2, +reload, impulse 100, +zoom, invnext, invprev, lastinv, slot1–slot6 (15)
component-binding-misc.qml save quick, load quick, toggleconsole, incrementvar closecaption 0 1 1, +moveup, +movedown, +lookup, +lookdown, +left, +right (10)
component-binding-weapons.qml use weapon_crowbar, use weapon_glock, use weapon_357, use weapon_mp5, use weapon_shotgun, use weapon_crossbow, use weapon_rpg, use weapon_tau, use weapon_gluon, use weapon_hivehand, use weapon_frag, use weapon_tripmine, use weapon_satchel, use weapon_snark (14)
component-binding-multiplayer.qml chooseteam, +voicerecord (2)

Notable Issues

1. headerHeight uses widthScale. Math.ceil(85 * Theme.widthScale) is used for both the header and footer height instead of Theme.heightScale. At non-16:9 resolutions the header and footer will be incorrectly sized vertically.

2. bindingsKeyMap.push(command) bug. In getBindings(), when a key already exists in bindingsKeyMap, the code calls bindingsKeyMap.push(command) instead of bindingsKeyMap[key].push(command). bindingsKeyMap is a plain object, not an array, so push is undefined and this call throws a TypeError at runtime. The second command for any multiply-bound key is never added to the reverse map, causing conflict detection to miss cases where a key is bound to more than one command.

3. restoreDefaultBindings() ignores the parsed config. The function reads vfs:///cfg/config_default.cfg via XHR and parses it, but the parsed response is never used — the commented-out code shows the original intent was to iterate over it and re-apply bindings individually. The current implementation simply executes unbindall; exec config_default.cfg unconditionally, making the XHR call and parse entirely redundant.

4. confirmBindingOverwriteAlert has no initial messageText. The property is only set dynamically by onConflictsChanged. If the alert were shown before the first conflict event, it would display an empty message body.

5. Trailing comma in component-binding-multiplayer.qml. The commands array ends with a trailing comma after '+voicerecord'. This is valid in ES5+ but may cause issues in older V8/QML engine versions.

6. visibleRows: 7 with 6 category list items. The body height is 7 * rowHeight, but the category ListView only has 6 items (5 categories + Reset). The category list is shorter than the body, leaving a blank gap at the bottom of the left panel.

7. No pending-changes guard. Unlike routeview-video.qml, there is no onRouteWillChange confirmation dialog. Navigating away while a key capture is in progress (isBinding is true) silently cancels the capture with no feedback to the user.

routeview-campaigns.qml

routeview-campaigns.qml is a 9-line stub file. It is a RouteView containing a single Text element that displays the literal string "..." centered on screen. It has no properties, no logic, no signals, and no interactive elements.

routeview-campaigns.qml is not registered in routes.qml. There is no campaigns route defined anywhere in the routing system. A search across the entire QML codebase finds zero references to this file by name — it is not listed in qmldir, not referenced in component-header.qml, and not loaded by any router or engine call visible in the QML layer.

routeview-empty.qml

routeview-empty.qml is the blank/null route view. It is registered in routes.qml as the empty route and serves as the router's initial state and as the visual placeholder used during level loading and UI-hidden transitions.

The file is 4 lines and contains no content beyond the base class instantiation:

  
import QtQuick 2.9  
import CrowbarCollective 1.0  
  
RouteView {}

It renders nothing — no children, no properties, no signals overridden.

Route Registration

Property Value
name "empty"
path "empty"
qmlFile "routeview-empty.qml"
alert (not set)
rank (not set)
passthrough (not set)

The comment in routes.qml reads: "empty route that displays nothing".

Role in the Router

Initial State

router.qml (a StackView) transitions to the empty route in its Component.onCompleted handler, making it the first view pushed onto the stack before any engine events have fired:

  
Component.onCompleted: {  
    outlet.setRoute(emptyRoute.name)  
}
Transition Behaviour

The _getRouteTransitionConfig function in router.qml contains three branches that reference the empty route:

Condition Transition used Notes
route.name === Routes.empty.name (navigating to empty) routeTransitions.up — slides in from y=+300 Caught by the same branch as alert routes: route.alert || route.name === Routes.empty.name
route.name === Routes.empty.name (second check, line 65) routeTransitions.down — slides in from y=−300 Dead branch. This condition is unreachable because the first branch (line 62) already matches any navigation to the empty route and returns early. The down transition is never applied via this path.
currentRoute.name === Routes.empty.name (navigating away from empty) routeTransitions.down — slides in from y=−300 Applied when the router transitions from empty to any non-alert route (e.g. to index on startup).

Usage in main.qml

main.qml aliases the route as emptyRoute for convenience:

  
readonly property Route emptyRoute: Routes.empty

It is routed to in two engine event handlers:

Handler Call Behaviour
onGameUIHidden router.setRoute(emptyRoute.name, didLoadLevel) Transitions to empty whenever the game UI is hidden. If didLoadLevel is true (the UI is hiding because a level just finished loading), the second argument causes setRoute to use StackView.Immediate, skipping the animation entirely. If the user dismissed the UI manually (Esc), didLoadLevel is false and the up transition plays.
onLevelLoadingStarted router.setRoute(emptyRoute.name, true) Immediately transitions to empty (no animation) as soon as a level begins loading, clearing all menu content from the screen before the loading screen takes over.

Usage in component-footer.qml

The footer uses the empty route name in two visibility conditions:

Property Expression Effect
_showBackButton currentRoute.name !== Routes.index.name && currentRoute.name !== Routes.empty.name The Back button is hidden on the empty route (there is nothing to go back to from a blank screen).
_showBackToGameButton isInGame && (currentRoute.name === Routes.index.name || currentRoute.name === Routes.empty.name) The "Back to Game" button is shown on the empty route when isInGame is true, allowing the player to dismiss the UI from the loading/blank state.

Notable Issues

1. Dead branch in _getRouteTransitionConfig. The condition route.name === Routes.empty.name appears twice in the transition logic. The first occurrence (line 62, combined with the alert check) always matches first and returns routeTransitions.up. The second occurrence (line 65) is therefore unreachable, and the intended routeTransitions.down transition for navigating to the empty route is never applied via that path.

2. _showBackToGameButton on the empty route is unreachable in practice. The empty route is only active when the UI is hidden (onGameUIHidden) or a level is loading (onLevelLoadingStarted). In both cases appRoot.visible is false or the footer is in loading mode, so the "Back to Game" button condition is technically satisfied but never visible to the user.

routeview-game.qml

routeview-game.qml is the Game Options settings page. It is registered in routes.qml as the game route at path options.game, rank 3.1. Because the parent options route is passthrough: true with destination: "game", navigating to the Options main-nav button lands directly on this page. It is the first entry in optionsNavModel in component-header.qml, with tab label L10n.strings.menus.game (#QTUI_Menu_Options_Game).

The file is 263 lines and contains one top-level property, four helper functions, and one OptionsList.

Top-level Property

Property Type Default Purpose
availableMultiplayerModels var [] Populated in Component.onCompleted from BlackMesaEngine.getAvailableMultiplayerModels(). Used as the source data for the multiplayer character model selector.

Helper Functions

generateModelSelectData()

Maps availableMultiplayerModels to an array of { label, value } objects. Labels are resolved via L10n.getString(item.name); values are item.model (the model path string).

findSkinsForCurrentSelectedModel(model)

Calls BlackMesaEngine.getCurrentMultiplayerModelSkins(model) and returns the result directly. The return value is a skin count (integer), not an array, despite the variable name skins used at the call site.

generateModelSkinsSelectData(model, skinCount)

Builds a skin options array by iterating from 0 to skinCount - 1. Each entry is { label: L10n.getString("#" + model + "_Skin" + i), value: Number(i).toString() }. Skin localization keys follow the pattern #<modelpath>_Skin0, #<modelpath>_Skin1, etc.

setCurrentMultiplayerModel(model, skin)

Calls BlackMesaEngine.setCurrentMultiplayerModel(model, skin) inside a try/catch block. The error handler body is entirely commented out (//BlackMesaEngine.printConsoleMessage("#AFE4AA", e);), so errors are silently swallowed.

gameOptions OptionsList

Property Value
title L10n.strings.headers.gameOptions (#QTUI_Header_Options_Game)
visibleRows 7 (list scrolls; there are 13 items total)
anchors.centerIn parent
anchors.verticalCenterOffset Math.ceil(20 * Theme.heightScale)

onRequestSettingsChange calls setValue(model, value) directly with no custom logic. There is no onRouteWillChange override, so navigating away silently discards any unapplied changes.

groups

Two group handler functions are defined on the groups QtObject:

Function Trigger Behaviour
mp_multiplayer_character_model_group() Character model selector changes Fetches the skin count for the newly selected model, regenerates the skin options list via generateModelSkinsSelectData, resets the skin value to "0", disables the skin selector if the skin count is less than 2, then calls setCurrentMultiplayerModel with the new model and skin "0".
mp_multiplayer_character_skin_group() Character skin selector changes Calls setCurrentMultiplayerModel with the current model value and the newly selected skin value.
Settings Items

All 13 items are appended in gameOptionsModel.Component.onCompleted. Items 1–11 use direct CVar bindings; items 12–13 are managed entirely through the groups mechanism and have no cvar property.

# Key Type CVar Options / Range
1 game_difficulty select (int) skill Easy = 1, Normal = 2, Hard = 3
2 game_alwaysRun select (int) sv_always_run No = 0, Yes = 1
3 game_viewRoll slider (real) cl_view_roll 0.0 – 3.5, step 0.1, precision 1, decimal formatter
4 game_fastWeapon select (int) hud_fastswitch No = 0, Yes = 1
5 game_AutoWeaponSwitch select (int) cl_weapon_autoswitch No = 0, Yes = 1
6 game_classicIronSight select (int) cl_ironsight_classic No = 0, Yes = 1
7 game_autoCrouch select (int) cl_auto_crouch_jump No = 0, Yes = 1
8 game_toggleCrouch select (int) cl_toggle_duck No = 0, Yes = 1
9 game_announcer select (string) bm_killstreaks_voice_pack_file Marine = value of bm_marine_announcer, Scientist = value of bm_scientist_announcer
10 game_devConsole select (int) con_enable No = 0, Yes = 1
11 game_autoAim select (int) sk_autoaim_enabled No = 0, Yes = 1
12 mp_multiplayer_character_model select (string) (none — group-managed) Dynamic; generated by generateModelSelectData() at construction time
13 mp_multiplayer_character_skin select (int) (none — group-managed) Dynamic; generated by generateModelSkinsSelectData() for the current model

The announcer option values are read from the engine at construction time via BlackMesaEngine.getConsoleVariableAsString("bm_marine_announcer") and BlackMesaEngine.getConsoleVariableAsString("bm_scientist_announcer"), making the option values indirect CVar references rather than hardcoded strings.

Notable Issues

1. game_classicIronSight label bypasses L10n. Its label uses BlackMesaEngine.getLocalizedString("#BlackMesaUI_Options_Game_IronSightClassic") directly instead of the L10n singleton, inconsistent with all other items in the list which use L10n.strings.options.labels.*.

2. game_fastWeapon key/label mismatch. The item's key is "game_fastWeapon" but the corresponding L10n label key is game_weaponSwitch. The two identifiers are inconsistent, though this has no functional impact.

3. skins < 2 compares a count, not an array. findSkinsForCurrentSelectedModel returns an integer count. The variable is named skins, which implies an array. The comparison if (skins < 2) is numerically correct but semantically misleading.

4. Multiplayer skin initial value is hardcoded. mp_multiplayer_character_skin is initialized with value: "0" unconditionally. The current skin is never read from the engine on page load, so the skin selector always resets to the first skin when the page is opened.

5. Multiplayer model/skin section is wrapped in a silent try/catch. If BlackMesaEngine.getAvailableMultiplayerModels() or BlackMesaEngine.getCurrentMultiplayerModel() throws, currentMultiplayerModel and currentMultiplayerModelSkins remain undefined. The subsequent append calls for items 12 and 13 will then use undefined.model and pass undefined as the skin list, producing broken selectors with no error surfaced to the user.

6. No pending-changes guard. Unlike routeview-video.qml, there is no onRouteWillChange override. Navigating away after changing settings but before they are flushed silently discards all changes.

7. visibleRows: 7 with 13 items. The list requires scrolling to reach items 8–13 (Auto Crouch Jump through Multiplayer Skin). The multiplayer model and skin selectors are below the fold by default.

routeview-host.qml

routeview-host.qml is the Host Game configuration page. It is registered in routes.qml as the host route at path multiplayer.host, rank 2.2. It has no explicit id on the root RouteView.

The page is accessed via the Host sub-nav tab in the Multiplayer section. The tab is defined in component-header.qml inside multiplayerNavModel with isEnabled: true. Notably, multiplayerNavModel.Component.onCompleted also executes BlackMesaEngine.executeClientCommandUnrestricted("exec server.cfg;") before appending the tab entries; a comment in that file reads "this one is needed for correct host settings load". This means server.cfg is loaded whenever the user first navigates to any Multiplayer sub-route, not only when the Host tab is opened.

Scaling Properties

Property Value Notes
headerHeight Math.ceil(80 * Theme.widthScale) Uses widthScale, not heightScale. See Notable Issues.
headerMargin Math.ceil(16 * Theme.widthScale)
headerFontSize Math.ceil(32 * Theme.heightScale)
optionHeight Math.ceil(72 * Theme.heightScale) Used for all settings rows except the map row.

handleSettingsChange

function handleSettingsChange(model, value) {  
    model.value = value; // lol  
}

The sole change handler for all settings rows. It updates the in-memory ListElement value only. It does not write to any CVar, does not validate input, and does not track pending changes. All CVar writes are deferred until the Launch Game button is clicked.

Layout

The entire page is a single Item sized at 1024×768 (scaled) and centered in the parent with a vertical offset of Math.ceil(20 * Theme.heightScale). It is divided into three vertically stacked sections:

Section id Height Background
header headerHeight Theme.colors.modalBackground at Theme.opacity.modal
(background rectangle) Fills between header.bottom and footer.top Theme.colors.skrim at Theme.opacity.modal
contents Fills between header.bottom and footer.top Transparent (overlays the background rectangle)
footer headerHeight Theme.colors.modalBackground at Theme.opacity.modal
header

Contains a single Text element displaying the localized string #BlackMesaUI_Multiplayer_HostGame in Theme.colors.highlight, bold, uppercase, at headerFontSize.

contents

Contains six OptionsListRow items stacked vertically. Component.onCompleted connects each row's requestSettingsChange signal to handleSettingsChange via row.requestSettingsChange.connect(handleSettingsChange). See Notable Issues regarding the inline onRequestSettingsChange handlers also present on each row.

Row id Label (engine key) Type Initial value Container height
serverName #BlackMesaUI_Multiplayer_ServerName text BlackMesaEngine.getConsoleVariableAsString("hostname") optionHeight
map #BlackMesaUI_Multiplayer_Map map "dm_stalkyard" (hardcoded) 200 * Theme.widthScale
fragLimit #BlackMesaUI_Multiplayer_FragLimit text BlackMesaEngine.getConsoleVariableAsInt("mp_fraglimit") optionHeight
timeLimit #BlackMesaUI_Multiplayer_TimeLimit text BlackMesaEngine.getConsoleVariableAsInt("mp_timelimit") / 60 optionHeight
teams #BlackMesaUI_Multiplayer_TeamPlay checkbox BlackMesaEngine.getConsoleVariableAsBoolean("mp_teamplay") optionHeight
respawn #BlackMesaUI_Multiplayer_ForceRespawn checkbox BlackMesaEngine.getConsoleVariableAsBoolean("mp_forcerespawn") optionHeight

The map row's options array is a hardcoded list of 11 deathmatch maps:

dm_bounce, dm_chopper, dm_crossfire, dm_gasworks, dm_lambdabunker, dm_power, dm_rail, dm_stack, dm_stalkyard, dm_subtransit, dm_undertow.

The timeLimit row reads mp_timelimit (stored in seconds) and divides by 60 for display. On write, the stored value is multiplied by 60 before being passed to the engine.

footer

Contains a Timer (id: launchGameTimer) and a CTAButton (id: launchButton).

launchButton

objectName: "ui:btn:action[apply]", text: #BlackMesaUI_Multiplayer_LaunchGame, centered in the footer.

onClicked:

  1. Calls BlackMesaEngine.executeClientCommandUnrestricted("disconnect").
  2. Starts launchGameTimer.
  3. Disables itself ().
launchGameTimer

Interval: 125 ms, repeat: true. On each tick, checks BlackMesaEngine.isInGame(). If the engine reports it is not in a game session, the timer:

  1. Writes all user-configured CVars to the engine:
  2. Hardcodes the following CVars regardless of any user preference:
  3. Executes: sv_cheats 0; maxplayers 12; map <mapname> (player count hardcoded to 12).
  4. Stops the timer and re-enables launchButton.
  5. Calls BlackMesaEngine.writeHostMultiplayerSettings().

The polling approach is used to wait for the disconnect command to fully take effect before issuing the map command.

Notable Issues

1. headerHeight uses widthScale. Both the header and footer heights are computed as Math.ceil(80 * Theme.widthScale) instead of Theme.heightScale. At non-16:9 resolutions, the header and footer will be disproportionately tall or short relative to the rest of the UI.

2. mapContainer height uses widthScale. The map row container height is 200 * Theme.widthScale, inconsistent with optionHeight which uses heightScale.

3. Inline onRequestSettingsChange handlers are no-ops. Each OptionsListRow declares onRequestSettingsChange: handleSettingsChange. In QML, this evaluates handleSettingsChange as an expression when the signal fires, returning the function reference without calling it. The actual connections are made in contents.Component.onCompleted via connect(). The inline declarations are dead code.

4. No pending-changes guard. Unlike routeview-video.qml, there is no onRouteWillChange override. Navigating away after editing settings but before clicking Launch silently discards all changes.

5. Map default is hardcoded, not read from a CVar. mapModel.value is initialized to "dm_stalkyard" unconditionally. It does not read any engine variable, so the previously used map is never restored on page load.

6. Player count is hardcoded to 12 (instead of 32). The maxplayers argument in the launch command is a literal 12 with no corresponding UI control.

7. mp_friendlyfire, mp_flashlight, and mp_warmup_time are silently forced. These three settings are always written to fixed values (false, false, 15) on every launch, with no UI option to change them.

8. sv_lan is always false. The server is always launched as an internet server. There is no LAN-only option.

9. teamsModel and respawnModel use fragile boolean parsing. The checkbox rows store their values as strings via getConsoleVariableAsBoolean(). On write, JSON.parse(teamsModel.value) is used to convert back to a boolean. If the engine returns a value other than "true" or "false" (e.g. "1" or "0"), JSON.parse will throw a SyntaxError.

10. No objectName on any OptionsListRow. None of the six rows have an objectName set, so BlackMesaUtils.traverseUIElements() will not register them as option items. Keyboard and controller navigation cannot move between rows on this page.

11. All label strings bypass L10n. Every label and the page title use BlackMesaEngine.getLocalizedString() directly with #BlackMesaUI_* keys, inconsistent with the rest of the options pages which use the L10n singleton.

routeview-index.qml

routeview-index.qml is the main menu landing page. It is registered in routes.qml as the index route with no alert flag and no rank.

Property Value
name "index"
path "index"
qmlFile "routeview-index.qml"

The router navigates to this route from main.qml in three situations:

1. onGameUIActived — when the game UI is activated and either this is the initial load or the UI was previously hidden.

2. onLevelLoadingFinished — after any level finishes loading (both the main menu background map and real game levels).

3. autoBackgroundMusicTimer.onTriggered — a 1250 ms fallback timer that fires once on startup in case the normal activation path does not run.

Properties

Property Type Default Description
lastSave variant (set in Component.onCompleted) The most recent save game object returned by BlackMesaUtils.getSaveGames()[0].
isInGame bool false Whether the player is currently in an active game session. Set externally by main.qml via the Router isInGame binding.
showRoguePointCTA bool true Controls visibility of the Rogue Point wishlist banner. Persisted to SQLite. Forced to false when isInGame is true.
logoVerticalCenterOffset int Math.ceil(-80 * Theme.heightScale) Vertical offset applied to the logo anchor in all three sub-components.
childMargin int Math.ceil(75 * Theme.widthScale) Left margin applied to all child content in all three sub-components.
gameNameFontSize int Math.ceil(51 * Theme.heightScale) Font size used for the chapter name or save game chapter name text.

Component.onCompleted

On construction, the route:

1. Fetches lastSave = BlackMesaUtils.getSaveGames()[0].

2. Calls loadRoguePointCTAVisibility() to restore the CTA preference from SQLite.

3. Selects which sub-component to load into the Loader:

Condition (evaluated in order) Sub-component loaded
isInGame === true indexInGame
!isInGame && lastSave indexContinue
!isInGame && !lastSave indexNew

LocalStorage persistence

The file imports QtQuick.LocalStorage 2.0 and uses a synchronous SQLite database to persist the CTA visibility preference across sessions.

Function Behaviour
saveRoguePointCTAVisibility() Opens the "BlackMesa" database (version "1.0", 100 KB limit). Creates a Settings(key TEXT, value TEXT) table if it does not exist. Inserts or replaces the row ["showRoguePointCTA", showRoguePointCTA].
loadRoguePointCTAVisibility() Opens the same database. Reads the showRoguePointCTA row and sets showRoguePointCTA = (value === 'true') if the row exists.

Loader

A Loader (id: loader) fills the entire RouteView. Its onStatusChanged handler fires when loader.status === Loader.Ready and re-registers the newly loaded sub-component with the navigation system by calling:

1. BlackMesaUtils.clearUIElementsData()

2. BlackMesaUtils.traverseUIElements(appRoot)

3. BlackMesaUtils.afterTraverseCallback()

roguePointCTA — Rogue Point Wishlist Banner

An Image anchored to the top-right corner of the page. It displays ui/images/rp-wishlist-cta.png at a nominal 652×144 pixels (both dimensions scaled by Theme.widthScale). It is only visible when showRoguePointCTA is true, which is forced to false when isInGame is true.

Opacity animates over 200 ms via a Behavior on opacity NumberAnimation.

MouseArea (hoverArea)

Covers the entire banner. hoverEnabled: true, cursorShape: Qt.PointingHandCursor.

Handler Action
onClicked Calls BlackMesaEngine.activateSteamOverlayToWebPage("https://store.steampowered.com/app/1843840?utm_source=blackmesa_ui&utm_campaign=wishlists") and plays Theme.sounds.buttonClicked.
onEntered Sets roguePointCTA.opacity to 0.6 and plays Theme.sounds.buttonFocused.
onExited Restores roguePointCTA.opacity to 1.0.
closeButton

A 30×30 transparent Rectangle with a white border and radius: 15 (circle), positioned at the top-right corner of the banner with 15 px margins. Contains a centered white "X" Text element. Its MouseArea.onClicked sets , calls saveRoguePointCTAVisibility(), and plays Theme.sounds.buttonClicked.

Sub-components

indexInGame

Loaded when isInGame is true. Displays the current chapter name, a live clock, and save/disconnect controls.

Element Description
logo (Image) ui/images/logo.png, 69 px tall, left-aligned, vertically centered with logoVerticalCenterOffset.
gameNameText (Text) Displays BlackMesaEngine.getLocalizedString(BlackMesaEngine.getChapterName()) — the localized name of the current chapter. Uses gameNameFontSize, Theme.fonts.regular, letter spacing 5, Theme.colors.buttonText.
timerText (Text) Displays the current date and time via Theme.getDateTimeString(new Date()). Updated every 1000 ms by a repeating Timer with triggeredOnStart: true.
Button row Three CTAButton elements (see table below).
Button objectName Label (L10n key) Action Notes
Quick Save ui:btn:action[apply] L10n.strings.buttons.quicksave (#QTUI_Buttons_Quicksave) index.saveGameRequest("quick") disabled: appRoot.isInMultiplayerMode
Save Game (none) L10n.strings.buttons.saveGame (#QTUI_Buttons_SaveGame) index.routeRequest(Routes.savegame.name) disabled: appRoot.isInMultiplayerMode
Disconnect ui:btn:action[discard] L10n.strings.buttons.disconnect (#QTUI_Buttons_Disconnect) Calls BlackMesaEngine.executeClientCommandUnrestricted("disconnect"), sets and , manually sets loader.sourceComponent = indexContinue, then calls index.routeRequest(Routes.index.name). Always enabled.
indexNew

Loaded when !isInGame and no save games exist. Displays a larger logo and a single start button.

Element Description
logo (Image) ui/images/logo-new.png, 168 px tall (significantly larger than the other two sub-components). Left-aligned, vertically centered with logoVerticalCenterOffset.
CTAButton (ui:btn:action[apply]) Label: L10n.strings.buttons.startGame (#QTUI_Buttons_StartGame). Action: index.routeRequest(Routes.newgame.name).
indexContinue

Loaded when !isInGame and at least one save game exists. Displays the most recent save's metadata and a resume button.

Element Description
logo (Image) ui/images/logo.png, 69 px tall. Same layout as indexInGame.
continueGame (Item) Visible only when lastSave && !isInGame. Contains all save metadata and the resume button.
saveTypeText (Text) Displays the save type label from L10n.strings.labels: autoSave (#QTUI_Labels_AutoSave), quickSave (#QTUI_Labels_QuickSave), or manualSave (#QTUI_Labels_ManualSave). All-uppercase, Theme.fonts.light.
gameNameText (Text) Displays lastSave.chapterName at gameNameFontSize, Theme.fonts.regular, letter spacing 5.
dateText (Text) Displays Theme.getDateTimeString(lastSave.dateCreated) at 20 px scaled, Theme.fonts.light.
CTAButton (ui:btn:action[apply]) Label: L10n.strings.buttons.resume (#QTUI_Buttons_Resume). Action: index.loadGameRequest(lastSave), passing the full save object to the router, which extracts savegame.chapterName and savegame.savename and calls BlackMesaUtils.loadGame(savegame.savename).

Notable Issues

1. Redundant loader.sourceComponent assignment in Disconnect handler. The Disconnect button manually sets loader.sourceComponent = indexContinue before calling index.routeRequest(Routes.index.name). The route request causes the router to destroy and recreate the entire index route, which re-runs Component.onCompleted and selects the correct sub-component independently. The manual assignment is therefore redundant and executes a component instantiation that is immediately discarded.

2. Redundant !isInGame guard in indexContinue. continueGame.visible: lastSave && !isInGame — the !isInGame condition is always true at the time indexContinue is loaded, since it is only selected when isInGame is false. The guard would only matter if isInGame changed after the component was loaded without triggering a route reload, which does not happen in normal flow.

3. roguePointCTA uses hardcoded topMargin: -50. The top margin is not scaled by Theme.heightScale, unlike every other margin in the file. This intentionally positions the banner partially off-screen at the top edge, but the offset will be visually inconsistent at non-1080p resolutions.

4. Both dimensions of roguePointCTA use Theme.widthScale. The height property uses Theme.widthScale instead of Theme.heightScale, causing the banner to scale uniformly with screen width rather than independently in each axis. This matches the pattern in routeview-unavailable.qml and appears intentional for aspect-ratio preservation.

5. closeButton MouseArea has no hover feedback. Unlike the parent hoverArea, the close button's MouseArea does not set hoverEnabled, does not change the cursor, and does not animate opacity on hover.

6. indexInGame Save Game button has no objectName. The Quick Save button has objectName: "ui:btn:action[apply]" and the Disconnect button has objectName: "ui:btn:action[discard]", but the Save Game button has no objectName. This means BlackMesaUtils.traverseUIElements() will not register it as an action button, so it cannot be triggered by the controller Enter key via the action button system — only by direct mouse click or keyboard focus.

routeview-input.qml

routeview-input.qml is the Mouse & Controller Input Options page. It is registered in routes.qml as the input route at path options.input, rank 3.2. It is accessible via the Input tab in optionsNavModel inside component-header.qml, with tab label L10n.strings.menus.input (#QTUI_Menu_Options_Input). The tab is always enabled (isEnabled: true).

The file is 331 lines. The outer structure is a RouteView containing a single Item (id: container). A second OptionsList (id: controllerOptions) that was originally intended to sit below the first is entirely commented out.

container (Item)

The container item is centered in the parent via anchors.centerIn: parent with a verticalCenterOffset of Math.ceil(20 * Theme.heightScale). Its dimensions are derived from the active OptionsList:

Property Value
width inputOptions.width
height inputOptions.height + Math.ceil(20 * Theme.heightScale)

A commented-out version of the height property reads //height: inputOptions.height + Math.ceil(20 * Theme.heightScale) + controllerOptions.height, showing the original intent to include the second (now fully commented-out) OptionsList.

inputOptions (OptionsList)

Property Value
title L10n.strings.headers.inputOptions (#QTUI_Header_Options_Input)
visibleRows 6
getComplex / setComplex

inputOptions defines a getComplex and setComplex object, each with a single function: controller_horizontalSensitivity.

The getter reads in_look_yaw_sensitivity via BlackMesaEngine.getConsoleVariableAsFloat and returns its negated value as a string. The setter writes -Number(value) back to in_look_yaw_sensitivity. This negation is required because the engine stores the horizontal look sensitivity as a negative float for non-inverted look.

Note: No model item in the active mouseModel uses the key controller_horizontalSensitivity. The active controller sensitivity items use direct cvar bindings instead. The getComplex/setComplex functions are therefore dead code in the current state of the file.

mouseModel (ListModel)

The model is populated in Component.onCompleted. Items are appended in the following order:

# Key Type CVar Range / Options L10n label key
— (separator) separator — — L10n.strings.headers.mouseOptions (#QTUI_Header_Options_Input_Mouse)
1 mouse_invert select m_pitch Off: "0.022", On: "-0.022" #QTUI_Option_Mouse_Invert
2 mouse_raw select m_rawinput Off: "0", On: "1" #QTUI_Option_Mouse_RawInput
3 mouse_accelerationswitch select m_customaccel Off: "0", On: "3" #QTUI_Option_Mouse_AccelerationSwitch
4 mouse_sensitivity slider sensitivity 0.1 – 6.0, step 0.1 #QTUI_Option_Mouse_Sensitivity
5 mouse_acceleration slider m_customaccel_exponent 1.0 – 1.4, step 0.1 #QTUI_Option_Mouse_Acceleration
6 mouse_zoomAcceleration slider zoom_sensitivity_ratio 0.0 – 2.0, step 0.1 #QTUI_Option_Mouse_ZoomAcceleration
— (separator) separator — — L10n.strings.headers.controllerOptions (#QTUI_Header_Options_Input_Controller)
7 controller_lookVerticalSensitivity slider in_joy_look_pitch_sensitivity 0.0 – 2.0, step 0.01 #QTUI_Option_Controller_LookVerticalSensitivity
8 controller_lookHorizontalSensitivity slider in_joy_look_yaw_sensitivity 0.0 – 2.0, step 0.01 #QTUI_Option_Controller_LookHorizontalSensitivity
9 controller_gyroVerticalSensitivity slider in_gyro_look_pitch_sensitivity 0.0 – 2.0, step 0.01 #QTUI_Option_Controller_GyroVerticalSensitivity
10 controller_gyroHorizontalSensitivity slider in_gyro_look_yaw_sensitivity 0.0 – 2.0, step 0.01 #QTUI_Option_Controller_GyroHorizontalSensitivity

All sliders use valueType: "real", precision: 2, and formatter: "decimal".

Two items are commented out inside the model block: a controller_rumble select (cl_rumblescale) and a controller_invert select (joy_inverty), both with Off/On options.

Commented-out controllerOptions (OptionsList)

The entire second OptionsList (id: controllerOptions) is wrapped in a block comment. It was designed to sit below inputOptions with visibleRows: 4 and title: L10n.strings.headers.controllerOptions.

It contained:

  • A setControllerState() function that disabled or enabled the controller_invert, controller_horizontalSensitivity, and controller_verticalSensitivity rows based on whether .
  • onSettingsReset and onRequestSettingsChange handlers that called setControllerState() to keep the disabled state in sync.
  • Its own getComplex/setComplex for controller_horizontalSensitivity, using the CVar joy_yawsensitivity (distinct from the in_look_yaw_sensitivity used in the active inputOptions).
  • A controllerModel with four items:
Key Type CVar Range / Options
controller_enabled select joystick No: "0", Yes: "1"
controller_invert select joy_inverty No: "0", Yes: "1"
controller_horizontalSensitivity slider (complex) joy_yawsensitivity (negated) 0.5 – 7.0, step 0.001
controller_verticalSensitivity slider joy_pitchsensitivity 0.5 – 7.0, step 0.001

Notable Issues

1. Dead getComplex/setComplex on inputOptions. The active inputOptions defines getComplex.controller_horizontalSensitivity and setComplex.controller_horizontalSensitivity, but no item in mouseModel uses the key controller_horizontalSensitivity. The controller sensitivity items in the active model (items 8–10) use direct cvar bindings. These complex getter/setter functions are never called.

2. CVar mismatch between active and commented-out code. The active getComplex/setComplex targets in_look_yaw_sensitivity, while the commented-out controllerOptions targeted joy_yawsensitivity. These are different CVars. If the commented-out section were re-enabled without reconciling this, the two panels would read and write different CVars for the same conceptual setting.

3. mouse_invert valueType mismatch. The mouse_invert select item declares valueType: "int", but its option values are the float strings "0.022" and "-0.022". The m_pitch CVar is a float. The valueType should be "real".

4. Narrow mouse_acceleration range. The mouse_acceleration slider (m_customaccel_exponent) spans 1.0 – 1.4 with a step of 0.1, yielding only five discrete positions. The exponent range for m_customaccel mode 3 is typically 1.0 – 1.4, so the range is technically correct, but the coarse step size means the slider has very limited granularity.

5. Redundant anchors.verticalCenterOffset: 0 on inputOptions. The inputOptions item sets anchors.verticalCenterOffset: 0, which is the default value and has no effect.

6. Verbose step values. The controller sensitivity sliders use stepValue: 0.010000 (six decimal places). This is functionally identical to 0.01.

routeview-join.qml

routeview-join.qml is the Join Game page, the first sub-route of the Multiplayer section. It is registered in routes.qml as the join route at path multiplayer.join, rank 2.1. The parent multiplayer route is passthrough: true with destination: "join", so navigating to Multiplayer always lands here first.

Navigation Entry Point

component-header.qml defines multiplayerNavModel, which appends two sub-nav tabs on Component.onCompleted:

Label (L10n key) routeName isEnabled
L10n.strings.menus.join (#QTUI_Menu_Multiplayer_Join) join true
L10n.strings.menus.host (#QTUI_Menu_Multiplayer_Host) host true

As a side effect of multiplayerNavModel initialization, component-header.qml also executes BlackMesaEngine.executeClientCommandUnrestricted("exec server.cfg;") to pre-load server configuration before the Host page is visited.

Properties

Property Type Value / Purpose
total int Declared but never read or written anywhere in the file. Dead property.
cellH int Math.ceil(200 * Theme.heightScale) — height of each server row in the list.
serverDescriptionMainTextSize int Math.ceil(32 * Theme.heightScale) — base font size used for server info text.
stepServerList int State machine variable: 0 = before search, 1 = searching LAN, 2 = searching Internet.
searchTextState string Status message displayed above the list. Initialized to #BlackMesaUI_Multiplayer_SearchingServersLocal.
fastpathServerName variant Regex /(fastpath)/ig used to filter out internal "fastpath" servers from the results.

A private QtObject (id: d) holds one property, queryHandle (string), which stores the handle returned by the server list request calls. It is written but never read.

Server Discovery Sequence

deferredCompletedTimer

A one-shot Timer with a 1250 ms delay that fires automatically on page load (running: true). Its onTriggered handler:

  1. Calls BlackMesaEngine.listSaveEntries() and discards the result (dead code).
  2. Calls BlackMesaEngine.requestLANServerList(), stores the handle in d.queryHandle, and sets stepServerList = 1.

The 1250 ms delay defers the server query until after the route transition animation has completed.

Connections (BlackMesaEngine signals)
Signal Handler behaviour
onMatchmakingServerResponded Checks that serverEntry.steamApplicationId === BlackMesaEngine.getSteamApplicationId() and serverEntry.gameDirectory === "bms". Sets serverEntry.lan to 1 if currently in LAN phase, 0 otherwise. Filters out any entry whose name or gameDescription matches fastpathServerName. Appends surviving entries to serverList.
onMatchmakingQueryCompleted If (LAN done): updates searchTextState to #BlackMesaUI_Multiplayer_SearchingServersInternet, calls BlackMesaEngine.requestInternetServerList(), sets . If (Internet done): sets searchTextState to #BlackMesaUI_Multiplayer_NoServersFound or #BlackMesaUI_Multiplayer_ServersFoundCount.arg(serverList.count), then calls BlackMesaUtils.clearUIElementsData(), BlackMesaUtils.traverseUIElements(appRoot), and BlackMesaUtils.afterTraverseCallback() to register the newly populated list rows with the keyboard/controller navigation system.

Layout

The page uses a two-row, one-column GridLayout with 16 px margins filling the entire RouteView.

Row 1 — Status Bar

An Item of fixed height 40 * Theme.heightScale containing:

  • serverSearchingState (Text): displays searchTextState in bold, Theme.colors.headerText, at serverDescriptionMainTextSize * 0.6.
  • A spinner Image (Rolling-1s-200px.png), 32×32 px (scaled by heightScale), anchored to the right of the status text. It is visible only when stepServerList !== 2 (i.e. hidden once the Internet search completes). A RotationAnimation spins it continuously from 0° to 360° over 500 ms.
Row 2 — Server List

A Rectangle (id: serverListContainer) with a 2 px white border and a near-transparent background (#10000000), filling the remaining height.

Inside it, a GridView (id: grid) with:

Property Value
cellWidth parent.width — full width, single column
cellHeight cellH (200 px scaled)
cacheBuffer 8000
boundsBehavior Flickable.StopAtBounds
ScrollBar.vertical VerticalScrollBar (always visible)
model ListModel (id: serverList), populated dynamically by onMatchmakingServerResponded
Server Row Delegate

Each row is a MouseArea with:

  • objectName: "ui:option-item" — registers the row with BlackMesaUtils.traverseUIElements() as a navigable option item.
  • type: "join" — a custom type value not used by the navigation system.
  • Two states: blurred (no border, #40000000 background) and focused (2 px Theme.colors.highlight border, same background).
  • onEntered: sets state to "focused", plays Theme.sounds.buttonFocused.
  • onExited: sets state to "blurred".
  • onDoubleClicked: executes BlackMesaEngine.executeClientCommandUnrestricted("disconnect; connect " + connectionAddressString).
  • A callback property holding the same connect command as a function, intended to be invoked by the keyboard/controller navigation system when Enter is pressed on a focused row.

The inner layout is a GridLayout with four columns:

Column Width Contents
Map thumbnail cellH (square) Rectangle (#111111 bg) containing an async Image loaded from materials/vgui/multiplayer/map_backgrounds/<map>_0_widescreen_16_10.vtf, and a Text label below it showing the map name with the dm_ prefix stripped.
Player count 96 px fixed Three Text elements showing playersOnServerCurrently / playersOnServerMaximum (current in headerText, separator and max in highlight), plus a serverNetworkType label at the bottom showing #BlackMesaUI_Multiplayer_ServerTypeLocal or #BlackMesaUI_Multiplayer_ServerTypeInternet in highlight color.
Server name Fill remaining width Text (id: serverName) showing name.trim() in bold, headerText color, with elide: Text.ElideRight.
Ping 64 px fixed Text (id: serverPing) showing ping in regular weight, headerText color (overridden to headerText in both states — the state change has no visible effect on this element).

Notable Issues

1. total is a dead property. It is declared as property int total but is never assigned or read anywhere in the file.

2. Dead engine call in the timer. var listSaveEntries = BlackMesaEngine.listSaveEntries() is called inside deferredCompletedTimer.onTriggered and the result is immediately discarded. This makes an unnecessary engine call on every page load.

3. d.queryHandle is write-only. The handle returned by requestLANServerList() and requestInternetServerList() is stored in d.queryHandle but never read. There is no mechanism to cancel an in-progress query when the user navigates away from the page, which may cause onMatchmakingServerResponded to fire and attempt to append to serverList after the route has been destroyed.

4. type: "join" has no effect. BlackMesaUtils.traverseUIElements() classifies items with objectName: "ui:option-item" as option items regardless of their type property. The type: "join" value is unique to this file and is not handled by any navigation logic.

5. No single-click handler. The delegate only handles onDoubleClicked for connecting. Single-click focuses the row visually. The callback property provides the Enter-key connect action via the navigation system, but there is no explicit onClicked handler, making mouse single-click a no-op.

routeview-loadgame.qml

routeview-loadgame.qml is the Load Game page. It is registered in routes.qml as the loadgame route at path campaign.loadgame, rank 1.2.

The file is 70 lines and contains one property, one Carousel, and one Alert.

Route Registration and Activation

Property Value
name loadgame
path campaign.loadgame
rank 1.2
alert (not set — standard replace transition)

The Load Game tab is the second entry in campaignNavModel inside component-header.qml, with isEnabled initialized to false. It is enabled at runtime by checkButtonsActive() only when BlackMesaUtils.getSaveGames().length > 0 && !appRoot.isInMultiplayerMode. If there are no saved games, or the player is in multiplayer mode, the tab remains disabled and the route is inaccessible from the header. The tab label is L10n.strings.menus.loadgame (#QTUI_Menu_Campaign_LoadGame).

Because loadgame has rank 1.2, navigating to it from newgame (rank 1.1) uses the left-enter transition (slides in from the right); navigating from savegame (rank 1.3) uses the right-enter transition (slides in from the left).

selectedModel Property

A single variant property (id: loadGame) that stores the model object of the save entry currently pending deletion. It is set in onSelectedSecondary and cleared after the delete confirmation is handled.

loadGameCarousel

A Carousel (id: loadGameCarousel) using CarouselLoadGameItem as its itemComponent.

Model Population

Component.onCompleted calls BlackMesaUtils.getSaveGames() and appends every returned entry to levels without any filtering. This means all save types — manual, autosave, and quicksave — are shown, sorted by date descending (the sort is performed inside BlackMesaUtils.getSaveGames()). This differs from routeview-savegame.qml, which filters out autosaves and quicksaves.

Each appended model object has the following fields:

Field Source
savename save.savename
chapter save.chapter
chapterName save.chapterName
date save.dateCreated
thumbnailUrl save.thumbnail
saveType save.type ("manual", "autosave", or "quick")
buttonText L10n.strings.buttons.resume (#QTUI_Buttons_Resume) — same for all entries
CarouselLoadGameItem Delegate

The itemComponent passes the following to each CarouselLoadGameItem:

Property Value
buttonText model.buttonText (always #QTUI_Buttons_Resume)
thumbnailUrl model.thumbnailUrl
chapterName model.chapterName
date Theme.getDateTimeString(model.date) — locale-formatted date string
saveType model.saveType
secondaryButtonVisible true — always shown for every card (unlike routeview-savegame.qml where it is conditional on !!model.savename)
buttonTextSecondary BlackMesaEngine.getLocalizedString("#GameUI_Delete")

CarouselLoadGameItem (component-carousel-item-loadgame.qml) renders three text lines in a Column: the chapter name (Theme.colors.headerText, 26px), the formatted date (Theme.colors.text, 16px), and the save type label in all-caps (L10n.strings.labels.autoSave/quickSave/manualSave; bold font for manual saves; Theme.colors.dimmedText for autosaves, Theme.colors.text otherwise).

Selection Handlers

Both onSelected and onSelectedWithDoubleClick are identical: they immediately fire loadGame.loadGameRequest(model) with no intermediate confirmation dialog. There is no overwrite or confirmation step — selecting a save loads it instantly.

onSelectedSecondary sets loadGame.selectedModel = model and calls confirmDeleteAlert.show().

loadGameRequest Signal Chain

Passing the full model object to loadGameRequest triggers the following chain: 1. loadGame.loadGameRequest(model) fires the signal declared in the RouteView base class (routeview.qml): signal loadGameRequest(variant savegame). 2. router.qml has connected this to _loadGameRequestHandler(savegame), which re-emits outlet.loadGameRequest(savegame). 3. main.qml handles onLoadGameRequest: sets footer.levelName = savegame.chapterName (so the loading screen shows the correct chapter name), then calls BlackMesaUtils.loadGame(savegame.savename). 4. BlackMesaUtils.loadGame(filename) issues the engine command disconnect;wait;wait;sv_cheats 0; maxplayers 1; load <filename>.

confirmDeleteAlert

An Alert (id: confirmDeleteAlert) shown when the user clicks the secondary Delete button on any save card.

Property Value
titleText L10n.strings.headers.deleteSaveConfirmation (#QTUI_Header_DeleteSaveConfirmation)
messageText L10n.strings.modalMessages.deleteSaveConfirmation (#QTUI_Messages_DeleteSaveConfirmation)
Buttons
Button type objectName Label Action
WarningButton ui:btn:action[apply] L10n.strings.buttons.deleteSave (#QTUI_Buttons_DeleteSave) If BlackMesaEngine.removeSaveEntry(selectedModel.savename) returns true, clears loadGameCarousel.levels and attempts to repopulate via loadGameCarousel.levels.Component.completed(). Unconditionally nulls selectedModel and hides the alert regardless of whether the delete succeeded.
DefaultButton ui:btn:action[cancel] L10n.strings.buttons.cancel (#QTUI_Buttons_Cancel) Hides the alert.

Comparison with routeview-savegame.qml

Behaviour routeview-loadgame.qml routeview-savegame.qml
Save types shown All (manual, autosave, quicksave) Manual only
"New Save" slot No Yes (first card)
Primary action Immediate load, no confirmation Overwrite confirmation dialog
Secondary button visibility Always true Only when !!model.savename
Number of Alert dialogs 1 (delete only) 2 (overwrite + delete)

Notable Issues

1. loadGameCarousel.levels.Component.completed() is not valid QML. Component.completed is a signal, not a callable function. Calling it directly does not re-run the Component.onCompleted handler. After a successful delete, the carousel model is cleared but never repopulated, leaving the user with an empty save list until they navigate away and back.

2. selectedModel is nulled unconditionally. Even if BlackMesaEngine.removeSaveEntry() returns false (delete failed), selectedModel is still set to null and the alert is hidden. The carousel is only cleared on success, but the UI state is reset regardless of the outcome.

3. Secondary button label bypasses L10n. The Delete button uses BlackMesaEngine.getLocalizedString("#GameUI_Delete") directly instead of the L10n singleton, inconsistent with all other button labels in the file.

4. onSelected and onSelectedWithDoubleClick are identical. Single-click and double-click produce the same result with no distinction in behavior.

routeview-newgame.qml

routeview-newgame.qml is the New Game page, registered in routes.qml as the newgame route at path campaign.newgame, rank 1.1. The parent campaign route (rank 1.0) is a passthrough: true route with destination: "newgame", meaning navigating to campaign automatically redirects here.

The file is 92 lines and contains a single Carousel component with two delegate definitions and two-phase selection logic.

Route Registration

Property Value
name newgame
path campaign.newgame
rank 1.1
qmlFile routeview-newgame.qml

The sub-nav tab that triggers this route is defined in component-header.qml and labeled with L10n.strings.menus.newgame (engine key: #QTUI_Menu_Campaign_NewGame).

Two-Phase Selection

The page operates in two sequential phases controlled by the currentlySelectedCampaign property on the Carousel:

Phase Condition Active delegate Items shown
Campaign selection currentlySelectedCampaign === null campaignDelegate One card per official campaign returned by BlackMesaEngine.listCampaignEntries()
Chapter selection currentlySelectedCampaign !== null chapterDelegate One card per chapter in the selected campaign

The active delegate is selected via itemComponent: currentlySelectedCampaign !== null ? chapterDelegate : campaignDelegate.

newGameCarousel Properties

Property Type Description
campaignEntries var Result of BlackMesaEngine.listCampaignEntries().filter(function (campaign) { return campaign.isOfficial }) — only official campaigns are included.
currentlySelectedCampaign var Initially null. Set to a campaign object when the user selects a campaign card, triggering the switch to chapter selection.

Component.onCompleted

Iterates campaignEntries, sets levelName: "" on each entry (clearing any engine-provided level name that would be inappropriate at the campaign level), then appends each entry to levels.

If levels.count === 1 after population, currentlySelectedCampaign is immediately set to campaignEntries[0], skipping the campaign selection phase entirely.

Note: setting levelName: "" mutates the original objects in campaignEntries directly, since JavaScript objects are passed by reference.

onCurrentlySelectedCampaignChanged

Fires whenever currentlySelectedCampaign is assigned. It:

1. Clears levels and repopulates it with the chapters of the newly selected campaign. 2. Sets showLeft = false and showRight = levels.count > 4 to reset carousel pagination. 3. If levels.count === 1, immediately fires newGame.loadMapRequest(currentlySelectedCampaign.chapters[0].levelName, localizedTitle), skipping chapter selection entirely.

campaignDelegate

A Component wrapping a CarouselNewGameItem used during the campaign selection phase.

Property Value
buttonText L10n.strings.buttons.startGame (#QTUI_Buttons_StartGame)
isLocked Always false
thumbnailUrl model.imageSource
chapterName BlackMesaEngine.getLocalizedString(model.title)
chapterNumber index + 1
type BlackMesaEngine.getLocalizedString("#GameUI_NewGame")
onSelected newGameCarousel.currentlySelectedCampaign = newGameCarousel.campaignEntries[index]
onSelectedWithDoubleClick Calls selected() — identical to single-click.

chapterDelegate

A Component wrapping a CarouselNewGameItem used during the chapter selection phase.

Property Value
buttonText L10n.strings.buttons.startGame (#QTUI_Buttons_StartGame)
isLocked Always false
thumbnailUrl model.imageSource
chapterName BlackMesaEngine.getLocalizedString(model.title)
chapterNumber index + 1
type BlackMesaEngine.getLocalizedString("#GameUI_Chapter")
onSelected newGame.loadMapRequest(model.levelName, localizedTitle)
onSelectedWithDoubleClick Calls selected() — identical to single-click.

loadMapRequest Signal Chain

loadMapRequest(string filename, string mapname) is declared in the RouteView base class (routeview.qml). It is handled by router.qml (7 connection points), which ultimately calls BlackMesaUtils.loadMap(filename), issuing the engine command disconnect;wait;wait;sv_cheats 0; maxplayers 1; map {filename}.

CarouselNewGameItem

CarouselNewGameItem (component-carousel-item-newgame.qml) extends CarouselItem and adds:

Property Default Description
chapterNumber 0 Displayed as part of the type label below the chapter name.
type BlackMesaEngine.getLocalizedString("#GameUI_Chapter") Label prefix shown before the chapter number (e.g. "Chapter 3").

Its textComponent is a Column with two Text elements:

Element Content Font Color
Top chapterName Regular, 24px (width-scaled) Theme.colors.headerText
Bottom type + " " + chapterNumber Light, 15px (height-scaled) Theme.colors.text

CarouselItem Base Class

CarouselItem (component-carousel-item.qml) provides the shared card layout used by all carousel delegates. Key behaviors:

  • objectName: "ui:carousel-item" — registered by BlackMesaUtils.traverseUIElements() as a navigable carousel item for controller/keyboard support.
  • isLocked — when true, hides the textComponent and shows a lock.png overlay on the thumbnail.
  • The primary action button is loaded dynamically via loader.setSource("button-" + buttonType + ".qml"). For CarouselNewGameItem, buttonType defaults to "cta", loading button-cta.qml.
  • Three visual states: initializing (all hidden), blurred (thumbnail dimmed at 0.7 opacity, text at 0.7 opacity, no button), focused (thumbnail clear, text fully visible, button visible, background rectangle at 0.9 opacity). Entering focused plays Theme.sounds.buttonFocused via Sound.playEffect.
  • Thumbnail images load asynchronously and fade in over 250ms once ready.

Carousel Component

Carousel (component-carousel.qml) provides the horizontal scrolling container. Key properties:

Property Description
levels The ListModel backing the ListView.
itemComponent The Component used as the delegate.
showLeft / showRight Control visibility of the left/right CarouselButton pagination arrows.
visibleCount Math.floor(maskWidth / (itemWidth + itemSpacing)) — typically 4 items at 1920×1080.

changePagination(type) animates contentX of the internal ListView by visibleCount items over 100ms with InOutQuint easing. After the animation completes, it calls BlackMesaUtils.parseTraversalTree(appRoot) and BlackMesaUtils.updateCurrentUISelection() to re-register the newly visible carousel items with the navigation system.

Notable Issues

1. Chapter locking disabled. The chapterDelegate has a commented-out line:

// isLocked: (index + 1) > newGameCarousel.officialChaptersUnlockedCount && newGameCarousel.currentlySelectedCampaign.isOfficial

The supporting property is also commented out:

// property int officialChaptersUnlockedCount: BlackMesaEngine.getConsoleVariableAsInt("sv_unlockedchapters")

As a result, isLocked is hardcoded to false for all chapters, and the sv_unlockedchapters console variable has no effect on the UI.

2. type label bypasses L10n. Both delegates use BlackMesaEngine.getLocalizedString() directly for the type label (#GameUI_NewGame and #GameUI_Chapter) instead of routing through the L10n singleton, inconsistent with the rest of the UI.

3. onSelectedWithDoubleClick is identical to onSelected. Both delegates call selected() on double-click, making double-click and single-click indistinguishable.

4. Auto-skip can bypass the page entirely. If listCampaignEntries() returns exactly one official campaign with exactly one chapter, the page will immediately fire loadMapRequest in Component.onCompleted without displaying any carousel to the user.

routeview-policy.qml

routeview-policy.qml is the Privacy Policy page under the Options section. It is registered in routes.qml as the policy route at rank 3.6, with no alert flag.

Route Registration

Property Value
name policy
path options.policy
rank 3.6
qmlFile routeview-policy.qml

Trigger

The route is accessible via the Options sub-navigation bar in component-header.qml. The optionsNavModel ListModel includes an entry { label: labels.policy, routeName: "policy", isEnabled: true }, which renders as a LetterboxButton tab. Clicking it calls header.routeRequest("policy"). The tab appears selected when currentRoute.path.split('.')[1] === "policy". The tab label is sourced from L10n.strings.menus.policy (engine key: #QTUI_Menu_Options_Policy).

Properties

The RouteView has no explicit id — unlike most other route views in the codebase.

Property Type Value / Purpose
policyText string A hardcoded HTML string containing the full Crowbar Collective Privacy Policy, last updated March 24, 2020. It is not localized and not fetched from a URL.
fontSize int Math.ceil(16 * Theme.heightScale)
policyText Content

The string uses Qt StyledText-compatible HTML markup (<h3>, <div>, <br>, <ul>, <li>). It covers the following sections:

  1. Privacy Policy (introduction, last updated March 24, 2020)
  2. Information we collect (PII, DII, interaction logs)
  3. How we use information we collect
  4. GDPR Classifications
  5. Third Parties
  6. Choice (account cancellation, California minors, DNT/opt-out links)
  7. Accessing and updating your information (contact: Contact@CrowbarCollective.com)
  8. Information security
  9. Children Under 13
  10. Changes
  11. Questions?

Layout

A full-size Item containing two children: a background Rectangle and a ListView.

Background

A Rectangle filling the parent with color: Theme.colors.subNavBackground (#111111) and opacity: Theme.opacity.subNav (0.5). This is the same background style used by the sub-navigation bar itself.

ListView (id: grid)

A scrollable list (named grid despite being a ListView, not a GridView) with the following properties:

Property Value
clip true
interactive true
boundsBehavior Flickable.StopAtBounds
anchors.rightMargin Math.ceil(8 * Theme.widthScale) (space for the scrollbar)
ScrollBar.vertical VerticalScrollBar, always visible

Component.onCompleted calls grid.forceActiveFocus() so keyboard/controller scrolling works immediately on page load.

Keys.onUpPressed and Keys.onDownPressed call scrollBar.decrease() and scrollBar.increase() directly, bypassing ListView item navigation — the same pattern used in routeview-translators.qml.

Model

A single-item ListModel that appends { _text: policyText } in its Component.onCompleted. The entire privacy policy is rendered as one Text delegate.

Delegate (Text, id: policyTextContainer)
Property Value
width parent.width
font.family Theme.fonts.regular
font.pixelSize fontSize (Math.ceil(16 * Theme.heightScale))
color "#EEEEEE" (hardcoded near-white; does not use Theme.colors.text)
text _text (the policyText string from the model)
textFormat Text.StyledText — renders the HTML markup in policyText
wrapMode TextInput.WordWrap
horizontalAlignment Text.AlignJustify

Notable Issues

1. Broken padding syntax. The delegate sets padding using a JavaScript block expression:

padding: {  
    left: Math.ceil(16 * Theme.widthScale);  
    top: Math.ceil(16 * Theme.heightScale);  
    bottom: Math.ceil(16 * Theme.heightScale);  
    right: Math.ceil(24 * Theme.widthScale);  
}

2. In QML, this is not a property group assignment — it is a JavaScript block with labeled statements. The value of the block is the last expression, so padding (all four sides) is set to Math.ceil(24 * Theme.widthScale). The left, top, and bottom lines are no-ops. The correct properties are leftPadding, topPadding, bottomPadding, and rightPadding.

3. Wrong wrapMode enum type. The delegate uses wrapMode: TextInput.WordWrap instead of wrapMode: Text.WordWrap. Both resolve to the same integer value (3) at runtime, so wrapping works correctly, but the reference to TextInput is semantically incorrect for a Text element.

4. Hardcoded color. The text color is "#EEEEEE" rather than Theme.colors.text ("white"), making it inconsistent with the rest of the UI and not updatable via the theme system.

5. Hardcoded, non-localized content. The entire privacy policy is embedded as a string literal in the QML source. It is English-only, not routed through the L10n singleton or the engine localization system, and cannot be updated without a code change.

6. Single-item ListView. Using a ListView with a one-item ListModel to render a single Text element is unnecessarily complex. A plain Flickable or ScrollView wrapping a Text directly would be simpler and more idiomatic.

routeview-quit.qml

routeview-quit.qml is the Quit Game confirmation dialog. It is registered in routes.qml as the quit route with alert: true, meaning the router overlays it on top of the current view rather than replacing it. Contains one property and one Alert.

quotes property

An immediately-invoked function expression (IIFE) that runs at construction time. It iterates over all keys of L10n.strings.quit and collects their values into a plain JavaScript array. L10n.strings.quit contains 6 localized strings keyed quote01 through quote06, corresponding to engine localization keys #QTUI_Quit_Quote01 through #QTUI_Quit_Quote06.

alert

A single Alert component (id: alert) with the following properties:

Property Value
skrim false — no darkening overlay is drawn behind the dialog, unlike most other alerts in the UI.
titleText L10n.strings.headers.quit (#QTUI_Header_Quit)
messageText A randomly selected entry from the quotes array, chosen once at construction time via quotes[Math.floor(Math.random() * quotes.length)].
Buttons
Button type objectName Label Action
CTAButton ui:btn:action[apply] L10n.strings.buttons.quit Calls BlackMesaEngine.executeClientCommandUnrestricted("quit") to quit the game.
DefaultButton ui:btn:action[cancel] L10n.strings.buttons.cancel Calls quitView.routeRequest(Routes.back.name) to navigate back. Routes.back.name resolves to the string "back", the special route that tells the router to pop the current view.

Routes.back.name resolves to the string "back", the special route that tells the router to pop the current view.

Auto-show

Component.onCompleted immediately calls alert.show(), so the dialog appears as soon as the route is loaded with no additional trigger required.

routeview-savebeforequit.qml

routeview-savebeforequit.qml is the Save Before Quit confirmation dialog. It is registered in routes.qml as the savebeforequit route with alert: true and no rank, meaning the router pushes it onto the stack using the upward slide-in transition rather than replacing the current route.

The file is 43 lines and contains a single Alert with no additional properties on the RouteView itself.

Route Registration

Property Value
name savebeforequit
path savebeforequit
alert true
qmlFile routeview-savebeforequit.qml

Because alert is true, router.qml uses the upEnterTransition (slides up from below, fades in) when pushing this route, and downExitTransition when popping it via Routes.back.

Trigger

The route is requested by component-footer.qml. The footer's Quit LetterboxButton checks isInGame at click time:

  • If isInGame is true: calls footer.routeRequest(Routes.savebeforequit.name) — shows this dialog.
  • If isInGame is false: calls footer.routeRequest(Routes.quit.name) — shows the standard quit dialog instead.

alert

A single Alert component (id: alert) with the following properties:

Property Value
skrim false — no darkening overlay is drawn behind the dialog.
titleText L10n.strings.headers.saveBeforeQuit (engine key: #QTUI_Header_SaveBeforeQuit)
messageText L10n.strings.modalMessages.saveBeforeQuit (engine key: #QTUI_Messages_SaveBeforeQuit)
Buttons
Button type objectName Label (L10n key) Action
CTAButton ui:btn:action[cancel] L10n.strings.buttons.cancel (#QTUI_Buttons_Cancel) Calls saveBeforeQuitView.routeRequest(Routes.back.name) — navigates back without quitting or saving.
CTAButton ui:btn:action[discard] L10n.strings.buttons.dontSave (#QTUI_Buttons_DontSave) Calls BlackMesaEngine.executeClientCommandUnrestricted("quit") — quits immediately without saving.
DefaultButton ui:btn:action[apply] L10n.strings.buttons.save (#QTUI_Buttons_Save) Calls saveBeforeQuitView.saveGameRequest(null), then immediately calls BlackMesaEngine.executeClientCommandUnrestricted("quit").

Note the unusual button type assignments: both Cancel and Don't Save use the prominent CTAButton style (orange highlight), while Save — the safest and most constructive action — uses the less prominent DefaultButton. This is the inverse of the visual hierarchy used elsewhere in the UI, where the primary action is typically the CTAButton.

Auto-show

Component.onCompleted immediately calls alert.show(), so the dialog appears as soon as the route is loaded with no additional trigger required.

saveGameRequest Signal Chain

Passing null to saveGameRequest triggers the following chain:

  1. saveBeforeQuitView.saveGameRequest(null) fires the signal defined in the RouteView base class (routeview.qml).
  2. router.qml has connected this signal to _saveGameRequestHandler, which re-emits outlet.saveGameRequest(filename).
  3. The upstream handler (in main.qml) calls BlackMesaUtils.saveGame(null, callback).
  4. BlackMesaUtils.saveGame auto-generates a zero-padded filename in the format bms-NNN (e.g. bms-001) and issues the engine command gameui_hide;save bms-NNN.
  5. The quit command then executes immediately after, without waiting for the save to complete.

The lack of any callback or deferred execution between the save and quit calls means the game quits synchronously after issuing the save command, relying on the engine to flush the save before exiting.

routeview-savegame.qml

This is the Save Game page, accessible as the campaign.savegame route (rank 1.3). Contains three top-level elements: a Carousel, and two Alert dialogs.

Top-level Property

selectedModel (variant) — stores the carousel item model of the save slot the user last interacted with, so the confirmation dialogs can reference it.

saveGameCarousel — The Carousel

Uses CarouselLoadGameItem as its itemComponent. The following properties are bound from the model into each card:

Property Source
buttonText model.buttonText
thumbnailUrl model.thumbnailUrl
chapterName model.chapterName
date Theme.getDateTimeString(model.date) — locale-formatted
saveType model.saveType
buttonType model.buttonType ("cta" or "warning")

CarouselLoadGameItem renders each card with a chapter name (white, 26px), a date (white, 16px), and a save type label (ALL CAPS, bold for manual saves, dimmed for autosave).

Interaction Handlers

onSelected/onSelectedWithDoubleClick — both are identical:

  • If model.savename is non-empty (existing save): store the model in selectedModel and show confirmOverwriteAlert.
  • If model.savename is empty (the "New Save" slot): emit saveGameRequest(null) directly, which the router handles by calling BlackMesaUtils.saveGame(null, callback) to auto-generate a file name

Secondary button (Delete): only visible when !!model.savename (hidden on the New Save slot). Its label comes from BlackMesaEngine.getLocalizedString("#GameUI_Delete"). Clicking it stores the model and shows confirmDeleteAlert.

levels ListModel

Built in Component.onCompleted from BlackMesaUtils.getSaveGames(): 1. First item always: a "New Save" slot with savename: "", thumbnailUrl: "ui/images/newSaveThumbnail.png", buttonText: createSaveButtonText, buttonType: "cta". 2. Remaining items: all existing saves where savename does not match /^(autosave|quick)\d*$/ — i.e. only manual saves are shown. Autosaves and quicksaves are excluded. Each gets buttonType: "warning" and buttonText: overwriteButtonText.

confirmOverwriteAlert

Shown when the user selects an existing save slot.

  • Title: L10n.strings.headers.overwriteSaveConfirmation
  • Message: L10n.strings.modalMessages.overwriteSaveConfirmation
  • WarningButton (ui:btn:action[apply]): emits saveGameRequest(selectedModel.savename) then nulls selectedModel. The router handles this signal by calling BlackMesaUtils.saveGame(filename, callback).
  • DefaultButton (ui:btn:action[cancel]): hides the alert.

confirmDeleteAlert

Shown when the user clicks the secondary Delete button on an existing save.

  • Title: L10n.strings.headers.deleteSaveConfirmation
  • Message: L10n.strings.modalMessages.deleteSaveConfirmation
  • WarningButton (ui:btn:action[apply]): calls BlackMesaEngine.removeSaveEntry(selectedModel.savename). If successful, clears the carousel model and attempts to reload it via saveGameCarousel.levels.Component.completed(), then nulls selectedModel and hides the alert.
  • DefaultButton (ui:btn:action[cancel]): hides the alert.

saveGameRequest Signal

Defined in the RouteView base class (routeview.qml). The comment there says: "if savegame is null, a new save should be created."

It is handled by router.qml (7 matches) which calls BlackMesaUtils.saveGame().

Notable Issues

1. saveGameCarousel.levels.Component.completed() (line 110) is not valid QML. Component.completed() is a signal, not a callable function — can't be invoked directly to re-run Component.onCompleted. This means after a successful delete, the carousel model is cleared but never repopulated, leaving the user with an empty save list until they navigate away and back.

2. onSelected and onSelectedWithDoubleClick are identical — there is no difference in behavior between a single click and a double click on a save slot.

3. Secondary button label uses BlackMesaEngine.getLocalizedString("#GameUI_Delete") directly instead of the L10n singleton used for all other strings in the file — inconsistent with the rest of the UI.

routeview-translators.qml

This is the Translators credits page, accessible as the options.translators route (rank 3.7).

Top-level Properties

  • translators_proofreaders - hardcoded JSON array of proofreader objects, fields: crowdin_name, discord_name, language, full_name_nick_name.
  • translators_credits - hardcoded JSON array of translator objects, fields: name, language, translated_words.
  • pageWidth - 1600 * Theme.widthScale, unused in layout, defined but not referenced.
  • headerHeight - 64 * Theme.heightScale, not referenced in the layout.
  • headerOffset - 128 * Theme.heightScale, not referenced in the layout.
  • footerOffset - 72 * Theme.heightScale, not referenced in the layout.
  • cellW - 360 * Theme.widthScale, minimum card width.
  • cellH - 220 * Theme.heightScale, card height.
  • itemsToShowOnRow - floor(proofreadersContainer.width / cellW) — broken: references proofreadersContainer which does not exist in the file.
  • activeTab - integer, default 0, controls which tab/dataset is shown.

The data is entirely hardcoded in the QML source — no engine API is called to fetch it.

proofreaderDelegate Component

A card for each entry in translators_proofreaders. Each card is an Item sized to the grid cell, containing a centered inner Item with 32px padding on all sides. Inside the inner item:

  • A Rectangle background with radius: 4 and color: '#A6000000' (~65% opaque black).
  • An Image (ui/images/user-avatar.png), 48×48px (height-scaled), centered horizontally at the top.
  • Four Text elements stacked vertically, all in Theme.colors.highlight (orange):
    • _text_label (16px, bold): crowdin_name.
    • _nickname (14px): "Full Name: <full_name_nick_name>".
    • _discord_nickname (14px): "Discord: <discord_name>".
    • _lang (14px): "Language: <language>".

translatorDelegate Component

A card for each entry in translators_credits. Structurally identical to proofreaderDelegate (same background, same avatar image, same styling), but shows different fields:

  • _text_label (16px, bold): name (includes Crowdin username in parentheses).
  • _language (14px): "Language: <language>".
  • _translated_words (14px): "Translated words: <translated_words>".

No discord_name or full_name_nick_name fields — this delegate has one fewer text row.

Main Layout

A full-size Item (translators_main_container) containing a GridLayout with 1 column and 2 rows.

Row 1 — Tab Bar
Button objectName selected condition Label (localized) onClicked
Proofreaders "ui:tab" !activeTab (i.e. activeTab === 0) #BlackMesaUI_TranslatorsTab_Proofreaders activeTab = 0
Translators "ui:tab" activeTab (i.e. activeTab === 1) #BlackMesaUI_TranslatorsTab_Translators activeTab = 1
skins int Currently selected skin index from the player configuration.

Both have type: "sub-nav" and objectName: "ui:tab", so they are picked up by BlackMesaUtils.traverseUIElements() as navigable tabs.

Row 2 — GridView (grid_view)

The scrollable grid of cards. Key properties:

  • cellWidth: max(cellW, grid_view.width / 5) - 16 * Theme.widthScale — tries to fit 5 columns but never goes below cellW (360px scaled); subtracts 16px for the scrollbar.
  • cellHeight: cellH (220px scaled).
  • clip: true, keyNavigationEnabled: true.
  • model}: translators_proofreaders when , else translators_credits.
  • delegate: proofreaderDelegate when , else translatorDelegate.
  • ScrollBar.vertical: VerticalScrollBar (always visible).
  • Component.onCompleted: calls grid_view.forceActiveFocus() so keyboard navigation works immediately on page load.

Keyboard scrolling quirk

Keys.onUpPressed and Keys.onDownPressed call scrollBar.decrease()/scrollBar.increase() directly on the scrollbar, rather than letting keyNavigationEnabled move between grid cells. This means Up/Down scroll the list rather than moving the selection row by row.

Notable Issues

1. itemsToShowOnRow references proofreadersContainer.width, which does not exist anywhere in the file. This property will always be NaN/undefined at runtime, though it is never used in the layout either.

2. pageWidth, headerHeight, headerOffset, footerOffset are all defined but never referenced in the layout — dead properties.

3. Tab labels use BlackMesaEngine.getLocalizedString() directly instead of the L10n singleton used everywhere else in the UI.

4. All card text uses Theme.colors.highlight (orange) for every field — including secondary info like Discord name and word count — rather than using Theme.colors.text or Theme.colors.dimmedText for secondary fields as other components do.

routeview-unavailable.qml

Unused. It is a RouteView containing a single Image element. The image is:

  • Sourced from ui/images/unavailable.png via the engine's image://game/ provider.
  • Sized at a nominal 609×108 pixels, scaled by Theme.widthScale.
    Note.pngNote: Both dimensions use widthScale, not heightScale — so it scales uniformly with screen width.
  • Centered in the parent via anchors.centerIn: parent.

It has no interactive elements, no text, no buttons, and no logic — it is purely a static "this feature is unavailable" splash image.

routeview-video.qml

This is the Video Options settings page. It is a RouteView (id: videoOptionsView) containing a single OptionsList, a footer description panel, a warning header, and a confirmation alert.

Top-level Properties

  • blockingRouteName - stores the destination route when navigation is intercepted due to unsaved changes.
  • costFontSize - scaled font size (16 * Theme.widthScale) for the footer description panel.
  • headerWarningVisibility - boolean that shows/hides the warning icon in the top-right corner.
  • advancedQualityKeys - array of 17 setting keys that are controlled by the overall quality preset.

Navigation Guard

onRouteWillChange(newRouteName) intercepts any attempt to leave the page. If videoOptions.hasPendingChanges is true, it stores the destination in blockingRouteName, shows confirmAlert, and returns true to block the navigation.

OptionsList — videoOptions

The main content area. It uses batchUpdates: true and shows 8 visible rows at a time.

Quality Preset System

Component.onCompleted defines a qualitySettings object with 5 presets (keys "0"–"4"): Potato, Low, Medium, High, Ultra. Each preset is a map of all 17 advancedQualityKeys to their target values.

onSettingsReset' reads mat_easymenu_quality_level and calls setAdvancedSettingsState() to restore the preset.

onRequestSettingsChange handles two cases, after every change it calls updateHeaderWarningVisibility():

  • If the changed key is video_quality, it applies the matching preset via setAdvancedSettingsState().
  • If the changed key is one of the 17 advanced keys, it sets video_quality to "5" (Custom).

setAdvancedSettingsState(settings) iterates advancedQualityKeys and calls setValue() for each key, but only if the current quality is not already Custom ("5").

updateHeaderWarningVisibility() scans all select-type model items and counts how many currently-selected options have warning: 1. Sets headerWarningVisibility accordingly.

groups — Grouped Apply Callbacks

A single function displayMode() handles both video_resolution and video_displayMode together. It parses the resolution string, immediately updates appRoot.width/height and Theme.widthScale/heightScale so the UI rescales at once, sets reloadPageAfterApplyChanges = true, then issues mat_setvideomode with the correct windowed/borderless flags.

setComplex — Multi-CVar Setters

Settings that map to more than one engine CVar have a named function here instead of a simple cvar property:

Several setters enforce caps when mat_unlock_gfx_highend_unsupported is false (e.g. dynamic shadow quality capped at 4, CSM quality capped at 3, dynamic lights capped at 4).

getComplex — Multi-CVar Getters

Mirror functions that read the same console variables and reconstruct the UI value. They also silently clamp out-of-range values back to valid ones (the comment calls this "terrible and hacky" but intentional — it self-heals console-edited values).

Note.pngNote: video_resolution reads from Theme.rootWidth and Theme.rootHeight rather than from an engine console variable.
Icon-Bug.pngBug:getComplex.video_godRays() has an unreachable return "0" at line 591 after the else branch already returns.

ListModel — The 25 Settings Items

Built dynamically in Component.onCompleted. Some of the components has warning: 1, contributes to headerWarningVisibility.

Note.pngNote: A Potato quality tier and video_unlockPotato checkbox are fully implemented in the code but entirely commented out. unlockedPotato is hardcoded to true in all getters/setters, meaning Potato-tier options are silently available in the advanced settings dropdowns but the preset and unlock checkbox are disabled.

Footer Description Panel — footerGraphicDescription

An Item anchored to the bottom-left of the page (leaving 600px on the right for the options list scrollbar area). It contains 7 text elements:

  • footerGraphicDescriptionText_desc — the setting's description_main string (wraps to a calculated width).
  • footerGraphicDescriptionText_cost_CPU/GPU/RAM — labels "CPU:", "GPU:", "RAM:" (white, only shown if the setting has a cost).
  • footerGraphicDescriptionText_cost_CPU/GPU/RAM_value — the cost values, colored dynamically.

onSelectionChanged(modelSelected) populates all 7 texts and applies a color map to the value texts:

  • Major - #FF4D2D (red).
  • Moderate - #FFD53E (yellow).
  • Minor - #55E835 (green).
  • None - white.
  • (empty) - #000000 (black/hidden).

Warning Header — warningHeaderSign/warningHeaderText

A warning icon (ui/images/warning.png) and text label anchored to the top-right of the page. Both are visible: headerWarningVisibility. They appear whenever any currently-selected option has warning: 1 (i.e. Water High, CSM Insane, Dynamic Lights Ultra/Insane).

Confirmation Alert — confirmAlert

An Alert dialog shown when the user tries to navigate away with unsaved changes. It has three buttons:

  • Apply (CTAButton) — calls videoOptions.flushPendingChanges() then navigates to blockingRouteName.
  • Discard (WarningButton) — navigates to blockingRouteName without saving.
  • Cancel (DefaultButton) — clears blockingRouteName and hides the alert.