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
a37f8489
Commit
a37f8489
authored
Jun 07, 2013
by
Bryant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the UASQuickView support resetting to a default state after all UASes are removed.
parent
b1fc82ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
23 deletions
+43
-23
UASQuickView.cc
src/ui/uas/UASQuickView.cc
+43
-23
No files found.
src/ui/uas/UASQuickView.cc
View file @
a37f8489
...
...
@@ -78,7 +78,6 @@ UASQuickView::UASQuickView(QWidget *parent) :
updateTimer
=
new
QTimer
(
this
);
connect
(
updateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateTimerTick
()));
updateTimer
->
start
(
1000
);
}
void
UASQuickView
::
updateTimerTick
()
{
...
...
@@ -104,23 +103,35 @@ void UASQuickView::addUAS(UASInterface* uas)
void
UASQuickView
::
setActiveUAS
(
UASInterface
*
uas
)
{
if
(
!
uas
)
// Clean up from the old UAS
if
(
this
->
uas
)
{
return
;
uasPropertyList
.
clear
();
uasPropertyValueMap
.
clear
();
uasPropertyToLabelMap
.
clear
();
updateTimer
->
stop
();
this
->
actions
().
clear
();
}
this
->
uas
=
uas
;
connect
(
uas
,
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
this
,
SLOT
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
uasPropertyList
.
clear
();
// And connect the new one if it exists.
if
(
this
->
uas
)
{
// Monitor new UAS for changes
connect
(
this
->
uas
,
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
this
,
SLOT
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
// Populate a right-click menu for selecting which properties to display
qDebug
()
<<
"UASInfoWidget property count:"
<<
uas
->
metaObject
()
->
propertyCount
();
for
(
int
i
=
0
;
i
<
uas
->
metaObject
()
->
propertyCount
();
i
++
)
for
(
int
i
=
0
;
i
<
this
->
uas
->
metaObject
()
->
propertyCount
();
i
++
)
{
if
(
uas
->
metaObject
()
->
property
(
i
).
hasNotifySignal
())
if
(
this
->
uas
->
metaObject
()
->
property
(
i
).
hasNotifySignal
())
{
qDebug
()
<<
"Property:"
<<
i
<<
uas
->
metaObject
()
->
property
(
i
).
name
();
uasPropertyList
.
append
(
uas
->
metaObject
()
->
property
(
i
).
name
());
if
(
!
uasPropertyToLabelMap
.
contains
(
uas
->
metaObject
()
->
property
(
i
).
name
()))
qDebug
()
<<
"Property:"
<<
i
<<
this
->
uas
->
metaObject
()
->
property
(
i
).
name
();
uasPropertyList
.
append
(
this
->
uas
->
metaObject
()
->
property
(
i
).
name
());
if
(
!
uasPropertyToLabelMap
.
contains
(
this
->
uas
->
metaObject
()
->
property
(
i
).
name
()))
{
QAction
*
action
=
new
QAction
(
QString
(
uas
->
metaObject
()
->
property
(
i
).
name
()),
this
);
QAction
*
action
=
new
QAction
(
QString
(
this
->
uas
->
metaObject
()
->
property
(
i
).
name
()),
this
);
action
->
setCheckable
(
true
);
connect
(
action
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
actionTriggered
(
bool
)));
this
->
addAction
(
action
);
...
...
@@ -137,6 +148,10 @@ void UASQuickView::setActiveUAS(UASInterface* uas)
}
}
}
// And periodically update the view.
updateTimer
->
start
(
1000
);
}
}
void
UASQuickView
::
actionTriggered
(
bool
checked
)
{
...
...
@@ -162,11 +177,16 @@ void UASQuickView::actionTriggered(bool checked)
}
void
UASQuickView
::
valueChanged
(
const
int
uasid
,
const
QString
&
name
,
const
QString
&
unit
,
const
QVariant
value
,
const
quint64
msecs
)
{
Q_UNUSED
(
uasid
);
Q_UNUSED
(
unit
);
Q_UNUSED
(
msecs
);
uasPropertyValueMap
[
name
]
=
value
.
toDouble
();
}
void
UASQuickView
::
valChanged
(
double
val
,
QString
type
)
{
Q_UNUSED
(
val
);
Q_UNUSED
(
type
);
//qDebug() << "Value changed:" << type << val;
// uasPropertyValueMap[type] = val;
}
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