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
daf18492
Commit
daf18492
authored
7 years ago
by
Don Gagne
Committed by
GitHub
7 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4871 from DonLakeFlyer/MorePlanWorm
More work on Plan user model
parents
4544f671
420ea060
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
107 deletions
+94
-107
MissionController.cc
src/MissionManager/MissionController.cc
+5
-2
MissionController.h
src/MissionManager/MissionController.h
+5
-2
MissionSettingsEditor.qml
src/PlanView/MissionSettingsEditor.qml
+2
-9
PlanToolBar.qml
src/PlanView/PlanToolBar.qml
+22
-3
PlanView.qml
src/PlanView/PlanView.qml
+60
-91
No files found.
src/MissionManager/MissionController.cc
View file @
daf18492
...
...
@@ -1618,12 +1618,15 @@ void MissionController::save(void)
saveToFile
(
missionDir
+
"/"
+
missionName
);
}
_settingsItem
->
setExistingMission
(
savedToFile
);
}
void
MissionController
::
saveAndSend
(
void
)
{
// Send to vehicle if we are connected
if
(
!
_activeVehicle
->
isOfflineEditingVehicle
())
{
sendToVehicle
();
}
_settingsItem
->
setExistingMission
(
savedToFile
);
}
void
MissionController
::
clearMission
(
void
)
...
...
This diff is collapsed.
Click to expand it.
src/MissionManager/MissionController.h
View file @
daf18492
...
...
@@ -89,10 +89,13 @@ public:
/// Sends the mission items to the specified vehicle
static
void
sendItemsToVehicle
(
Vehicle
*
vehicle
,
QmlObjectListModel
*
visualMissionItems
);
/// Saves the mission to file
if any and sends to vehicle
/// Saves the mission to file
Q_INVOKABLE
void
save
(
void
);
/// Removes all items from the mission saving and sending as needed
/// Save and to file and send to vehicle if possible
Q_INVOKABLE
void
saveAndSend
(
void
);
/// Removes all items from the mission
Q_INVOKABLE
void
clearMission
(
void
);
/// Closes the mission, saving and sending as needed before closing
...
...
This diff is collapsed.
Click to expand it.
src/PlanView/MissionSettingsEditor.qml
View file @
daf18492
...
...
@@ -109,25 +109,18 @@ Rectangle {
anchors.right
:
parent
.
right
QGCButton
{
text
:
qsTr
(
"
Clear
"
)
text
:
qsTr
(
"
Remove All
"
)
visible
:
!
_noMissionItemsAdded
Layout.fillWidth
:
true
onClicked
:
missionController
.
clearMission
()
}
QGCButton
{
text
:
qsTr
(
"
Close
"
)
text
:
qsTr
(
"
New Mission
"
)
visible
:
!
_noMissionItemsAdded
Layout.fillWidth
:
true
onClicked
:
missionController
.
closeMission
()
}
QGCButton
{
text
:
qsTr
(
"
Upload
"
)
visible
:
!
_noMissionItemsAdded
&&
!
automaticUploadCheckbox
.
checked
Layout.fillWidth
:
true
onClicked
:
missionController
.
sendToVehicle
()
}
}
Loader
{
...
...
This diff is collapsed.
Click to expand it.
src/PlanView/PlanToolBar.qml
View file @
daf18492
...
...
@@ -36,6 +36,12 @@ Rectangle {
property
bool
_statusValid
:
currentMissionItem
!=
undefined
property
bool
_missionValid
:
missionItems
!=
undefined
property
bool
_controllerValid
:
missionController
!=
undefined
property
bool
_manualUpload
:
QGroundControl
.
settingsManager
.
appSettings
.
automaticMissionUpload
.
rawValue
==
0
Connections
{
target
:
QGroundControl
.
settingsManager
.
appSettings
.
automaticMissionUpload
onRawValueChanged
:
console
.
log
(
"
changed
"
,
QGroundControl
.
settingsManager
.
appSettings
.
automaticMissionUpload
.
rawValue
)
}
property
real
_distance
:
_statusValid
?
currentMissionItem
.
distance
:
NaN
property
real
_altDifference
:
_statusValid
?
currentMissionItem
.
altDifference
:
NaN
...
...
@@ -66,9 +72,11 @@ Rectangle {
onReleased
:
{
mouse
.
accepted
=
true
;
}
}
Row
{
Row
Layout
{
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
anchors.right
:
uploadButton
.
visible
?
uploadButton
.
left
:
uploadButton
.
right
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
2
QGCToolBarButton
{
...
...
@@ -81,8 +89,9 @@ Rectangle {
onClicked
:
{
checked
=
false
missionController
.
saveOnSwitch
()
showFlyView
()
if
(
missionController
.
saveOnSwitch
())
{
showFlyView
()
}
}
}
...
...
@@ -163,5 +172,15 @@ Rectangle {
QGCLabel
{
text
:
"
--
"
}
}
}
QGCButton
{
id
:
uploadButton
anchors.rightMargin
:
_margins
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
qsTr
(
"
Upload
"
)
visible
:
_manualUpload
&&
missionController
.
dirty
onClicked
:
missionController
.
uploadFromToolbar
()
}
}
This diff is collapsed.
Click to expand it.
src/PlanView/PlanView.qml
View file @
daf18492
...
...
@@ -48,15 +48,16 @@ QGCView {
property
bool
_lightWidgetBorders
:
editorMap
.
isSatelliteMap
property
bool
_addWaypointOnClick
:
false
property
bool
_singleComplexItem
:
missionController
.
complexMissionItemNames
.
length
===
1
property
real
_toolbarHeight
:
_qgcView
.
height
-
ScreenTools
.
availableHeight
property
real
_toolbarHeight
:
_qgcView
.
height
-
ScreenTools
.
availableHeight
property
int
_editingLayer
:
_layerMission
/// The controller which should be called for load/save, send to/from vehicle calls
property
var
_syncDropDownController
:
missionController
readonly
property
int
_layerMission
:
1
readonly
property
int
_layerGeoFence
:
2
readonly
property
int
_layerRallyPoints
:
3
property
int
_editingLayer
:
_layerMission
readonly
property
int
_layerMission
:
1
readonly
property
int
_layerGeoFence
:
2
readonly
property
int
_layerRallyPoints
:
3
readonly
property
string
_armedVehicleUploadPrompt
:
qsTr
(
"
Vehicle is currently armed. Do you want to upload the mission to the vehicle?
"
)
Component.onCompleted
:
{
toolbar
.
missionController
=
Qt
.
binding
(
function
()
{
return
missionController
})
...
...
@@ -106,7 +107,28 @@ QGCView {
// Users is switching away from Plan View
function
saveOnSwitch
()
{
save
()
if
(
missionController
.
dirty
)
{
save
()
if
(
_activeVehicle
.
armed
)
{
_qgcView
.
showDialog
(
confirmSendToActiveVehicleAndSwitchView
,
qsTr
(
"
Mission Upload
"
),
_qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
No
)
return
false
}
else
{
sendToVehicle
()
}
}
return
true
}
// User clicked upload button in plan toolbar
function
uploadFromToolbar
()
{
if
(
missionController
.
dirty
)
{
save
()
if
(
_activeVehicle
.
armed
)
{
_qgcView
.
showDialog
(
confirmSendToActiveVehicle
,
qsTr
(
"
Mission Upload
"
),
_qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
No
)
}
else
{
sendToVehicle
()
}
}
}
function
loadFromSelectedFile
()
{
...
...
@@ -506,7 +528,6 @@ QGCView {
color
:
qgcPal
.
window
title
:
qsTr
(
"
Plan
"
)
z
:
QGroundControl
.
zOrderWidgets
buttonEnabled
:
[
true
,
true
,
true
,
true
,
true
]
buttonVisible
:
[
true
,
true
,
true
,
_showZoom
,
_showZoom
]
maxHeight
:
mapScale
.
y
-
toolStrip
.
y
...
...
@@ -777,90 +798,6 @@ QGCView {
//- ToolStrip DropPanel Components
Component
{
id
:
syncDropPanel
Column
{
id
:
columnHolder
spacing
:
_margin
property
string
_overwriteText
:
(
_editingLayer
==
_layerMission
)
?
qsTr
(
"
Mission overwrite
"
)
:
((
_editingLayer
==
_layerGeoFence
)
?
qsTr
(
"
GeoFence overwrite
"
)
:
qsTr
(
"
Rally Points overwrite
"
))
QGCLabel
{
width
:
sendSaveGrid
.
width
wrapMode
:
Text
.
WordWrap
text
:
_syncDropDownController
.
dirty
?
qsTr
(
"
You have unsaved changes. You should send to your vehicle, or save to a file:
"
)
:
qsTr
(
"
Sync:
"
)
}
GridLayout
{
id
:
sendSaveGrid
columns
:
2
anchors.margins
:
_margin
rowSpacing
:
_margin
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
QGCButton
{
text
:
qsTr
(
"
Save
"
)
Layout.fillWidth
:
true
enabled
:
!
_syncDropDownController
.
syncInProgress
onClicked
:
{
dropPanel
.
hide
()
_syncDropDownController
.
save
()
}
}
QGCButton
{
text
:
qsTr
(
"
Load From Vehicle
"
)
Layout.fillWidth
:
true
enabled
:
_activeVehicle
&&
!
_syncDropDownController
.
syncInProgress
onClicked
:
{
dropPanel
.
hide
()
if
(
_syncDropDownController
.
dirty
)
{
_qgcView
.
showDialog
(
syncLoadFromVehicleOverwrite
,
columnHolder
.
_overwriteText
,
_qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
Cancel
)
}
else
{
_syncDropDownController
.
loadFromVehicle
()
}
}
}
QGCButton
{
text
:
qsTr
(
"
Save To File...
"
)
Layout.fillWidth
:
true
enabled
:
!
_syncDropDownController
.
syncInProgress
onClicked
:
{
dropPanel
.
hide
()
_syncDropDownController
.
saveToSelectedFile
()
}
}
QGCButton
{
text
:
qsTr
(
"
Load From File...
"
)
Layout.fillWidth
:
true
enabled
:
!
_syncDropDownController
.
syncInProgress
onClicked
:
{
dropPanel
.
hide
()
if
(
_syncDropDownController
.
dirty
)
{
_qgcView
.
showDialog
(
syncLoadFromFileOverwrite
,
columnHolder
.
_overwriteText
,
_qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
Cancel
)
}
else
{
_syncDropDownController
.
loadFromSelectedFile
()
}
}
}
QGCButton
{
text
:
qsTr
(
"
Remove All
"
)
Layout.fillWidth
:
true
onClicked
:
{
dropPanel
.
hide
()
_qgcView
.
showDialog
(
removeAllPromptDialog
,
qsTr
(
"
Remove all
"
),
_qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
No
)
}
}
}
}
}
Component
{
id
:
centerMapDropPanel
...
...
@@ -904,4 +841,36 @@ QGCView {
flightMap
:
editorMap
}
}
Component
{
id
:
confirmSendToActiveVehicleAndSwitchView
QGCViewMessage
{
message
:
_armedVehicleUploadPrompt
function
accept
()
{
missionController
.
sendToVehicle
()
toolbar
.
showFlyView
()
hideDialog
()
}
function
reject
()
{
toolbar
.
showFlyView
()
hideDialog
()
}
}
}
Component
{
id
:
confirmSendToActiveVehicle
QGCViewMessage
{
message
:
_armedVehicleUploadPrompt
function
accept
()
{
missionController
.
sendToVehicle
()
hideDialog
()
}
}
}
}
// QGCVIew
This diff is collapsed.
Click to expand it.
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