12import QGroundControl.Controls
13import QGroundControl.FlyView
14import QGroundControl.FlightMap
15import QGroundControl.Viewer3D
17// This is the ui overlay layer for the widgets/tools for Fly View
21 property var parentToolInsets
22 property var totalToolInsets: _totalToolInsets
23 property var mapControl
25 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
26 property var _planMasterController: globals.planMasterControllerFlyView
27 property var _missionController: _planMasterController.missionController
28 property var _geoFenceController: _planMasterController.geoFenceController
29 property var _rallyPointController: _planMasterController.rallyPointController
30 property var _guidedController: globals.guidedControllerFlyView
31 property real _margins: ScreenTools.defaultFontPixelWidth / 2
32 property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
33 property rect _centerViewport: Qt.rect(0, 0, width, height)
34 property real _rightPanelWidth: ScreenTools.defaultFontPixelWidth * 30
35 property real _layoutMargin: ScreenTools.defaultFontPixelWidth * 0.75
36 property bool _layoutSpacing: ScreenTools.defaultFontPixelWidth
37 property bool _showSingleVehicleUI: true
41 leftEdgeTopInset: toolStrip.leftEdgeTopInset
42 leftEdgeCenterInset: toolStrip.leftEdgeCenterInset
43 leftEdgeBottomInset: virtualJoystickMultiTouch.visible ? virtualJoystickMultiTouch.leftEdgeBottomInset : parentToolInsets.leftEdgeBottomInset
44 rightEdgeTopInset: topRightPanel.rightEdgeTopInset
45 rightEdgeCenterInset: topRightPanel.rightEdgeCenterInset
46 rightEdgeBottomInset: bottomRightRowLayout.rightEdgeBottomInset
47 topEdgeLeftInset: toolStrip.topEdgeLeftInset
48 topEdgeCenterInset: mapScale.topEdgeCenterInset
49 topEdgeRightInset: topRightPanel.topEdgeRightInset
50 bottomEdgeLeftInset: virtualJoystickMultiTouch.visible ? virtualJoystickMultiTouch.bottomEdgeLeftInset : parentToolInsets.bottomEdgeLeftInset
51 bottomEdgeCenterInset: bottomRightRowLayout.bottomEdgeCenterInset
52 bottomEdgeRightInset: virtualJoystickMultiTouch.visible ? virtualJoystickMultiTouch.bottomEdgeRightInset : bottomRightRowLayout.bottomEdgeRightInset
55 FlyViewTopRightPanel {
57 anchors.top: parent.top
58 anchors.right: parent.right
59 maximumHeight: parent.height - (bottomRightRowLayout.height + _margins * 4)
61 property real topEdgeRightInset: height + _layoutMargin
62 property real rightEdgeTopInset: width + _layoutMargin
63 property real rightEdgeCenterInset: rightEdgeTopInset
66 FlyViewTopRightColumnLayout {
67 id: topRightColumnLayout
68 anchors.top: parent.top
69 anchors.right: parent.right
70 spacing: _layoutSpacing
71 visible: !topRightPanel.visible
73 property real topEdgeRightInset: childrenRect.height + _layoutMargin
74 property real rightEdgeTopInset: width + _layoutMargin
75 property real rightEdgeCenterInset: rightEdgeTopInset
78 FlyViewBottomRightRowLayout {
79 id: bottomRightRowLayout
80 anchors.bottom: parent.bottom
81 anchors.right: parent.right
82 spacing: _layoutSpacing
84 property real bottomEdgeRightInset: height + _layoutMargin
85 property real bottomEdgeCenterInset: bottomEdgeRightInset
86 property real rightEdgeBottomInset: width + _layoutMargin
89 FlyViewMissionCompleteDialog {
90 missionController: _missionController
91 geoFenceController: _geoFenceController
92 rallyPointController: _rallyPointController
97 id: virtualJoystickMultiTouch
98 z: QGroundControl.zOrderTopMost + 1
99 anchors.right: parent.right
100 anchors.rightMargin: anchors.leftMargin
101 height: Math.min(parent.height * 0.25, ScreenTools.defaultFontPixelWidth * 16)
102 visible: _virtualJoystickEnabled && !QGroundControl.videoManager.fullScreen && !(_activeVehicle ? _activeVehicle.usingHighLatencyLink : false)
103 anchors.bottom: parent.bottom
104 anchors.bottomMargin: bottomLoaderMargin
105 anchors.left: parent.left
106 anchors.leftMargin: ( y > toolStrip.y + toolStrip.height ? toolStrip.width / 2 : toolStrip.width * 1.05 + toolStrip.x)
107 source: "qrc:/qml/QGroundControl/FlyView/VirtualJoystick.qml"
108 active: _virtualJoystickEnabled && !(_activeVehicle ? _activeVehicle.usingHighLatencyLink : false)
110 property real bottomEdgeLeftInset: parent.height-y
111 property bool autoCenterThrottle: QGroundControl.settingsManager.appSettings.virtualJoystickAutoCenterThrottle.rawValue
112 property bool leftHandedMode: QGroundControl.settingsManager.appSettings.virtualJoystickLeftHandedMode.rawValue
113 property bool _virtualJoystickEnabled: QGroundControl.settingsManager.appSettings.virtualJoystick.rawValue
114 property real bottomEdgeRightInset: parent.height-y
115 property var _pipViewMargin: _pipView.visible ? parentToolInsets.bottomEdgeLeftInset + ScreenTools.defaultFontPixelHeight * 2 :
116 bottomRightRowLayout.height + ScreenTools.defaultFontPixelHeight * 1.5
118 property var bottomLoaderMargin: _pipViewMargin >= parent.height / 2 ? parent.height / 2 : _pipViewMargin
120 // Width is difficult to access directly hence this hack which may not work in all circumstances
121 property real leftEdgeBottomInset: visible ? bottomEdgeLeftInset + width/18 - ScreenTools.defaultFontPixelHeight*2 : 0
122 property real rightEdgeBottomInset: visible ? bottomEdgeRightInset + width/18 - ScreenTools.defaultFontPixelHeight*2 : 0
123 property real rootWidth: _root.width
124 property var itemX: virtualJoystickMultiTouch.x // real X on screen
126 onRootWidthChanged: virtualJoystickMultiTouch.status == Loader.Ready && visible ? virtualJoystickMultiTouch.item.uiTotalWidth = rootWidth : undefined
127 onItemXChanged: virtualJoystickMultiTouch.status == Loader.Ready && visible ? virtualJoystickMultiTouch.item.uiRealX = itemX : undefined
129 //Loader status logic
131 if (virtualJoystickMultiTouch.visible) {
132 virtualJoystickMultiTouch.item.calibration = true
133 virtualJoystickMultiTouch.item.uiTotalWidth = rootWidth
134 virtualJoystickMultiTouch.item.uiRealX = itemX
136 virtualJoystickMultiTouch.item.calibration = false
143 anchors.left: parent.left
144 anchors.top: parent.top
145 z: QGroundControl.zOrderWidgets
146 maxHeight: parent.height - y - parentToolInsets.bottomEdgeLeftInset - _toolsMargin
147 visible: !QGroundControl.videoManager.fullScreen
149 onDisplayPreFlightChecklist: {
150 if (!preFlightChecklistLoader.active) {
151 preFlightChecklistLoader.active = true
153 preFlightChecklistLoader.item.open()
156 property real topEdgeLeftInset: visible ? y + height : 0
157 property real leftEdgeTopInset: visible ? x + width : 0
158 property real leftEdgeCenterInset: leftEdgeTopInset
162 anchors.centerIn: parent
163 z: QGroundControl.zOrderTopMost
168 anchors.left: toolStrip.right
169 anchors.top: parent.top
170 mapControl: _mapControl
172 visible: !ScreenTools.isTinyScreen && QGroundControl.corePlugin.options.flyView.showMapScale && QGCViewer3DManager.displayMode !== QGCViewer3DManager.View3D && mapControl.pipState.state === mapControl.pipState.fullState
174 property real topEdgeCenterInset: visible ? y + height : 0
178 id: preFlightChecklistLoader
179 sourceComponent: preFlightChecklistPopup
184 id: preFlightChecklistPopup
185 FlyViewPreFlightChecklistPopup {