Commit e103b4fa authored by Eike Hein's avatar Eike Hein

Disable QtGamepad use on Android for now.

parent e473d982
......@@ -60,8 +60,13 @@ if (BUILD_APP)
ecm_find_qmlmodule(QtGamePad 5.12)
ecm_find_qmlmodule(QtGraphicalEffects 1.12)
ecm_find_qmlmodule(QtLocation 5.12)
ecm_find_qmlmodule(QtPositioning 5.12)
ecm_find_qmlmodule(org.kde.kirigami 2.6)
# FIXME TODO: QtGamepad currently causes performance problems on
# Android (blocking multi-tasking) that need to be investigated.
if(NOT ANDROID)
ecm_find_qmlmodule(QtPositioning 5.12)
endif()
endif()
if(BUILD_APP OR BUILD_QT_QUICK_LIB)
......
......@@ -5,6 +5,7 @@
<file alias="FlightControls.qml">ui/FlightControls.qml</file>
<file alias="goose.webp">ui/assets/goose.webp</file>
<file alias="fallback.jpg">ui/assets/fallback.jpg</file>
<file alias="Gamepad.qml">ui/Gamepad.qml</file>
<file alias="ModeRocker.qml">ui/components/ModeRocker.qml</file>
<file alias="NavigationMap.qml">ui/NavigationMap.qml</file>
<file alias="PillBox.qml">ui/components/PillBox.qml</file>
......
......@@ -20,7 +20,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12 as QQC2
import QtGamepad 1.12
import org.kde.kirigami 2.6 as Kirigami
......@@ -37,6 +36,8 @@ Kirigami.Page {
readonly property int yardstick: Math.min(parent.width, parent.height)
readonly property bool touched: leftTouchPoint.active || rightTouchPoint.active
property alias gamepad: gamepadLoader.item
leftPadding: 0
rightPadding: 0
topPadding: 0
......@@ -320,7 +321,7 @@ Kirigami.Page {
ModeRocker {
id: inputMode
visible: gamepad.connected && !kirogiSettings.alwaysShowDPads
visible: gamepad && gamepad.connected && !kirogiSettings.alwaysShowDPads
anchors.verticalCenter: shotButton.verticalCenter
anchors.left: flightMode.right
......@@ -433,7 +434,7 @@ Kirigami.Page {
TouchDPad {
id: leftDPad
visible: inputMode.selectedMode == 0 || kirogiSettings.alwaysShowDPads || !gamepad.connected
visible: inputMode.selectedMode == 0 || kirogiSettings.alwaysShowDPads || (gamepad && !gamepad.connected)
anchors.left: parent.left
anchors.leftMargin: yardstick * 0.18
......@@ -941,43 +942,15 @@ Kirigami.Page {
handleClosedIcon.source: "configure"
}
Connections {
target: GamepadManager
onGamepadConnected: deviceId = deviceId
}
Gamepad {
id: gamepad
Loader {
id: gamepadLoader
deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1
source: "Gamepad.qml"
asynchronous: true
onAxisLeftXChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
onAxisLeftYChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
onAxisRightXChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
onAxisRightYChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
// FIXME TODO: QtGamepad currently causes performance problems on
// Android (blocking multi-tasking) that need to be investigated.
active: !Kirigami.Settings.isMobile
}
Component.onCompleted: videoPlayer.playing = kirogiSettings.flying
......
/*
* Copyright 2019 Eike Hein <hein@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.12
import QtGamepad 1.12
Gamepad {
id: gamepad
deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1
onAxisLeftXChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
onAxisLeftYChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
onAxisRightXChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
onAxisRightYChanged: {
if (kirogi.flying && inputMode.selectedMode == 1) {
kirogi.currentVehicle.pilot(axisRightX * 100, (axisRightY < 0 ? Math.abs(axisRightY) : -axisLeftY) * 100,
axisLeftX * 100, (axisLeftY < 0 ? Math.abs(axisLeftY) : -axisLeftY) * 100);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment