|
|
@ -14,6 +14,10 @@ import QGroundControl.Palette 1.0 |
|
|
|
Rectangle { |
|
|
|
Rectangle { |
|
|
|
id: _root |
|
|
|
id: _root |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
height: editorLoader.y + editorLoader.height + (_margin * 2) |
|
|
|
|
|
|
|
color: missionItem.isCurrentItem ? qgcPal.buttonHighlight : qgcPal.windowShade |
|
|
|
|
|
|
|
radius: _radius |
|
|
|
|
|
|
|
|
|
|
|
property var missionItem ///< MissionItem associated with this editor |
|
|
|
property var missionItem ///< MissionItem associated with this editor |
|
|
|
property bool readOnly ///< true: read only view, false: full editing view |
|
|
|
property bool readOnly ///< true: read only view, false: full editing view |
|
|
|
property var qgcView ///< QGCView control used for showing dialogs |
|
|
|
property var qgcView ///< QGCView control used for showing dialogs |
|
|
@ -23,21 +27,127 @@ Rectangle { |
|
|
|
signal insert(int i) |
|
|
|
signal insert(int i) |
|
|
|
signal moveHomeToMapCenter |
|
|
|
signal moveHomeToMapCenter |
|
|
|
|
|
|
|
|
|
|
|
height: innerItem.height + (_margin * 3) |
|
|
|
readonly property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16 |
|
|
|
color: missionItem.isCurrentItem ? qgcPal.buttonHighlight : qgcPal.windowShade |
|
|
|
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
radius: _radius |
|
|
|
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
|
|
|
property color _outerTextColor: missionItem.isCurrentItem ? "black" : qgcPal.text |
|
|
|
readonly property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16 |
|
|
|
|
|
|
|
readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
|
|
|
readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool _showValues: missionItem.isCurrentItem |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCPalette { |
|
|
|
QGCPalette { |
|
|
|
id: qgcPal |
|
|
|
id: qgcPal |
|
|
|
colorGroupEnabled: enabled |
|
|
|
colorGroupEnabled: enabled |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
visible: !missionItem.isCurrentItem |
|
|
|
|
|
|
|
onClicked: _root.clicked() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
|
|
|
id: label |
|
|
|
|
|
|
|
anchors.verticalCenter: commandPicker.verticalCenter |
|
|
|
|
|
|
|
anchors.leftMargin: _margin |
|
|
|
|
|
|
|
anchors.left: parent.left |
|
|
|
|
|
|
|
text: missionItem.sequenceNumber == 0 ? "H" : missionItem.sequenceNumber |
|
|
|
|
|
|
|
color: _outerTextColor |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Image { |
|
|
|
|
|
|
|
id: hamburger |
|
|
|
|
|
|
|
anchors.rightMargin: ScreenTools.defaultFontPixelWidth |
|
|
|
|
|
|
|
anchors.right: parent.right |
|
|
|
|
|
|
|
anchors.verticalCenter: commandPicker.verticalCenter |
|
|
|
|
|
|
|
width: commandPicker.height |
|
|
|
|
|
|
|
height: commandPicker.height |
|
|
|
|
|
|
|
source: "qrc:/qmlimages/Hamburger.svg" |
|
|
|
|
|
|
|
visible: missionItem.isCurrentItem && missionItem.sequenceNumber != 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
onClicked: hamburgerMenu.popup() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Menu { |
|
|
|
|
|
|
|
id: hamburgerMenu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
|
|
|
text: "Insert" |
|
|
|
|
|
|
|
onTriggered: insert(missionItem.sequenceNumber) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
|
|
|
text: "Delete" |
|
|
|
|
|
|
|
onTriggered: remove() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuSeparator { |
|
|
|
|
|
|
|
visible: !missionItem.simpleItem |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
|
|
|
text: "Show all values" |
|
|
|
|
|
|
|
checkable: true |
|
|
|
|
|
|
|
checked: missionItem.rawEdit |
|
|
|
|
|
|
|
visible: !missionItem.simpleItem |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onTriggered: { |
|
|
|
|
|
|
|
if (missionItem.rawEdit) { |
|
|
|
|
|
|
|
if (missionItem.friendlyEditAllowed) { |
|
|
|
|
|
|
|
missionItem.rawEdit = false |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
qgcView.showMessage("Mission Edit", "You have made changes to the mission item which cannot be shown in Simple Mode", StandardButton.Ok) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
missionItem.rawEdit = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
checked = missionItem.rawEdit |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
|
|
|
id: commandPicker |
|
|
|
|
|
|
|
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2 |
|
|
|
|
|
|
|
anchors.rightMargin: ScreenTools.defaultFontPixelWidth |
|
|
|
|
|
|
|
anchors.left: label.right |
|
|
|
|
|
|
|
anchors.right: hamburger.left |
|
|
|
|
|
|
|
visible: missionItem.sequenceNumber != 0 && missionItem.isCurrentItem && !missionItem.rawEdit && missionItem.simpleItem |
|
|
|
|
|
|
|
text: missionItem.commandName |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
|
|
|
|
id: commandDialog |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MissionCommandDialog { |
|
|
|
|
|
|
|
missionItem: _root.missionItem |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onClicked: qgcView.showDialog(commandDialog, "Select Mission Command", qgcView.showDialogDefaultWidth, StandardButton.Cancel) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
|
|
|
anchors.fill: commandPicker |
|
|
|
|
|
|
|
visible: missionItem.sequenceNumber == 0 || !missionItem.isCurrentItem || !missionItem.simpleItem |
|
|
|
|
|
|
|
verticalAlignment: Text.AlignVCenter |
|
|
|
|
|
|
|
text: missionItem.sequenceNumber == 0 ? "Home Position" : (missionItem.simpleItem ? missionItem.commandName : "Survey") |
|
|
|
|
|
|
|
color: _outerTextColor |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Loader { |
|
|
|
|
|
|
|
id: editorLoader |
|
|
|
|
|
|
|
anchors.leftMargin: _margin |
|
|
|
|
|
|
|
anchors.topMargin: _margin |
|
|
|
|
|
|
|
anchors.left: parent.left |
|
|
|
|
|
|
|
anchors.top: commandPicker.bottom |
|
|
|
|
|
|
|
sourceComponent: missionItem.simpleItem ? simpleMissionItemEditor : complexMissionItemEditor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// How wide the loaded component should be |
|
|
|
|
|
|
|
property real availableWidth: _root.width - (_margin * 2) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
Component { |
|
|
|
id: valuesComponent |
|
|
|
id: valuesComponent |
|
|
|
|
|
|
|
|
|
|
@ -54,7 +164,7 @@ 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: valuesColumn.height + _margin |
|
|
|
height: valuesColumn.height + (_margin * 2) |
|
|
|
|
|
|
|
|
|
|
|
Column { |
|
|
|
Column { |
|
|
|
id: valuesColumn |
|
|
|
id: valuesColumn |
|
|
@ -69,8 +179,8 @@ Rectangle { |
|
|
|
text: missionItem.sequenceNumber == 0 ? |
|
|
|
text: missionItem.sequenceNumber == 0 ? |
|
|
|
"Planned home position." : |
|
|
|
"Planned home position." : |
|
|
|
(missionItem.rawEdit ? |
|
|
|
(missionItem.rawEdit ? |
|
|
|
"Provides advanced access to all commands/parameters. Be very careful!" : |
|
|
|
"Provides advanced access to all commands/parameters. Be very careful!" : |
|
|
|
missionItem.commandDescription) |
|
|
|
missionItem.commandDescription) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Repeater { |
|
|
|
Repeater { |
|
|
@ -150,114 +260,73 @@ Rectangle { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Item { |
|
|
|
Component { |
|
|
|
id: innerItem |
|
|
|
id: simpleMissionItemEditor |
|
|
|
anchors.margins: _margin |
|
|
|
|
|
|
|
anchors.top: parent.top |
|
|
|
|
|
|
|
anchors.left: parent.left |
|
|
|
|
|
|
|
anchors.right: parent.right |
|
|
|
|
|
|
|
height: _showValues ? valuesLoader.y + valuesLoader.height : valuesLoader.y |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
Item { |
|
|
|
anchors.fill: parent |
|
|
|
id: innerItem |
|
|
|
visible: !missionItem.isCurrentItem |
|
|
|
width: availableWidth |
|
|
|
|
|
|
|
height: _showValues ? valuesLoader.y + valuesLoader.height : valuesLoader.y |
|
|
|
|
|
|
|
|
|
|
|
onClicked: _root.clicked() |
|
|
|
property bool _showValues: missionItem.isCurrentItem |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
Loader { |
|
|
|
id: label |
|
|
|
id: valuesLoader |
|
|
|
anchors.verticalCenter: commandPicker.verticalCenter |
|
|
|
anchors.left: parent.left |
|
|
|
color: missionItem.isCurrentItem ? qgcPal.buttonHighlightText : qgcPal.buttonText |
|
|
|
anchors.right: parent.right |
|
|
|
text: missionItem.sequenceNumber == 0 ? "H" : missionItem.sequenceNumber |
|
|
|
sourceComponent: _showValues ? valuesComponent : undefined |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} // Item |
|
|
|
|
|
|
|
} // Component - simpleMissionItemEditor |
|
|
|
|
|
|
|
|
|
|
|
Image { |
|
|
|
Component { |
|
|
|
id: hamburger |
|
|
|
id: complexMissionItemEditor |
|
|
|
anchors.rightMargin: ScreenTools.defaultFontPixelWidth |
|
|
|
|
|
|
|
anchors.right: parent.right |
|
|
|
|
|
|
|
anchors.verticalCenter: commandPicker.verticalCenter |
|
|
|
|
|
|
|
width: commandPicker.height |
|
|
|
|
|
|
|
height: commandPicker.height |
|
|
|
|
|
|
|
source: "qrc:/qmlimages/Hamburger.svg" |
|
|
|
|
|
|
|
visible: missionItem.isCurrentItem && missionItem.sequenceNumber != 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
onClicked: hamburgerMenu.popup() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Menu { |
|
|
|
|
|
|
|
id: hamburgerMenu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
|
|
|
|
text: "Insert" |
|
|
|
|
|
|
|
onTriggered: insert(missionItem.sequenceNumber) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
Rectangle { |
|
|
|
text: "Delete" |
|
|
|
id: outerRect |
|
|
|
onTriggered: remove() |
|
|
|
height: editorColumn.height + (_margin * 2) |
|
|
|
} |
|
|
|
width: availableWidth |
|
|
|
|
|
|
|
color: qgcPal.windowShadeDark |
|
|
|
|
|
|
|
radius: _radius |
|
|
|
|
|
|
|
|
|
|
|
MenuSeparator { } |
|
|
|
property bool addPointsMode: false |
|
|
|
|
|
|
|
|
|
|
|
MenuItem { |
|
|
|
Column { |
|
|
|
text: "Show all values" |
|
|
|
id: editorColumn |
|
|
|
checkable: true |
|
|
|
anchors.margins: _margin |
|
|
|
checked: missionItem.rawEdit |
|
|
|
anchors.top: parent.top |
|
|
|
|
|
|
|
anchors.left: parent.left |
|
|
|
|
|
|
|
width: availableWidth |
|
|
|
|
|
|
|
spacing: _margin |
|
|
|
|
|
|
|
|
|
|
|
onTriggered: { |
|
|
|
Connections { |
|
|
|
if (missionItem.rawEdit) { |
|
|
|
target: editorMap |
|
|
|
if (missionItem.friendlyEditAllowed) { |
|
|
|
|
|
|
|
missionItem.rawEdit = false |
|
|
|
onMapClicked: { |
|
|
|
} else { |
|
|
|
if (addPointsMode) { |
|
|
|
qgcView.showMessage("Mission Edit", "You have made changes to the mission item which cannot be shown in Simple Mode", StandardButton.Ok) |
|
|
|
missionItem.addPolygonCoordinate(coordinate) |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
missionItem.rawEdit = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
checked = missionItem.rawEdit |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
|
|
|
id: commandPicker |
|
|
|
|
|
|
|
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2 |
|
|
|
|
|
|
|
anchors.rightMargin: ScreenTools.defaultFontPixelWidth |
|
|
|
|
|
|
|
anchors.left: label.right |
|
|
|
|
|
|
|
anchors.right: hamburger.left |
|
|
|
|
|
|
|
visible: missionItem.sequenceNumber != 0 && missionItem.isCurrentItem && !missionItem.rawEdit |
|
|
|
|
|
|
|
text: missionItem.commandName |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
QGCLabel { |
|
|
|
id: commandDialog |
|
|
|
text: "Fly a grid pattern over a defined area." |
|
|
|
|
|
|
|
wrapMode: Text.WordWrap |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
MissionCommandDialog { |
|
|
|
QGCButton { |
|
|
|
missionItem: _root.missionItem |
|
|
|
text: addPointsMode ? "Finished" : "Draw Polygon" |
|
|
|
|
|
|
|
onClicked: { |
|
|
|
|
|
|
|
if (addPointsMode) { |
|
|
|
|
|
|
|
addPointsMode = false |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
missionItem.clearPolygon() |
|
|
|
|
|
|
|
addPointsMode = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onClicked: qgcView.showDialog(commandDialog, "Select Mission Command", qgcView.showDialogDefaultWidth, StandardButton.Cancel) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
|
|
|
anchors.fill: commandPicker |
|
|
|
|
|
|
|
visible: missionItem.sequenceNumber == 0 || !missionItem.isCurrentItem |
|
|
|
|
|
|
|
verticalAlignment: Text.AlignVCenter |
|
|
|
|
|
|
|
text: missionItem.sequenceNumber == 0 ? "Home Position" : missionItem.commandName |
|
|
|
|
|
|
|
color: qgcPal.buttonText |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} // Component - complexMissionItemEditor |
|
|
|
|
|
|
|
|
|
|
|
Loader { |
|
|
|
|
|
|
|
id: valuesLoader |
|
|
|
|
|
|
|
anchors.topMargin: _margin |
|
|
|
|
|
|
|
anchors.top: commandPicker.bottom |
|
|
|
|
|
|
|
anchors.left: parent.left |
|
|
|
|
|
|
|
anchors.right: parent.right |
|
|
|
|
|
|
|
sourceComponent: _showValues ? valuesComponent : undefined |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} // Item |
|
|
|
|
|
|
|
} // Rectangle |
|
|
|
} // Rectangle |
|
|
|