diff --git a/qgcresources.qrc b/qgcresources.qrc index 9e4454aa0ed353dd745254a95385ac38bdad7ec2..7136d936052cbd77827c91f10beac09294dbd64c 100644 --- a/qgcresources.qrc +++ b/qgcresources.qrc @@ -50,6 +50,7 @@ src/FlightMap/Images/compassInstrumentAirplane.svg src/FlightMap/Images/compassInstrumentDial.svg src/FlightMap/Images/crossHair.svg + src/FlightMap/Images/PIP.svg src/FlightMap/Images/rollDialWhite.svg src/FlightMap/Images/rollPointerWhite.svg src/FlightMap/Images/scale.png diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 18736e9878b2a528411ae77851daa224994899d4..f102923495d62402e880a0913ad8bf9a07cc2eac 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -57,8 +57,10 @@ Item { readonly property string _mapName: "FlightDisplayView" readonly property string _showMapBackgroundKey: "/showMapBackground" readonly property string _mainIsMapKey: "MainFlyWindowIsMap" + readonly property string _PIPVisibleKey: "IsPIPVisible" - property bool _mainIsMap: QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) + property bool _mainIsMap: QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true) + property bool _isPipVisible: QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch @@ -71,6 +73,9 @@ Item { property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate + property bool _isBackgroundDark: _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true + + property var _flightMap: null property var _flightVideo: null property var _savedZoomLevel: 0 @@ -123,7 +128,7 @@ Item { //-- PIP Window Rectangle { id: pip - visible: _controller.hasVideo + visible: _controller.hasVideo && _isPipVisible anchors.margins: ScreenTools.defaultFontPixelHeight anchors.left: parent.left anchors.bottom: parent.bottom @@ -132,12 +137,7 @@ Item { 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) - } + border.color: _isBackgroundDark ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75) Loader { id: pipLoader anchors.fill: parent @@ -160,6 +160,52 @@ Item { QGroundControl.saveBoolGlobalSetting(_mainIsMapKey, _mainIsMap) } } + Image { + id: closePIP + source: "/qmlimages/PIP.svg" + mipmap: true + fillMode: Image.PreserveAspectFit + anchors.left: parent.left + anchors.bottom: parent.bottom + height: ScreenTools.defaultFontPixelSize * 2.5 + width: ScreenTools.defaultFontPixelSize * 2.5 + MouseArea { + anchors.fill: parent + onClicked: { + _isPipVisible = false + QGroundControl.saveBoolGlobalSetting(_PIPVisibleKey, false) + } + } + } + } + + //-- Show PIP + Rectangle { + id: openPIP + anchors.left : parent.left + anchors.bottom: parent.bottom + anchors.margins: ScreenTools.defaultFontPixelHeight + height: ScreenTools.defaultFontPixelSize * 2 + width: ScreenTools.defaultFontPixelSize * 2 + radius: ScreenTools.defaultFontPixelSize / 3 + visible: _controller.hasVideo && !_isPipVisible + color: _isBackgroundDark ? 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/buttonRight.svg" + mipmap: true + fillMode: Image.PreserveAspectFit + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + MouseArea { + anchors.fill: parent + onClicked: { + _isPipVisible = true + QGroundControl.saveBoolGlobalSetting(_PIPVisibleKey, true) + } + } } //-- Widgets diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index b3a57b7cf6d176113bebfbf1834a02aa05143d67..bd082a88dc43de71138924133a21f98cb0ef0ed6 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -39,6 +39,10 @@ import QGroundControl.FlightMap 1.0 /// FlightDisplayViewControl. Item { + readonly property string _InstrumentVisibleKey: "IsInstrumentPanelVisible" + + property bool _isInstrumentVisible: QGroundControl.loadBoolGlobalSetting(_InstrumentVisibleKey, true) + ExclusiveGroup { id: _dropButtonsExclusiveGroup } @@ -74,11 +78,12 @@ Item { } } - //-- Instrument Pannel + //-- Instrument Panel QGCInstrumentWidget { anchors.margins: ScreenTools.defaultFontPixelHeight anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter + visible: _isInstrumentVisible size: ScreenTools.defaultFontPixelSize * (9) active: _activeVehicle != null heading: _heading @@ -89,6 +94,39 @@ Item { airSpeed: _airSpeed isSatellite: _mainIsMap ? _flightMap ? _flightMap.isSatelliteMap : true : true z: QGroundControl.zOrderWidgets + onClicked: { + _isInstrumentVisible = false + QGroundControl.saveBoolGlobalSetting(_InstrumentVisibleKey, false) + } + } + + //-- Show (Hidden) Instrument Panel + Rectangle { + id: openButton + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: ScreenTools.defaultFontPixelHeight + height: ScreenTools.defaultFontPixelSize * 2 + width: ScreenTools.defaultFontPixelSize * 2 + radius: ScreenTools.defaultFontPixelSize / 3 + visible: !_isInstrumentVisible + color: _isBackgroundDark ? 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: { + _isInstrumentVisible = true + QGroundControl.saveBoolGlobalSetting(_InstrumentVisibleKey, false) + } + } } //-- Vertical Tool Buttons diff --git a/src/FlightMap/Images/PiP.svg b/src/FlightMap/Images/PiP.svg index a14ec2bbc73ddfedf32f1d79ceb5dcb007f70d1f..f73f1e577fe4f979208a214e584fdc662cffae2c 100644 --- a/src/FlightMap/Images/PiP.svg +++ b/src/FlightMap/Images/PiP.svg @@ -2,9 +2,9 @@ - + - - + + diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index 73675693993f6b25d591fb7103cf05bda3562d39..0dfef8412602493c675b2f9059878d40e1054aed 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml @@ -36,6 +36,8 @@ Item { id: root height: size + signal clicked + property alias heading: compass.heading property alias rollAngle: attitude.rollAngle property alias pitchAngle: attitude.pitchAngle @@ -48,9 +50,9 @@ Item { property bool _isVisible: true - //-- Instrument Pannel + //-- Instrument Panel Rectangle { - id: instrumentPannel + id: instrumentPanel height: instruments.height + ScreenTools.defaultFontPixelSize width: root.size radius: root.size / 2 @@ -162,36 +164,8 @@ Item { MouseArea { anchors.fill: parent onClicked: { - _isVisible = !_isVisible + onClicked: root.clicked() } } } - - //-- Show Instruments - Rectangle { - id: openButton - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - height: ScreenTools.defaultFontPixelSize * 2 - width: ScreenTools.defaultFontPixelSize * 2 - radius: ScreenTools.defaultFontPixelSize / 3 - 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 - } - } - } - }