diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 168d5d7cc6ccbd149bf4d817d755375781a4d165..8e1db1b2191794f75b0a81e755238993002fe848 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -77,11 +77,14 @@ src/FlightDisplay/FlightDisplayView.qml src/FlightDisplay/FlightDisplayWidget.qml src/MissionEditor/MissionEditor.qml + src/MissionEditor/MissionEditorHelp.qml src/FlightDisplay/qmldir src/FlightDisplay/FlightDisplayView.qml - src/FlightDisplay/FlightDisplayViewDelayLoad.qml + src/FlightDisplay/FlightDisplayViewMap.qml + src/FlightDisplay/FlightDisplayViewVideo.qml + src/FlightDisplay/FlightDisplayViewWidgets.qml src/FlightMap/qmldir diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 6e6d823927753cd73c0d9270c485ab21052565d8..0265d175a01a7925029d79c1c441b08045f03309 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -41,16 +41,6 @@ import QGroundControl.Controllers 1.0 Item { id: root - property alias latitude: flightMap.latitude - property alias longitude: flightMap.longitude - - // Top margin for all widgets. Used to prevent overlap with the toolbar - property real topMargin: 0 - - // Used by parent to hide widgets when it displays something above in the z order. - // Prevents z order drawing problems. - property bool hideWidgets: false - QGCPalette { id: qgcPal; colorGroupEnabled: enabled } property var _activeVehicle: multiVehicleManager.activeVehicle @@ -64,139 +54,117 @@ Item { readonly property real _defaultAirSpeed: 0 readonly property real _defaultClimbRate: 0 - readonly property string _mapName: "FlightDisplayView" - readonly property string _showMapBackgroundKey: "/showMapBackground" + readonly property string _mapName: "FlightDisplayView" + readonly property string _showMapBackgroundKey: "/showMapBackground" - readonly property var _flightMap: flightMap + property bool _mainIsMap: !_controller.hasVideo - property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll - property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch + property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll + property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch property real _heading: _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading property var _vehicleCoordinate: _activeVehicle ? (_activeVehicle.coordinateValid ? _activeVehicle.coordinate : _defaultVehicleCoordinate) : _defaultVehicleCoordinate property real _altitudeWGS84: _activeVehicle ? _activeVehicle.altitudeWGS84 : _defaultAltitudeWGS84 - property real _groundSpeed: _activeVehicle ? _activeVehicle.groundSpeed : _defaultGroundSpeed - property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed - property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate + property real _groundSpeed: _activeVehicle ? _activeVehicle.groundSpeed : _defaultGroundSpeed + property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed + property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate - property bool _showMap: getBool(QGroundControl.flightMapSettings.loadMapSetting(flightMap.mapName, _showMapBackgroundKey, "1")) + property var _flightMap: null + property var _flightVideo: null + property var _savedZoomLevel: 0 FlightDisplayViewController { id: _controller } MissionController { id: _missionController - Component.onCompleted: start(false /* editMode */) } - ExclusiveGroup { - id: _dropButtonsExclusiveGroup + function reloadContents() { + if(_flightVideo) { + _flightVideo.visible = false + } + if(_mainIsMap) { + mainLoader.source = "FlightDisplayViewMap.qml" + pipLoader.source = "FlightDisplayViewVideo.qml" + } else { + mainLoader.source = "FlightDisplayViewVideo.qml" + pipLoader.source = "FlightDisplayViewMap.qml" + } } - // Validate _showMap setting Component.onCompleted: { - delayLoader.source = "FlightDisplayViewDelayLoad.qml" - - // We have to be careful to not reference root properties in a function which is in a subcomponent - // until the root component has completed loading. Otherwise you get undefined references. - flightMap.rootLoadCompleted = true - flightMap.updateMapPosition(true /* force */) - _setShowMap(_showMap) - } - - function getBool(value) { - return value === '0' ? false : true; + reloadContents(); + widgetsLoader.source = "FlightDisplayViewWidgets.qml" } - function setBool(value) { - return value ? "1" : "0"; - } - - function _setShowMap(showMap) { - _showMap = _controller.hasVideo ? showMap : true - QGroundControl.flightMapSettings.saveMapSetting(flightMap.mapName, _showMapBackgroundKey, setBool(_showMap)) - } - - FlightMap { - id: flightMap - anchors.fill: parent - mapName: _mapName - visible: _showMap - latitude: root._defaultCoordinate.latitude - longitude: root._defaultCoordinate.longitude - - property var rootVehicleCoordinate: _vehicleCoordinate - property bool rootLoadCompleted: false - - property bool _followVehicle: true - - onRootVehicleCoordinateChanged: updateMapPosition(false /* force */) - - function updateMapPosition(force) { - if ((_followVehicle || force) && rootLoadCompleted) { - flightMap.latitude = root._vehicleCoordinate.latitude - flightMap.longitude = root._vehicleCoordinate.longitude + //-- Main Window + Loader { + id: mainLoader + anchors.fill: parent + onLoaded: { + if(_mainIsMap) { + _flightMap = item + if(_savedZoomLevel != 0) + _flightMap.zoomLevel = _savedZoomLevel + else + _savedZoomLevel = _flightMap.zoomLevel + _flightMap.updateMapPosition(true /* force */) + } else { + _flightVideo = item + _flightVideo.visible = true } } + } - // Home position - MissionItemIndicator { - label: "H" - coordinate: (_activeVehicle && _activeVehicle.homePositionAvailable) ? _activeVehicle.homePosition : QtPositioning.coordinate(0, 0) - visible: _activeVehicle ? _activeVehicle.homePositionAvailable : false - z: QGroundControl.zOrderMapItems - } - - // Add trajectory points to the map - MapItemView { - model: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.trajectoryPoints : 0 - - delegate: - MapPolyline { - line.width: 3 - line.color: "orange" - z: QGroundControl.zOrderMapItems - 1 - - - path: [ - { latitude: object.coordinate1.latitude, longitude: object.coordinate1.longitude }, - { latitude: object.coordinate2.latitude, longitude: object.coordinate2.longitude }, - ] - } + //-- PIP Window + Rectangle { + id: pip + visible: _controller.hasVideo + anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.left: parent.left + anchors.bottom: parent.bottom + height: ScreenTools.defaultFontPixelSize * (9) + width: ScreenTools.defaultFontPixelSize * (9) * (16/9) + color: "#000010" + border.width: 4 + radius: 4 + border.color: { + if(_mainIsMap && _flightMap != null) + return _flightMap.isSatelliteMap ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75) + else + return Qt.rgba(0,0,0,0.75) } - - // Add the vehicles to the map - MapItemView { - model: multiVehicleManager.vehicles - - delegate: - VehicleMapItem { - vehicle: object - coordinate: object.coordinate - isSatellite: flightMap.isSatelliteMap - z: QGroundControl.zOrderMapItems + Loader { + id: pipLoader + anchors.fill: parent + anchors.margins: 2 + onLoaded: { + if(_mainIsMap) { + _flightVideo = item + _flightVideo.visible = true + } else { + _flightMap = item + _savedZoomLevel = _flightMap.zoomLevel + _flightMap.zoomLevel = _savedZoomLevel - 3 } + pip.visible = _controller.hasVideo + } } - - // Add the mission items to the map - MissionItemView { - model: _missionController.missionItems - } - - // Add lines between waypoints - MissionLineView { - model: _missionController.waypointLines - } - - // Used to make pinch zoom work MouseArea { anchors.fill: parent + onClicked: { + _mainIsMap = !_mainIsMap + pip.visible = false + reloadContents(); + } } - } // Flight Map + } + //-- Widgets Loader { - id: delayLoader - anchors.fill: parent + id: widgetsLoader + anchors.fill: parent } } diff --git a/src/FlightDisplay/FlightDisplayViewDelayLoad.qml b/src/FlightDisplay/FlightDisplayViewDelayLoad.qml deleted file mode 100644 index de2e8a559ad06c430e9dc5469d247a8387df790f..0000000000000000000000000000000000000000 --- a/src/FlightDisplay/FlightDisplayViewDelayLoad.qml +++ /dev/null @@ -1,222 +0,0 @@ -/*===================================================================== - -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.4 -import QtQuick.Controls 1.3 -import QtQuick.Controls.Styles 1.2 -import QtQuick.Dialogs 1.2 -import QtLocation 5.3 -import QtPositioning 5.2 - -import QGroundControl 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.Vehicle 1.0 -import QGroundControl.FlightMap 1.0 - -/// This component is used to delay load the items which are direct children of the -/// FlightDisplayViewControl. -Item { - - QGCVideoBackground { - anchors.fill: parent - display: _controller.videoSurface - receiver: _controller.videoReceiver - visible: !_showMap - - QGCCompassHUD { - id: compassHUD - y: root.height * 0.7 - x: root.width * 0.5 - ScreenTools.defaultFontPixelSize * (5) - width: ScreenTools.defaultFontPixelSize * (10) - height: ScreenTools.defaultFontPixelSize * (10) - heading: _heading - active: multiVehicleManager.activeVehicleAvailable - z: QGroundControl.zOrderWidgets - } - - QGCAttitudeHUD { - id: attitudeHUD - rollAngle: _roll - pitchAngle: _pitch - width: ScreenTools.defaultFontPixelSize * (30) - height: ScreenTools.defaultFontPixelSize * (30) - active: multiVehicleManager.activeVehicleAvailable - z: QGroundControl.zOrderWidgets - } - } - - //-- Vehicle GPS lock display - Column { - id: gpsLockColumn - y: (parent.height - height) / 2 - width: parent.width - - Repeater { - model: multiVehicleManager.vehicles - - delegate: - QGCLabel { - width: gpsLockColumn.width - horizontalAlignment: Text.AlignHCenter - visible: !object.coordinateValid - text: "No GPS Lock for Vehicle #" + object.id - z: QGroundControl.zOrderMapItems - 2 - } - } - } - - //-- Instrument Pannel - QGCInstrumentWidget { - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.left: parent.left - anchors.bottom: parent.bottom - size: ScreenTools.defaultFontPixelSize * (9) - heading: _heading - rollAngle: _roll - pitchAngle: _pitch - z: QGroundControl.zOrderWidgets - } - - //-- Map Center Control - DropButton { - id: centerMapDropButton - anchors.rightMargin: ScreenTools.defaultFontPixelHeight - anchors.right: mapTypeButton.left - anchors.top: mapTypeButton.top - dropDirection: dropDown - buttonImage: "/qmlimages/MapCenter.svg" - viewportMargins: ScreenTools.defaultFontPixelWidth / 2 - exclusiveGroup: _dropButtonsExclusiveGroup - z: QGroundControl.zOrderWidgets - - dropDownComponent: Component { - Row { - spacing: ScreenTools.defaultFontPixelWidth - - QGCCheckBox { - id: followVehicleCheckBox - text: "Follow Vehicle" - checked: flightMap._followVehicle - anchors.baseline: centerMapButton.baseline - - onClicked: { - centerMapDropButton.hideDropDown() - flightMap._followVehicle = !flightMap._followVehicle - } - } - - QGCButton { - id: centerMapButton - text: "Center map on Vehicle" - enabled: _activeVehicle && !followVehicleCheckBox.checked - - property var activeVehicle: multiVehicleManager.activeVehicle - - onClicked: { - centerMapDropButton.hideDropDown() - flightMap.latitude = activeVehicle.latitude - flightMap.longitude = activeVehicle.longitude - } - } - } - } - } - - //-- Map Type Control - DropButton { - id: mapTypeButton - anchors.topMargin: topMargin - anchors.rightMargin: ScreenTools.defaultFontPixelHeight - anchors.top: parent.top - anchors.right: parent.right - dropDirection: dropDown - buttonImage: "/qmlimages/MapType.svg" - viewportMargins: ScreenTools.defaultFontPixelWidth / 2 - exclusiveGroup: _dropButtonsExclusiveGroup - z: QGroundControl.zOrderWidgets - - dropDownComponent: Component { - Row { - spacing: ScreenTools.defaultFontPixelWidth - - Repeater { - model: QGroundControl.flightMapSettings.mapTypes - - QGCButton { - checkable: true - checked: flightMap.mapType == text - text: modelData - - onClicked: { - flightMap.mapType = text - mapTypeButton.hideDropDown() - } - } - } - } - } - } - - //-- Temporary Options Button - QGCButton { - id: optionsButton - x: _flightMap.mapWidgets.x - y: _flightMap.mapWidgets.y - height - (ScreenTools.defaultFontPixelHeight / 2) - z: QGroundControl.zOrderWidgets - width: _flightMap.mapWidgets.width - text: "Options" - menu: optionsMenu - visible: _controller.hasVideo && !hideWidgets - - ExclusiveGroup { - id: backgroundTypeGroup - } - - Menu { - id: optionsMenu - - MenuItem { - id: mapBackgroundMenuItem - exclusiveGroup: backgroundTypeGroup - checkable: true - checked: _showMap - text: "Show map as background" - - onTriggered: _setShowMap(true) - } - - MenuItem { - id: videoBackgroundMenuItem - exclusiveGroup: backgroundTypeGroup - checkable: true - checked: !_showMap - text: "Show video as background" - - onTriggered: _setShowMap(false) - } - } - } - -} diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml new file mode 100644 index 0000000000000000000000000000000000000000..eb3dae40e4468790210287fb03713b23ded68f15 --- /dev/null +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -0,0 +1,202 @@ +/*===================================================================== + +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.4 +import QtQuick.Controls 1.3 +import QtQuick.Controls.Styles 1.2 +import QtQuick.Dialogs 1.2 +import QtLocation 5.3 +import QtPositioning 5.2 + +import QGroundControl 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Vehicle 1.0 +import QGroundControl.FlightMap 1.0 + +/// This component is used to delay load the items which are direct children of the +/// FlightDisplayViewControl. +Item { + + ExclusiveGroup { + id: _dropButtonsExclusiveGroup + } + + //-- Vehicle GPS lock display + Column { + id: gpsLockColumn + y: (parent.height - height) / 2 + width: parent.width + + Repeater { + model: multiVehicleManager.vehicles + + delegate: + QGCLabel { + width: gpsLockColumn.width + horizontalAlignment: Text.AlignHCenter + visible: !object.coordinateValid + text: "No GPS Lock for Vehicle #" + object.id + z: QGroundControl.zOrderMapItems - 2 + } + } + } + + //-- Dismiss Drop Down (if any) + MouseArea { + anchors.fill: parent + enabled: _dropButtonsExclusiveGroup.current != null + onClicked: { + if(_dropButtonsExclusiveGroup.current) + _dropButtonsExclusiveGroup.current.checked = false + _dropButtonsExclusiveGroup.current = null + } + } + + //-- Instrument Pannel + QGCInstrumentWidget { + anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.bottom: parent.bottom + anchors.right: parent.right + size: ScreenTools.defaultFontPixelSize * (9) + active: _activeVehicle != null + heading: _heading + rollAngle: _roll + pitchAngle: _pitch + isSatellite: _mainIsMap ? _flightMap ? _flightMap.isSatelliteMap : true : true + z: QGroundControl.zOrderWidgets + } + + //-- Vertical Tool Buttons + Column { + id: toolColumn + anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.left: parent.left + anchors.top: parent.top + spacing: ScreenTools.defaultFontPixelHeight + + //-- Map Center Control + DropButton { + id: centerMapDropButton + dropDirection: dropRight + buttonImage: "/qmlimages/MapCenter.svg" + viewportMargins: ScreenTools.defaultFontPixelWidth / 2 + exclusiveGroup: _dropButtonsExclusiveGroup + z: QGroundControl.zOrderWidgets + + dropDownComponent: Component { + Row { + spacing: ScreenTools.defaultFontPixelWidth + + QGCCheckBox { + id: followVehicleCheckBox + text: "Follow Vehicle" + checked: _flightMap ? _flightMap._followVehicle : false + anchors.baseline: centerMapButton.baseline + + onClicked: { + _dropButtonsExclusiveGroup.current = null + _flightMap._followVehicle = !_flightMap._followVehicle + } + } + + QGCButton { + id: centerMapButton + text: "Center map on Vehicle" + enabled: _activeVehicle && !followVehicleCheckBox.checked + + property var activeVehicle: multiVehicleManager.activeVehicle + + onClicked: { + _dropButtonsExclusiveGroup.current = null + _flightMap.latitude = activeVehicle.latitude + _flightMap.longitude = activeVehicle.longitude + } + } + } + } + } + + //-- Map Type Control + DropButton { + id: mapTypeButton + dropDirection: dropRight + buttonImage: "/qmlimages/MapType.svg" + viewportMargins: ScreenTools.defaultFontPixelWidth / 2 + exclusiveGroup: _dropButtonsExclusiveGroup + z: QGroundControl.zOrderWidgets + + dropDownComponent: Component { + Row { + spacing: ScreenTools.defaultFontPixelWidth + + Repeater { + model: QGroundControl.flightMapSettings.mapTypes + + QGCButton { + checkable: true + checked: _flightMap ? _flightMap.mapType == text : false + text: modelData + + onClicked: { + _flightMap.mapType = text + _dropButtonsExclusiveGroup.current = null + } + } + } + } + } + } + + //-- Zoom Map In + RoundButton { + id: mapZoomPlus + visible: _mainIsMap + buttonImage: "/qmlimages/ZoomPlus.svg" + exclusiveGroup: _dropButtonsExclusiveGroup + z: QGroundControl.zOrderWidgets + onClicked: { + if(_flightMap) + _flightMap.zoomLevel += 0.5 + checked = false + } + } + + //-- Zoom Map Out + RoundButton { + id: mapZoomMinus + visible: _mainIsMap + buttonImage: "/qmlimages/ZoomMinus.svg" + exclusiveGroup: _dropButtonsExclusiveGroup + z: QGroundControl.zOrderWidgets + onClicked: { + if(_flightMap) + _flightMap.zoomLevel -= 0.5 + checked = false + } + } + + } + +} diff --git a/src/FlightDisplay/qmldir b/src/FlightDisplay/qmldir index 94ca787073c7f5e567d29e1da7f3843f1dc69979..a7c889fd49fca48c2977a4eb0d096ab319d9d0be 100644 --- a/src/FlightDisplay/qmldir +++ b/src/FlightDisplay/qmldir @@ -1,5 +1,4 @@ Module QGroundControl.FlightDisplay FlightDisplayView 1.0 FlightDisplayView.qml -FlightDisplayViewDelayLoad 1.0 FlightDisplayViewDelayLoad.qml diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index dd8641c3bf54960a00faaf1cf97e0d2c11ec396e..d572ed810635821e5aafec0bece1d7597d65c75b 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -49,7 +49,7 @@ Map { property bool interactive: true property string mapName: 'defaultMap' property string mapType: QGroundControl.flightMapSettings.mapTypeForMapName(mapName) - property alias mapWidgets: controlWidgets +// property alias mapWidgets: controlWidgets property bool isSatelliteMap: mapType == "Satellite Map" || mapType == "Hybrid Map" property real lon: (longitude >= -180 && longitude <= 180) ? longitude : 0 @@ -80,6 +80,7 @@ Map { } } +/********************************************* /// Map control widgets Column { id: controlWidgets @@ -151,6 +152,7 @@ Map { } } // Row - +/- buttons } // Column - Map control widgets +*********************************************/ /* The slider and scale display are commented out for now to try to save real estate - DonLakeFlyer diff --git a/src/FlightMap/Images/ZoomMinus.svg b/src/FlightMap/Images/ZoomMinus.svg index 62392cdae1fb3f1317211e35d7915e1945ffd86e..38fa497596912c6a33c4859d783817d9bcf5e2bc 100644 --- a/src/FlightMap/Images/ZoomMinus.svg +++ b/src/FlightMap/Images/ZoomMinus.svg @@ -1,9 +1,15 @@ - - - - + viewBox="-269 361 72 72" style="enable-background:new -269 361 72 72;" xml:space="preserve"> + + + + + diff --git a/src/FlightMap/Images/ZoomPlus.svg b/src/FlightMap/Images/ZoomPlus.svg index ed0b1674a6bd082eba55a9bc880c35b11cd3bb71..f9a45974cfb8af7d1b01f9ffb87177f3787a089b 100644 --- a/src/FlightMap/Images/ZoomPlus.svg +++ b/src/FlightMap/Images/ZoomPlus.svg @@ -1,8 +1,13 @@ - - - + viewBox="-269 361 72 72" style="enable-background:new -269 361 72 72;" xml:space="preserve"> + + + + diff --git a/src/FlightMap/MapItems/VehicleMapItem.qml b/src/FlightMap/MapItems/VehicleMapItem.qml index c3b578be35895ee8c863a5f1744716dc88a1fdff..47c6ed12772f4c49982b80d1b61ca89855f557df 100644 --- a/src/FlightMap/MapItems/VehicleMapItem.qml +++ b/src/FlightMap/MapItems/VehicleMapItem.qml @@ -33,8 +33,9 @@ import QGroundControl.Vehicle 1.0 /// Marker for displaying a vehicle location on the map MapQuickItem { - property var vehicle ///< Vehicle object - property bool isSatellite: false ///< true: satellite map is showing + property var vehicle ///< Vehicle object + property bool isSatellite: false ///< true: satellite map is showing + property real size: ScreenTools.defaultFontPixelHeight * 5 anchorPoint.x: vehicleIcon.width / 2 anchorPoint.y: vehicleIcon.height / 2 @@ -44,7 +45,7 @@ MapQuickItem { id: vehicleIcon source: isSatellite ? "/qmlimages/airplaneOpaque.svg" : "/qmlimages/airplaneOutline.svg" mipmap: true - width: ScreenTools.defaultFontPixelHeight * 5 + width: size fillMode: Image.PreserveAspectFit transform: Rotation { diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index cb1c156892740aa585ad5269783446414f5e34d0..50b4718bc2be00d6989b0b83ea1fb3776edae01f 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml @@ -36,21 +36,26 @@ Item { id: root height: size - property alias heading: compass.heading - property alias active: attitude.active - property alias rollAngle: attitude.rollAngle - property alias pitchAngle: attitude.pitchAngle - property real size: ScreenTools.defaultFontPixelSize * (10) + property alias heading: compass.heading + property alias rollAngle: attitude.rollAngle + property alias pitchAngle: attitude.pitchAngle + property real size: ScreenTools.defaultFontPixelSize * (10) + property bool isSatellite: false + property bool active: false + + property bool _isVisible: true + + //-- Instrument Pannel Rectangle { id: instrumentPannel - anchors.left: parent.left + anchors.right: parent.right anchors.bottom: parent.bottom height: root.size width: instruments.width + 8 radius: root.size / 2 - color: Qt.rgba(0,0,0,0.5) - + visible: _isVisible + color: isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5) Row { id: instruments height: parent.height @@ -59,14 +64,49 @@ Item { QGCAttitudeWidget { id: attitude size: parent.height * 0.9 + active: root.active anchors.verticalCenter: parent.verticalCenter } QGCCompassWidget { id: compass size: parent.height * 0.9 + active: root.active anchors.verticalCenter: parent.verticalCenter } } + MouseArea { + anchors.fill: parent + onClicked: { + _isVisible = !_isVisible + } + } + } + //-- Show Instruments + Rectangle { + id: openButton + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 24 + width: 24 + radius: 4 + visible: !_isVisible + color: isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5) + Image { + width: parent.width * 0.75 + height: parent.height * 0.75 + source: "/qmlimages/buttonLeft.svg" + mipmap: true + fillMode: Image.PreserveAspectFit + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + MouseArea { + anchors.fill: parent + onClicked: { + _isVisible = !_isVisible + } + } } + } diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index a7e92f5b428091a442be0480676709cbfa2d6860..53e16c7af6c8a836bd62d1f7115f7b6fce08867e 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -75,7 +75,11 @@ QGCView { property bool _showHelp: QGroundControl.flightMapSettings.loadBoolMapSetting(editorMap.mapName, _showHelpKey, true) onGpsLockChanged: updateMapToVehiclePosition() - Component.onCompleted: updateMapToVehiclePosition() + + Component.onCompleted: { + helpPanel.source = "MissionEditorHelp.qml" + updateMapToVehiclePosition() + } function updateMapToVehiclePosition() { if (gpsLock && _firstGpsLock) { @@ -676,207 +680,16 @@ QGCView { } // Item - Home Position Manager */ - // Help Panel - Rectangle { - id: helpPanel - anchors.margins: margins - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: addMissionItemsButton.right - anchors.right: missionItemEditor.left - width: parent.width - (margins * 2) - _rightPanelWidth - visible: helpButton.checked - color: qgcPal.window - opacity: _rightPanelOpacity - radius: ScreenTools.defaultFontPixelHeight - z: QGroundControl.zOrderTopMost - - readonly property real margins: ScreenTools.defaultFontPixelHeight - - Image { - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.top: parent.top - anchors.right: parent.right - width: ScreenTools.defaultFontPixelHeight * 1.5 - height: ScreenTools.defaultFontPixelHeight * 1.5 - source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/XDeleteBlack.svg" : "/qmlimages/XDelete.svg" - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - - MouseArea { - anchors.fill: parent - onClicked: helpButton.checked = false - } - } - - Item { - anchors.margins: _margin - anchors.fill: parent - - QGCLabel { - id: helpTitle - font.pixelSize: ScreenTools.mediumFontPixelSize - text: "Mission Planner" - } - - QGCLabel { - id: helpIconLabel - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: helpTitle.bottom - width: parent.width - wrapMode: Text.WordWrap - text: "Mission Planner tool buttons:" - } - - Image { - id: addMissionItemsHelpIcon - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: helpIconLabel.bottom - width: ScreenTools.defaultFontPixelHeight * 3 - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/MapAddMissionBlack.svg" : "/qmlimages/MapAddMission.svg" - } - - QGCLabel { - id: addMissionItemsHelpText - anchors.leftMargin: ScreenTools.defaultFontPixelHeight - anchors.left: mapTypeHelpIcon.right - anchors.right: parent.right - anchors.top: addMissionItemsHelpIcon.top - wrapMode: Text.WordWrap - text: "Add Mission Items
" + - "When enabled, add mission items by clicking on the map." - } - - Image { - id: deleteHelpIcon - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: addMissionItemsHelpText.bottom - width: ScreenTools.defaultFontPixelHeight * 3 - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/TrashDeleteBlack.svg" : "/qmlimages/TrashDelete.svg" - } - - QGCLabel { - id: deleteHelpText - anchors.leftMargin: ScreenTools.defaultFontPixelHeight - anchors.left: mapTypeHelpIcon.right - anchors.right: parent.right - anchors.top: deleteHelpIcon.top - wrapMode: Text.WordWrap - text: "Delete Mission Item
" + - "Delete the currently selected mission item." - } - - /* - Home Position Manager disabled - - Image { - id: homePositionManagerHelpIcon - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: deleteHelpText.bottom - width: ScreenTools.defaultFontPixelHeight * 3 - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/MapHomeBlack.svg" : "/qmlimages/MapHome.svg" - } - - QGCLabel { - id: homePositionManagerHelpText - anchors.leftMargin: ScreenTools.defaultFontPixelHeight - anchors.left: mapTypeHelpIcon.right - anchors.right: parent.right - anchors.top: homePositionManagerHelpIcon.top - wrapMode: Text.WordWrap - text: "Flying Field Manager
" + - "When enabled, allows you to select/add/update flying field locations. " + - "You can save multiple flying field locations for use while creating missions while you are not connected to your vehicle." - } - */ - - Image { - id: mapCenterHelpIcon - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: deleteHelpText.bottom - width: ScreenTools.defaultFontPixelHeight * 3 - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/MapCenterBlack.svg" : "/qmlimages/MapCenter.svg" - } - - QGCLabel { - id: mapCenterHelpText - anchors.leftMargin: ScreenTools.defaultFontPixelHeight - anchors.left: mapTypeHelpIcon.right - anchors.right: parent.right - anchors.top: mapCenterHelpIcon.top - wrapMode: Text.WordWrap - text: "Map Center
" + - "Options for centering the map." - } - - Image { - id: syncHelpIcon - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: mapCenterHelpText.bottom - width: ScreenTools.defaultFontPixelHeight * 3 - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/MapSyncBlack.svg" : "/qmlimages/MapSync.svg" - } - - QGCLabel { - id: syncHelpText - anchors.leftMargin: ScreenTools.defaultFontPixelHeight - anchors.left: mapTypeHelpIcon.right - anchors.right: parent.right - anchors.top: syncHelpIcon.top - wrapMode: Text.WordWrap - text: "Sync
" + - "Options for saving/loading mission items." - } - - Image { - id: mapTypeHelpIcon - anchors.topMargin: ScreenTools.defaultFontPixelHeight - anchors.top: syncHelpText.bottom - width: ScreenTools.defaultFontPixelHeight * 3 - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/MapTypeBlack.svg" : "/qmlimages/MapType.svg" - } - - QGCLabel { - id: mapTypeHelpText - anchors.leftMargin: ScreenTools.defaultFontPixelHeight - anchors.left: mapTypeHelpIcon.right - anchors.right: parent.right - anchors.top: mapTypeHelpIcon.top - wrapMode: Text.WordWrap - text: "Map Type
" + - "Map type options." - } - - QGCCheckBox { - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.margins: _margin - checked: !_showHelp - text: "Don't show me again" + //-- Help Panel + Loader { + id: helpPanel + width: parent.width * 0.65 + height: parent.height * 0.75 + z: QGroundControl.zOrderTopMost + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } - onClicked: QGroundControl.flightMapSettings.saveBoolMapSetting(editorMap.mapName, _showHelpKey, !checked) - } - } // Item - margin - } // Item - Help Panel RoundButton { id: addMissionItemsButton