Browse Source

Change to Flying Field Manager terminology

Also fixed button and panel state transition bugs
QGC4.4
Don Gagne 10 years ago
parent
commit
02aa2810b1
  1. 105
      src/MissionEditor/MissionEditor.qml

105
src/MissionEditor/MissionEditor.qml

@ -46,9 +46,6 @@ QGCView {
readonly property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16 readonly property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16
property var _missionItems: controller.missionItems property var _missionItems: controller.missionItems
property bool _showHomePositionManager: false
property bool _addMissionItems: false
property bool _showHelpPanel: true
property var _homePositionManager: QGroundControl.homePositionManager property var _homePositionManager: QGroundControl.homePositionManager
property string _homePositionName: _homePositionManager.homePositions.get(0).name property string _homePositionName: _homePositionManager.homePositions.get(0).name
@ -66,12 +63,7 @@ QGCView {
ExclusiveGroup { ExclusiveGroup {
id: _dropButtonsExclusiveGroup id: _dropButtonsExclusiveGroup
} onCurrentChanged: console.log("Current button", current)
function disableToggles() {
_showHomePositionManager = false
_addMissionItems = false
_showHelpPanel = false
} }
function setCurrentItem(index) { function setCurrentItem(index) {
@ -128,9 +120,9 @@ QGCView {
coordinate.latitude = coordinate.latitude.toFixed(_decimalPlaces) coordinate.latitude = coordinate.latitude.toFixed(_decimalPlaces)
coordinate.longitude = coordinate.longitude.toFixed(_decimalPlaces) coordinate.longitude = coordinate.longitude.toFixed(_decimalPlaces)
coordinate.altitude = coordinate.altitude.toFixed(_decimalPlaces) coordinate.altitude = coordinate.altitude.toFixed(_decimalPlaces)
if (_showHomePositionManager) { if (homePositionManagerButton.checked) {
offlineHomePosition = coordinate offlineHomePosition = coordinate
} else if (_addMissionItems) { } else if (addMissionItemsButton.checked) {
var index = controller.addMissionItem(coordinate) var index = controller.addMissionItem(coordinate)
setCurrentItem(index) setCurrentItem(index)
} }
@ -169,23 +161,15 @@ QGCView {
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
RoundButton { RoundButton {
id: addMissionItemsButton id: addMissionItemsButton
buttonImage: "/qmlimages/MapAddMission.svg" buttonImage: "/qmlimages/MapAddMission.svg"
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
onClicked: {
disableToggles()
_addMissionItems = addMissionItemsButton.checked
}
} }
RoundButton { RoundButton {
id: homePositionManagerButton id: homePositionManagerButton
buttonImage: "/qmlimages/MapHome.svg" buttonImage: "/qmlimages/MapHome.svg"
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
onClicked: {
disableToggles()
_showHomePositionManager = homePositionManagerButton.checked
}
} }
DropButton { DropButton {
@ -195,10 +179,6 @@ QGCView {
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
onClicked: {
disableToggles()
}
dropDownComponent: Component { dropDownComponent: Component {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
@ -209,7 +189,6 @@ QGCView {
onClicked: { onClicked: {
centerMapButton.hideDropDown() centerMapButton.hideDropDown()
editorMap.center = QtPositioning.coordinate(homePosition.latitude, homePosition.longitude) editorMap.center = QtPositioning.coordinate(homePosition.latitude, homePosition.longitude)
_showHomePositionManager = true
} }
} }
@ -272,10 +251,6 @@ QGCView {
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
onClicked: {
disableToggles()
}
dropDownComponent: Component { dropDownComponent: Component {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
@ -326,11 +301,7 @@ QGCView {
dropDirection: dropDown dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg" buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
onClicked: {
disableToggles()
}
dropDownComponent: Component { dropDownComponent: Component {
Row { Row {
@ -357,14 +328,9 @@ QGCView {
} }
RoundButton { RoundButton {
id: showHelpButton id: helpButton
buttonImage: "/qmlimages/Help.svg" buttonImage: "/qmlimages/Help.svg"
exclusiveGroup: _dropButtonsExclusiveGroup exclusiveGroup: _dropButtonsExclusiveGroup
checked: true
onClicked: {
disableToggles()
_showHelpPanel = showHelpButton.checked
}
} }
} }
@ -376,27 +342,15 @@ QGCView {
delegate: delegate:
MissionItemIndicator { MissionItemIndicator {
id: itemIndicator id: itemIndicator
label: object.sequenceNumber == 0 ? "H" : object.sequenceNumber label: object.sequenceNumber == 0 ? (liveHomePositionAvailable ? "H" : "F") : object.sequenceNumber
isCurrentItem: !_showHomePositionManager && object.isCurrentItem isCurrentItem: !homePositionManagerButton.checked && object.isCurrentItem
coordinate: object.coordinate coordinate: object.coordinate
z: 2 z: 2
visible: object.specifiesCoordinate visible: object.specifiesCoordinate
onClicked: { onClicked: {
disableToggles()
if (_dropButtonsExclusiveGroup.current) {
_dropButtonsExclusiveGroup.current.checked = false
}
//-- Home?
if (object.sequenceNumber === 0) {
homePositionManagerButton.checked = true
_showHomePositionManager = true
//-- Otherwise it's a mission item
} else {
addMissionItemsButton.checked = true
_addMissionItems = true
}
setCurrentItem(object.sequenceNumber) setCurrentItem(object.sequenceNumber)
missionItemEditorButton.checked
} }
Row { Row {
@ -409,12 +363,12 @@ QGCView {
delegate: delegate:
MissionItemIndexLabel { MissionItemIndexLabel {
label: object.sequenceNumber label: object.sequenceNumber
isCurrentItem: !_showHomePositionManager && object.isCurrentItem isCurrentItem: !homePositionManagerButton.checked && object.isCurrentItem
z: 2 z: 2
onClicked: { onClicked: {
_showHomePositionManager = false
setCurrentItem(object.sequenceNumber) setCurrentItem(object.sequenceNumber)
missionItemEditorButton.checked
} }
} }
@ -461,7 +415,7 @@ QGCView {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: ScreenTools.defaultFontPixelWidth * 30 width: ScreenTools.defaultFontPixelWidth * 30
color: _qgcPal.window color: _qgcPal.window
Item { Item {
anchors.margins: _verticalMargin anchors.margins: _verticalMargin
@ -469,8 +423,9 @@ QGCView {
// Mission Item Editor // Mission Item Editor
Item { Item {
id: missionItemEditor
anchors.fill: parent anchors.fill: parent
visible: !_showHomePositionManager && controller.missionItems.count != 1 && ! _showHelpPanel visible: !helpButton.checked && !homePositionManagerButton.checked && _missionItems.count > 1
ListView { ListView {
id: missionItemSummaryList id: missionItemSummaryList
@ -513,8 +468,9 @@ QGCView {
// Home Position Manager // Home Position Manager
Item { Item {
id: homePositionManager
anchors.fill: parent anchors.fill: parent
visible: _showHomePositionManager && !_showHelpPanel visible: homePositionManagerButton.checked
Column { Column {
anchors.fill: parent anchors.fill: parent
@ -522,7 +478,7 @@ QGCView {
QGCLabel { QGCLabel {
font.pixelSize: ScreenTools.mediumFontPixelSize font.pixelSize: ScreenTools.mediumFontPixelSize
text: "Offline Home Position Manager" text: "Flying Field Manager"
} }
Item { Item {
@ -533,7 +489,7 @@ QGCView {
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: "This is used to specify a simulated home position while you are not connected to a Vehicle." text: "This is used to save locations associated with your flying field for use while creating missions with no vehicle connection."
} }
Item { Item {
@ -542,7 +498,7 @@ QGCView {
} }
QGCLabel { QGCLabel {
text: "Select home position to use:" text: "Select field to use:"
} }
QGCComboBox { QGCComboBox {
@ -570,9 +526,9 @@ QGCView {
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: "To add a new home position, click on the Map to set the position. " + text: "To add a new flying field, click on the Map to set the position. " +
"Then give it a new name and click Add/Update. " + "Then give it a new name and click Add/Update. " +
"To change the current home position, click on the Map to set the new position. " + "To change the current field position, click on the Map to set the new position. " +
"Then click Add/Update without changing the name." "Then click Add/Update without changing the name."
} }
@ -777,8 +733,9 @@ QGCView {
// Help Panel // Help Panel
Item { Item {
id: helpPanel
anchors.fill: parent anchors.fill: parent
visible: !_showHomePositionManager && (controller.missionItems.count == 1 || _showHelpPanel) visible: !homePositionManagerButton.checked && (_missionItems.count == 1 || helpButton.checked)
QGCLabel { QGCLabel {
id: helpTitle id: helpTitle
@ -835,9 +792,9 @@ QGCView {
anchors.right: parent.right anchors.right: parent.right
anchors.top: homePositionManagerHelpIcon.top anchors.top: homePositionManagerHelpIcon.top
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: "<b>Home Position Manager</b><br>" + text: "<b>Flying Field Manager</b><br>" +
"When enabled, allows you to select/add/update home positions. " + "When enabled, allows you to select/add/update flying field locations. " +
"You can save multiple home position to represent multiple flying areas." "You can save multiple flying field locations for use while creating missions while you are not connected to your vehicle."
} }
Image { Image {

Loading…
Cancel
Save