Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
24ae7b64
Commit
24ae7b64
authored
Oct 14, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better home position handling
Also remove Move Up and Move Down support
parent
2440526f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
75 deletions
+19
-75
MissionEditor.cc
src/MissionEditor/MissionEditor.cc
+0
-46
MissionEditor.h
src/MissionEditor/MissionEditor.h
+0
-2
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+1
-3
MissionItemEditor.qml
src/QmlControls/MissionItemEditor.qml
+18
-24
No files found.
src/MissionEditor/MissionEditor.cc
View file @
24ae7b64
...
...
@@ -142,52 +142,6 @@ void MissionEditor::removeMissionItem(int index)
_recalcAll
();
}
void
MissionEditor
::
moveUp
(
int
index
)
{
if
(
!
_canEdit
)
{
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
return
;
}
if
(
_missionItems
->
count
()
<
2
||
index
<=
0
||
index
>=
_missionItems
->
count
())
{
return
;
}
MissionItem
item1
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
-
1
));
MissionItem
item2
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
));
_missionItems
->
removeAt
(
index
-
1
);
_missionItems
->
removeAt
(
index
-
1
);
_missionItems
->
insert
(
index
-
1
,
new
MissionItem
(
item2
,
_missionItems
));
_missionItems
->
insert
(
index
,
new
MissionItem
(
item1
,
_missionItems
));
_recalcAll
();
}
void
MissionEditor
::
moveDown
(
int
index
)
{
if
(
!
_canEdit
)
{
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
return
;
}
if
(
_missionItems
->
count
()
<
2
||
index
>=
_missionItems
->
count
()
-
1
)
{
return
;
}
MissionItem
item1
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
));
MissionItem
item2
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
+
1
));
_missionItems
->
removeAt
(
index
);
_missionItems
->
removeAt
(
index
);
_missionItems
->
insert
(
index
,
new
MissionItem
(
item2
,
_missionItems
));
_missionItems
->
insert
(
index
+
1
,
new
MissionItem
(
item1
,
_missionItems
));
_recalcAll
();
}
void
MissionEditor
::
loadMissionFromFile
(
void
)
{
QString
errorString
;
...
...
src/MissionEditor/MissionEditor.h
View file @
24ae7b64
...
...
@@ -48,8 +48,6 @@ public:
Q_INVOKABLE
void
loadMissionFromFile
(
void
);
Q_INVOKABLE
void
saveMissionToFile
(
void
);
Q_INVOKABLE
void
removeMissionItem
(
int
index
);
Q_INVOKABLE
void
moveUp
(
int
index
);
Q_INVOKABLE
void
moveDown
(
int
index
);
// Property accessors
...
...
src/MissionEditor/MissionEditor.qml
View file @
24ae7b64
...
...
@@ -440,6 +440,7 @@ QGCView {
MissionItemEditor
{
missionItem
:
object
width
:
parent
.
width
readOnly
:
object
.
sequenceNumber
==
0
&&
liveHomePositionAvailable
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
...
...
@@ -451,9 +452,6 @@ QGCView {
setCurrentItem
(
newCurrentItem
)
}
}
onMoveUp
:
controller
.
moveUp
(
object
.
sequenceNumber
)
onMoveDown
:
controller
.
moveDown
(
object
.
sequenceNumber
)
}
}
// ListView
...
...
src/QmlControls/MissionItemEditor.qml
View file @
24ae7b64
...
...
@@ -13,17 +13,16 @@ import QGroundControl.Palette 1.0
Rectangle
{
id
:
_root
property
var
missionItem
property
var
missionItem
///< MissionItem associated with this editor
property
bool
readOnly
///< true: read only view, false: full editing view
signal
clicked
signal
remove
signal
moveUp
signal
moveDown
height
:
missionItem
.
isCurrentItem
?
(
missionItem
.
textFieldFacts
.
count
*
(
measureTextField
.
height
+
_margin
))
+
(
missionItem
.
checkboxFacts
.
count
*
(
measureCheckbox
.
height
+
_margin
))
+
commandPicker
.
height
+
deleteButton
.
height
+
(
_margin
*
9
)
:
commandPicker
.
height
+
(
deleteButton
.
visible
?
deleteButton
.
height
:
0
)
+
(
_margin
*
9
)
:
commandPicker
.
height
+
(
_margin
*
2
)
color
:
missionItem
.
isCurrentItem
?
qgcPal
.
buttonHighlight
:
qgcPal
.
windowShade
...
...
@@ -63,7 +62,6 @@ Rectangle {
onClicked
:
_root
.
clicked
()
}
QGCComboBox
{
id
:
commandPicker
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
10
...
...
@@ -71,7 +69,7 @@ Rectangle {
anchors.right
:
parent
.
right
currentIndex
:
missionItem
.
commandByIndex
model
:
missionItem
.
commandNames
visible
:
missionItem
.
sequenceNumber
!=
0
visible
:
missionItem
.
sequenceNumber
!=
0
// Item 0 is home position, can't change item type
onActivated
:
missionItem
.
commandByIndex
=
index
}
...
...
@@ -79,7 +77,7 @@ Rectangle {
Rectangle
{
anchors.fill
:
commandPicker
color
:
qgcPal
.
button
visible
:
missionItem
.
sequenceNumber
==
0
visible
:
missionItem
.
sequenceNumber
==
0
// Item 0 is home position, can't change item type
QGCLabel
{
id
:
homeLabel
...
...
@@ -119,6 +117,7 @@ Rectangle {
height
:
textField
.
height
QGCLabel
{
id
:
textFieldLabel
anchors.baseline
:
textField
.
baseline
text
:
object
.
name
}
...
...
@@ -129,6 +128,14 @@ Rectangle {
width
:
_editFieldWidth
showUnits
:
true
fact
:
object
visible
:
!
_root
.
readOnly
}
FactLabel
{
anchors.baseline
:
textFieldLabel
.
baseline
anchors.right
:
parent
.
right
fact
:
object
visible
:
_root
.
readOnly
}
}
}
...
...
@@ -160,26 +167,13 @@ Rectangle {
readonly
property
real
buttonWidth
:
(
width
-
(
_margin
*
2
))
/
3
QGCButton
{
id
:
deleteButton
width
:
parent
.
buttonWidth
text
:
"
Delete
"
id
:
deleteButton
width
:
parent
.
buttonWidth
text
:
"
Delete
"
visible
:
!
readOnly
onClicked
:
_root
.
remove
()
}
QGCButton
{
width
:
parent
.
buttonWidth
text
:
"
Up
"
onClicked
:
_root
.
moveUp
()
}
QGCButton
{
width
:
parent
.
buttonWidth
text
:
"
Down
"
onClicked
:
_root
.
moveDown
()
}
}
}
// Column
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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