Unverified Commit a49984d0 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #8264 from mavlink/pr-various-fixes

Various fixes
parents 9c521d0c 4340f2a2
...@@ -49,7 +49,6 @@ Item { ...@@ -49,7 +49,6 @@ Item {
property var _rallyPointController: _planController.rallyPointController property var _rallyPointController: _planController.rallyPointController
property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property real _savedZoomLevel: 0
property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _pipSize: mainWindow.width * 0.2 property real _pipSize: mainWindow.width * 0.2
property alias _guidedController: guidedActionsController property alias _guidedController: guidedActionsController
...@@ -75,25 +74,10 @@ Item { ...@@ -75,25 +74,10 @@ Item {
//-- Adjust Margins //-- Adjust Margins
_flightMapContainer.state = "fullMode" _flightMapContainer.state = "fullMode"
_flightVideo.state = "pipMode" _flightVideo.state = "pipMode"
//-- Save/Restore Map Zoom Level
if(_savedZoomLevel != 0) {
if(mainWindow.flightDisplayMap) {
mainWindow.flightDisplayMap.zoomLevel = _savedZoomLevel
}
} else {
if(mainWindow.flightDisplayMap) {
_savedZoomLevel = mainWindow.flightDisplayMap.zoomLevel
}
}
} else { } else {
//-- Adjust Margins //-- Adjust Margins
_flightMapContainer.state = "pipMode" _flightMapContainer.state = "pipMode"
_flightVideo.state = "fullMode" _flightVideo.state = "fullMode"
//-- Set Map Zoom Level
if(mainWindow.flightDisplayMap) {
_savedZoomLevel = mainWindow.flightDisplayMap.zoomLevel
mainWindow.flightDisplayMap.zoomLevel = _savedZoomLevel - 3
}
} }
} }
...@@ -335,6 +319,7 @@ Item { ...@@ -335,6 +319,7 @@ Item {
scaleState: (mainIsMap && flyViewOverlay.item) ? (flyViewOverlay.item.scaleState ? flyViewOverlay.item.scaleState : "bottomMode") : "bottomMode" scaleState: (mainIsMap && flyViewOverlay.item) ? (flyViewOverlay.item.scaleState ? flyViewOverlay.item.scaleState : "bottomMode") : "bottomMode"
Component.onCompleted: { Component.onCompleted: {
mainWindow.flightDisplayMap = _fMap mainWindow.flightDisplayMap = _fMap
_fMap.adjustMapSize()
} }
} }
} }
...@@ -367,7 +352,7 @@ Item { ...@@ -367,7 +352,7 @@ Item {
name: "pipMode" name: "pipMode"
PropertyChanges { PropertyChanges {
target: _flightVideo target: _flightVideo
anchors.margins: _toolsMargin anchors.margins: ScreenTools.defaultFontPixelHeight
} }
PropertyChanges { PropertyChanges {
target: _flightVideoPipControl target: _flightVideoPipControl
...@@ -390,7 +375,7 @@ Item { ...@@ -390,7 +375,7 @@ Item {
StateChangeScript { StateChangeScript {
script: { script: {
// Stop video, restart it again with Timer // Stop video, restart it again with Timer
// Avoiding crashs if ParentChange is not yet done // Avoiding crashes if ParentChange is not yet done
QGroundControl.videoManager.stopVideo() QGroundControl.videoManager.stopVideo()
videoPopUpTimer.running = true videoPopUpTimer.running = true
} }
...@@ -459,6 +444,7 @@ Item { ...@@ -459,6 +444,7 @@ Item {
onActivated: { onActivated: {
mainIsMap = !mainIsMap mainIsMap = !mainIsMap
setStates() setStates()
_fMap.adjustMapSize()
} }
onHideIt: { onHideIt: {
setPipVisibility(!state) setPipVisibility(!state)
......
...@@ -30,6 +30,8 @@ FlightMap { ...@@ -30,6 +30,8 @@ FlightMap {
allowGCSLocationCenter: !userPanned allowGCSLocationCenter: !userPanned
allowVehicleLocationCenter: !_keepVehicleCentered allowVehicleLocationCenter: !_keepVehicleCentered
planView: false planView: false
zoomLevel: QGroundControl.flightMapZoom
center: QGroundControl.flightMapPosition
property alias scaleState: mapScale.state property alias scaleState: mapScale.state
...@@ -52,6 +54,7 @@ FlightMap { ...@@ -52,6 +54,7 @@ FlightMap {
property bool _disableVehicleTracking: false property bool _disableVehicleTracking: false
property bool _keepVehicleCentered: mainIsMap ? false : true property bool _keepVehicleCentered: mainIsMap ? false : true
property bool _pipping: false
function updateAirspace(reset) { function updateAirspace(reset) {
if(_airspaceEnabled) { if(_airspaceEnabled) {
...@@ -63,12 +66,42 @@ FlightMap { ...@@ -63,12 +66,42 @@ FlightMap {
} }
} }
function pipIn() {
if(QGroundControl.flightMapZoom > 3) {
_pipping = true;
zoomLevel = QGroundControl.flightMapZoom - 3
_pipping = false;
}
}
function pipOut() {
_pipping = true;
zoomLevel = QGroundControl.flightMapZoom
_pipping = false;
}
function adjustMapSize() {
if(mainIsMap)
pipOut()
else
pipIn()
}
// Track last known map position and zoom from Fly view in settings // Track last known map position and zoom from Fly view in settings
onVisibleChanged: {
if(visible) {
adjustMapSize()
center = QGroundControl.flightMapPosition
}
}
onZoomLevelChanged: { onZoomLevelChanged: {
if(!_pipping) {
QGroundControl.flightMapZoom = zoomLevel QGroundControl.flightMapZoom = zoomLevel
updateAirspace(false) updateAirspace(false)
} }
}
onCenterChanged: { onCenterChanged: {
QGroundControl.flightMapPosition = center QGroundControl.flightMapPosition = center
updateAirspace(false) updateAirspace(false)
......
...@@ -25,8 +25,6 @@ import QGroundControl.QGCPositionManager 1.0 ...@@ -25,8 +25,6 @@ import QGroundControl.QGCPositionManager 1.0
Map { Map {
id: _map id: _map
zoomLevel: QGroundControl.flightMapZoom
center: QGroundControl.flightMapPosition
//-- Qt 5.9 has rotation gesture enabled by default. Here we limit the possible gestures. //-- Qt 5.9 has rotation gesture enabled by default. Here we limit the possible gestures.
gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
gesture.flickDeceleration: 3000 gesture.flickDeceleration: 3000
...@@ -80,8 +78,10 @@ Map { ...@@ -80,8 +78,10 @@ Map {
onGcsPositionChanged: { onGcsPositionChanged: {
if (gcsPosition.isValid && allowGCSLocationCenter && !firstGCSPositionReceived && !firstVehiclePositionReceived) { if (gcsPosition.isValid && allowGCSLocationCenter && !firstGCSPositionReceived && !firstVehiclePositionReceived) {
firstGCSPositionReceived = true firstGCSPositionReceived = true
//-- Only center on gsc if we have no vehicle (and we are supposed to do so)
var activeVehicleCoordinate = activeVehicle ? activeVehicle.coordinate : QtPositioning.coordinate()
if(QGroundControl.settingsManager.flyViewSettings.keepMapCenteredOnVehicle.rawValue || !activeVehicleCoordinate.isValid)
center = gcsPosition center = gcsPosition
zoomLevel = QGroundControl.flightMapInitialZoom
} }
} }
......
...@@ -105,10 +105,14 @@ Item { ...@@ -105,10 +105,14 @@ Item {
} }
onVisibleChanged: { onVisibleChanged: {
if (visible && !_planMasterController.containsItems) { if(visible) {
editorMap.zoomLevel = QGroundControl.flightMapZoom
editorMap.center = QGroundControl.flightMapPosition
if (!_planMasterController.containsItems) {
toolStrip.simulateClick(toolStrip.fileButtonIndex) toolStrip.simulateClick(toolStrip.fileButtonIndex)
} }
} }
}
Connections { Connections {
target: _appSettings ? _appSettings.defaultMissionItemAltitude : null target: _appSettings ? _appSettings.defaultMissionItemAltitude : null
...@@ -367,28 +371,28 @@ Item { ...@@ -367,28 +371,28 @@ Item {
allowVehicleLocationCenter: true allowVehicleLocationCenter: true
planView: true planView: true
zoomLevel: QGroundControl.flightMapZoom
center: QGroundControl.flightMapPosition
// This is the center rectangle of the map which is not obscured by tools // This is the center rectangle of the map which is not obscured by tools
property rect centerViewport: Qt.rect(_leftToolWidth + _margin, _toolsMargin, editorMap.width - _leftToolWidth - _rightToolWidth - (_margin * 2), mapScale.y - _margin - _toolsMargin) property rect centerViewport: Qt.rect(_leftToolWidth + _margin, _toolsMargin, editorMap.width - _leftToolWidth - _rightToolWidth - (_margin * 2), mapScale.y - _margin - _toolsMargin)
property real _leftToolWidth: toolStrip.x + toolStrip.width property real _leftToolWidth: toolStrip.x + toolStrip.width
property real _rightToolWidth: rightPanel.width + rightPanel.anchors.rightMargin property real _rightToolWidth: rightPanel.width + rightPanel.anchors.rightMargin
readonly property real animationDuration: 500
// Initial map position duplicates Fly view position // Initial map position duplicates Fly view position
Component.onCompleted: editorMap.center = QGroundControl.flightMapPosition Component.onCompleted: editorMap.center = QGroundControl.flightMapPosition
Behavior on zoomLevel {
NumberAnimation {
duration: editorMap.animationDuration
easing.type: Easing.InOutQuad
}
}
QGCMapPalette { id: mapPal; lightColors: editorMap.isSatelliteMap } QGCMapPalette { id: mapPal; lightColors: editorMap.isSatelliteMap }
onZoomLevelChanged: updateAirspace(false) onZoomLevelChanged: {
onCenterChanged: updateAirspace(false) QGroundControl.flightMapZoom = zoomLevel
updateAirspace(false)
}
onCenterChanged: {
QGroundControl.flightMapPosition = center
updateAirspace(false)
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
......
...@@ -68,7 +68,7 @@ Slider { ...@@ -68,7 +68,7 @@ Slider {
radius: _radius radius: _radius
property real _radius: Math.round(ScreenTools.defaultFontPixelHeight * 0.75) property real _radius: Math.round(ScreenTools.defaultFontPixelHeight * 0.75)
Label { Label {
text: _root.value.toFixed(0) text: _root.value.toFixed( _root.maximumValue <= 1 ? 1 : 0)
visible: _root.displayValue visible: _root.displayValue
anchors.centerIn: parent anchors.centerIn: parent
font.family: ScreenTools.normalFontFamily font.family: ScreenTools.normalFontFamily
......
...@@ -132,7 +132,7 @@ Rectangle { ...@@ -132,7 +132,7 @@ Rectangle {
} }
onClicked : { onClicked : {
console.log(modelData.setupSource) //console.log(modelData.setupSource)
if (modelData.setupSource !== "") { if (modelData.setupSource !== "") {
setupView.showVehicleComponentPanel(modelData) setupView.showVehicleComponentPanel(modelData)
} }
......
...@@ -207,7 +207,7 @@ ApplicationWindow { ...@@ -207,7 +207,7 @@ ApplicationWindow {
dlgLoader.source = "QGCViewDialogContainer.qml" dlgLoader.source = "QGCViewDialogContainer.qml"
} }
onClosed: { onClosed: {
console.log("View switch ok") //console.log("View switch ok")
mainWindow.popPreventViewSwitch() mainWindow.popPreventViewSwitch()
dlgLoader.source = "" dlgLoader.source = ""
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment