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
b3cff5ca
Commit
b3cff5ca
authored
Jun 06, 2013
by
Bryant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added groupboxes around UASes in the ListWidget to indicate primary communication channel.
parent
44684144
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
9 deletions
+73
-9
UASListWidget.cc
src/ui/uas/UASListWidget.cc
+68
-8
UASListWidget.h
src/ui/uas/UASListWidget.h
+5
-1
No files found.
src/ui/uas/UASListWidget.cc
View file @
b3cff5ca
...
@@ -45,7 +45,8 @@ This file is part of the PIXHAWK project
...
@@ -45,7 +45,8 @@ This file is part of the PIXHAWK project
#include "MAVLinkSimulationLink.h"
#include "MAVLinkSimulationLink.h"
#include "LinkManager.h"
#include "LinkManager.h"
UASListWidget
::
UASListWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
m_ui
(
new
Ui
::
UASList
)
UASListWidget
::
UASListWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
m_ui
(
new
Ui
::
UASList
)
{
{
m_ui
->
setupUi
(
this
);
m_ui
->
setupUi
(
this
);
m_ui
->
verticalLayout
->
setAlignment
(
Qt
::
AlignTop
);
m_ui
->
verticalLayout
->
setAlignment
(
Qt
::
AlignTop
);
...
@@ -54,11 +55,13 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA
...
@@ -54,11 +55,13 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UA
uWidget
=
new
QGCUnconnectedInfoWidget
(
this
);
uWidget
=
new
QGCUnconnectedInfoWidget
(
this
);
m_ui
->
verticalLayout
->
addWidget
(
uWidget
);
m_ui
->
verticalLayout
->
addWidget
(
uWidget
);
linkToBoxMapping
=
QMap
<
LinkInterface
*
,
QGroupBox
*>
();
uasViews
=
QMap
<
UASInterface
*
,
UASView
*>
();
uasViews
=
QMap
<
UASInterface
*
,
UASView
*>
();
this
->
setVisible
(
false
);
this
->
setVisible
(
false
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
addUAS
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
addUAS
(
UASInterface
*
)));
// Get a list of all existing UAS
// Get a list of all existing UAS
foreach
(
UASInterface
*
uas
,
UASManager
::
instance
()
->
getUASList
())
{
foreach
(
UASInterface
*
uas
,
UASManager
::
instance
()
->
getUASList
())
{
...
@@ -96,8 +99,38 @@ void UASListWidget::addUAS(UASInterface* uas)
...
@@ -96,8 +99,38 @@ void UASListWidget::addUAS(UASInterface* uas)
if
(
!
uasViews
.
contains
(
uas
))
if
(
!
uasViews
.
contains
(
uas
))
{
{
uasViews
.
insert
(
uas
,
new
UASView
(
uas
,
this
));
// Only display the UAS in a single link.
m_ui
->
verticalLayout
->
addWidget
(
uasViews
.
value
(
uas
));
QList
<
LinkInterface
*>*
x
=
uas
->
getLinks
();
if
(
x
->
size
())
{
LinkInterface
*
li
=
x
->
at
(
0
);
// Find an existing QGroupBox for this LinkInterface or create a
// new one.
QGroupBox
*
newBox
;
if
(
linkToBoxMapping
.
contains
(
li
))
{
newBox
=
linkToBoxMapping
[
li
];
}
else
{
newBox
=
new
QGroupBox
(
li
->
getName
(),
this
);
QVBoxLayout
*
boxLayout
=
new
QVBoxLayout
(
newBox
);
newBox
->
setLayout
(
boxLayout
);
m_ui
->
verticalLayout
->
addWidget
(
newBox
);
linkToBoxMapping
[
li
]
=
newBox
;
}
// And add the new UAS to the UASList
UASView
*
newView
=
new
UASView
(
uas
,
newBox
);
uasViews
.
insert
(
uas
,
newView
);
newBox
->
layout
()
->
addWidget
(
newView
);
// Watch for when this widget is destroyed so that we can clean up the
// groupbox if necessary.
connect
(
newView
,
SIGNAL
(
destroyed
(
QObject
*
)),
this
,
SLOT
(
removeUASView
(
QObject
*
)));
}
}
}
}
}
...
@@ -109,9 +142,36 @@ void UASListWidget::activeUAS(UASInterface* uas)
...
@@ -109,9 +142,36 @@ void UASListWidget::activeUAS(UASInterface* uas)
}
}
}
}
void
UASListWidget
::
removeUAS
(
UASInterface
*
uas
)
/**
* If the UAS was removed, check to see if it was the last one in the QGroupBox and delete
* the QGroupBox if so.
*/
void
UASListWidget
::
removeUASView
(
QObject
*
widget
)
{
{
m_ui
->
verticalLayout
->
removeWidget
(
uasViews
.
value
(
uas
));
UASView
*
view
=
(
UASView
*
)
widget
;
uasViews
.
value
(
uas
)
->
deleteLater
();
if
(
view
)
{
uasViews
.
remove
(
uas
);
int
views
=
view
->
parentWidget
()
->
findChildren
<
UASView
*>
().
size
();
if
(
views
==
0
)
{
// Delete the groupbox
view
->
parentWidget
()
->
deleteLater
();
// Remove the associated UAS from our list.
UASInterface
*
uas
=
uasViews
.
key
(
view
,
NULL
);
if
(
uas
)
{
uasViews
.
remove
(
uas
);
}
// And remove this GroupBox from our mapping.
LinkInterface
*
link
=
linkToBoxMapping
.
key
((
QGroupBox
*
)
view
->
parentWidget
(),
NULL
);
if
(
link
)
{
linkToBoxMapping
.
remove
(
link
);
}
// And put the initial widget back.
uWidget
=
new
QGCUnconnectedInfoWidget
(
this
);
m_ui
->
verticalLayout
->
addWidget
(
uWidget
);
}
}
}
}
src/ui/uas/UASListWidget.h
View file @
b3cff5ca
...
@@ -34,6 +34,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -34,6 +34,7 @@ This file is part of the QGROUNDCONTROL project
#include <QWidget>
#include <QWidget>
#include <QMap>
#include <QMap>
#include <QVBoxLayout>
#include <QVBoxLayout>
#include <QGroupBox>
#include "UASInterface.h"
#include "UASInterface.h"
#include "UASView.h"
#include "UASView.h"
#include "QGCUnconnectedInfoWidget.h"
#include "QGCUnconnectedInfoWidget.h"
...
@@ -50,9 +51,12 @@ public:
...
@@ -50,9 +51,12 @@ public:
public
slots
:
public
slots
:
void
addUAS
(
UASInterface
*
uas
);
void
addUAS
(
UASInterface
*
uas
);
void
activeUAS
(
UASInterface
*
uas
);
void
activeUAS
(
UASInterface
*
uas
);
void
removeUAS
(
UASInterface
*
uas
);
void
removeUAS
View
(
QObject
*
widget
);
protected:
protected:
// Keep a mapping from Links to GroupBoxes for adding new links.
QMap
<
LinkInterface
*
,
QGroupBox
*>
linkToBoxMapping
;
// Tie each view to their UAS object.
QMap
<
UASInterface
*
,
UASView
*>
uasViews
;
QMap
<
UASInterface
*
,
UASView
*>
uasViews
;
QGCUnconnectedInfoWidget
*
uWidget
;
QGCUnconnectedInfoWidget
*
uWidget
;
void
changeEvent
(
QEvent
*
e
);
void
changeEvent
(
QEvent
*
e
);
...
...
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