diff --git a/qgcresources.qrc b/qgcresources.qrc index 9e4454a..7136d93 100644 --- a/qgcresources.qrc +++ b/qgcresources.qrc @@ -50,6 +50,7 @@ <file alias="compassInstrumentAirplane.svg">src/FlightMap/Images/compassInstrumentAirplane.svg</file> <file alias="compassInstrumentDial.svg">src/FlightMap/Images/compassInstrumentDial.svg</file> <file alias="crossHair.svg">src/FlightMap/Images/crossHair.svg</file> + <file alias="PIP.svg">src/FlightMap/Images/PIP.svg</file> <file alias="rollDialWhite.svg">src/FlightMap/Images/rollDialWhite.svg</file> <file alias="rollPointerWhite.svg">src/FlightMap/Images/rollPointerWhite.svg</file> <file alias="scale.png">src/FlightMap/Images/scale.png</file> diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 18736e9..f102923 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 b3a57b7..bd082a8 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 a14ec2b..f73f1e5 100644 --- a/src/FlightMap/Images/PiP.svg +++ b/src/FlightMap/Images/PiP.svg @@ -2,9 +2,9 @@ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 72 72" enable-background="new 0 0 72 72" xml:space="preserve"> -<path opacity="0.85" d="M0,72V0l72,0C72,39.797,39.797,72,0,72z"/> +<path opacity="0.5" d="M0,0v72h72C72,32.203,39.797,0,0,0z"/> <g> - <rect x="14.4" y="15.401" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" width="36" height="27"/> - <rect x="5.4" y="6.401" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" width="36" height="27"/> + <rect x="14.4" y="29.599" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" width="36" height="27"/> + <rect x="5.4" y="38.599" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" width="36" height="27"/> </g> </svg> diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index 7367569..0dfef84 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 - } - } - } - }