Commit 98db1bee authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5009 from DonLakeFlyer/Fixes

Fixes
parents 83b22d62 464b7157
......@@ -33,6 +33,7 @@ Rectangle {
property color _outerTextColor: _currentItem ? qgcPal.primaryButtonText : qgcPal.text
property bool _noMissionItemsAdded: ListView.view.model.count === 1
property real _sectionSpacer: ScreenTools.defaultFontPixelWidth / 2 // spacing between section headings
property bool _singleComplexItem: missionController.complexMissionItemNames.length === 1
readonly property real _editFieldWidth: Math.min(width - _margin * 2, ScreenTools.defaultFontPixelWidth * 12)
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
......@@ -63,7 +64,7 @@ Rectangle {
anchors.verticalCenter: commandPicker.verticalCenter
anchors.leftMargin: _margin
anchors.left: parent.left
text: missionItem.abbreviation.charAt(0)
text: missionItem.homePosition ? "H" : missionItem.sequenceNumber
color: _outerTextColor
}
......@@ -97,20 +98,16 @@ Rectangle {
onTriggered: insertWaypoint()
}
MenuItem {
text: qsTr("Delete")
onTriggered: remove()
}
Menu {
id: normalPatternMenu
title: qsTr("Insert pattern")
id: patternMenu
title: qsTr("Insert pattern")
visible: !_singleComplexItem
Instantiator {
model: missionController.complexMissionItemNames
onObjectAdded: normalPatternMenu.insertItem(index, object)
onObjectRemoved: normalPatternMenu.removeItem(object)
onObjectAdded: patternMenu.insertItem(index, object)
onObjectRemoved: patternMenu.removeItem(object)
MenuItem {
text: modelData
......@@ -119,6 +116,17 @@ Rectangle {
}
}
MenuItem {
text: qsTr("Insert ") + missionController.complexMissionItemNames[0]
visible: _singleComplexItem
onTriggered: insertComplexItem(missionController.complexMissionItemNames[0])
}
MenuItem {
text: qsTr("Delete")
onTriggered: remove()
}
MenuItem {
text: qsTr("Change command...")
onTriggered: commandPicker.clicked()
......
......@@ -111,7 +111,6 @@ Rectangle {
}
}
RowLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
......@@ -247,7 +246,7 @@ Rectangle {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: missionController ? (missionController.dirty ? qsTr("Upload Required") : qsTr("Upload")) : ""
enabled: _activeVehicle
enabled: _activeVehicle && !missionController.syncInProgress
visible: _activeVehicle && _manualUpload
onClicked: missionController.upload()
......
......@@ -76,7 +76,7 @@ QGCView {
function insertComplexMissionItem(complexItemName, coordinate, index) {
var sequenceNumber = missionController.insertComplexMissionItem(complexItemName, coordinate, index)
setCurrentItem(sequenceNumber)
setCurrentItem(sequenceNumber, true)
}
property bool _firstMissionLoadComplete: false
......@@ -168,7 +168,7 @@ QGCView {
Component.onCompleted: {
start(true /* editMode */)
setCurrentItem(0)
setCurrentItem(0, true)
}
function _denyUpload(switchToFly) {
......@@ -223,7 +223,7 @@ QGCView {
if (_visualItems && _visualItems.count != 1) {
mapFitFunctions.fitMapViewportToMissionItems()
}
setCurrentItem(0)
setCurrentItem(0, true)
}
}
......@@ -305,8 +305,8 @@ QGCView {
/// Sets a new current mission item
/// @param sequenceNumber - index for new item, -1 to clear current item
function setCurrentItem(sequenceNumber) {
if (sequenceNumber !== _currentMissionIndex) {
function setCurrentItem(sequenceNumber, force) {
if (force || sequenceNumber !== _currentMissionIndex) {
_currentMissionItem = undefined
_currentMissionIndex = -1
for (var i=0; i<_visualItems.count; i++) {
......@@ -326,9 +326,8 @@ QGCView {
/// @param coordinate Location to insert item
/// @param index Insert item at this index
function insertSimpleMissionItem(coordinate, index) {
setCurrentItem(-1)
var sequenceNumber = missionController.insertSimpleMissionItem(coordinate, index)
setCurrentItem(sequenceNumber)
setCurrentItem(sequenceNumber, true)
}
property int _moveDialogMissionItemIndex
......@@ -347,7 +346,7 @@ QGCView {
onAcceptedForLoad: {
_syncDropDownController.loadFromFile(file)
_syncDropDownController.fitViewportToItems()
_currentMissionItem = _visualItems.get(0)
setCurrentItem(0, true)
close()
}
}
......@@ -506,7 +505,7 @@ QGCView {
delegate: MissionItemMapVisual {
map: editorMap
onClicked: setCurrentItem(sequenceNumber)
onClicked: setCurrentItem(sequenceNumber, false)
}
}
......@@ -568,7 +567,7 @@ QGCView {
toggle: true
},
{
name: "Pattern",
name: _singleComplexItem ? missionController.complexMissionItemNames[0] : "Pattern",
iconSource: "/qmlimages/MapDrawShape.svg",
dropPanelComponent: _singleComplexItem ? undefined : patternDropPanel
},
......@@ -721,7 +720,7 @@ QGCView {
readOnly: false
rootQgcView: _qgcView
onClicked: setCurrentItem(object.sequenceNumber)
onClicked: setCurrentItem(object.sequenceNumber, false)
onRemove: {
var removeIndex = index
......@@ -731,7 +730,7 @@ QGCView {
removeIndex--
}
_currentMissionIndex = -1
rootQgcView.setCurrentItem(removeIndex)
rootQgcView.setCurrentItem(removeIndex, true)
}
onInsertWaypoint: insertSimpleMissionItem(editorMap.center, index)
......
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