diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index ac6c0333ed2d2c5b4059859b27e4eb7684c09a43..168d5d7cc6ccbd149bf4d817d755375781a4d165 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -81,8 +81,7 @@ src/FlightDisplay/qmldir src/FlightDisplay/FlightDisplayView.qml - src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml - src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml + src/FlightDisplay/FlightDisplayViewDelayLoad.qml src/FlightMap/qmldir @@ -96,6 +95,7 @@ src/FlightMap/Widgets/QGCCompassHUD.qml src/FlightMap/Widgets/QGCCurrentAltitude.qml src/FlightMap/Widgets/QGCCurrentSpeed.qml + src/FlightMap/Widgets/QGCInstrumentWidget.qml src/FlightMap/Widgets/QGCPitchIndicator.qml src/FlightMap/Widgets/QGCSlider.qml src/FlightMap/Widgets/QGCSpeedWidget.qml diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index c39f3065745cb838a8e49af1f06676926911b06c..6e6d823927753cd73c0d9270c485ab21052565d8 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -96,7 +96,7 @@ Item { // Validate _showMap setting Component.onCompleted: { - delayLoader.source = "FlightDisplayViewDelayLoadOuter.qml" + 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. @@ -133,14 +133,13 @@ Item { onRootVehicleCoordinateChanged: updateMapPosition(false /* force */) - Component.onCompleted: flightMapDelayLoader.source = "FlightDisplayViewDelayLoadInner.qml" - function updateMapPosition(force) { if ((_followVehicle || force) && rootLoadCompleted) { flightMap.latitude = root._vehicleCoordinate.latitude flightMap.longitude = root._vehicleCoordinate.longitude } } + // Home position MissionItemIndicator { label: "H" @@ -190,11 +189,6 @@ Item { model: _missionController.waypointLines } - Loader { - id: flightMapDelayLoader - anchors.fill: parent - } - // Used to make pinch zoom work MouseArea { anchors.fill: parent diff --git a/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml b/src/FlightDisplay/FlightDisplayViewDelayLoad.qml similarity index 66% rename from src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml rename to src/FlightDisplay/FlightDisplayViewDelayLoad.qml index 50fb3239fa2964c07150895ab284da691d8ba08b..de2e8a559ad06c430e9dc5469d247a8387df790f 100644 --- a/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml +++ b/src/FlightDisplay/FlightDisplayViewDelayLoad.qml @@ -35,10 +35,39 @@ import QGroundControl.Palette 1.0 import QGroundControl.Vehicle 1.0 import QGroundControl.FlightMap 1.0 -/// This component is used to delay load the controls which are children of the inner FlightMap -/// control of FlightDisplayView. -// Vehicle GPS lock display +/// 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 @@ -58,27 +87,19 @@ Item { } } - QGCCompassWidget { - anchors.leftMargin: ScreenTools.defaultFontPixelHeight - anchors.topMargin: topMargin - anchors.left: parent.left - anchors.top: parent.top - size: ScreenTools.defaultFontPixelSize * (13.3) - heading: _heading - z: QGroundControl.zOrderWidgets - } - - QGCAttitudeWidget { + //-- Instrument Pannel + QGCInstrumentWidget { anchors.margins: ScreenTools.defaultFontPixelHeight anchors.left: parent.left anchors.bottom: parent.bottom - size: ScreenTools.defaultFontPixelSize * (13.3) + size: ScreenTools.defaultFontPixelSize * (9) + heading: _heading rollAngle: _roll pitchAngle: _pitch - active: multiVehicleManager.activeVehicleAvailable z: QGroundControl.zOrderWidgets } + //-- Map Center Control DropButton { id: centerMapDropButton anchors.rightMargin: ScreenTools.defaultFontPixelHeight @@ -123,6 +144,7 @@ Item { } } + //-- Map Type Control DropButton { id: mapTypeButton anchors.topMargin: topMargin @@ -156,4 +178,45 @@ Item { } } } + + //-- 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/FlightDisplayViewDelayLoadOuter.qml b/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml deleted file mode 100644 index b57e36906c49b729317767dc6b7126f371c2ad06..0000000000000000000000000000000000000000 --- a/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml +++ /dev/null @@ -1,145 +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 - } - } - - QGCAltitudeWidget { - anchors.right: parent.right - height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 - width: ScreenTools.defaultFontPixelSize * (5) - altitude: _altitudeWGS84 - z: QGroundControl.zOrderWidgets - visible: !hideWidgets - } - - QGCSpeedWidget { - anchors.left: parent.left - width: ScreenTools.defaultFontPixelSize * (5) - height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 - speed: _groundSpeed - z: QGroundControl.zOrderWidgets - visible: !hideWidgets - } - - QGCCurrentSpeed { - anchors.left: parent.left - width: ScreenTools.defaultFontPixelSize * (6.25) - airspeed: _airSpeed - groundspeed: _groundSpeed - active: multiVehicleManager.activeVehicleAvailable - z: QGroundControl.zOrderWidgets - visible: !hideWidgets - } - - QGCCurrentAltitude { - anchors.right: parent.right - width: ScreenTools.defaultFontPixelSize * (6.25) - altitude: _altitudeWGS84 - vertZ: _climbRate - active: multiVehicleManager.activeVehicleAvailable - z: QGroundControl.zOrderWidgets - visible: !hideWidgets - } - - 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/qmldir b/src/FlightDisplay/qmldir index 31f93cdf6389a24b3e2e6c063e49c6923420ba70..94ca787073c7f5e567d29e1da7f3843f1dc69979 100644 --- a/src/FlightDisplay/qmldir +++ b/src/FlightDisplay/qmldir @@ -1,6 +1,5 @@ Module QGroundControl.FlightDisplay -FlightDisplayView 1.0 FlightDisplayView.qml -FlightDisplayViewDelayLoadInner 1.0 FlightDisplayViewDelayLoadInner.qml -FlightDisplayViewDelayLoadOuter 1.0 FlightDisplayViewDelayLoadOuter.qml +FlightDisplayView 1.0 FlightDisplayView.qml +FlightDisplayViewDelayLoad 1.0 FlightDisplayViewDelayLoad.qml diff --git a/src/FlightMap/Images/attitudeInstrument.svg b/src/FlightMap/Images/attitudeInstrument.svg index b5a4940d902c2887ff71d6ac61cc9193ba427d41..1b0563f14d5ad9b8a53da93ac66db1a6a599f061 100644 --- a/src/FlightMap/Images/attitudeInstrument.svg +++ b/src/FlightMap/Images/attitudeInstrument.svg @@ -1,7 +1,10 @@ - + - + viewBox="-161 253 288 288" style="enable-background:new -161 253 288 288;" xml:space="preserve"> + + diff --git a/src/FlightMap/Images/buttonLeft.svg b/src/FlightMap/Images/buttonLeft.svg index 8219d4ffef5357be9acf51322d578dff980d6100..c238ffebac6ae905d8bf7c9a976188606ad748b2 100644 --- a/src/FlightMap/Images/buttonLeft.svg +++ b/src/FlightMap/Images/buttonLeft.svg @@ -1,19 +1,13 @@ - - - - - + + + - - - - - - + + + diff --git a/src/FlightMap/Images/buttonRight.svg b/src/FlightMap/Images/buttonRight.svg index a8d7e8498a6f55b0f61ef42b507147fba207aabe..6dca6c1c94b1c04f2835f9111f0fe8e49b4bb787 100644 --- a/src/FlightMap/Images/buttonRight.svg +++ b/src/FlightMap/Images/buttonRight.svg @@ -1,19 +1,13 @@ - - - - - + + + - - - - - - + + + diff --git a/src/FlightMap/Widgets/QGCAttitudeWidget.qml b/src/FlightMap/Widgets/QGCAttitudeWidget.qml index c969122bec76131c61ee10c3519791c83c356c89..fa2801c99f58984f424699a6ca26dee09aba58ae 100644 --- a/src/FlightMap/Widgets/QGCAttitudeWidget.qml +++ b/src/FlightMap/Widgets/QGCAttitudeWidget.qml @@ -28,9 +28,11 @@ This file is part of the QGROUNDCONTROL project */ import QtQuick 2.4 +import QtGraphicalEffects 1.0 + import QGroundControl.Controls 1.0 -QGCMovableItem { +Item { id: root property bool active: false ///< true: actively connected to data provider, false: show inactive control @@ -42,70 +44,91 @@ QGCMovableItem { readonly property real _defaultRollAngle: 0 readonly property real _defaultPitchAngle: 0 - property real _rollAngle: active ? rollAngle : _defaultRollAngle + property real _rollAngle: active ? rollAngle : _defaultRollAngle property real _pitchAngle: active ? pitchAngle : _defaultPitchAngle width: size height: size - //---------------------------------------------------- - //-- Artificial Horizon - QGCArtificialHorizon { - rollAngle: _rollAngle - pitchAngle: _pitchAngle + Item { + id: instrument anchors.fill: parent - } - //---------------------------------------------------- - //-- Pointer - Image { - id: pointer - source: "/qmlimages/attitudePointer.svg" - mipmap: true - fillMode: Image.PreserveAspectFit - anchors.fill: parent - } - //---------------------------------------------------- - //-- Instrument Dial - Image { - id: instrumentDial - source: "/qmlimages/attitudeDial.svg" - mipmap: true - fillMode: Image.PreserveAspectFit - anchors.fill: parent - transform: Rotation { - origin.x: root.width / 2 - origin.y: root.height / 2 - angle: -_rollAngle + visible: false + + //---------------------------------------------------- + //-- Artificial Horizon + QGCArtificialHorizon { + rollAngle: _rollAngle + pitchAngle: _pitchAngle + anchors.fill: parent + } + //---------------------------------------------------- + //-- Pointer + Image { + id: pointer + source: "/qmlimages/attitudePointer.svg" + mipmap: true + fillMode: Image.PreserveAspectFit + anchors.fill: parent + } + //---------------------------------------------------- + //-- Instrument Dial + Image { + id: instrumentDial + source: "/qmlimages/attitudeDial.svg" + mipmap: true + fillMode: Image.PreserveAspectFit + anchors.fill: parent + transform: Rotation { + origin.x: root.width / 2 + origin.y: root.height / 2 + angle: -_rollAngle + } + } + //---------------------------------------------------- + //-- Pitch + QGCPitchIndicator { + id: pitchWidget + visible: root.showPitch + size: root.size * 0.65 + anchors.verticalCenter: parent.verticalCenter + pitchAngle: _pitchAngle + rollAngle: _rollAngle + color: Qt.rgba(0,0,0,0) + } + //---------------------------------------------------- + //-- Cross Hair + Image { + id: crossHair + anchors.centerIn: parent + source: "/qmlimages/crossHair.svg" + mipmap: true + width: size * 0.75 + fillMode: Image.PreserveAspectFit } } - //---------------------------------------------------- - //-- Pitch - QGCPitchIndicator { - id: pitchWidget - visible: root.showPitch - size: root.size * 0.65 - anchors.verticalCenter: parent.verticalCenter - pitchAngle: _pitchAngle - rollAngle: _rollAngle - color: Qt.rgba(0,0,0,0) + + Rectangle { + id: mask + anchors.fill: instrument + radius: width / 2 + color: "black" + visible: false } - //---------------------------------------------------- - //-- Cross Hair - Image { - id: crossHair - anchors.centerIn: parent - source: "/qmlimages/crossHair.svg" - mipmap: true - width: size * 0.75 - fillMode: Image.PreserveAspectFit + + OpacityMask { + anchors.fill: instrument + source: instrument + maskSource: mask } - //---------------------------------------------------- - //-- Instrument Pannel - Image { - id: pannel - source: "/qmlimages/attitudeInstrument.svg" - mipmap: true - fillMode: Image.PreserveAspectFit + + Rectangle { + id: borderRect anchors.fill: parent + radius: width / 2 + color: Qt.rgba(0,0,0,0) + border.color: "black" + border.width: 2 } + } diff --git a/src/FlightMap/Widgets/QGCCompassWidget.qml b/src/FlightMap/Widgets/QGCCompassWidget.qml index 72f2f388235e45b1b5eae36caad17a0f19ae32d1..251acc94342aa3c8af734cbfdcb6653c511624bf 100644 --- a/src/FlightMap/Widgets/QGCCompassWidget.qml +++ b/src/FlightMap/Widgets/QGCCompassWidget.qml @@ -28,59 +28,88 @@ This file is part of the QGROUNDCONTROL project */ import QtQuick 2.4 +import QtGraphicalEffects 1.0 + import QGroundControl.Controls 1.0 import QGroundControl.ScreenTools 1.0 -QGCMovableItem { +Item { id: root - property real heading: _defaultHeading + property bool active: false ///< true: actively connected to data provider, false: show inactive control + property real heading: 0 property real size: ScreenTools.defaultFontPixelSize * (10) - property int _fontSize: ScreenTools.defaultFontPixelSize - readonly property real _defaultHeading: 0 + property int _fontSize: ScreenTools.defaultFontPixelSize * 0.8 width: size height: size + Rectangle { - id: compassBack - anchors.fill: parent - color: "#212121" + id: borderRect + anchors.fill: parent + radius: width / 2 + color: "#202020" + border.color: "black" + border.width: 2 } - Image { - id: pointer - source: "/qmlimages/compassInstrumentAirplane.svg" - mipmap: true - width: size * 0.75 - fillMode: Image.PreserveAspectFit - anchors.centerIn: parent - transform: Rotation { - origin.x: pointer.width / 2 - origin.y: pointer.height / 2 - angle: heading + + Item { + id: instrument + anchors.fill: parent + visible: false + + Image { + id: pointer + source: "/qmlimages/compassInstrumentAirplane.svg" + mipmap: true + width: size * 0.75 + fillMode: Image.PreserveAspectFit + anchors.centerIn: parent + transform: Rotation { + origin.x: pointer.width / 2 + origin.y: pointer.height / 2 + angle: heading + } + } + + Image { + id: compassDial + source: "/qmlimages/compassInstrumentDial.svg" + mipmap: true + fillMode: Image.PreserveAspectFit + anchors.fill: parent + } + + Rectangle { + anchors.centerIn: parent + width: size * 0.35 + height: size * 0.2 + border.color: Qt.rgba(1,1,1,0.15) + color: Qt.rgba(0,0,0,0.65) + + QGCLabel { + text: active ? heading.toFixed(0) : "OFF" + font.weight: active ? Font.DemiBold : Font.Light + font.pixelSize: _fontSize < 1 ? 1 : _fontSize; + color: "white" + anchors.centerIn: parent + } } } - Image { - id: compassDial - source: "/qmlimages/compassInstrumentDial.svg" - mipmap: true - fillMode: Image.PreserveAspectFit - anchors.fill: parent - } + Rectangle { - anchors.centerIn: root - width: size * 0.35 - height: size * 0.2 - border.color: Qt.rgba(1,1,1,0.15) - color: Qt.rgba(0,0,0,0.65) - - QGCLabel { - text: _heading.toFixed(0) - font.weight: Font.DemiBold - font.pixelSize: _fontSize < 1 ? 1 : _fontSize; - color: "white" - anchors.centerIn: parent - visible: active - } + id: mask + anchors.fill: instrument + radius: width / 2 + color: "black" + visible: false } + + OpacityMask { + anchors.fill: instrument + source: instrument + maskSource: mask + } + } diff --git a/src/FlightMap/Widgets/QGCPitchIndicator.qml b/src/FlightMap/Widgets/QGCPitchIndicator.qml index 3e7c938089520280fa0a4d98b7ed5dd3340fdf11..a0f05a6ae47eeabe3630a20cb4dc7ea067fef4e3 100644 --- a/src/FlightMap/Widgets/QGCPitchIndicator.qml +++ b/src/FlightMap/Widgets/QGCPitchIndicator.qml @@ -34,13 +34,14 @@ import QGroundControl.Controls 1.0 Rectangle { property real pitchAngle: 0 property real rollAngle: 0 - property real size: 120 + property real size: 100 property real _reticleHeight: 1 property real _reticleSpacing: size * 0.15 property real _reticleSlot: _reticleSpacing + _reticleHeight property real _longDash: size * 0.40 property real _shortDash: size * 0.25 - property real _fontSize: ScreenTools.defaultFontPixelSize + property real _fontSize: ScreenTools.defaultFontPixelSize * (size / 100) + height: size * 0.9 width: size radius: ScreenTools.defaultFontPixelSize * (0.66) diff --git a/src/FlightMap/qmldir b/src/FlightMap/qmldir index 0f3ae93de041b0c7f9a2fe1dea5f14cc045c2535..c5493a2ba6e66158cb434aaedd0a0877e243c3ce 100644 --- a/src/FlightMap/qmldir +++ b/src/FlightMap/qmldir @@ -13,12 +13,13 @@ QGCCompassHUD 1.0 QGCCompassHUD.qml QGCCompassWidget 1.0 QGCCompassWidget.qml QGCCurrentAltitude 1.0 QGCCurrentAltitude.qml QGCCurrentSpeed 1.0 QGCCurrentSpeed.qml +QGCInstrumentWidget 1.0 QGCInstrumentWidget.qml QGCPitchIndicator 1.0 QGCPitchIndicator.qml QGCSlider 1.0 QGCSlider.qml QGCSpeedWidget 1.0 QGCSpeedWidget.qml # Map items -VehicleMapItem 1.0 VehicleMapItem.qml MissionItemIndicator 1.0 MissionItemIndicator.qml MissionItemView 1.0 MissionItemView.qml MissionLineView 1.0 MissionLineView.qml +VehicleMapItem 1.0 VehicleMapItem.qml