Commit 7045df93 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4573 from DonLakeFlyer/FlyStrip

Fly view: Use new ToolStrip
parents 8783b20d 6bf85ada
...@@ -71,151 +71,106 @@ FlightMap { ...@@ -71,151 +71,106 @@ FlightMap {
Component.onCompleted: start(false /* editMode */) Component.onCompleted: start(false /* editMode */)
} }
QGCMapLabel {
id: flyLabel
map: flightMap
text: qsTr("Fly")
visible: !ScreenTools.isShortScreen
anchors.topMargin: _toolButtonTopMargin
anchors.horizontalCenter: centerMapDropButton.horizontalCenter
anchors.top: parent.top
}
//-- Vertical Tool Buttons
ExclusiveGroup { ExclusiveGroup {
id: dropButtonsExclusiveGroup id: _mapTypeButtonsExclusiveGroup
} }
ExclusiveGroup { ToolStrip {
id: mapTypeButtonsExclusiveGroup id: toolStrip
} anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.topMargin: _toolButtonTopMargin
anchors.top: parent.top
color: qgcPal.window
title: qsTr("Fly")
z: QGroundControl.zOrderWidgets
buttonVisible: [ true, true, _showZoom, _showZoom ]
property bool _showZoom: !ScreenTools.isShortScreen
model: [
{
name: "Center",
iconSource: "/qmlimages/MapCenter.svg",
dropPanelComponent: centerMapDropPanel
},
{
name: "Map",
iconSource: "/qmlimages/MapType.svg",
dropPanelComponent: mapTypeDropPanel
},
{
name: "In",
iconSource: "/qmlimages/ZoomPlus.svg"
},
{
name: "Out",
iconSource: "/qmlimages/ZoomMinus.svg"
}
]
//-- Dismiss Drop Down (if any)
MouseArea {
anchors.fill: parent
enabled: dropButtonsExclusiveGroup.current != null
onClicked: { onClicked: {
if (dropButtonsExclusiveGroup.current) { switch (index) {
dropButtonsExclusiveGroup.current.checked = false case 2:
_flightMap.zoomLevel += 0.5
break
case 3:
_flightMap.zoomLevel -= 0.5
break
} }
dropButtonsExclusiveGroup.current = null
} }
} }
// IMPORTANT NOTE: Drop Buttons must be parented directly to the map. If they are placed in a Column for example the drop control positioning // Toolstrip drop panel compomnents
// will not work correctly.
//-- Map Center Control
CenterMapDropButton {
id: centerMapDropButton
anchors.topMargin: flyLabel.visible ? ScreenTools.defaultFontPixelHeight / 2 : _toolButtonTopMargin
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.top: flyLabel.visible ? flyLabel.bottom : parent.top
z: QGroundControl.zOrderWidgets
exclusiveGroup: dropButtonsExclusiveGroup
map: _flightMap
mapFitViewport: Qt.rect(leftToolWidth, _toolButtonTopMargin, flightMap.width - leftToolWidth - rightPanelWidth, flightMap.height - _toolButtonTopMargin)
usePlannedHomePosition: false
geoFenceController: geoFenceController
missionController: missionController
rallyPointController: rallyPointController
showFollowVehicle: true
followVehicle: _followVehicle
onFollowVehicleChanged: _followVehicle = followVehicle
property real leftToolWidth: centerMapDropButton.x + centerMapDropButton.width
}
//-- Map Type Control MapFitFunctions {
DropButton { id: mapFitFunctions
id: mapTypeButton map: _flightMap
anchors.topMargin: ScreenTools.defaultFontPixelHeight mapFitViewport: Qt.rect(leftToolWidth, _toolButtonTopMargin, flightMap.width - leftToolWidth - rightPanelWidth, flightMap.height - _toolButtonTopMargin)
anchors.top: centerMapDropButton.bottom usePlannedHomePosition: false
anchors.left: centerMapDropButton.left mapMissionController: missionController
dropDirection: dropRight mapGeoFenceController: geoFenceController
buttonImage: "/qmlimages/MapType.svg" mapRallyPointController: rallyPointController
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets
lightBorders: isSatelliteMap
dropDownComponent: Component { property real leftToolWidth: toolStrip.x + toolStrip.width
Column { }
spacing: ScreenTools.defaultFontPixelWidth
Row { Component {
spacing: ScreenTools.defaultFontPixelWidth id: centerMapDropPanel
Repeater { CenterMapDropPanel {
model: QGroundControl.flightMapSettings.mapTypes map: _flightMap
fitFunctions: mapFitFunctions
}
}
QGCButton { Component {
checkable: true id: mapTypeDropPanel
checked: QGroundControl.flightMapSettings.mapType === text
text: modelData
width: clearButton.width
exclusiveGroup: mapTypeButtonsExclusiveGroup
onClicked: { Column {
QGroundControl.flightMapSettings.mapType = text spacing: ScreenTools.defaultFontPixelHeight / 2
checked = true
dropButtonsExclusiveGroup.current = null
}
}
}
}
QGCButton { QGCLabel { text: qsTr("Map type:") }
id: clearButton Row {
text: qsTr("Clear Flight Trails") spacing: ScreenTools.defaultFontPixelWidth
enabled: QGroundControl.multiVehicleManager.activeVehicle Repeater {
onClicked: { model: QGroundControl.flightMapSettings.mapTypes
QGroundControl.multiVehicleManager.activeVehicle.clearTrajectoryPoints()
dropButtonsExclusiveGroup.current = null QGCButton {
checkable: true
checked: QGroundControl.flightMapSettings.mapType === text
text: modelData
exclusiveGroup: _mapTypeButtonsExclusiveGroup
onClicked: {
QGroundControl.flightMapSettings.mapType = text
dropPanel.hide()
}
} }
} }
} }
} }
} }
//-- Zoom Map In
RoundButton {
id: mapZoomPlus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapTypeButton.bottom
anchors.left: mapTypeButton.left
visible: !ScreenTools.isTinyScreen && _mainIsMap
buttonImage: "/qmlimages/ZoomPlus.svg"
exclusiveGroup: dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets
lightBorders: isSatelliteMap
onClicked: {
if(_flightMap)
_flightMap.zoomLevel += 0.5
checked = false
}
}
//-- Zoom Map Out
RoundButton {
id: mapZoomMinus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapZoomPlus.bottom
anchors.left: mapZoomPlus.left
visible: !ScreenTools.isTinyScreen && _mainIsMap
buttonImage: "/qmlimages/ZoomMinus.svg"
exclusiveGroup: dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets
lightBorders: isSatelliteMap
onClicked: {
if(_flightMap)
_flightMap.zoomLevel -= 0.5
checked = false
}
}
// Add trajectory points to the map // Add trajectory points to the map
MapItemView { MapItemView {
model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0 model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0
......
...@@ -100,7 +100,7 @@ QGCView { ...@@ -100,7 +100,7 @@ QGCView {
property real toolbarHeight: qgcView.height - ScreenTools.availableHeight property real toolbarHeight: qgcView.height - ScreenTools.availableHeight
property real rightPanelWidth: _rightPanelWidth property real rightPanelWidth: _rightPanelWidth
property real leftToolWidth: mapFitFunctions.x + mapFitFunctions.width property real leftToolWidth: toolStrip.x + toolStrip.width
} }
MissionController { MissionController {
...@@ -810,46 +810,8 @@ QGCView { ...@@ -810,46 +810,8 @@ QGCView {
} }
} }
/*
FIXME: Need to put these back into ToolStrip
//-- Zoom Map In
RoundButton {
id: mapZoomPlus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapTypeButton.bottom
anchors.left: mapTypeButton.left
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomPlus.svg"
lightBorders: _lightWidgetBorders
onClicked: {
if(editorMap)
editorMap.zoomLevel += 0.5
checked = false
}
}
//-- Zoom Map Out
RoundButton {
id: mapZoomMinus
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapZoomPlus.bottom
anchors.left: mapZoomPlus.left
visible: !ScreenTools.isTinyScreen && !ScreenTools.isShortScreen
buttonImage: "/qmlimages/ZoomMinus.svg"
lightBorders: _lightWidgetBorders
onClicked: {
if(editorMap)
editorMap.zoomLevel -= 0.5
checked = false
}
}
*/
ToolStrip { ToolStrip {
id: toolStrip
anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left anchors.left: parent.left
anchors.topMargin: _toolButtonTopMargin anchors.topMargin: _toolButtonTopMargin
...@@ -857,9 +819,12 @@ QGCView { ...@@ -857,9 +819,12 @@ QGCView {
color: qgcPal.window color: qgcPal.window
title: qsTr("Plan") title: qsTr("Plan")
z: QGroundControl.zOrderWidgets z: QGroundControl.zOrderWidgets
showAlternateIcon: [ false, false, _syncDropDownController.dirty, false, false ] showAlternateIcon: [ false, false, _syncDropDownController.dirty, false, false, false, false ]
rotateImage: [ false, false, _syncDropDownController.syncInProgress, false, false ] rotateImage: [ false, false, _syncDropDownController.syncInProgress, false, false, false, false ]
buttonEnabled: [ true, true, !_syncDropDownController.syncInProgress, true, true ] buttonEnabled: [ true, true, !_syncDropDownController.syncInProgress, true, true, true, true ]
buttonVisible: [ true, true, true, true, true, _showZoom, _showZoom ]
property bool _showZoom: !ScreenTools.isShortScreen
model: [ model: [
{ {
...@@ -887,12 +852,34 @@ QGCView { ...@@ -887,12 +852,34 @@ QGCView {
name: "Map", name: "Map",
iconSource: "/qmlimages/MapType.svg", iconSource: "/qmlimages/MapType.svg",
dropPanelComponent: mapTypeDropPanel dropPanelComponent: mapTypeDropPanel
},
{
name: "In",
iconSource: "/qmlimages/ZoomPlus.svg"
},
{
name: "Out",
iconSource: "/qmlimages/ZoomMinus.svg"
} }
] ]
onClicked: { onClicked: {
if (index == 0) { switch (index == 0) {
case 0:
_addWaypointOnClick = checked _addWaypointOnClick = checked
break
case 5:
editorMap.zoomLevel += 0.5
break
case 6:
editorMap.zoomLevel -= 0.5
break
case 5:
editorMap.zoomLevel += 0.5
break
case 6:
editorMap.zoomLevel -= 0.5
break
} }
} }
} }
......
...@@ -23,7 +23,6 @@ Item { ...@@ -23,7 +23,6 @@ Item {
signal clicked() signal clicked()
property real radius: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.75 : ScreenTools.defaultFontPixelHeight * 1.25 property real radius: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.75 : ScreenTools.defaultFontPixelHeight * 1.25
property real viewportMargins: 0 property real viewportMargins: 0
property real topMargin: parent.height - ScreenTools.availableHeight
property var toolStrip property var toolStrip
...@@ -48,7 +47,7 @@ Item { ...@@ -48,7 +47,7 @@ Item {
property alias _dropDownComponent: dropDownLoader.sourceComponent property alias _dropDownComponent: dropDownLoader.sourceComponent
property real _viewportMaxLeft: -x + viewportMargins property real _viewportMaxLeft: -x + viewportMargins
property real _viewportMaxRight: parent.width - (viewportMargins * 2) - x property real _viewportMaxRight: parent.width - (viewportMargins * 2) - x
property real _viewportMaxTop: -y + viewportMargins + topMargin property real _viewportMaxTop: -y + viewportMargins
property real _viewportMaxBottom: parent.height - (viewportMargins * 2) - y property real _viewportMaxBottom: parent.height - (viewportMargins * 2) - y
function show(panelEdgeTopPoint, panelEdgeHeight, panelComponent) { function show(panelEdgeTopPoint, panelEdgeHeight, panelComponent) {
...@@ -104,19 +103,6 @@ Item { ...@@ -104,19 +103,6 @@ Item {
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
/*
MouseArea {
x: _viewportMaxLeft
y: _viewportMaxTop
width: _viewportMaxRight -_viewportMaxLeft
height: _viewportMaxBottom - _viewportMaxTop
visible: checked
onClicked: {
checked = false
_root.clicked()
}
}*/
Item { Item {
id: dropDownItem id: dropDownItem
......
...@@ -25,16 +25,17 @@ Rectangle { ...@@ -25,16 +25,17 @@ Rectangle {
property var showAlternateIcon property var showAlternateIcon
property var rotateImage property var rotateImage
property var buttonEnabled property var buttonEnabled
property var buttonVisible
signal clicked(int index, bool checked) signal clicked(int index, bool checked)
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth readonly property real _buttonSpacing: ScreenTools.defaultFontPixelWidth
readonly property bool _showOptionalElements: !ScreenTools.isShortScreen
ExclusiveGroup { QGCPalette { id: qgcPal }
id: dropButtonsExclusiveGroup ExclusiveGroup { id: dropButtonsExclusiveGroup }
}
function uncheckAll() { function uncheckAll() {
dropButtonsExclusiveGroup.current = null dropButtonsExclusiveGroup.current = null
...@@ -65,31 +66,34 @@ Rectangle { ...@@ -65,31 +66,34 @@ Rectangle {
QGCLabel { QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: title text: title
visible: _showOptionalElements
} }
Item { width: 1; height: _buttonSpacing } Item { width: 1; height: _buttonSpacing; visible: _showOptionalElements }
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 1 height: 1
color: qgcPal.text color: qgcPal.text
visible: _showOptionalElements
} }
Repeater { Repeater {
id: repeater id: repeater
delegate: Column { delegate: Column {
id: buttonColumn id: buttonColumn
width: buttonStripColumn.width width: buttonStripColumn.width
visible: _root.buttonVisible ? _root.buttonVisible[index] : true
property bool checked: false property bool checked: false
property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup property ExclusiveGroup exclusiveGroup: dropButtonsExclusiveGroup
property var _iconSource: modelData.iconSource property var _iconSource: modelData.iconSource
property var _alternateIconSource: modelData.alternateIconSource property var _alternateIconSource: modelData.alternateIconSource
property var _source: _root.showAlternateIcon[index] ? _alternateIconSource : _iconSource property var _source: (_root.showAlternateIcon && _root.showAlternateIcon[index]) ? _alternateIconSource : _iconSource
property bool rotateImage: _root.rotateImage[index] property bool rotateImage: _root.rotateImage ? _root.rotateImage[index] : false
onExclusiveGroupChanged: { onExclusiveGroupChanged: {
if (exclusiveGroup) { if (exclusiveGroup) {
...@@ -106,7 +110,11 @@ Rectangle { ...@@ -106,7 +110,11 @@ Rectangle {
} }
} }
Item { width: 1; height: _buttonSpacing } Item {
width: 1
height: _buttonSpacing
visible: index == 0 ? _showOptionalElements : true
}
Rectangle { Rectangle {
anchors.left: parent.left anchors.left: parent.left
...@@ -139,8 +147,8 @@ Rectangle { ...@@ -139,8 +147,8 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
height: parent.height + buttonLabel.height + buttonColumn.spacing height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0)
visible: _root.buttonEnabled[index] visible: _root.buttonEnabled ? _root.buttonEnabled[index] : true
onClicked: { onClicked: {
if (modelData.dropPanelComponent === undefined) { if (modelData.dropPanelComponent === undefined) {
...@@ -171,6 +179,7 @@ Rectangle { ...@@ -171,6 +179,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
text: modelData.name text: modelData.name
visible: _showOptionalElements
} }
} }
} }
......
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