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
c8942215
Commit
c8942215
authored
Nov 22, 2015
by
Don Gagne
Browse files
Work correctly when no Vehicle
parent
3d9a4ce4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/FactSystem/FactControls/FactPanelController.cc
View file @
c8942215
...
...
@@ -33,19 +33,18 @@
QGC_LOGGING_CATEGORY
(
FactPanelControllerLog
,
"FactPanelControllerLog"
)
FactPanelController
::
FactPanelController
(
void
)
:
_factPanel
(
NULL
)
FactPanelController
::
FactPanelController
(
void
)
:
_vehicle
(
NULL
)
,
_uas
(
NULL
)
,
_autopilot
(
NULL
)
,
_factPanel
(
NULL
)
{
_vehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
();
Q_ASSERT
(
_vehicle
);
_uas
=
_vehicle
->
uas
();
Q_ASSERT
(
_uas
);
_autopilot
=
_vehicle
->
autopilotPlugin
();
Q_ASSERT
(
_autopilot
);
Q_ASSERT
(
_autopilot
->
parametersReady
());
Q_ASSERT
(
!
_autopilot
->
missingParameters
());
if
(
_vehicle
)
{
_uas
=
_vehicle
->
uas
();
_autopilot
=
_vehicle
->
autopilotPlugin
();
}
// Do a delayed check for the _factPanel finally being set correctly from Qml
QTimer
::
singleShot
(
1000
,
this
,
&
FactPanelController
::
_checkForMissingFactPanel
);
...
...
@@ -114,7 +113,7 @@ bool FactPanelController::_allParametersExists(int componentId, QStringList name
bool
noMissingFacts
=
true
;
foreach
(
QString
name
,
names
)
{
if
(
!
_autopilot
->
parameterExists
(
componentId
,
name
))
{
if
(
_autopilot
&&
!
_autopilot
->
parameterExists
(
componentId
,
name
))
{
_reportMissingParameter
(
componentId
,
name
);
noMissingFacts
=
false
;
}
...
...
@@ -132,7 +131,7 @@ void FactPanelController::_checkForMissingFactPanel(void)
Fact
*
FactPanelController
::
getParameterFact
(
int
componentId
,
const
QString
&
name
)
{
if
(
_autopilot
->
parameterExists
(
componentId
,
name
))
{
if
(
_autopilot
&&
_autopilot
->
parameterExists
(
componentId
,
name
))
{
Fact
*
fact
=
_autopilot
->
getParameterFact
(
componentId
,
name
);
QQmlEngine
::
setObjectOwnership
(
fact
,
QQmlEngine
::
CppOwnership
);
return
fact
;
...
...
@@ -144,7 +143,7 @@ Fact* FactPanelController::getParameterFact(int componentId, const QString& name
bool
FactPanelController
::
parameterExists
(
int
componentId
,
const
QString
&
name
)
{
return
_autopilot
->
parameterExists
(
componentId
,
name
);
return
_autopilot
?
_autopilot
->
parameterExists
(
componentId
,
name
)
:
false
;
}
void
FactPanelController
::
_showInternalError
(
const
QString
&
errorMsg
)
...
...
src/QmlControls/ParameterEditorController.cc
View file @
c8942215
...
...
@@ -34,11 +34,13 @@
/// @Brief Constructs a new ParameterEditorController Widget. This widget is used within the PX4VehicleConfig set of screens.
ParameterEditorController
::
ParameterEditorController
(
void
)
{
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
foreach
(
int
componentId
,
groupMap
.
keys
())
{
_componentIds
+=
QString
(
"%1"
).
arg
(
componentId
);
}
if
(
_autopilot
)
{
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
foreach
(
int
componentId
,
groupMap
.
keys
())
{
_componentIds
+=
QString
(
"%1"
).
arg
(
componentId
);
}
}
}
ParameterEditorController
::~
ParameterEditorController
()
...
...
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