Commit a204a40b authored by Don Gagne's avatar Don Gagne

MissionEditor usability changes

parent e100631f
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<file alias="MockLink.params">src/comm/MockLink.params</file> <file alias="MockLink.params">src/comm/MockLink.params</file>
<file alias="FactSystemTest.qml">src/FactSystem/FactSystemTest.qml</file> <file alias="FactSystemTest.qml">src/FactSystem/FactSystemTest.qml</file>
</qresource> </qresource>
<qresource prefix="/qmlimages"> <qresource prefix="/qmlimages">
<file alias="SafetyComponentTree.svg">src/AutoPilotPlugins/PX4/Images/SafetyComponentTree.svg</file> <file alias="SafetyComponentTree.svg">src/AutoPilotPlugins/PX4/Images/SafetyComponentTree.svg</file>
<file alias="SafetyComponentHome.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentHome.png</file> <file alias="SafetyComponentHome.png">src/AutoPilotPlugins/PX4/Images/SafetyComponentHome.png</file>
...@@ -66,6 +67,9 @@ ...@@ -66,6 +67,9 @@
<file alias="MapCenter.svg">src/FlightMap/Images/MapCenter.svg</file> <file alias="MapCenter.svg">src/FlightMap/Images/MapCenter.svg</file>
<file alias="ZoomPlus.svg">src/FlightMap/Images/ZoomPlus.svg</file> <file alias="ZoomPlus.svg">src/FlightMap/Images/ZoomPlus.svg</file>
<file alias="ZoomMinus.svg">src/FlightMap/Images/ZoomMinus.svg</file> <file alias="ZoomMinus.svg">src/FlightMap/Images/ZoomMinus.svg</file>
<!-- Map Buttons -->
<file alias="Sync.png">resources/Sync.png</file>
</qresource> </qresource>
<qresource prefix="/qml"> <qresource prefix="/qml">
<file alias="test.qml">src/test.qml</file> <file alias="test.qml">src/test.qml</file>
......
...@@ -46,6 +46,7 @@ QGCView { ...@@ -46,6 +46,7 @@ QGCView {
property var _missionItems: controller.missionItems property var _missionItems: controller.missionItems
property bool _showHomePositionManager: false property bool _showHomePositionManager: false
property bool _addMissionItems: false
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
...@@ -53,6 +54,14 @@ QGCView { ...@@ -53,6 +54,14 @@ QGCView {
QGCPalette { id: _qgcPal; colorGroupEnabled: enabled } QGCPalette { id: _qgcPal; colorGroupEnabled: enabled }
ExclusiveGroup {
id: _mapTypeButtonsExclusiveGroup
}
ExclusiveGroup {
id: _dropButtonsExclusiveGroup
}
function setCurrentItem(index) { function setCurrentItem(index) {
for (var i=0; i<_missionItems.count; i++) { for (var i=0; i<_missionItems.count; i++) {
_missionItems.get(i).isCurrentItem = (i == index) _missionItems.get(i).isCurrentItem = (i == index)
...@@ -73,8 +82,11 @@ QGCView { ...@@ -73,8 +82,11 @@ QGCView {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
mapName: "MissionEditor" mapName: "MissionEditor"
latitude: _homePositionCoordinate.latitude
longitude: _homePositionCoordinate.longitude Component.onCompleted: {
latitude = _homePositionCoordinate.latitude
longitude = _homePositionCoordinate.longitude
}
QGCLabel { QGCLabel {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
...@@ -91,21 +103,106 @@ QGCView { ...@@ -91,21 +103,106 @@ QGCView {
coordinate.altitude = coordinate.altitude.toFixed(_decimalPlaces) coordinate.altitude = coordinate.altitude.toFixed(_decimalPlaces)
if (_showHomePositionManager) { if (_showHomePositionManager) {
_homePositionCoordinate = coordinate _homePositionCoordinate = coordinate
} else { } else if (_addMissionItems) {
var index = controller.addMissionItem(coordinate) var index = controller.addMissionItem(coordinate)
setCurrentItem(index) setCurrentItem(index)
} }
} }
} }
Rectangle {
id: addMissionItemsButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: homePositionManagerButton.left
anchors.top: homePositionManagerButton.top
radius: (ScreenTools.defaultFontPixelHeight * 3) / 2
width: radius * 2
height: radius * 2
border.width: 2
border.color: "white"
color: _addMissionItems ? _qgcPal.buttonHighlight : "black"
opacity: _addMissionItems ? 0.75 : 1.0
MouseArea {
anchors.fill: parent
onClicked: {
_addMissionItems = !_addMissionItems
_showHomePositionManager = false
}
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: ScreenTools.defaultFontPixelHeight * 1.5
height: width
radius: width / 2
border.width: 2
border.color: "white"
color: "transparent"
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
text: "1"
}
}
}
Rectangle {
id: homePositionManagerButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: centerMapButton.left
anchors.top: centerMapButton.top
radius: (ScreenTools.defaultFontPixelHeight * 3) / 2
width: radius * 2
height: radius * 2
border.width: 2
border.color: "white"
color: _showHomePositionManager ? _qgcPal.buttonHighlight : "black"
opacity: _showHomePositionManager ? 0.75 : 1.0
MouseArea {
anchors.fill: parent
onClicked: {
_showHomePositionManager = !_showHomePositionManager
_addMissionItems = false
}
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: ScreenTools.defaultFontPixelHeight * 1.5
height: width
radius: width / 2
border.width: 2
border.color: "white"
color: "transparent"
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
text: "H"
}
}
}
DropButton { DropButton {
id: centerMapButton id: centerMapButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: mapTypeButton.left anchors.right: syncButton.left
anchors.top: mapTypeButton.top anchors.top: syncButton.top
dropDirection: dropDown dropDirection: dropDown
buttonImage: "/qmlimages/MapCenter.svg" buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component { dropDownComponent: Component {
Row { Row {
...@@ -121,6 +218,19 @@ QGCView { ...@@ -121,6 +218,19 @@ QGCView {
} }
} }
QGCButton {
text: "Vehicle"
enabled: activeVehicle && activeVehicle.latitude != 0 && activeVehicle.longitude != 0
property var activeVehicle: multiVehicleManager.activeVehicle
onClicked: {
centerMapButton.hideDropDown()
editorMap.latitude = activeVehicle.latitude
editorMap.longitude = activeVehicle.longitude
}
}
/* /*
This code will need to wait for Qml 5.5 support since Map.visibleRegion is only in Qt 5.5 This code will need to wait for Qml 5.5 support since Map.visibleRegion is only in Qt 5.5
...@@ -160,6 +270,61 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -160,6 +270,61 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
} }
} }
DropButton {
id: syncButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: mapTypeButton.left
anchors.top: mapTypeButton.top
dropDirection: dropDown
buttonImage: "/qmlimages/Sync.png"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
text: "Load from vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
onClicked: {
syncButton.hideDropDown()
controller.getMissionItems()
}
}
QGCButton {
text: "Save to vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
onClicked: {
syncButton.hideDropDown()
controller.setMissionItems()
}
}
QGCButton {
text: "Load from file..."
onClicked: {
syncButton.hideDropDown()
controller.loadMissionFromFile()
}
}
QGCButton {
text: "Save to file..."
onClicked: {
syncButton.hideDropDown()
controller.saveMissionToFile()
}
}
}
}
}
DropButton { DropButton {
id: mapTypeButton id: mapTypeButton
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight
...@@ -168,6 +333,7 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -168,6 +333,7 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
dropDirection: dropDown dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg" buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2 viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
dropDownComponent: Component { dropDownComponent: Component {
Row { Row {
...@@ -180,9 +346,11 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -180,9 +346,11 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
checkable: true checkable: true
checked: editorMap.mapType == text checked: editorMap.mapType == text
text: modelData text: modelData
exclusiveGroup: _mapTypeButtonsExclusiveGroup
onClicked: { onClicked: {
editorMap.mapType = text editorMap.mapType = text
checked = true
mapTypeButton.hideDropDown() mapTypeButton.hideDropDown()
} }
} }
...@@ -245,76 +413,10 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -245,76 +413,10 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
anchors.margins: _verticalMargin anchors.margins: _verticalMargin
anchors.fill: parent anchors.fill: parent
QGCButton {
id: toolsButton
text: "Tools"
menu : toolMenu
Menu {
id: toolMenu
MenuItem {
text: "Manage Home Position"
checkable: true
checked: _showHomePositionManager
onTriggered: _showHomePositionManager = checked
}
MenuSeparator { }
MenuItem {
text: "Get mission items from vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
onTriggered: controller.getMissionItems()
}
MenuItem {
text: "Send mission items to vehicle"
enabled: _activeVehicle && !_activeVehicle.missionManager.inProgress
onTriggered: controller.setMissionItems()
}
MenuSeparator { }
MenuItem {
text: "Load mission from file..."
onTriggered: controller.loadMissionFromFile()
}
MenuItem {
text: "Save mission to file..."
onTriggered: controller.saveMissionToFile()
}
MenuSeparator { }
MenuItem {
text: "Move to current vehicle position"
enabled: activeVehicle && activeVehicle.latitude != 0 && activeVehicle.longitude != 0
property var activeVehicle: multiVehicleManager.activeVehicle
onTriggered: {
editorMap.latitude = activeVehicle.latitude
editorMap.longitude = activeVehicle.longitude
}
}
}
}
// Mission Item Editor // Mission Item Editor
Item { Item {
anchors.topMargin: _verticalMargin anchors.fill: parent
anchors.left: parent.left visible: !_showHomePositionManager && controller.missionItems.count != 0
anchors.right: parent.right
anchors.top: toolsButton.bottom
anchors.bottom: parent.bottom
visible: !_showHomePositionManager
ListView { ListView {
id: missionItemSummaryList id: missionItemSummaryList
...@@ -346,13 +448,6 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -346,13 +448,6 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
} }
} // ListView } // ListView
QGCLabel {
anchors.fill: parent
visible: controller.missionItems.count == 0
wrapMode: Text.WordWrap
text: "Click in the map to add Mission Items"
}
QGCLabel { QGCLabel {
anchors.fill: parent anchors.fill: parent
visible: !controller.canEdit visible: !controller.canEdit
...@@ -364,11 +459,7 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -364,11 +459,7 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
// Home Position Manager // Home Position Manager
Item { Item {
anchors.topMargin: _verticalMargin anchors.fill: parent
anchors.left: parent.left
anchors.right: parent.right
anchors.top: toolsButton.bottom
anchors.bottom: parent.bottom
visible: _showHomePositionManager visible: _showHomePositionManager
Column { Column {
...@@ -399,6 +490,8 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -399,6 +490,8 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
var homePos = _homePositionManager.homePositions.get(currentIndex) var homePos = _homePositionManager.homePositions.get(currentIndex)
_homePositionName = homePos.name _homePositionName = homePos.name
_homePositionCoordinate = homePos.coordinate _homePositionCoordinate = homePos.coordinate
editorMap.latitude = _homePositionCoordinate.latitude
editorMap.longitude = _homePositionCoordinate.longitude
} }
} }
} }
...@@ -411,7 +504,10 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -411,7 +504,10 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: "To add a new home position, click in the Map to set the position. Then give it a name and click Add." text: "To add a new home position, click in the Map to set the position. " +
"Then give it a new name and click Add/Update. " +
"To change the current home position, click in the Map to set the new position. " +
"Then click Add/Update without changing the name."
} }
Item { Item {
...@@ -535,6 +631,158 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only ...@@ -535,6 +631,158 @@ This code will need to wait for Qml 5.5 support since Map.visibleRegion is only
} // Column } // Column
} // Item - Home Position Manager } // Item - Home Position Manager
// Help Panel
Item {
anchors.fill: parent
visible: !_showHomePositionManager && controller.missionItems.count == 0
QGCLabel {
id: helpTitle
font.pixelSize: ScreenTools.mediumFontPixelSize
text: "Mission Planner"
}
QGCLabel {
id: helpIconLabel
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: helpTitle.bottom
width: parent.width
wrapMode: Text.WordWrap
text: "In the upper right corner of the map you will see the Mission Planner tools:"
}
Rectangle {
id: addMissionItemsHelpIcon
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: helpIconLabel.bottom
anchors.horizontalCenter: mapTypeHelpIcon.horizontalCenter
width: ScreenTools.defaultFontPixelHeight * 1.5
height: width
radius: width / 2
border.width: 2
border.color: "white"
color: _qgcPal.window
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
text: "1"
}
}
QGCLabel {
id: addMissionItemsHelpText
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: mapTypeHelpIcon.right
anchors.right: parent.right
anchors.top: addMissionItemsHelpIcon.top
wrapMode: Text.WordWrap
text: "This is the Add Mission Items tool. " +
"Click it to turn on the ability to add mission items by clicking in the map. " +
"Click it again to turn it off."
}
Rectangle {
id: homePositionManagerHelpIcon
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: addMissionItemsHelpText.bottom
anchors.horizontalCenter: mapTypeHelpIcon.horizontalCenter
width: ScreenTools.defaultFontPixelHeight * 1.5
height: width
radius: width / 2
border.width: 2
border.color: "white"
color: _qgcPal.window
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
text: "H"
}
}
QGCLabel {
id: homePositionManagerHelpText
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: mapTypeHelpIcon.right
anchors.right: parent.right
anchors.top: homePositionManagerHelpIcon.top
wrapMode: Text.WordWrap
text: "This is the Home Position Manager tool. " +
"This tool allows you to select/add/update home positions. " +
"You can save multiple home position to represent multiple flying areas."
}
Image {
id: mapCenterHelpIcon
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: homePositionManagerHelpText.bottom
width: ScreenTools.defaultFontPixelHeight * 3
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
source: "/qmlimages/MapCenter.svg"
}
QGCLabel {
id: mapCenterHelpText
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: mapTypeHelpIcon.right
anchors.right: parent.right
anchors.top: mapCenterHelpIcon.top
wrapMode: Text.WordWrap
text: "This is the Map Center tool. " +
"It will show a set of options which will center the map."
}
Image {
id: syncHelpIcon
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: mapCenterHelpText.bottom
width: ScreenTools.defaultFontPixelHeight * 3
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
source: "/qmlimages/Sync.png"
}
QGCLabel {
id: syncHelpText
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: mapTypeHelpIcon.right
anchors.right: parent.right
anchors.top: syncHelpIcon.top
wrapMode: Text.WordWrap
text: "This is the Sync tool. " +
"It will show a set of options for saving/loading mission items."
}
Image {
id: mapTypeHelpIcon
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: syncHelpText.bottom
width: ScreenTools.defaultFontPixelHeight * 3
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
source: "/qmlimages/MapType.svg"
}
QGCLabel {
id: mapTypeHelpText
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: mapTypeHelpIcon.right
anchors.right: parent.right
anchors.top: mapTypeHelpIcon.top
wrapMode: Text.WordWrap
text: "This is the Map Type tool. " +
"It will show a set of options for selecting map types."
}
} // Item - Help Panel
} // Item } // Item
} // Rectangle - mission item list } // Rectangle - mission item list
} // Item - split view container } // Item - split view container
......
...@@ -23,10 +23,6 @@ Item { ...@@ -23,10 +23,6 @@ Item {
readonly property int dropUp: 3 readonly property int dropUp: 3
readonly property int dropDown: 4 readonly property int dropDown: 4
function hideDropDown() {
_showDropDown = false
}
readonly property real _arrowBaseWidth: (radius * 2) / 2 // Width of long side of arrow readonly property real _arrowBaseWidth: (radius * 2) / 2 // Width of long side of arrow
readonly property real _arrowPointHeight: (radius * 2) / 3 // Height is long side to point readonly property real _arrowPointHeight: (radius * 2) / 3 // Height is long side to point
readonly property real _dropCornerRadius: ScreenTools.defaultFontPixelWidth / 2 readonly property real _dropCornerRadius: ScreenTools.defaultFontPixelWidth / 2
...@@ -39,7 +35,20 @@ Item { ...@@ -39,7 +35,20 @@ Item {
property real _viewportMaxTop: -y + viewportMargins property real _viewportMaxTop: -y + viewportMargins
property real _viewportMaxBottom: parent.height - (viewportMargins * 2) - y property real _viewportMaxBottom: parent.height - (viewportMargins * 2) - y
property bool _showDropDown: false // Set up ExclusiveGroup support. We use the checked property to drive visibility of drop down.
property bool checked: false
property ExclusiveGroup exclusiveGroup: null
onExclusiveGroupChanged: {
if (exclusiveGroup) {
exclusiveGroup.bindCheckable(_root)
}
}
function hideDropDown() {
checked = false
}
Component.onCompleted: _calcPositions() Component.onCompleted: _calcPositions()
...@@ -138,29 +147,37 @@ Item { ...@@ -138,29 +147,37 @@ Item {
y: _viewportMaxTop y: _viewportMaxTop
width: _viewportMaxRight -_viewportMaxLeft width: _viewportMaxRight -_viewportMaxLeft
height: _viewportMaxBottom - _viewportMaxTop height: _viewportMaxBottom - _viewportMaxTop
visible: _showDropDown visible: checked
onClicked: _showDropDown = false onClicked: checked = false
} }
// Button // Button
Rectangle {
anchors.fill: parent
radius: width / 2
border.width: 2
border.color: "white"
color: "transparent"
Image { Image {
id: button id: button
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: _showDropDown ? 1.0 : 0.75 opacity: checked ? 1.0 : 0.75
mipmap: true mipmap: true
smooth: true smooth: true
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: _showDropDown = !_showDropDown onClicked: checked = !checked
} }
} // Image - button } // Image - button
}
Item { Item {
id: dropDownItem id: dropDownItem
visible: _showDropDown visible: checked
QGCCanvas { QGCCanvas {
id: arrowCanvas id: arrowCanvas
......
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