mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
feat: add gamepad buttons support android (#2066)
* feat: add support gamepad buttons * feat: add support gamepad with github repo * feat: add gitmodules dependency * feat: add submodule qtgamepad * chore: update qtgamepad submodule to commit 4e57142e563b931766056b4c7507c16892260222 * fix: update qtgamepad with standard CMake and private headers support Update qtgamepad to commit f72b3e0 which: - Replaces qt_add_library with standard add_library to avoid Qt 6.10 macro conflicts - Copies private headers to build include tree for Android backend - Creates Qt:: and Qt6:: namespace aliases for proper linking
This commit is contained in:
@@ -6,6 +6,7 @@ import QtQuick.Dialogs
|
||||
|
||||
import PageEnum 1.0
|
||||
import Style 1.0
|
||||
import QtGamepadLegacy
|
||||
|
||||
import "Config"
|
||||
import "Controls2"
|
||||
@@ -83,6 +84,44 @@ Window {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loader {
|
||||
active: Qt.platform.os === "android"
|
||||
sourceComponent: Component {
|
||||
Item {
|
||||
Gamepad {
|
||||
id: gamepad
|
||||
deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1
|
||||
|
||||
onButtonStartChanged: {
|
||||
if (buttonStart) {
|
||||
ServersModel.setProcessedServerIndex(ServersModel.defaultIndex)
|
||||
ConnectionController.connectButtonClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GamepadKeyNavigation {
|
||||
id: gamepadKeyNav
|
||||
gamepad: gamepad
|
||||
active: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: GamepadManager
|
||||
function onConnectedGamepadsChanged() {
|
||||
if (GamepadManager.connectedGamepads.length > 0) {
|
||||
gamepad.deviceId = GamepadManager.connectedGamepads[0]
|
||||
} else {
|
||||
gamepad.deviceId = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
objectName: "pageControllerConnections"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user