61c448eb00
Integrate SDL3 controller support and wire it into the InputRouter.
- Add ControllerInputService (src/ControllerInputService.{h,cpp}) to discover, poll and translate SDL3 gamepad events into InputRouter actions, with axis repeat handling and debouncing.
- Update CMakeLists to find or fetch SDL3, add the new source files to the target, link the SDL3 target, and copy runtime DLLs on Windows.
- Add triggerAction(Action) to InputRouter and use it from existing keyboard handling to centralize action dispatch.
- Instantiate ControllerInputService in main so controllers feed the InputRouter.
- Update QML views (ShellWindow, HomeView, LibraryView, SettingsView) to use numeric action IDs and add small UI/status text and navigation tweaks for controller-driven flows.
These changes enable gamepad/controller input for Bigscreen via SDL3 and adapt UI code to handle the mapped actions.
63 lines
1.3 KiB
QML
63 lines
1.3 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Nebula.Bigscreen
|
|
|
|
ColumnLayout {
|
|
id: root
|
|
|
|
property var homeTiles: [
|
|
{ label: "Library", meta: "Games and apps", icon: "📚", route: "library" },
|
|
{ label: "Settings", meta: "System controls", icon: "⚙", route: "settings" },
|
|
{ label: "Power", meta: "Sleep and sessions", icon: "⏻", route: "power" }
|
|
]
|
|
|
|
signal navigate(string route)
|
|
|
|
spacing: 28
|
|
|
|
Text {
|
|
text: "Home"
|
|
font: Theme.brandFont
|
|
color: Theme.textPrimary
|
|
Layout.leftMargin: 40
|
|
}
|
|
|
|
TileRail {
|
|
id: rail
|
|
Layout.fillWidth: true
|
|
tiles: root.homeTiles
|
|
|
|
onTileActivated: function(index) {
|
|
const route = root.homeTiles[index].route
|
|
if (route === "power") {
|
|
root.navigate("power")
|
|
} else {
|
|
root.navigate(route)
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleInput(action) {
|
|
switch (action) {
|
|
case 3:
|
|
rail.moveFocus(-1)
|
|
break
|
|
case 4:
|
|
rail.moveFocus(1)
|
|
break
|
|
case 5:
|
|
rail.activateFocused()
|
|
break
|
|
case 6:
|
|
root.navigate("power")
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
|
|
function accentFocus() {
|
|
return rail.accentFocus
|
|
}
|
|
}
|