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
529a0873
Commit
529a0873
authored
Aug 05, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move handleParameterUpdate into data model class
parent
83409be5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
13 deletions
+27
-13
UASParameterDataModel.cc
src/uas/UASParameterDataModel.cc
+23
-1
UASParameterDataModel.h
src/uas/UASParameterDataModel.h
+2
-0
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+2
-12
No files found.
src/uas/UASParameterDataModel.cc
View file @
529a0873
#include "UASParameterDataModel.h"
#include <QDebug>
#include <QVariant>
UASParameterDataModel
::
UASParameterDataModel
(
QObject
*
parent
)
:
...
...
@@ -31,7 +32,7 @@ void UASParameterDataModel::setPendingParameter(int componentId, QString& key,
params
->
insert
(
key
,
value
);
}
void
UASParameterDataModel
::
setOnboardParameter
(
int
componentId
,
QString
&
key
,
QVariant
&
value
)
void
UASParameterDataModel
::
setOnboardParameter
(
int
componentId
,
QString
&
key
,
QVariant
&
value
)
{
//ensure we have a placeholder map for this component
addComponent
(
componentId
);
...
...
@@ -48,3 +49,24 @@ void UASParameterDataModel::addComponent(int componentId)
pendingParameters
.
insert
(
componentId
,
new
QMap
<
QString
,
QVariant
>
());
}
}
void
UASParameterDataModel
::
handleParameterUpdate
(
int
componentId
,
QString
&
key
,
QVariant
&
value
)
{
//verify that the value requested by the user matches the set value
//if it doesn't match, leave the pending parameter in the pending list!
if
(
pendingParameters
.
contains
(
componentId
))
{
QMap
<
QString
,
QVariant
>
*
pendingParams
=
pendingParameters
.
value
(
componentId
);
if
((
NULL
!=
pendingParams
)
&&
pendingParams
->
contains
(
key
))
{
QVariant
reqVal
=
pendingParams
->
value
(
key
);
if
(
reqVal
==
value
)
{
pendingParams
->
remove
(
key
);
}
else
{
qDebug
()
<<
"Pending commit for "
<<
key
<<
" want: "
<<
reqVal
<<
" got: "
<<
value
;
}
}
}
setOnboardParameter
(
componentId
,
key
,
value
);
}
src/uas/UASParameterDataModel.h
View file @
529a0873
...
...
@@ -22,6 +22,8 @@ public:
virtual
void
addPendingIfParameterChanged
(
int
componentId
,
QString
&
key
,
QVariant
&
value
);
void
handleParameterUpdate
(
int
componentId
,
QString
&
key
,
QVariant
&
value
);
QMap
<
QString
,
QVariant
>*
getPendingParametersForComponent
(
int
componentId
)
{
return
pendingParameters
.
value
(
componentId
);
}
...
...
src/ui/QGCParamWidget.cc
View file @
529a0873
...
...
@@ -636,18 +636,8 @@ void QGCParamWidget::receivedParameterUpdate(int uas, int component, QString par
parameterItem
->
setToolTip
(
0
,
tooltipFormat
);
parameterItem
->
setToolTip
(
1
,
tooltipFormat
);
//verify that the value requested by the user matches the set value
//if it doesn't match, leave the pending parameter in the pending list!
QMap
<
int
,
QMap
<
QString
,
QVariant
>
*>
changedValues
=
this
->
paramDataModel
->
getPendingParameters
();
if
(
changedValues
.
contains
(
component
))
{
QMap
<
QString
,
QVariant
>
*
compReqVals
=
changedValues
.
value
(
component
);
if
((
NULL
!=
compReqVals
)
&&
compReqVals
->
contains
(
parameterName
))
{
QVariant
reqVal
=
compReqVals
->
value
(
parameterName
);
if
(
reqVal
==
value
)
{
compReqVals
->
remove
(
parameterName
);
}
}
}
paramDataModel
->
handleParameterUpdate
(
component
,
parameterName
,
value
);
}
/**
...
...
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