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
d542a9f1
Commit
d542a9f1
authored
Jul 31, 2015
by
Lorenz Meier
Browse files
Update airframe meta handler
parent
815fa1e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/AutoPilotPlugins/PX4/AirframeComponentAirframes.cc
View file @
d542a9f1
...
...
@@ -30,6 +30,7 @@ QMap<QString, AirframeComponentAirframes::AirframeType_t*> AirframeComponentAirf
QMap
<
QString
,
AirframeComponentAirframes
::
AirframeType_t
*>&
AirframeComponentAirframes
::
get
()
{
#if 0
// Set a single airframe to prevent the UI from going crazy
if (rgAirframeTypes.count() == 0) {
// Standard planes
...
...
@@ -45,18 +46,39 @@ QMap<QString, AirframeComponentAirframes::AirframeType_t*>& AirframeComponentAir
// Flying wings
}
#endif
return
rgAirframeTypes
;
}
void
AirframeComponentAirframes
::
insert
(
QString
&
group
,
QString
&
image
,
QString
&
name
,
int
id
)
{
AirframeType_t
*
g
;
if
(
!
rgAirframeTypes
.
contains
(
group
))
{
g
=
new
AirframeType_t
;
g
->
name
=
group
;
g
->
imageResource
=
QString
(
"qrc:/qmlimages/"
).
append
(
image
);
qDebug
()
<<
"IMAGE:"
<<
g
->
imageResource
;
rgAirframeTypes
.
insert
(
group
,
g
);
}
else
{
g
=
rgAirframeTypes
.
value
(
group
);
}
AirframeInfo_t
*
i
=
new
AirframeInfo_t
;
i
->
name
=
name
;
i
->
autostartId
=
id
;
g
->
rgAirframeInfo
.
append
(
i
);
}
void
AirframeComponentAirframes
::
clear
()
{
// Run through all and delete them
for
(
unsigned
tindex
=
0
;
tindex
<
AirframeComponentAirframes
::
get
().
count
();
tindex
++
)
{
for
(
int
tindex
=
0
;
tindex
<
AirframeComponentAirframes
::
get
().
count
();
tindex
++
)
{
const
AirframeComponentAirframes
::
AirframeType_t
*
pType
=
AirframeComponentAirframes
::
get
().
values
().
at
(
tindex
);
for
(
unsigned
index
=
0
;
index
<
pType
->
rgAirframeInfo
.
count
();
index
++
)
{
for
(
int
index
=
0
;
index
<
pType
->
rgAirframeInfo
.
count
();
index
++
)
{
const
AirframeComponentAirframes
::
AirframeInfo_t
*
pInfo
=
pType
->
rgAirframeInfo
.
at
(
index
);
delete
pInfo
;
}
...
...
src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h
View file @
d542a9f1
...
...
@@ -52,6 +52,7 @@ public:
static
QMap
<
QString
,
AirframeComponentAirframes
::
AirframeType_t
*>&
get
();
static
void
clear
();
static
void
insert
(
QString
&
group
,
QString
&
image
,
QString
&
name
,
int
id
);
protected:
static
QMap
<
QString
,
AirframeType_t
*>
rgAirframeTypes
;
...
...
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