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
63abdfd5
Commit
63abdfd5
authored
May 10, 2018
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to version 2
Ignore old version 1
parent
e48aad6b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
7 deletions
+31
-7
GeoFenceController.cc
src/MissionManager/GeoFenceController.cc
+7
-0
GeoFenceController.h
src/MissionManager/GeoFenceController.h
+1
-1
RallyPointController.cc
src/MissionManager/RallyPointController.cc
+21
-6
RallyPointController.h
src/MissionManager/RallyPointController.h
+2
-0
No files found.
src/MissionManager/GeoFenceController.cc
View file @
63abdfd5
...
...
@@ -119,8 +119,15 @@ void GeoFenceController::managerVehicleChanged(Vehicle* managerVehicle)
bool
GeoFenceController
::
load
(
const
QJsonObject
&
json
,
QString
&
errorString
)
{
removeAll
();
errorString
.
clear
();
if
(
json
.
contains
(
JsonHelper
::
jsonVersionKey
)
&&
json
[
JsonHelper
::
jsonVersionKey
].
toInt
()
==
1
)
{
// We just ignore old version 1 data
return
true
;
}
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfoList
=
{
{
JsonHelper
::
jsonVersionKey
,
QJsonValue
::
Double
,
true
},
{
_jsonCirclesKey
,
QJsonValue
::
Array
,
true
},
...
...
src/MissionManager/GeoFenceController.h
View file @
63abdfd5
...
...
@@ -113,7 +113,7 @@ private:
static
const
char
*
_px4ParamCircularFence
;
static
const
int
_jsonCurrentVersion
=
1
;
static
const
int
_jsonCurrentVersion
=
2
;
static
const
char
*
_jsonFileTypeValue
;
static
const
char
*
_jsonBreachReturnKey
;
...
...
src/MissionManager/RallyPointController.cc
View file @
63abdfd5
...
...
@@ -82,13 +82,28 @@ void RallyPointController::managerVehicleChanged(Vehicle* managerVehicle)
bool
RallyPointController
::
load
(
const
QJsonObject
&
json
,
QString
&
errorString
)
{
removeAll
();
errorString
.
clear
();
if
(
json
.
contains
(
JsonHelper
::
jsonVersionKey
)
&&
json
[
JsonHelper
::
jsonVersionKey
].
toInt
()
==
1
)
{
// We just ignore old version 1 data
return
true
;
}
QList
<
JsonHelper
::
KeyValidateInfo
>
keyInfoList
=
{
{
JsonHelper
::
jsonVersionKey
,
QJsonValue
::
Double
,
true
},
{
_jsonPointsKey
,
QJsonValue
::
Array
,
true
},
};
if
(
!
JsonHelper
::
validateKeys
(
json
,
keyInfoList
,
errorString
))
{
return
false
;
}
QString
errorStr
;
QString
errorMessage
=
tr
(
"Rally: %1"
);
// Check for required keys
QStringList
requiredKeys
=
{
_jsonPointsKey
};
if
(
!
JsonHelper
::
validateRequiredKeys
(
json
,
requiredKeys
,
errorStr
))
{
errorString
=
errorMessage
.
arg
(
errorStr
);
if
(
json
[
JsonHelper
::
jsonVersionKey
].
toInt
()
!=
_jsonCurrentVersion
)
{
errorString
=
tr
(
"Rally Points supports version %1"
).
arg
(
_jsonCurrentVersion
);
return
false
;
}
...
...
@@ -97,7 +112,7 @@ bool RallyPointController::load(const QJsonObject& json, QString& errorString)
errorString
=
errorMessage
.
arg
(
errorStr
);
return
false
;
}
_points
.
clearAndDeleteContents
();
QObjectList
pointList
;
for
(
int
i
=
0
;
i
<
rgPoints
.
count
();
i
++
)
{
pointList
.
append
(
new
RallyPoint
(
rgPoints
[
i
],
this
));
...
...
@@ -112,7 +127,7 @@ bool RallyPointController::load(const QJsonObject& json, QString& errorString)
void
RallyPointController
::
save
(
QJsonObject
&
json
)
{
json
[
JsonHelper
::
jsonVersionKey
]
=
1
;
json
[
JsonHelper
::
jsonVersionKey
]
=
_jsonCurrentVersion
;
QJsonArray
rgPoints
;
QJsonValue
jsonPoint
;
...
...
src/MissionManager/RallyPointController.h
View file @
63abdfd5
...
...
@@ -74,6 +74,8 @@ private:
QObject
*
_currentRallyPoint
;
bool
_itemsRequested
;
static
const
int
_jsonCurrentVersion
=
2
;
static
const
char
*
_jsonFileTypeValue
;
static
const
char
*
_jsonPointsKey
;
};
...
...
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