Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qgroundcontrol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Valentin Platzgummer
qgroundcontrol
Commits
e79c7162
Commit
e79c7162
authored
10 years ago
by
Don Gagne
Browse files
Options
Downloads
Patches
Plain Diff
Fix generic metadata loading
parent
c041e95b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/FactSystem/FactLoader.cc
+14
-7
14 additions, 7 deletions
src/FactSystem/FactLoader.cc
with
14 additions
and
7 deletions
src/FactSystem/FactLoader.cc
+
14
−
7
View file @
e79c7162
...
...
@@ -82,18 +82,18 @@ void FactLoader::_parameterChanged(int uas, int component, QString parameterName
Q_ASSERT
(
component
==
_lastSeenComponent
);
}
bool
setMetaData
=
false
;
if
(
!
_mapParameterName2Variant
.
contains
(
parameterName
))
{
qCDebug
(
FactLoaderLog
)
<<
"Adding new fact"
<<
parameterName
;
Fact
*
fact
=
new
Fact
(
parameterName
,
this
);
setMetaData
=
true
;
_mapParameterName2Variant
[
parameterName
]
=
QVariant
::
fromValue
(
fact
);
_mapFact2ParameterName
[
fact
]
=
parameterName
;
// We need to know when the fact changes from QML so that we can send the new value to the parameter manager
connect
(
fact
,
&
Fact
::
_containerValueChanged
,
this
,
&
FactLoader
::
_valueUpdated
);
_addMetaDataToFact
(
fact
);
}
Q_ASSERT
(
_mapParameterName2Variant
.
contains
(
parameterName
));
...
...
@@ -103,6 +103,10 @@ void FactLoader::_parameterChanged(int uas, int component, QString parameterName
Fact
*
fact
=
_mapParameterName2Variant
[
parameterName
].
value
<
Fact
*>
();
Q_ASSERT
(
fact
);
fact
->
_containerSetValue
(
value
);
if
(
setMetaData
)
{
_addMetaDataToFact
(
fact
);
}
}
/// Connected to Fact::valueUpdated
...
...
@@ -122,23 +126,26 @@ void FactLoader::_valueUpdated(QVariant value)
case
FactMetaData
::
valueTypeInt8
:
case
FactMetaData
::
valueTypeInt16
:
case
FactMetaData
::
valueTypeInt32
:
typedValue
=
QVariant
(
value
.
value
<
int
>
());
typedValue
.
setValue
(
QVariant
(
value
.
toInt
()));
break
;
case
FactMetaData
::
valueTypeUint8
:
case
FactMetaData
::
valueTypeUint16
:
case
FactMetaData
::
valueTypeUint32
:
typedValue
=
QVariant
(
value
.
value
<
ui
nt
>
());
typedValue
.
setValue
(
value
.
toUI
nt
());
break
;
case
FactMetaData
::
valueTypeFloat
:
typedValue
=
QVariant
(
value
.
toFloat
());
typedValue
.
setValue
(
value
.
toFloat
());
break
;
case
FactMetaData
::
valueTypeDouble
:
typedValue
=
QVariant
(
value
.
toDouble
());
typedValue
.
setValue
(
value
.
toDouble
());
break
;
}
qCDebug
(
FactLoaderLog
)
<<
"Set parameter"
<<
fact
->
name
()
<<
typedValue
;
_paramMgr
->
setParameter
(
_lastSeenComponent
,
_mapFact2ParameterName
[
fact
],
typedValue
);
_paramMgr
->
sendPendingParameters
(
true
/* persistAfterSend */
,
false
/* forceSend */
);
}
...
...
@@ -191,7 +198,7 @@ void FactLoader::_addMetaDataToFact(Fact* fact)
break
;
default:
q
C
Warning
(
FactLoaderLog
)
<<
"Invalid variant type"
<<
fact
->
value
().
type
();
qWarning
(
)
<<
fact
->
name
(
)
<<
"Invalid variant type"
<<
fact
->
value
().
type
();
break
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment