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
b6a6fe96
Commit
b6a6fe96
authored
Dec 24, 2019
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
dd1cc241
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
159 deletions
+0
-159
MultiVehicleDockWidget.cc
src/ui/MultiVehicleDockWidget.cc
+0
-80
MultiVehicleDockWidget.h
src/ui/MultiVehicleDockWidget.h
+0
-52
MultiVehicleDockWidget.ui
src/ui/MultiVehicleDockWidget.ui
+0
-27
No files found.
src/ui/MultiVehicleDockWidget.cc
deleted
100644 → 0
View file @
dd1cc241
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "MultiVehicleDockWidget.h"
#include "ui_MultiVehicleDockWidget.h"
#include "MultiVehicleManager.h"
#include "QGCApplication.h"
MultiVehicleDockWidget
::
MultiVehicleDockWidget
(
const
QString
&
title
,
QAction
*
action
,
QWidget
*
parent
)
:
QGCDockWidget
(
title
,
action
,
parent
)
,
_ui
(
new
Ui
::
MultiVehicleDockWidget
)
{
_ui
->
setupUi
(
this
);
setWindowTitle
(
title
);
connect
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
MultiVehicleDockWidget
::
_activeVehicleChanged
);
connect
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
&
MultiVehicleManager
::
vehicleAdded
,
this
,
&
MultiVehicleDockWidget
::
_vehicleAdded
);
connect
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
&
MultiVehicleManager
::
vehicleRemoved
,
this
,
&
MultiVehicleDockWidget
::
_vehicleRemoved
);
}
void
MultiVehicleDockWidget
::
init
(
void
)
{
QmlObjectListModel
*
vehicles
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
vehicles
();
for
(
int
i
=
0
;
i
<
vehicles
->
count
();
i
++
)
{
_vehicleAdded
(
qobject_cast
<
Vehicle
*>
(
vehicles
->
get
(
i
)));
}
if
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
())
{
_activeVehicleChanged
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
());
}
}
MultiVehicleDockWidget
::~
MultiVehicleDockWidget
()
{
delete
_ui
;
}
void
MultiVehicleDockWidget
::
_vehicleRemoved
(
Vehicle
*
vehicle
)
{
int
id
=
vehicle
->
id
();
if
(
_vehicleWidgets
.
contains
(
id
))
{
_vehicleWidgets
[
id
]
->
deleteLater
();
_vehicleWidgets
.
remove
(
id
);
}
}
void
MultiVehicleDockWidget
::
_vehicleAdded
(
Vehicle
*
vehicle
)
{
int
id
=
vehicle
->
id
();
if
(
!
_vehicleWidgets
.
contains
(
id
))
{
QWidget
*
vehicleWidget
=
_newVehicleWidget
(
vehicle
,
_ui
->
stackedWidget
);
_vehicleWidgets
[
id
]
=
vehicleWidget
;
_ui
->
stackedWidget
->
addWidget
(
vehicleWidget
);
}
}
void
MultiVehicleDockWidget
::
_activeVehicleChanged
(
Vehicle
*
vehicle
)
{
if
(
vehicle
)
{
int
id
=
vehicle
->
id
();
if
(
!
_vehicleWidgets
.
contains
(
id
))
{
_vehicleAdded
(
vehicle
);
}
QWidget
*
vehicleWidget
=
_vehicleWidgets
[
id
];
_ui
->
stackedWidget
->
setCurrentWidget
(
vehicleWidget
);
}
}
src/ui/MultiVehicleDockWidget.h
deleted
100644 → 0
View file @
dd1cc241
/****************************************************************************
*
* (c) 2009-2018 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include <QMap>
#include "QGCDockWidget.h"
#include "Vehicle.h"
namespace
Ui
{
class
MultiVehicleDockWidget
;
}
/// Provides a base class for a dock widget which automatically handles
/// Vehicles coming and going. It does this by using a stacked widget which
/// holds individual Vehicle specific widgets.
class
MultiVehicleDockWidget
:
public
QGCDockWidget
{
Q_OBJECT
public:
explicit
MultiVehicleDockWidget
(
const
QString
&
title
,
QAction
*
action
,
QWidget
*
parent
=
0
);
~
MultiVehicleDockWidget
();
/// Must be called in the derived class contructor to initialize the base class
void
init
(
void
);
protected:
/// Derived class must implement this to create the QWidget for the
/// specified Vehicle.
virtual
QWidget
*
_newVehicleWidget
(
Vehicle
*
vehicle
,
QWidget
*
parent
)
=
0
;
private
slots
:
void
_vehicleAdded
(
Vehicle
*
vehicle
);
void
_vehicleRemoved
(
Vehicle
*
vehicle
);
void
_activeVehicleChanged
(
Vehicle
*
vehicle
);
private:
QMap
<
int
,
QWidget
*>
_vehicleWidgets
;
Ui
::
MultiVehicleDockWidget
*
_ui
;
};
src/ui/MultiVehicleDockWidget.ui
deleted
100644 → 0
View file @
dd1cc241
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
MultiVehicleDockWidget
</class>
<widget
class=
"QWidget"
name=
"MultiVehicleDockWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
200
</width>
<height>
300
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<property
name=
"margin"
>
<number>
0
</number>
</property>
<item>
<widget
class=
"QStackedWidget"
name=
"stackedWidget"
/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
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