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.
102 lines
2.6 KiB
QML
102 lines
2.6 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Nebula.Bigscreen
|
|
|
|
ColumnLayout {
|
|
id: root
|
|
|
|
signal goBack()
|
|
|
|
readonly property var entries: [
|
|
{ title: "Nebula Demo", meta: "Local • Ready", icon: "🎮" },
|
|
{ title: "Retro Runner", meta: "Wine • Installed", icon: "👾" },
|
|
{ title: "Media Hub", meta: "App • Installed", icon: "🎬" }
|
|
]
|
|
|
|
property int focusIndex: 0
|
|
property string statusText: "Mock entries for v0 — scanners and launchers come later."
|
|
|
|
spacing: 20
|
|
|
|
Text {
|
|
text: "Library"
|
|
font: Theme.brandFont
|
|
color: Theme.textPrimary
|
|
Layout.leftMargin: 40
|
|
}
|
|
|
|
Text {
|
|
text: root.statusText
|
|
font: Theme.metaFont
|
|
color: Theme.textMuted
|
|
Layout.leftMargin: 40
|
|
Layout.bottomMargin: 8
|
|
}
|
|
|
|
ListView {
|
|
id: list
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
Layout.leftMargin: 40
|
|
Layout.rightMargin: 40
|
|
clip: true
|
|
spacing: 12
|
|
model: root.entries
|
|
|
|
delegate: Rectangle {
|
|
width: list.width
|
|
height: 72
|
|
radius: 12
|
|
color: index === root.focusIndex ? "#22304A66" : Theme.backgroundPanel
|
|
border.color: index === root.focusIndex ? Theme.accentCyan : Theme.accentLine
|
|
border.width: index === root.focusIndex ? 2 : 1
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.margins: 16
|
|
spacing: 16
|
|
|
|
Text {
|
|
text: modelData.icon
|
|
font.pixelSize: 28
|
|
}
|
|
|
|
ColumnLayout {
|
|
spacing: 2
|
|
Text {
|
|
text: modelData.title
|
|
font: Theme.titleFont
|
|
color: Theme.textPrimary
|
|
}
|
|
Text {
|
|
text: modelData.meta
|
|
font: Theme.metaFont
|
|
color: Theme.textMuted
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleInput(action) {
|
|
switch (action) {
|
|
case 1:
|
|
focusIndex = Math.max(0, focusIndex - 1)
|
|
list.currentIndex = focusIndex
|
|
break
|
|
case 2:
|
|
focusIndex = Math.min(entries.length - 1, focusIndex + 1)
|
|
list.currentIndex = focusIndex
|
|
break
|
|
case 6:
|
|
root.goBack()
|
|
break
|
|
case 5:
|
|
statusText = entries[focusIndex].title + " selected — launcher integration comes later."
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
}
|