diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index e406f8bfb8b9ab3911c24a26f0e400e629a7c4bb..d5c8c2f5eaeff718ecfbfdd2fbecbb236497b61d 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -93,11 +93,13 @@ src/FactSystem/FactControls/FactPanel.qml src/FactSystem/FactControls/FactTextField.qml src/FactSystem/FactControls/qmldir + + src/FlightDisplay/qmldir src/FlightDisplay/FlightDisplayView.qml src/FlightDisplay/FlightDisplayViewMap.qml src/FlightDisplay/FlightDisplayViewVideo.qml src/FlightDisplay/FlightDisplayViewWidgets.qml - src/FlightDisplay/qmldir + src/FlightDisplay/VirtualJoystick.qml src/FlightMap/qmldir src/FlightMap/FlightMap.qml diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 764b89c09e1ce3ed88d9093ce6992cd1993c9a85..8a7c39798be42964d9d8ddafea4854276419a7c7 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -231,58 +231,25 @@ QGCView { anchors.left: parent.left anchors.bottom: parent.bottom height: availableHeight + asynchronous: true + visible: status == Loader.Ready + property bool isBackgroundDark: root.isBackgroundDark property var qgcView: root } //-- Virtual Joystick - Item { + Loader { id: multiTouchItem z: _panel.z + 5 width: parent.width - (_flightVideoPipControl.width / 2) - height: thumbAreaHeight + height: Math.min(parent.height * 0.25, ScreenTools.defaultFontPixelWidth * 16) visible: QGroundControl.virtualTabletJoystick anchors.bottom: _flightVideoPipControl.top anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2 anchors.horizontalCenter: parent.horizontalCenter - - readonly property real thumbAreaHeight: Math.min(parent.height * 0.25, ScreenTools.defaultFontPixelWidth * 16) - - QGCMapPalette { id: mapPal; lightColors: !isBackgroundDark } - - Timer { - interval: 40 // 25Hz, same as real joystick rate - running: QGroundControl.virtualTabletJoystick && _activeVehicle - repeat: true - onTriggered: { - if (_activeVehicle) { - _activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis) - } - } - } - - JoystickThumbPad { - id: leftStick - anchors.leftMargin: xPositionDelta - anchors.bottomMargin: -yPositionDelta - anchors.left: parent.left - anchors.bottom: parent.bottom - width: parent.thumbAreaHeight - height: parent.thumbAreaHeight - yAxisThrottle: true - lightColors: !isBackgroundDark - } - - JoystickThumbPad { - id: rightStick - anchors.rightMargin: -xPositionDelta - anchors.bottomMargin: -yPositionDelta - anchors.right: parent.right - anchors.bottom: parent.bottom - width: parent.thumbAreaHeight - height: parent.thumbAreaHeight - lightColors: !isBackgroundDark - } + source: "qrc:/qml/VirtualJoystick.qml" + active: QGroundControl.virtualTabletJoystick } } } diff --git a/src/FlightDisplay/VirtualJoystick.qml b/src/FlightDisplay/VirtualJoystick.qml new file mode 100644 index 0000000000000000000000000000000000000000..bad2fbc9e7c3003762d5f9b08f1ff4c3de0ee833 --- /dev/null +++ b/src/FlightDisplay/VirtualJoystick.qml @@ -0,0 +1,68 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2015 QGROUNDCONTROL PROJECT + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL 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 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see . + +======================================================================*/ + +import QtQuick 2.5 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Vehicle 1.0 + +Item { + QGCMapPalette { id: mapPal; lightColors: !isBackgroundDark } + + Timer { + interval: 40 // 25Hz, same as real joystick rate + running: QGroundControl.virtualTabletJoystick && _activeVehicle + repeat: true + onTriggered: { + if (_activeVehicle) { + _activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis) + } + } + } + + JoystickThumbPad { + id: leftStick + anchors.leftMargin: xPositionDelta + anchors.bottomMargin: -yPositionDelta + anchors.left: parent.left + anchors.bottom: parent.bottom + width: parent.height + height: parent.height + yAxisThrottle: true + lightColors: !isBackgroundDark + } + + JoystickThumbPad { + id: rightStick + anchors.rightMargin: -xPositionDelta + anchors.bottomMargin: -yPositionDelta + anchors.right: parent.right + anchors.bottom: parent.bottom + width: parent.height + height: parent.height + lightColors: !isBackgroundDark + } +} diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml index 16c47d0dbdd8b94ce2ca5300d0981d45f533d44a..e515a92880588a647131e821372f25f155cb9bbc 100644 --- a/src/ui/MainWindowInner.qml +++ b/src/ui/MainWindowInner.qml @@ -205,7 +205,7 @@ Item { } function showLeftMenu() { - if(!leftPanel.visible && !leftPanel.item.animateShowDialog.running) { + if(!leftPanel.visible) { leftPanel.visible = true leftPanel.item.animateShowDialog.start() } else if(leftPanel.visible && !leftPanel.item.animateShowDialog.running) { @@ -261,6 +261,8 @@ Item { anchors.fill: parent visible: false z: QGroundControl.zOrderTopMost + 100 + active: visible + source: "MainWindowLeftPanel.qml" } //-- Main UI @@ -276,10 +278,6 @@ Item { isBackgroundDark: flightView.isBackgroundDark z: QGroundControl.zOrderTopMost - Component.onCompleted: { - leftPanel.source = "MainWindowLeftPanel.qml" - } - onShowSetupView: mainWindow.showSetupView() onShowPlanView: mainWindow.showPlanView() onShowFlyView: mainWindow.showFlyView()