Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
e3ed76f0
Commit
e3ed76f0
authored
Dec 30, 2015
by
Don Gagne
Browse files
Merge pull request #2502 from DonLakeFlyer/MissionHamburger
Mission Edit: Rework gear icon to hamburger with menu options
parents
3a1f28cc
0f710520
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/MissionEditor/MissionEditor.qml
View file @
e3ed76f0
...
...
@@ -133,6 +133,43 @@ QGCView {
}
}
property
int
_moveDialogMissionItemIndex
Component
{
id
:
moveDialog
QGCViewDialog
{
function
accept
()
{
var
toIndex
=
toCombo
.
currentIndex
if
(
toIndex
==
0
)
{
toIndex
=
1
}
controller
.
moveMissionItem
(
_moveDialogMissionItemIndex
,
toIndex
)
hideDialog
()
}
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
"
Move the selected mission item to the be after following mission item:
"
}
QGCComboBox
{
id
:
toCombo
model
:
_missionItems
.
count
currentIndex
:
_moveDialogMissionItemIndex
}
}
}
}
QGCViewPanel
{
id
:
panel
anchors.fill
:
parent
...
...
@@ -340,12 +377,13 @@ QGCView {
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
onRemove
:
{
var
newCurrentItem
=
object
.
sequenceNumber
-
1
itemDragger
.
clearItem
()
controller
.
removeMissionItem
(
object
.
sequenceNumber
)
if
(
_missionItems
.
count
>
1
)
{
newCurrentItem
=
Math
.
min
(
_missionItems
.
count
-
1
,
newCurrentItem
)
setCurrentItem
(
newCurrentItem
)
}
}
onRemoveAll
:
{
itemDragger
.
clearItem
()
controller
.
removeAllMissionItems
()
}
}
}
// ListView
...
...
@@ -408,18 +446,6 @@ QGCView {
}
}
RoundButton
{
id
:
deleteMissionItemButton
buttonImage
:
"
/qmlimages/TrashDelete.svg
"
z
:
QGroundControl
.
zOrderWidgets
onClicked
:
{
addMissionItemsButton
.
checked
=
false
itemDragger
.
clearItem
()
controller
.
deleteCurrentMissionItem
()
checked
=
false
}
}
DropButton
{
id
:
syncButton
dropDirection
:
dropRight
...
...
src/MissionEditor/MissionEditorHelp.qml
View file @
e3ed76f0
...
...
@@ -97,59 +97,10 @@ Rectangle {
"
When enabled, add mission items by clicking on the map.
"
}
Image
{
id
:
deleteHelpIcon
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
anchors.top
:
addMissionItemsHelpText
.
bottom
width
:
ScreenTools
.
defaultFontPixelHeight
*
3
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
source
:
(
qgcPal
.
globalTheme
===
QGCPalette
.
Light
)
?
"
/qmlimages/TrashDeleteBlack.svg
"
:
"
/qmlimages/TrashDelete.svg
"
}
QGCLabel
{
id
:
deleteHelpText
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelHeight
anchors.left
:
mapTypeHelpIcon
.
right
anchors.right
:
parent
.
right
anchors.top
:
deleteHelpIcon
.
top
wrapMode
:
Text
.
WordWrap
text
:
"
<b>Delete Mission Item</b><br>
"
+
"
Delete the currently selected mission item.
"
}
/*
Home Position Manager disabled
Image {
id: homePositionManagerHelpIcon
anchors.topMargin: ScreenTools.defaultFontPixelHeight
anchors.top: deleteHelpText.bottom
width: ScreenTools.defaultFontPixelHeight * 3
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
source: (qgcPal.globalTheme === QGCPalette.Light) ? "/qmlimages/MapHomeBlack.svg" : "/qmlimages/MapHome.svg"
}
QGCLabel {
id: homePositionManagerHelpText
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.left: mapTypeHelpIcon.right
anchors.right: parent.right
anchors.top: homePositionManagerHelpIcon.top
wrapMode: Text.WordWrap
text: "<b>Flying Field Manager</b><br>" +
"When enabled, allows you to select/add/update flying field locations. " +
"You can save multiple flying field locations for use while creating missions while you are not connected to your vehicle."
}
*/
Image
{
id
:
mapCenterHelpIcon
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
anchors.top
:
delete
HelpText
.
bottom
anchors.top
:
addMissionItems
HelpText
.
bottom
width
:
ScreenTools
.
defaultFontPixelHeight
*
3
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
...
...
src/MissionManager/MissionController.cc
View file @
e3ed76f0
...
...
@@ -205,6 +205,17 @@ void MissionController::removeMissionItem(int index)
}
}
void
MissionController
::
removeAllMissionItems
(
void
)
{
if
(
_missionItems
)
{
_deinitAllMissionItems
();
_missionItems
->
deleteLater
();
}
_missionItems
=
new
QmlObjectListModel
(
this
);
_initAllMissionItems
();
}
void
MissionController
::
loadMissionFromFile
(
void
)
{
#ifndef __mobile__
...
...
@@ -606,17 +617,6 @@ void MissionController::_activeVehicleHomePositionChanged(const QGeoCoordinate&
_recalcWaypointLines
();
}
void
MissionController
::
deleteCurrentMissionItem
(
void
)
{
for
(
int
i
=
0
;
i
<
_missionItems
->
count
();
i
++
)
{
MissionItem
*
item
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
i
));
if
(
item
->
isCurrentItem
()
&&
i
!=
0
)
{
removeMissionItem
(
i
);
return
;
}
}
}
void
MissionController
::
setAutoSync
(
bool
autoSync
)
{
// FIXME: AutoSync temporarily turned off
...
...
src/MissionManager/MissionController.h
View file @
e3ed76f0
...
...
@@ -53,7 +53,7 @@ public:
Q_INVOKABLE
void
loadMissionFromFile
(
void
);
Q_INVOKABLE
void
saveMissionToFile
(
void
);
Q_INVOKABLE
void
removeMissionItem
(
int
index
);
Q_INVOKABLE
void
deleteCurrent
MissionItem
(
void
);
Q_INVOKABLE
void
removeAll
MissionItem
s
(
void
);
// Property accessors
...
...
src/QmlControls/MissionItemEditor.qml
View file @
e3ed76f0
...
...
@@ -20,6 +20,7 @@ Rectangle {
signal
clicked
signal
remove
signal
removeAll
height
:
innerItem
.
height
+
(
_margin
*
3
)
color
:
missionItem
.
isCurrentItem
?
qgcPal
.
buttonHighlight
:
qgcPal
.
windowShade
...
...
@@ -34,6 +35,19 @@ Rectangle {
colorGroupEnabled
:
enabled
}
Component
{
id
:
deleteAllPromptDialog
QGCViewMessage
{
message
:
"
Are you sure you want to delete all mission items?
"
function
accept
()
{
removeAll
()
hideDialog
()
}
}
}
Item
{
id
:
innerItem
anchors.margins
:
_margin
...
...
@@ -57,18 +71,54 @@ Rectangle {
}
Image
{
id
:
rawEdit
id
:
hamburger
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
parent
.
right
anchors.verticalCenter
:
commandPicker
.
verticalCenter
width
:
commandPicker
.
height
height
:
commandPicker
.
height
visibl
e
:
missionItem
.
friendlyEditAllowed
&&
missionItem
.
sequenceNumber
!=
0
&&
missionItem
.
isCurrentItem
sourc
e
:
"
qrc:/qmlimages/CogWheel.svg
"
sourc
e
:
"
qrc:/qmlimages/Hamburger.svg
"
visibl
e
:
missionItem
.
isCurrentItem
&&
missionItem
.
sequenceNumber
!=
0
MouseArea
{
anchors.fill
:
parent
onClicked
:
missionItem
.
rawEdit
=
!
missionItem
.
rawEdit
onClicked
:
hamburgerMenu
.
popup
()
Menu
{
id
:
hamburgerMenu
MenuItem
{
text
:
"
Delete
"
onTriggered
:
remove
()
}
MenuItem
{
text
:
"
Delete all
"
onTriggered
:
qgcView
.
showDialog
(
deleteAllPromptDialog
,
"
Delete all
"
,
40
,
StandardButton
.
Yes
|
StandardButton
.
No
)
}
MenuSeparator
{
}
MenuItem
{
text
:
"
Show all values
"
checkable
:
true
checked
:
missionItem
.
rawEdit
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
}
}
}
}
}
...
...
@@ -77,7 +127,7 @@ Rectangle {
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
label
.
right
anchors.right
:
rawEdit
.
left
anchors.right
:
hamburger
.
left
visible
:
missionItem
.
sequenceNumber
!=
0
&&
missionItem
.
isCurrentItem
&&
!
missionItem
.
rawEdit
text
:
missionItem
.
commandName
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment