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
12b1624e
Commit
12b1624e
authored
Mar 27, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on Plan sync user model
parent
62fb732c
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
514 additions
and
429 deletions
+514
-429
CenterMapDropPanel.qml
src/FlightMap/Widgets/CenterMapDropPanel.qml
+2
-2
MissionController.cc
src/MissionManager/MissionController.cc
+40
-12
MissionController.h
src/MissionManager/MissionController.h
+8
-0
MissionSettingsItem.cc
src/MissionManager/MissionSettingsItem.cc
+8
-16
MissionSettingsItem.h
src/MissionManager/MissionSettingsItem.h
+7
-5
MissionItemEditor.qml
src/PlanView/MissionItemEditor.qml
+2
-2
MissionSettingsEditor.qml
src/PlanView/MissionSettingsEditor.qml
+59
-10
PlanToolBar.qml
src/PlanView/PlanToolBar.qml
+0
-1
PlanView.qml
src/PlanView/PlanView.qml
+366
-381
App.SettingsGroup.json
src/Settings/App.SettingsGroup.json
+7
-0
AppSettings.cc
src/Settings/AppSettings.cc
+11
-0
AppSettings.h
src/Settings/AppSettings.h
+4
-0
No files found.
src/FlightMap/Widgets/CenterMapDropPanel.qml
View file @
12b1624e
...
@@ -65,11 +65,11 @@ ColumnLayout {
...
@@ -65,11 +65,11 @@ ColumnLayout {
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Current Location
"
)
text
:
qsTr
(
"
Current Location
"
)
Layout.fillWidth
:
true
Layout.fillWidth
:
true
enabled
:
mainWindow
.
gcsPosition
.
isValid
enabled
:
_map
.
gcsPosition
.
isValid
onClicked
:
{
onClicked
:
{
dropPanel
.
hide
()
dropPanel
.
hide
()
map
.
center
=
mainWindow
.
gcsPosition
map
.
center
=
_map
.
gcsPosition
}
}
}
}
...
...
src/MissionManager/MissionController.cc
View file @
12b1624e
...
@@ -56,6 +56,7 @@ MissionController::MissionController(QObject *parent)
...
@@ -56,6 +56,7 @@ MissionController::MissionController(QObject *parent)
,
_queuedSend
(
false
)
,
_queuedSend
(
false
)
,
_surveyMissionItemName
(
tr
(
"Survey"
))
,
_surveyMissionItemName
(
tr
(
"Survey"
))
,
_fwLandingMissionItemName
(
tr
(
"Fixed Wing Landing"
))
,
_fwLandingMissionItemName
(
tr
(
"Fixed Wing Landing"
))
,
_appSettings
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
())
{
{
_missionFlightStatus
.
maxTelemetryDistance
=
0
;
_missionFlightStatus
.
maxTelemetryDistance
=
0
;
_missionFlightStatus
.
totalDistance
=
0
;
_missionFlightStatus
.
totalDistance
=
0
;
...
@@ -449,18 +450,18 @@ bool MissionController::_loadJsonMissionFileV2(Vehicle* vehicle, const QJsonObje
...
@@ -449,18 +450,18 @@ bool MissionController::_loadJsonMissionFileV2(Vehicle* vehicle, const QJsonObje
// Mission Settings
// Mission Settings
QGeoCoordinate
homeCoordinate
;
QGeoCoordinate
homeCoordinate
;
SettingsManager
*
settingsManager
=
qgcApp
()
->
toolbox
()
->
settingsManager
();
AppSettings
*
appSettings
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
();
if
(
!
JsonHelper
::
loadGeoCoordinate
(
json
[
_jsonPlannedHomePositionKey
],
true
/* altitudeRequired */
,
homeCoordinate
,
errorString
))
{
if
(
!
JsonHelper
::
loadGeoCoordinate
(
json
[
_jsonPlannedHomePositionKey
],
true
/* altitudeRequired */
,
homeCoordinate
,
errorString
))
{
return
false
;
return
false
;
}
}
if
(
json
.
contains
(
_jsonVehicleTypeKey
)
&&
vehicle
->
isOfflineEditingVehicle
())
{
if
(
json
.
contains
(
_jsonVehicleTypeKey
)
&&
vehicle
->
isOfflineEditingVehicle
())
{
settingsManager
->
appSettings
()
->
offlineEditingVehicleType
()
->
setRawValue
(
json
[
_jsonVehicleTypeKey
].
toDouble
());
appSettings
->
offlineEditingVehicleType
()
->
setRawValue
(
json
[
_jsonVehicleTypeKey
].
toDouble
());
}
}
if
(
json
.
contains
(
_jsonCruiseSpeedKey
))
{
if
(
json
.
contains
(
_jsonCruiseSpeedKey
))
{
settingsManager
->
appSettings
()
->
offlineEditingCruiseSpeed
()
->
setRawValue
(
json
[
_jsonCruiseSpeedKey
].
toDouble
());
appSettings
->
offlineEditingCruiseSpeed
()
->
setRawValue
(
json
[
_jsonCruiseSpeedKey
].
toDouble
());
}
}
if
(
json
.
contains
(
_jsonHoverSpeedKey
))
{
if
(
json
.
contains
(
_jsonHoverSpeedKey
))
{
settingsManager
->
appSettings
()
->
offlineEditingHoverSpeed
()
->
setRawValue
(
json
[
_jsonHoverSpeedKey
].
toDouble
());
appSettings
->
offlineEditingHoverSpeed
()
->
setRawValue
(
json
[
_jsonHoverSpeedKey
].
toDouble
());
}
}
MissionSettingsItem
*
settingsItem
=
new
MissionSettingsItem
(
vehicle
,
visualItems
);
MissionSettingsItem
*
settingsItem
=
new
MissionSettingsItem
(
vehicle
,
visualItems
);
...
@@ -647,17 +648,27 @@ void MissionController::loadFromFile(const QString& filename)
...
@@ -647,17 +648,27 @@ void MissionController::loadFromFile(const QString& filename)
_initAllVisualItems
();
_initAllVisualItems
();
// Split the filename into directory and filename
QString
filenameOnly
=
filename
;
QString
filenameOnly
=
filename
;
int
lastSepIndex
=
filename
.
lastIndexOf
(
QStringLiteral
(
"/"
));
int
lastSepIndex
=
filename
.
lastIndexOf
(
QStringLiteral
(
"/"
));
if
(
lastSepIndex
!=
-
1
)
{
if
(
lastSepIndex
!=
-
1
)
{
filenameOnly
=
filename
.
right
(
filename
.
length
()
-
lastSepIndex
-
1
);
filenameOnly
=
filename
.
right
(
filename
.
length
()
-
lastSepIndex
-
1
);
}
}
QString
directoryOnly
=
filename
.
left
(
filename
.
length
()
-
filenameOnly
.
length
()
-
1
);
QString
extension
=
AppSettings
::
missionFileExtension
;
QString
extension
=
AppSettings
::
missionFileExtension
;
if
(
filenameOnly
.
endsWith
(
"."
+
extension
))
{
if
(
filenameOnly
.
endsWith
(
"."
+
extension
))
{
filenameOnly
=
filenameOnly
.
left
(
filenameOnly
.
length
()
-
extension
.
length
()
-
1
);
filenameOnly
=
filenameOnly
.
left
(
filenameOnly
.
length
()
-
extension
.
length
()
-
1
);
}
}
_settingsItem
->
missionName
()
->
setRawValue
(
filenameOnly
);
_settingsItem
->
missionName
()
->
setRawValue
(
filenameOnly
);
if
(
directoryOnly
==
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
missionSavePath
())
{
QString
emptyString
;
_settingsItem
->
setLoadedMissionDirectory
(
emptyString
);
}
else
{
_settingsItem
->
setLoadedMissionDirectory
(
directoryOnly
);
}
_settingsItem
->
setExistingMission
(
true
);
_settingsItem
->
setExistingMission
(
true
);
sendToVehicle
();
sendToVehicle
();
...
@@ -704,8 +715,6 @@ bool MissionController::loadItemsFromFile(Vehicle* vehicle, const QString& filen
...
@@ -704,8 +715,6 @@ bool MissionController::loadItemsFromFile(Vehicle* vehicle, const QString& filen
void
MissionController
::
saveToFile
(
const
QString
&
filename
)
void
MissionController
::
saveToFile
(
const
QString
&
filename
)
{
{
qDebug
()
<<
filename
;
if
(
filename
.
isEmpty
())
{
if
(
filename
.
isEmpty
())
{
return
;
return
;
}
}
...
@@ -718,7 +727,7 @@ void MissionController::saveToFile(const QString& filename)
...
@@ -718,7 +727,7 @@ void MissionController::saveToFile(const QString& filename)
QFile
file
(
missionFilename
);
QFile
file
(
missionFilename
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
qgcApp
()
->
showMessage
(
file
.
errorString
(
));
qgcApp
()
->
showMessage
(
tr
(
"Mission save %1 : %2"
).
arg
(
filename
).
arg
(
file
.
errorString
()
));
}
else
{
}
else
{
QJsonObject
missionFileObject
;
// top level json object
QJsonObject
missionFileObject
;
// top level json object
...
@@ -1596,9 +1605,17 @@ bool MissionController::missionInProgress(void) const
...
@@ -1596,9 +1605,17 @@ bool MissionController::missionInProgress(void) const
void
MissionController
::
save
(
void
)
void
MissionController
::
save
(
void
)
{
{
// Save to file if the mission is named
// Save to file if the mission is named
QString
missionFullPath
=
_settingsItem
->
missionFullPath
()
->
rawValue
().
toString
();
if
(
!
missionFullPath
.
isEmpty
())
{
QString
missionDir
=
_settingsItem
->
loadedMissionDirectory
();
saveToFile
(
missionFullPath
);
if
(
missionDir
.
isEmpty
())
{
missionDir
=
_appSettings
->
missionSavePath
();
}
bool
savedToFile
=
false
;
QString
missionName
=
_settingsItem
->
missionName
()
->
rawValue
().
toString
();
if
(
!
missionDir
.
isEmpty
()
&&
!
missionName
.
isEmpty
())
{
savedToFile
=
true
;
saveToFile
(
missionDir
+
"/"
+
missionName
);
}
}
// Send to vehicle if we are connected
// Send to vehicle if we are connected
...
@@ -1606,11 +1623,22 @@ void MissionController::save(void)
...
@@ -1606,11 +1623,22 @@ void MissionController::save(void)
sendToVehicle
();
sendToVehicle
();
}
}
_settingsItem
->
setExistingMission
(
_visualItems
->
count
()
>
1
&&
!
missionFullPath
.
isEmpty
()
);
_settingsItem
->
setExistingMission
(
savedToFile
);
}
}
void
MissionController
::
clearMission
(
void
)
void
MissionController
::
clearMission
(
void
)
{
// We need to save the mission information around removeAll all since it delete/recreates settings item
QString
missionName
=
_settingsItem
->
missionName
()
->
rawValue
().
toString
();
QString
loadedMissionDirectory
=
_settingsItem
->
loadedMissionDirectory
();
bool
existingMission
=
_settingsItem
->
existingMission
();
removeAll
();
_settingsItem
->
missionName
()
->
setRawValue
(
missionName
);
_settingsItem
->
setLoadedMissionDirectory
(
loadedMissionDirectory
);
_settingsItem
->
setExistingMission
(
existingMission
);
}
void
MissionController
::
closeMission
(
void
)
{
{
removeAll
();
removeAll
();
save
();
}
}
src/MissionManager/MissionController.h
View file @
12b1624e
...
@@ -23,6 +23,7 @@ class CoordinateVector;
...
@@ -23,6 +23,7 @@ class CoordinateVector;
class
VisualMissionItem
;
class
VisualMissionItem
;
class
MissionItem
;
class
MissionItem
;
class
MissionSettingsItem
;
class
MissionSettingsItem
;
class
AppSettings
;
Q_DECLARE_LOGGING_CATEGORY
(
MissionControllerLog
)
Q_DECLARE_LOGGING_CATEGORY
(
MissionControllerLog
)
...
@@ -88,9 +89,15 @@ public:
...
@@ -88,9 +89,15 @@ public:
/// Sends the mission items to the specified vehicle
/// Sends the mission items to the specified vehicle
static
void
sendItemsToVehicle
(
Vehicle
*
vehicle
,
QmlObjectListModel
*
visualMissionItems
);
static
void
sendItemsToVehicle
(
Vehicle
*
vehicle
,
QmlObjectListModel
*
visualMissionItems
);
/// Saves the mission to file if any and sends to vehicle
Q_INVOKABLE
void
save
(
void
);
Q_INVOKABLE
void
save
(
void
);
/// Removes all items from the mission saving and sending as needed
Q_INVOKABLE
void
clearMission
(
void
);
Q_INVOKABLE
void
clearMission
(
void
);
/// Closes the mission, saving and sending as needed before closing
Q_INVOKABLE
void
closeMission
(
void
);
// Overrides from PlanElementController
// Overrides from PlanElementController
void
start
(
bool
editMode
)
final
;
void
start
(
bool
editMode
)
final
;
void
startStaticActiveVehicle
(
Vehicle
*
vehicle
)
final
;
void
startStaticActiveVehicle
(
Vehicle
*
vehicle
)
final
;
...
@@ -193,6 +200,7 @@ private:
...
@@ -193,6 +200,7 @@ private:
MissionFlightStatus_t
_missionFlightStatus
;
MissionFlightStatus_t
_missionFlightStatus
;
QString
_surveyMissionItemName
;
QString
_surveyMissionItemName
;
QString
_fwLandingMissionItemName
;
QString
_fwLandingMissionItemName
;
AppSettings
*
_appSettings
;
static
const
char
*
_settingsGroup
;
static
const
char
*
_settingsGroup
;
...
...
src/MissionManager/MissionSettingsItem.cc
View file @
12b1624e
...
@@ -24,7 +24,6 @@ QGC_LOGGING_CATEGORY(MissionSettingsComplexItemLog, "MissionSettingsComplexItemL
...
@@ -24,7 +24,6 @@ QGC_LOGGING_CATEGORY(MissionSettingsComplexItemLog, "MissionSettingsComplexItemL
const
char
*
MissionSettingsItem
::
jsonComplexItemTypeValue
=
"MissionSettings"
;
const
char
*
MissionSettingsItem
::
jsonComplexItemTypeValue
=
"MissionSettings"
;
const
char
*
MissionSettingsItem
::
_missionNameName
=
"MissionName"
;
const
char
*
MissionSettingsItem
::
_missionNameName
=
"MissionName"
;
const
char
*
MissionSettingsItem
::
_missionFullPathName
=
"MissionFullPath"
;
const
char
*
MissionSettingsItem
::
_plannedHomePositionAltitudeName
=
"PlannedHomePositionAltitude"
;
const
char
*
MissionSettingsItem
::
_plannedHomePositionAltitudeName
=
"PlannedHomePositionAltitude"
;
const
char
*
MissionSettingsItem
::
_missionFlightSpeedName
=
"FlightSpeed"
;
const
char
*
MissionSettingsItem
::
_missionFlightSpeedName
=
"FlightSpeed"
;
const
char
*
MissionSettingsItem
::
_missionEndActionName
=
"MissionEndAction"
;
const
char
*
MissionSettingsItem
::
_missionEndActionName
=
"MissionEndAction"
;
...
@@ -36,7 +35,6 @@ MissionSettingsItem::MissionSettingsItem(Vehicle* vehicle, QObject* parent)
...
@@ -36,7 +35,6 @@ MissionSettingsItem::MissionSettingsItem(Vehicle* vehicle, QObject* parent)
,
_existingMission
(
false
)
,
_existingMission
(
false
)
,
_specifyMissionFlightSpeed
(
false
)
,
_specifyMissionFlightSpeed
(
false
)
,
_missionNameFact
(
0
,
_missionNameName
,
FactMetaData
::
valueTypeString
)
,
_missionNameFact
(
0
,
_missionNameName
,
FactMetaData
::
valueTypeString
)
,
_missionFullPathFact
(
0
,
_missionFullPathName
,
FactMetaData
::
valueTypeString
)
,
_plannedHomePositionAltitudeFact
(
0
,
_plannedHomePositionAltitudeName
,
FactMetaData
::
valueTypeDouble
)
,
_plannedHomePositionAltitudeFact
(
0
,
_plannedHomePositionAltitudeName
,
FactMetaData
::
valueTypeDouble
)
,
_missionFlightSpeedFact
(
0
,
_missionFlightSpeedName
,
FactMetaData
::
valueTypeDouble
)
,
_missionFlightSpeedFact
(
0
,
_missionFlightSpeedName
,
FactMetaData
::
valueTypeDouble
)
,
_missionEndActionFact
(
0
,
_missionEndActionName
,
FactMetaData
::
valueTypeUint32
)
,
_missionEndActionFact
(
0
,
_missionEndActionName
,
FactMetaData
::
valueTypeUint32
)
...
@@ -65,8 +63,6 @@ MissionSettingsItem::MissionSettingsItem(Vehicle* vehicle, QObject* parent)
...
@@ -65,8 +63,6 @@ MissionSettingsItem::MissionSettingsItem(Vehicle* vehicle, QObject* parent)
setHomePositionSpecialCase
(
true
);
setHomePositionSpecialCase
(
true
);
connect
(
&
_missionNameFact
,
&
Fact
::
valueChanged
,
this
,
&
MissionSettingsItem
::
_missionNameChanged
);
connect
(
this
,
&
MissionSettingsItem
::
specifyMissionFlightSpeedChanged
,
this
,
&
MissionSettingsItem
::
_setDirtyAndUpdateLastSequenceNumber
);
connect
(
this
,
&
MissionSettingsItem
::
specifyMissionFlightSpeedChanged
,
this
,
&
MissionSettingsItem
::
_setDirtyAndUpdateLastSequenceNumber
);
connect
(
&
_cameraSection
,
&
CameraSection
::
missionItemCountChanged
,
this
,
&
MissionSettingsItem
::
_setDirtyAndUpdateLastSequenceNumber
);
connect
(
&
_cameraSection
,
&
CameraSection
::
missionItemCountChanged
,
this
,
&
MissionSettingsItem
::
_setDirtyAndUpdateLastSequenceNumber
);
...
@@ -416,18 +412,6 @@ void MissionSettingsItem::_updateAltitudeInCoordinate(QVariant value)
...
@@ -416,18 +412,6 @@ void MissionSettingsItem::_updateAltitudeInCoordinate(QVariant value)
}
}
}
}
void
MissionSettingsItem
::
_missionNameChanged
(
QVariant
value
)
{
QString
missionDir
=
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
missionSavePath
();
QString
missionName
=
value
.
toString
();
if
(
missionName
.
isEmpty
())
{
_missionFullPathFact
.
setRawValue
(
QString
());
}
else
{
_missionFullPathFact
.
setRawValue
(
missionDir
+
"/"
+
missionName
);
}
}
void
MissionSettingsItem
::
setExistingMission
(
bool
existingMission
)
void
MissionSettingsItem
::
setExistingMission
(
bool
existingMission
)
{
{
if
(
existingMission
!=
_existingMission
)
{
if
(
existingMission
!=
_existingMission
)
{
...
@@ -435,3 +419,11 @@ void MissionSettingsItem::setExistingMission(bool existingMission)
...
@@ -435,3 +419,11 @@ void MissionSettingsItem::setExistingMission(bool existingMission)
emit
existingMissionChanged
(
existingMission
);
emit
existingMissionChanged
(
existingMission
);
}
}
}
}
void
MissionSettingsItem
::
setLoadedMissionDirectory
(
QString
&
loadedMissionDirectory
)
{
if
(
_loadedMissionDirectory
!=
loadedMissionDirectory
)
{
_loadedMissionDirectory
=
loadedMissionDirectory
;
emit
loadedMissionDirectoryChanged
(
loadedMissionDirectory
);
}
}
src/MissionManager/MissionSettingsItem.h
View file @
12b1624e
...
@@ -33,7 +33,7 @@ public:
...
@@ -33,7 +33,7 @@ public:
Q_ENUMS
(
MissionEndAction
)
Q_ENUMS
(
MissionEndAction
)
Q_PROPERTY
(
Fact
*
missionName
READ
missionName
CONSTANT
)
Q_PROPERTY
(
Fact
*
missionName
READ
missionName
CONSTANT
)
Q_PROPERTY
(
Fact
*
missionFullPath
READ
missionFullPath
CONSTANT
)
Q_PROPERTY
(
QString
loadedMissionDirectory
READ
loadedMissionDirectory
WRITE
setLoadedMissionDirectory
NOTIFY
loadedMissionDirectoryChanged
)
Q_PROPERTY
(
bool
existingMission
READ
existingMission
WRITE
setExistingMission
NOTIFY
existingMissionChanged
)
Q_PROPERTY
(
bool
existingMission
READ
existingMission
WRITE
setExistingMission
NOTIFY
existingMissionChanged
)
Q_PROPERTY
(
bool
specifyMissionFlightSpeed
READ
specifyMissionFlightSpeed
WRITE
setSpecifyMissionFlightSpeed
NOTIFY
specifyMissionFlightSpeedChanged
)
Q_PROPERTY
(
bool
specifyMissionFlightSpeed
READ
specifyMissionFlightSpeed
WRITE
setSpecifyMissionFlightSpeed
NOTIFY
specifyMissionFlightSpeedChanged
)
Q_PROPERTY
(
Fact
*
missionFlightSpeed
READ
missionFlightSpeed
CONSTANT
)
Q_PROPERTY
(
Fact
*
missionFlightSpeed
READ
missionFlightSpeed
CONSTANT
)
...
@@ -42,7 +42,6 @@ public:
...
@@ -42,7 +42,6 @@ public:
Q_PROPERTY
(
QObject
*
cameraSection
READ
cameraSection
CONSTANT
)
Q_PROPERTY
(
QObject
*
cameraSection
READ
cameraSection
CONSTANT
)
Fact
*
missionName
(
void
)
{
return
&
_missionNameFact
;
}
Fact
*
missionName
(
void
)
{
return
&
_missionNameFact
;
}
Fact
*
missionFullPath
(
void
)
{
return
&
_missionFullPathFact
;
}
Fact
*
plannedHomePositionAltitude
(
void
)
{
return
&
_plannedHomePositionAltitudeFact
;
}
Fact
*
plannedHomePositionAltitude
(
void
)
{
return
&
_plannedHomePositionAltitudeFact
;
}
Fact
*
missionFlightSpeed
(
void
)
{
return
&
_missionFlightSpeedFact
;
}
Fact
*
missionFlightSpeed
(
void
)
{
return
&
_missionFlightSpeedFact
;
}
Fact
*
missionEndAction
(
void
)
{
return
&
_missionEndActionFact
;
}
Fact
*
missionEndAction
(
void
)
{
return
&
_missionEndActionFact
;
}
...
@@ -63,6 +62,10 @@ public:
...
@@ -63,6 +62,10 @@ public:
/// @return true: Mission end action was added
/// @return true: Mission end action was added
bool
addMissionEndAction
(
QList
<
MissionItem
*>&
items
,
int
seqNum
,
QObject
*
missionItemParent
);
bool
addMissionEndAction
(
QList
<
MissionItem
*>&
items
,
int
seqNum
,
QObject
*
missionItemParent
);
// Returns the directory the misiosn was loaded from. Empty string is laoded from normal savePath.
QString
loadedMissionDirectory
(
void
)
const
{
return
_loadedMissionDirectory
;
}
void
setLoadedMissionDirectory
(
QString
&
loadedMissionDirectory
);
// Overrides from ComplexMissionItem
// Overrides from ComplexMissionItem
double
complexDistance
(
void
)
const
final
;
double
complexDistance
(
void
)
const
final
;
...
@@ -102,23 +105,23 @@ public:
...
@@ -102,23 +105,23 @@ public:
signals:
signals:
void
specifyMissionFlightSpeedChanged
(
bool
specifyMissionFlightSpeed
);
void
specifyMissionFlightSpeedChanged
(
bool
specifyMissionFlightSpeed
);
void
existingMissionChanged
(
bool
existingMission
);
void
existingMissionChanged
(
bool
existingMission
);
void
loadedMissionDirectoryChanged
(
QString
&
loadedMissionDirectory
);
private
slots
:
private
slots
:
void
_setDirtyAndUpdateLastSequenceNumber
(
void
);
void
_setDirtyAndUpdateLastSequenceNumber
(
void
);
void
_setDirty
(
void
);
void
_setDirty
(
void
);
void
_cameraSectionDirtyChanged
(
bool
dirty
);
void
_cameraSectionDirtyChanged
(
bool
dirty
);
void
_updateAltitudeInCoordinate
(
QVariant
value
);
void
_updateAltitudeInCoordinate
(
QVariant
value
);
void
_missionNameChanged
(
QVariant
value
);
private:
private:
bool
_existingMission
;
bool
_existingMission
;
bool
_specifyMissionFlightSpeed
;
bool
_specifyMissionFlightSpeed
;
QGeoCoordinate
_plannedHomePositionCoordinate
;
// Does not include altitde
QGeoCoordinate
_plannedHomePositionCoordinate
;
// Does not include altitde
Fact
_missionNameFact
;
Fact
_missionNameFact
;
Fact
_missionFullPathFact
;
Fact
_plannedHomePositionAltitudeFact
;
Fact
_plannedHomePositionAltitudeFact
;
Fact
_missionFlightSpeedFact
;
Fact
_missionFlightSpeedFact
;
Fact
_missionEndActionFact
;
Fact
_missionEndActionFact
;
QString
_loadedMissionDirectory
;
CameraSection
_cameraSection
;
CameraSection
_cameraSection
;
int
_sequenceNumber
;
int
_sequenceNumber
;
...
@@ -127,7 +130,6 @@ private:
...
@@ -127,7 +130,6 @@ private:
static
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
static
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
static
const
char
*
_missionNameName
;
static
const
char
*
_missionNameName
;
static
const
char
*
_missionFullPathName
;
static
const
char
*
_plannedHomePositionAltitudeName
;
static
const
char
*
_plannedHomePositionAltitudeName
;
static
const
char
*
_missionFlightSpeedName
;
static
const
char
*
_missionFlightSpeedName
;
static
const
char
*
_missionEndActionName
;
static
const
char
*
_missionEndActionName
;
...
...
src/PlanView/MissionItemEditor.qml
View file @
12b1624e
...
@@ -13,7 +13,6 @@ import QGroundControl.Palette 1.0
...
@@ -13,7 +13,6 @@ import QGroundControl.Palette 1.0
/// Mission item edit control
/// Mission item edit control
Rectangle
{
Rectangle
{
id
:
_root
id
:
_root
height
:
editorLoader
.
y
+
editorLoader
.
height
+
(
_margin
*
2
)
height
:
editorLoader
.
y
+
editorLoader
.
height
+
(
_margin
*
2
)
color
:
_currentItem
?
qgcPal
.
primaryButton
:
qgcPal
.
windowShade
color
:
_currentItem
?
qgcPal
.
primaryButton
:
qgcPal
.
windowShade
radius
:
_radius
radius
:
_radius
...
@@ -21,6 +20,7 @@ Rectangle {
...
@@ -21,6 +20,7 @@ Rectangle {
property
var
map
///< Map control
property
var
map
///< Map control
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
rootQgcView
signal
clicked
signal
clicked
signal
remove
signal
remove
...
...
src/PlanView/MissionSettingsEditor.qml
View file @
12b1624e
...
@@ -35,6 +35,7 @@ Rectangle {
...
@@ -35,6 +35,7 @@ Rectangle {
property
bool
_noMissionName
:
missionItem
.
missionName
.
valueString
===
""
property
bool
_noMissionName
:
missionItem
.
missionName
.
valueString
===
""
property
bool
_showMissionList
:
_noMissionItemsAdded
&&
(
_noMissionName
||
_newMissionAlreadyExists
)
property
bool
_showMissionList
:
_noMissionItemsAdded
&&
(
_noMissionName
||
_newMissionAlreadyExists
)
property
bool
_existingMissionLoaded
:
missionItem
.
existingMission
property
bool
_existingMissionLoaded
:
missionItem
.
existingMission
property
var
_appSettings
:
QGroundControl
.
settingsManager
.
appSettings
readonly
property
string
_firmwareLabel
:
qsTr
(
"
Firmware
"
)
readonly
property
string
_firmwareLabel
:
qsTr
(
"
Firmware
"
)
readonly
property
string
_vehicleLabel
:
qsTr
(
"
Vehicle
"
)
readonly
property
string
_vehicleLabel
:
qsTr
(
"
Vehicle
"
)
...
@@ -97,12 +98,38 @@ Rectangle {
...
@@ -97,12 +98,38 @@ Rectangle {
visible
:
!
_existingMissionLoaded
&&
_newMissionAlreadyExists
visible
:
!
_existingMissionLoaded
&&
_newMissionAlreadyExists
}
}
FactCheckBox
{
id
:
automaticUploadCheckbox
text
:
qsTr
(
"
Automatically upload on exit
"
)
fact
:
_appSettings
.
automaticMissionUpload
}
RowLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Clear mission
"
)
text
:
qsTr
(
"
Clear
"
)
visible
:
!
_noMissionItemsAdded
visible
:
!
_noMissionItemsAdded
Layout.fillWidth
:
true
onClicked
:
missionController
.
clearMission
()
onClicked
:
missionController
.
clearMission
()
}
}
QGCButton
{
text
:
qsTr
(
"
Close
"
)
visible
:
!
_noMissionItemsAdded
Layout.fillWidth
:
true
onClicked
:
missionController
.
closeMission
()
}
QGCButton
{
text
:
qsTr
(
"
Upload
"
)
visible
:
!
_noMissionItemsAdded
&&
!
automaticUploadCheckbox
.
checked
Layout.fillWidth
:
true
onClicked
:
missionController
.
sendToVehicle
()
}
}
Loader
{
Loader
{
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
...
@@ -132,14 +159,36 @@ Rectangle {
...
@@ -132,14 +159,36 @@ Rectangle {
showSpacer
:
false
showSpacer
:
false
}
}
QGCButton
{
RowLayout
{
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
text
:
qsTr
(
"
Load from Vehicle
"
)
QGCButton
{
text
:
qsTr
(
"
From Vehicle
"
)
visible
:
!
_offlineEditing
visible
:
!
_offlineEditing
Layout.fillWidth
:
true
onClicked
:
missionController
.
loadFromVehicle
()
}
onClicked
:
{
QGCButton
{
missionController
.
loadFromVehicle
()
text
:
qsTr
(
"
Browse
"
)
Layout.fillWidth
:
true
onClicked
:
fileDialog
.
openForLoad
()
QGCFileDialog
{
id
:
fileDialog
qgcView
:
rootQgcView
title
:
qsTr
(
"
Select mission file
"
)
selectExisting
:
true
folder
:
_appSettings
.
missionSavePath
fileExtension
:
_appSettings
.
missionFileExtension
nameFilters
:
[
qsTr
(
"
Mission Files (*.%1)
"
).
arg
(
fileExtension
)
,
qsTr
(
"
All Files (*.*)
"
)
]
onAcceptedForLoad
:
{
missionController
.
loadFromFile
(
file
)
fileDialog
.
close
()
}
}
}
}
}
}
...
@@ -337,5 +386,5 @@ Rectangle {
...
@@ -337,5 +386,5 @@ Rectangle {
}
}
}
}
}
// Column
}
// Column
}
}
// Deferred loader
}
// Rectangle
}
// Rectangle
src/PlanView/PlanToolBar.qml
View file @
12b1624e
...
@@ -80,7 +80,6 @@ Rectangle {
...
@@ -80,7 +80,6 @@ Rectangle {
checked
:
false
checked
:
false
onClicked
:
{
onClicked
:
{
console
.
log
(
"
Leave plan clicked
"
)
checked
=
false
checked
=
false
missionController
.
saveOnSwitch
()
missionController
.
saveOnSwitch
()
showFlyView
()
showFlyView
()
...
...
src/PlanView/PlanView.qml
View file @
12b1624e
This diff is collapsed.
Click to expand it.
src/Settings/App.SettingsGroup.json
View file @
12b1624e
...
@@ -115,6 +115,13 @@
...
@@ -115,6 +115,13 @@
"type"
:
"bool"
,
"type"
:
"bool"
,
"defaultValue"
:
false
"defaultValue"
:
false
},
},
{
"name"
:
"AutomaticMissionUpload"
,
"shortDescription"
:
"Automatic mission upload"
,
"longDescription"
:
"Automatically upload mission to vehicle after changes"
,
"type"
:
"bool"
,
"defaultValue"
:
true
},
{
{
"name"
:
"SavePath"
,
"name"
:
"SavePath"
,
"shortDescription"
:
"Application save directory"
,
"shortDescription"
:
"Application save directory"
,
...
...
src/Settings/AppSettings.cc
View file @
12b1624e
...
@@ -31,6 +31,7 @@ const char* AppSettings::indoorPaletteName = "StyleIs
...
@@ -31,6 +31,7 @@ const char* AppSettings::indoorPaletteName = "StyleIs
const
char
*
AppSettings
::
showLargeCompassName
=
"ShowLargeCompass"
;
const
char
*
AppSettings
::
showLargeCompassName
=
"ShowLargeCompass"
;
const
char
*
AppSettings
::
savePathName
=
"SavePath"
;
const
char
*
AppSettings
::
savePathName
=
"SavePath"
;
const
char
*
AppSettings
::
autoLoadMissionsName
=
"AutoLoadMissions"
;
const
char
*
AppSettings
::
autoLoadMissionsName
=
"AutoLoadMissions"
;
const
char
*
AppSettings
::
automaticMissionUploadName
=
"AutomaticMissionUpload"
;
const
char
*
AppSettings
::
parameterFileExtension
=
"params"
;
const
char
*
AppSettings
::
parameterFileExtension
=
"params"
;
const
char
*
AppSettings
::
missionFileExtension
=
"mission"
;
const
char
*
AppSettings
::
missionFileExtension
=
"mission"
;
...
@@ -59,6 +60,7 @@ AppSettings::AppSettings(QObject* parent)
...
@@ -59,6 +60,7 @@ AppSettings::AppSettings(QObject* parent)
,
_showLargeCompassFact
(
NULL
)
,
_showLargeCompassFact
(
NULL
)
,
_savePathFact
(
NULL
)
,
_savePathFact
(
NULL
)
,
_autoLoadMissionsFact
(
NULL
)
,
_autoLoadMissionsFact
(
NULL
)
,
_automaticMissionUpload
(
NULL
)
{
{
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
qmlRegisterUncreatableType
<
AppSettings
>
(
"QGroundControl.SettingsManager"
,
1
,
0
,
"AppSettings"
,
"Reference only"
);
qmlRegisterUncreatableType
<
AppSettings
>
(
"QGroundControl.SettingsManager"
,
1
,
0
,
"AppSettings"
,
"Reference only"
);
...
@@ -276,3 +278,12 @@ Fact* AppSettings::autoLoadMissions(void)
...
@@ -276,3 +278,12 @@ Fact* AppSettings::autoLoadMissions(void)
return
_autoLoadMissionsFact
;
return
_autoLoadMissionsFact
;
}
}
Fact
*
AppSettings
::
automaticMissionUpload
(
void
)
{
if
(
!
_automaticMissionUpload
)
{
_automaticMissionUpload
=
_createSettingsFact
(
automaticMissionUploadName
);
}
return
_automaticMissionUpload
;
}
src/Settings/AppSettings.h
View file @
12b1624e
...
@@ -34,6 +34,7 @@ public:
...
@@ -34,6 +34,7 @@ public:
Q_PROPERTY
(
Fact
*
showLargeCompass
READ
showLargeCompass
CONSTANT
)
Q_PROPERTY
(
Fact
*
showLargeCompass
READ
showLargeCompass
CONSTANT
)
Q_PROPERTY
(
Fact
*
savePath
READ
savePath
CONSTANT
)
Q_PROPERTY
(
Fact
*
savePath
READ
savePath
CONSTANT
)
Q_PROPERTY
(
Fact
*
autoLoadMissions
READ
autoLoadMissions
CONSTANT
)
Q_PROPERTY
(
Fact
*
autoLoadMissions
READ
autoLoadMissions
CONSTANT
)
Q_PROPERTY
(
Fact
*
automaticMissionUpload
READ
automaticMissionUpload
CONSTANT
)
Q_PROPERTY
(
QString
missionSavePath
READ
missionSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
missionSavePath
READ
missionSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
parameterSavePath
READ
parameterSavePath
NOTIFY
savePathsChanged
)
Q_PROPERTY
(
QString
parameterSavePath
READ
parameterSavePath
NOTIFY
savePathsChanged
)
...
@@ -58,6 +59,7 @@ public:
...
@@ -58,6 +59,7 @@ public:
Fact
*
showLargeCompass
(
void
);
Fact
*
showLargeCompass
(
void
);
Fact
*
savePath
(
void
);
Fact
*
savePath
(
void
);
Fact
*
autoLoadMissions
(
void
);
Fact
*
autoLoadMissions
(
void
);
Fact
*
automaticMissionUpload
(
void
);
QString
missionSavePath
(
void
);
QString
missionSavePath
(
void
);
QString
parameterSavePath
(
void
);
QString
parameterSavePath
(
void
);
...
@@ -80,6 +82,7 @@ public:
...
@@ -80,6 +82,7 @@ public:
static
const
char
*
showLargeCompassName
;
static
const
char
*
showLargeCompassName
;
static
const
char
*
savePathName
;
static
const
char
*
savePathName
;
static
const
char
*
autoLoadMissionsName
;
static
const
char
*
autoLoadMissionsName
;
static
const
char
*
automaticMissionUploadName
;
// Application wide file extensions
// Application wide file extensions
static
const
char
*
parameterFileExtension
;
static
const
char
*
parameterFileExtension
;
...
@@ -116,6 +119,7 @@ private:
...
@@ -116,6 +119,7 @@ private:
SettingsFact
*
_showLargeCompassFact
;
SettingsFact
*
_showLargeCompassFact
;
SettingsFact
*
_savePathFact
;
SettingsFact
*
_savePathFact
;
SettingsFact
*
_autoLoadMissionsFact
;
SettingsFact
*
_autoLoadMissionsFact
;
SettingsFact
*
_automaticMissionUpload
;
};
};
#endif
#endif
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