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
55cdf5db
Commit
55cdf5db
authored
Dec 21, 2010
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved and bugfixed window persistence
parent
e53a9d6f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
546 additions
and
958 deletions
+546
-958
UASManager.cc
src/uas/UASManager.cc
+13
-1
DebugConsole.cc
src/ui/DebugConsole.cc
+24
-24
HDDisplay.cc
src/ui/HDDisplay.cc
+2
-2
HUD.cc
src/ui/HUD.cc
+10
-2
MainWindow.cc
src/ui/MainWindow.cc
+490
-922
MainWindow.h
src/ui/MainWindow.h
+7
-7
No files found.
src/uas/UASManager.cc
View file @
55cdf5db
...
...
@@ -71,6 +71,18 @@ void UASManager::run()
void
UASManager
::
addUAS
(
UASInterface
*
uas
)
{
// WARNING: The active uas is set here
// and then announced below. This is necessary
// to make sure the getActiveUAS() function
// returns the UAS once the UASCreated() signal
// is emitted. The code is thus NOT redundant.
bool
firstUAS
=
false
;
if
(
activeUAS
==
NULL
)
{
firstUAS
=
true
;
activeUAS
=
uas
;
}
// Only execute if there is no UAS at this index
if
(
!
systems
.
contains
(
uas
->
getUASID
()))
{
...
...
@@ -79,7 +91,7 @@ void UASManager::addUAS(UASInterface* uas)
}
// If there is no active UAS yet, set the first one as the active UAS
if
(
activeUAS
==
NULL
)
if
(
firstUAS
)
{
setActiveUAS
(
uas
);
}
...
...
src/ui/DebugConsole.cc
View file @
55cdf5db
...
...
@@ -205,30 +205,30 @@ void DebugConsole::paintEvent(QPaintEvent *event)
{
Q_UNUSED
(
event
);
// Update bandwidth
if
(
holdOn
)
{
//qDebug() << "Data rate:" << dataRate/1000.0f << "kB/s";
QString
rate
(
"data rate: %1"
);
rate
.
arg
(
dataRate
);
QPainter
painter
(
this
);
painter
.
setRenderHint
(
QPainter
::
HighQualityAntialiasing
);
painter
.
translate
(
width
()
/
5.0
f
,
height
()
/
5.0
f
);
//QFont font("Bitstream Vera Sans");
QFont
font
=
painter
.
font
();
font
.
setPixelSize
((
int
)(
60.0
f
));
QFontMetrics
metrics
=
QFontMetrics
(
font
);
int
border
=
qMax
(
4
,
metrics
.
leading
());
QRect
rect
=
metrics
.
boundingRect
(
0
,
0
,
width
()
-
2
*
border
,
int
(
height
()
*
0.125
),
Qt
::
AlignLeft
|
Qt
::
TextWordWrap
,
rate
);
painter
.
setPen
(
QColor
(
255
,
50
,
50
));
painter
.
setRenderHint
(
QPainter
::
TextAntialiasing
);
painter
.
drawText
(
QRect
(
QPoint
(
static_cast
<
int
>
(
width
()
/
5.0
f
),
static_cast
<
int
>
(
height
()
/
5.0
f
)),
QPoint
(
static_cast
<
int
>
(
width
()
-
width
()
/
5.0
f
),
static_cast
<
int
>
(
height
()
-
height
()
/
5.0
f
))),
rate
);
//Qt::AlignRight | Qt::TextWordWrap
}
//
if (holdOn)
//
{
//
//qDebug() << "Data rate:" << dataRate/1000.0f << "kB/s";
//
QString rate("data rate: %1");
//
rate.arg(dataRate);
//
QPainter painter(this);
//
painter.setRenderHint(QPainter::HighQualityAntialiasing);
//
painter.translate(width()/5.0f, height()/5.0f);
//
//QFont font("Bitstream Vera Sans");
//
QFont font = painter.font();
//
font.setPixelSize((int)(60.0f));
//
QFontMetrics metrics = QFontMetrics(font);
//
int border = qMax(4, metrics.leading());
//
QRect rect = metrics.boundingRect(0, 0, width() - 2*border, int(height()*0.125),
//
Qt::AlignLeft | Qt::TextWordWrap, rate);
//
painter.setPen(QColor(255, 50, 50));
//
painter.setRenderHint(QPainter::TextAntialiasing);
//
painter.drawText(QRect(QPoint(static_cast<int>(width()/5.0f), static_cast<int>(height()/5.0f)), QPoint(static_cast<int>(width() - width()/5.0f), static_cast<int>(height() - height()/5.0f))), rate);
//
//Qt::AlignRight | Qt::TextWordWrap
//
}
}
void
DebugConsole
::
receiveBytes
(
LinkInterface
*
link
,
QByteArray
bytes
)
...
...
src/ui/HDDisplay.cc
View file @
55cdf5db
...
...
@@ -134,7 +134,7 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) :
if
(
!
QFile
::
exists
(
fontFileName
))
qDebug
()
<<
"ERROR! font file: "
<<
fontFileName
<<
" DOES NOT EXIST!"
;
fontDatabase
.
addApplicationFont
(
fontFileName
);
font
=
fontDatabase
.
font
(
fontFamilyName
,
"Roman"
,
(
int
)(
10
*
scalingFactor
*
1.2
f
+
0.5
f
));
font
=
fontDatabase
.
font
(
fontFamilyName
,
"Roman"
,
qMax
(
5
,
(
int
)(
10
*
scalingFactor
*
1.2
f
+
0.5
f
)
));
if
(
font
.
family
()
!=
fontFamilyName
)
qDebug
()
<<
"ERROR! Font not loaded: "
<<
fontFamilyName
;
// Connect with UAS
...
...
@@ -151,7 +151,7 @@ HDDisplay::~HDDisplay()
void
HDDisplay
::
enableGLRendering
(
bool
enable
)
{
Q_UNUSED
(
enable
)
}
void
HDDisplay
::
triggerUpdate
()
...
...
src/ui/HUD.cc
View file @
55cdf5db
...
...
@@ -150,8 +150,16 @@ HUD::HUD(int width, int height, QWidget* parent)
if
(
!
QFile
::
exists
(
fontFileName
))
qDebug
()
<<
"ERROR! font file: "
<<
fontFileName
<<
" DOES NOT EXIST!"
;
fontDatabase
.
addApplicationFont
(
fontFileName
);
font
=
fontDatabase
.
font
(
fontFamilyName
,
"Roman"
,
(
int
)(
10
*
scalingFactor
*
1.2
f
+
0.5
f
));
if
(
font
.
family
()
!=
fontFamilyName
)
qDebug
()
<<
"ERROR! Font not loaded: "
<<
fontFamilyName
;
font
=
fontDatabase
.
font
(
fontFamilyName
,
"Roman"
,
qMax
(
5
,(
int
)(
10.0
f
*
scalingFactor
*
1.2
f
+
0.5
f
)));
QFont
*
fontPtr
=
&
font
;
if
(
!
fontPtr
)
{
qDebug
()
<<
"ERROR! FONT NOT LOADED!"
;
}
else
{
if
(
font
.
family
()
!=
fontFamilyName
)
qDebug
()
<<
"ERROR! WRONG FONT LOADED: "
<<
fontFamilyName
;
}
// Connect with UAS
UASManager
*
manager
=
UASManager
::
instance
();
...
...
src/ui/MainWindow.cc
View file @
55cdf5db
...
...
@@ -48,11 +48,14 @@
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
),
toolsMenuActions
(),
currentView
(
VIEW_MAVLINK
),
currentView
(
VIEW_OPERATOR
),
aboutToCloseFlag
(
false
),
settings
()
{
this
->
hide
();
this
->
setVisible
(
false
);
// Get current settings
settings
.
sync
();
// Setup user interface
ui
.
setupUi
(
this
);
...
...
@@ -86,27 +89,28 @@ MainWindow::MainWindow(QWidget *parent):
// Load previous widget setup
// // FIXME WORK IN PROGRESS
// QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
// QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
// if (dockwidgets.size())
// {
// settings.beginGroup("mainwindow/dockwidgets");
// for (int i = 0; i < dockwidgets.size(); ++i)
// {
// QDockWidget *dockWidget = dockwidgets.at(i);
// if (dockWidget->parentWidget() == this)
// {
// if (settings.contains(dockWidget->windowTitle()))
// {
// dockWidget->setVisible(settings.value(dockWidget->windowTitle(), dockWidget->isVisible()).toBool());
// }
// }
// }
// settings.endGroup();
// }
// // FIXME WORK IN PROGRESS
// QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
// QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
// if (dockwidgets.size())
// {
// settings.beginGroup("mainwindow/dockwidgets");
// for (int i = 0; i < dockwidgets.size(); ++i)
// {
// QDockWidget *dockWidget = dockwidgets.at(i);
// if (dockWidget->parentWidget() == this)
// {
// if (settings.contains(dockWidget->windowTitle()))
// {
// dockWidget->setVisible(settings.value(dockWidget->windowTitle(), dockWidget->isVisible()).toBool());
// }
// }
// }
// settings.endGroup();
// }
// // Select the right perspective
// Enable and update view
this
->
show
();
...
...
@@ -308,9 +312,9 @@ void MainWindow::addToCentralWidgetsMenu ( QWidget* widget,
settings
.
setValue
(
chKey
,
false
);
tempAction
->
setChecked
(
false
);
}
// else {
// tempAction->setChecked(settings.value(chKey).toBool());
// }
// else {
// tempAction->setChecked(settings.value(chKey).toBool());
// }
// connect the action
connect
(
tempAction
,
SIGNAL
(
triggered
()),
this
,
slotName
);
...
...
@@ -353,6 +357,7 @@ void MainWindow::showCentralWidget()
// store the selected central widget
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
tool
),
currentView
);
settings
.
setValue
(
chKey
,
true
);
settings
.
sync
();
presentView
();
}
...
...
@@ -421,32 +426,40 @@ void MainWindow::addToToolsMenu ( QWidget* widget,
}
void
MainWindow
::
showToolWidget
(){
void
MainWindow
::
showToolWidget
()
{
QAction
*
temp
=
qobject_cast
<
QAction
*>
(
sender
());
int
tool
=
temp
->
data
().
toInt
();
if
(
temp
&&
dockWidgets
[
tool
]){
if
(
temp
->
isChecked
()){
if
(
temp
&&
dockWidgets
[
tool
])
{
if
(
temp
->
isChecked
())
{
addDockWidget
(
dockWidgetLocations
[
tool
],
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]));
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
])
->
show
();
}
else
{
}
else
{
removeDockWidget
(
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]));
}
QString
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
tool
),
currentView
);
settings
.
setValue
(
chKey
,
temp
->
isChecked
());
settings
.
sync
();
}
}
void
MainWindow
::
showTheWidget
(
TOOLS_WIDGET_NAMES
widget
,
VIEW_SECTIONS
view
){
void
MainWindow
::
showTheWidget
(
TOOLS_WIDGET_NAMES
widget
,
VIEW_SECTIONS
view
)
{
bool
tempVisible
;
Qt
::
DockWidgetArea
tempLocation
;
QDockWidget
*
tempWidget
=
static_cast
<
QDockWidget
*>
(
dockWidgets
[
widget
]);
tempVisible
=
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
widget
,
view
)).
toBool
();
if
(
tempWidget
){
if
(
tempWidget
)
{
toolsMenuActions
[
widget
]
->
setChecked
(
tempVisible
);
}
...
...
@@ -455,14 +468,16 @@ void MainWindow::showTheWidget (TOOLS_WIDGET_NAMES widget, VIEW_SECTIONS view){
tempLocation
=
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
widget
,
view
)).
toInt
());
if
(
tempWidget
&&
tempVisible
){
if
(
tempWidget
&&
tempVisible
)
{
addDockWidget
(
tempLocation
,
tempWidget
);
tempWidget
->
show
();
}
}
QString
MainWindow
::
buildMenuKey
(
SETTINGS_SECTIONS
section
,
TOOLS_WIDGET_NAMES
tool
,
VIEW_SECTIONS
view
){
QString
MainWindow
::
buildMenuKey
(
SETTINGS_SECTIONS
section
,
TOOLS_WIDGET_NAMES
tool
,
VIEW_SECTIONS
view
)
{
// Key is built as follows: autopilot_type/section_menu/view/tool/section
int
apType
;
...
...
@@ -477,51 +492,71 @@ QString MainWindow::buildMenuKey(SETTINGS_SECTIONS section, TOOLS_WIDGET_NAMES t
QString
::
number
(
section
)
+
"/"
);
}
void
MainWindow
::
updateVisibilitySettings
(
bool
vis
){
Q_UNUSED
(
vis
);
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
{
//settings.setValue("geometry", saveGeometry());
//settings.setValue("windowState", saveState());
aboutToCloseFlag
=
true
;
settings
.
setValue
(
"VIEW_ON_APPLICATION_CLOSE"
,
currentView
);
settings
.
sync
();
QMainWindow
::
closeEvent
(
event
);
}
void
MainWindow
::
updateVisibilitySettings
(
bool
vis
)
{
// This is commented since when the application closes
// sets the visibility to false.
// TODO: A workaround is needed. The QApplication::aboutToQuit
// did not work
/*
if
(
!
aboutToCloseFlag
)
{
QDockWidget
*
temp
=
qobject_cast
<
QDockWidget
*>
(
sender
());
if
(
temp
)
{
QHashIterator
<
int
,
QWidget
*>
i
(
dockWidgets
);
while (i.hasNext()) {
while
(
i
.
hasNext
())
{
i
.
next
();
if ((static_cast <QDockWidget *>(dockWidgets[i.key()])) == temp){
QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(i.key()));
qDebug() << "Key in visibility changed" << chKey;
settings.setValue(chKey,vis);
if
((
static_cast
<
QDockWidget
*>
(
dockWidgets
[
i
.
key
()]))
==
temp
)
{
// QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(i.key()), currentView);
// qDebug() << "Key in visibility changed" << chKey;
// settings.setValue(chKey,vis);
// settings.sync();
toolsMenuActions
[
i
.
key
()]
->
setChecked
(
vis
);
break
;
}
}
*/
}
}
}
void
MainWindow
::
updateLocationSettings
(
Qt
::
DockWidgetArea
location
){
void
MainWindow
::
updateLocationSettings
(
Qt
::
DockWidgetArea
location
)
{
QDockWidget
*
temp
=
qobject_cast
<
QDockWidget
*>
(
sender
());
QHashIterator
<
int
,
QWidget
*>
i
(
dockWidgets
);
while
(
i
.
hasNext
())
{
while
(
i
.
hasNext
())
{
i
.
next
();
if
((
static_cast
<
QDockWidget
*>
(
dockWidgets
[
i
.
key
()]))
==
temp
){
if
((
static_cast
<
QDockWidget
*>
(
dockWidgets
[
i
.
key
()]))
==
temp
)
{
QString
posKey
=
buildMenuKey
(
SUB_SECTION_LOCATION
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
i
.
key
()),
currentView
);
settings
.
setValue
(
posKey
,
location
);
break
;
}
}
//=======
// addDockWidget(Qt::BottomDockWidgetArea, slugsCamControlWidget);
// slugsCamControlWidget->hide();
//=======
// addDockWidget(Qt::BottomDockWidgetArea, slugsCamControlWidget);
// slugsCamControlWidget->hide();
// //FIXME: free memory in destructor
// joystick = new JoystickInput();
//>>>>>>> master
// //FIXME: free memory in destructor
// joystick = new JoystickInput();
//>>>>>>> master
}
/**
...
...
@@ -948,7 +983,37 @@ void MainWindow::UASCreated(UASInterface* uas)
// TODO Stylesheet reloading should in theory not be necessary
reloadStylesheet
();
switch
(
uas
->
getAutopilotType
()){
switch
(
uas
->
getAutopilotType
())
{
case
(
MAV_AUTOPILOT_SLUGS
):
{
// Build Slugs Widgets
buildSlugsWidgets
();
// Connect Slugs Widgets
connectSlugsWidgets
();
// Arrange Slugs Centerstack
arrangeSlugsCenterStack
();
// Connect Slugs Actions
connectSlugsActions
();
// FIXME: This type checking might be redundant
// if (slugsDataWidget) {
// SlugsDataSensorView* dataWidget = dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget());
// if (dataWidget) {
// SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas);
// if (mav2) {
(
dynamic_cast
<
SlugsDataSensorView
*>
(
slugsDataWidget
->
widget
()))
->
addUAS
(
uas
);
// //loadSlugsView();
// loadGlobalOperatorView();
// }
// }
// }
}
break
;
default:
case
(
MAV_AUTOPILOT_GENERIC
):
case
(
MAV_AUTOPILOT_ARDUPILOTMEGA
):
case
(
MAV_AUTOPILOT_PIXHAWK
):
...
...
@@ -965,42 +1030,31 @@ void MainWindow::UASCreated(UASInterface* uas)
// Connect Pixhawk Actions
connectPxActions
();
// FIXME: This type checking might be redundant
// Check which type this UAS is of
// PxQuadMAV* mav = dynamic_cast<PxQuadMAV*>(uas);
// if (mav) loadPixhawkEngineerView();
}
break
;
case
(
MAV_AUTOPILOT_SLUGS
):
{
// Build Slugs Widgets
buildSlugsWidgets
();
// Connect Slugs Widgets
connectSlugsWidgets
();
}
break
;
// Arrange Slugs Centerstack
arrangeSlugsCenterStack
();
}
// Connect Slugs Actions
connectSlugsActions
();
// Change the view only if this is the first UAS
// FIXME: This type checking might be redundant
// if (slugsDataWidget) {
// SlugsDataSensorView* dataWidget = dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget());
// if (dataWidget) {
// SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas);
// if (mav2) {
(
dynamic_cast
<
SlugsDataSensorView
*>
(
slugsDataWidget
->
widget
()))
->
addUAS
(
uas
);
// //loadSlugsView();
// loadGlobalOperatorView();
// }
// }
// }
}
break
;
// If this is the first connected UAS, it is both created as well as
// the currently active UAS
if
(
UASManager
::
instance
()
->
getActiveUAS
()
==
uas
)
{
qDebug
()
<<
"UPDATING THE VIEW SINCE THIS IS THE FIRST CONNECTED SYSTEM"
;
// Load last view if setting is present
if
(
settings
.
contains
(
"VIEW_ON_APPLICATION_CLOSE"
))
{
int
view
=
settings
.
value
(
"VIEW_ON_APPLICATION_CLOSE"
).
toInt
();
currentView
=
(
VIEW_SECTIONS
)
view
;
presentView
();
}
else
{
loadEngineerView
();
}
}
}
}
...
...
@@ -1275,153 +1329,28 @@ void MainWindow::presentView()
}
void
MainWindow
::
showTheCentralWidget
(
TOOLS_WIDGET_NAMES
centralWidget
,
VIEW_SECTIONS
view
){
void
MainWindow
::
showTheCentralWidget
(
TOOLS_WIDGET_NAMES
centralWidget
,
VIEW_SECTIONS
view
)
{
bool
tempVisible
;
QWidget
*
tempWidget
=
dockWidgets
[
centralWidget
];
//=======
// // ONBOARD PARAMETERS
// if (parametersDockWidget)
// {
// addDockWidget(Qt::RightDockWidgetArea, parametersDockWidget);
// parametersDockWidget->show();
// }
//}
//>>>>>>> master
tempVisible
=
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
view
)).
toBool
();
qDebug
()
<<
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
view
)
<<
tempVisible
;
if
(
toolsMenuActions
[
centralWidget
]){
toolsMenuActions
[
centralWidget
]
->
setChecked
(
tempVisible
);
}
if
(
centerStack
&&
tempWidget
&&
tempVisible
){
centerStack
->
setCurrentWidget
(
tempWidget
);
}
}
/*
==========================================================
Potentially Deprecated
==========================================================
*/
void
MainWindow
::
loadPixhawkEngineerView
()
{
}
void
MainWindow
::
loadAllView
()
{
clearView
();
if
(
headDown1DockWidget
)
{
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown1DockWidget
->
widget
());
if
(
hdd
)
{
addDockWidget
(
Qt
::
RightDockWidgetArea
,
headDown1DockWidget
);
headDown1DockWidget
->
show
();
hdd
->
start
();
}
}
if
(
headDown2DockWidget
)
{
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown2DockWidget
->
widget
());
if
(
hdd
)
{
addDockWidget
(
Qt
::
RightDockWidgetArea
,
headDown2DockWidget
);
headDown2DockWidget
->
show
();
hdd
->
start
();
}
}
//<<<<<<< HEAD
//=======
//}
//void MainWindow::loadOperatorView()
//{
// clearView();
// // MAP
// if (mapWidget)
// {
// QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
// if (centerStack)
// {
// centerStack->setCurrentWidget(mapWidget);
// }
// }
//>>>>>>> master
// UAS CONTROL
if
(
controlDockWidget
)
{
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
controlDockWidget
);
controlDockWidget
->
show
();
}
// UAS LIST
if
(
listDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
listDockWidget
);
listDockWidget
->
show
();
}
// UAS STATUS
if
(
infoDockWidget
)
{
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
infoDockWidget
);
infoDockWidget
->
show
();
}
// WAYPOINT LIST
if
(
waypointsDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
waypointsDockWidget
);
waypointsDockWidget
->
show
();
}
// DEBUG CONSOLE
if
(
debugConsoleDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
debugConsoleDockWidget
);
debugConsoleDockWidget
->
show
();
}
// OBJECT DETECTION
if
(
detectionDockWidget
)
if
(
toolsMenuActions
[
centralWidget
])
{
addDockWidget
(
Qt
::
RightDockWidgetArea
,
detectionDockWidget
);
detectionDockWidget
->
show
();
}
// LINE CHART
if
(
linechartWidget
)
{
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
if
(
centerStack
)
{
linechartWidget
->
setActive
(
true
);
centerStack
->
setCurrentWidget
(
linechartWidget
);
}
toolsMenuActions
[
centralWidget
]
->
setChecked
(
tempVisible
);
}
// ONBOARD PARAMETERS
if
(
parametersDockWidget
)
if
(
centerStack
&&
tempWidget
&&
tempVisible
)
{
addDockWidget
(
Qt
::
RightDockWidgetArea
,
parametersDockWidget
);
parametersDockWidget
->
show
();
centerStack
->
setCurrentWidget
(
tempWidget
);
}
}
void
MainWindow
::
loadWidgets
()
{
//
loadOperatorView();
loadMAVLinkView
();
loadOperatorView
();
//
loadMAVLinkView();
//loadPilotView();
}
...
...
@@ -1469,45 +1398,12 @@ void MainWindow::load3DMapView()
centerStack
->
setCurrentWidget
(
_3DMapWidget
);
}
}
// UAS CONTROL
if
(
controlDockWidget
)
{
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
controlDockWidget
);
controlDockWidget
->
show
();
}
// UAS LIST
if
(
listDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
listDockWidget
);
listDockWidget
->
show
();
}
// WAYPOINT LIST
if
(
waypointsDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
waypointsDockWidget
);
waypointsDockWidget
->
show
();
}
// HORIZONTAL SITUATION INDICATOR
if
(
hsiDockWidget
)
{
HSIDisplay
*
hsi
=
dynamic_cast
<
HSIDisplay
*>
(
hsiDockWidget
->
widget
()
);
if
(
hsi
)
{
hsi
->
start
();
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
hsiDockWidget
);
hsiDockWidget
->
show
();
}
}
#endif
}
void
MainWindow
::
loadGoogleEarthView
()
{
#if (defined Q_OS_WIN) | (defined Q_OS_MAC)
#if (defined Q_OS_WIN) | (defined Q_OS_MAC)
clearView
();
// 3D map
...
...
@@ -1519,39 +1415,6 @@ void MainWindow::loadGoogleEarthView()
centerStack
->
setCurrentWidget
(
gEarthWidget
);
}
}
// UAS CONTROL
if
(
controlDockWidget
)
{
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
controlDockWidget
);
controlDockWidget
->
show
();
}
// UAS LIST
if
(
listDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
listDockWidget
);
listDockWidget
->
show
();
}
// WAYPOINT LIST
if
(
waypointsDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
waypointsDockWidget
);
waypointsDockWidget
->
show
();
}
// HORIZONTAL SITUATION INDICATOR
if
(
hsiDockWidget
)
{
HSIDisplay
*
hsi
=
dynamic_cast
<
HSIDisplay
*>
(
hsiDockWidget
->
widget
()
);
if
(
hsi
)
{
hsi
->
start
();
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
hsiDockWidget
);
hsiDockWidget
->
show
();
}
}
#endif
}
...
...
@@ -1571,301 +1434,6 @@ void MainWindow::load3DView()
centerStack
->
setCurrentWidget
(
_3DWidget
);
}
}
// UAS CONTROL
if
(
controlDockWidget
)
{
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
controlDockWidget
);
controlDockWidget
->
show
();
}
// UAS LIST
if
(
listDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
listDockWidget
);
listDockWidget
->
show
();
}
// WAYPOINT LIST
if
(
waypointsDockWidget
)
{
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
waypointsDockWidget
);
waypointsDockWidget
->
show
();
}
// HORIZONTAL SITUATION INDICATOR
if
(
hsiDockWidget
)
{
HSIDisplay
*
hsi
=
dynamic_cast
<
HSIDisplay
*>
(
hsiDockWidget
->
widget
()
);
if
(
hsi
)
{
hsi
->
start
();
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
hsiDockWidget
);
hsiDockWidget
->
show
();
}
}
#endif
}
/*
==================================
========== ATTIC =================
==================================
void MainWindow::buildCommonWidgets()
{
//FIXME: memory of acceptList will never be freed again
QStringList* acceptList = new QStringList();
acceptList->append("roll IMU");
acceptList->append("pitch IMU");
acceptList->append("yaw IMU");
acceptList->append("rollspeed IMU");
acceptList->append("pitchspeed IMU");
acceptList->append("yawspeed IMU");
//FIXME: memory of acceptList2 will never be freed again
QStringList* acceptList2 = new QStringList();
acceptList2->append("Battery");
acceptList2->append("Pressure");
//TODO: move protocol outside UI
mavlink = new MAVLinkProtocol();
// Center widgets
linechartWidget = new Linecharts(this);
hudWidget = new HUD(320, 240, this);
mapWidget = new MapWidget(this);
protocolWidget = new XMLCommProtocolWidget(this);
dataplotWidget = new QGCDataPlot2D(this);
#ifdef QGC_OSG_ENABLED
_3DWidget = Q3DWidgetFactory::get("PIXHAWK");
#endif
#ifdef QGC_OSGEARTH_ENABLED
_3DMapWidget = Q3DWidgetFactory::get("MAP3D");
#endif
#if (defined Q_OS_WIN) | (defined Q_OS_MAC)
gEarthWidget = new QGCGoogleEarthView(this);
#endif
// Dock widgets
controlDockWidget = new QDockWidget(tr("Control"), this);
controlDockWidget->setWidget( new UASControlWidget(this) );
listDockWidget = new QDockWidget(tr("Unmanned Systems"), this);
listDockWidget->setWidget( new UASListWidget(this) );
<<<<<<< HEAD
waypointsDockWidget = new QDockWidget(tr("Waypoint List"), this);
waypointsDockWidget->setWidget( new WaypointList(this, NULL) );
infoDockWidget = new QDockWidget(tr("Status Details"), this);
infoDockWidget->setWidget( new UASInfoWidget(this) );
=======
// RADIO CONTROL VIEW
if (rcViewDockWidget)
{
addDockWidget(Qt::BottomDockWidgetArea, rcViewDockWidget);
rcViewDockWidget->show();
}
}
>>>>>>> master
detectionDockWidget = new QDockWidget(tr("Object Recognition"), this);
detectionDockWidget->setWidget( new ObjectDetectionView("images/patterns", this) );
<<<<<<< HEAD
debugConsoleDockWidget = new QDockWidget(tr("Communication Console"), this);
debugConsoleDockWidget->setWidget( new DebugConsole(this) );
parametersDockWidget = new QDockWidget(tr("Onboard Parameters"), this);
parametersDockWidget->setWidget( new ParameterInterface(this) );
watchdogControlDockWidget = new QDockWidget(tr("Process Control"), this);
watchdogControlDockWidget->setWidget( new WatchdogControl(this) );
hsiDockWidget = new QDockWidget(tr("Horizontal Situation Indicator"), this);
hsiDockWidget->setWidget( new HSIDisplay(this) );
headDown1DockWidget = new QDockWidget(tr("Primary Flight Display"), this);
headDown1DockWidget->setWidget( new HDDisplay(acceptList, this) );
headDown2DockWidget = new QDockWidget(tr("Payload Status"), this);
headDown2DockWidget->setWidget( new HDDisplay(acceptList2, this) );
rcViewDockWidget = new QDockWidget(tr("Radio Control"), this);
rcViewDockWidget->setWidget( new QGCRemoteControlView(this) );
headUpDockWidget = new QDockWidget(tr("Control Indicator"), this);
headUpDockWidget->setWidget( new HUD(320, 240, this));
// Dialogue widgets
//FIXME: free memory in destructor
joystick = new JoystickInput();
slugsDataWidget = new QDockWidget(tr("Slugs Data"), this);
slugsDataWidget->setWidget( new SlugsDataSensorView(this));
slugsPIDControlWidget = new QDockWidget(tr("PID Control"), this);
slugsPIDControlWidget->setWidget(new SlugsPIDControl(this));
slugsHilSimWidget = new QDockWidget(tr("Slugs Hil Sim"), this);
slugsHilSimWidget->setWidget( new SlugsHilSim(this));
slugsCamControlWidget = new QDockWidget(tr("Video Camera Control"), this);
slugsCamControlWidget->setWidget(new SlugsVideoCamControl(this));
=======
if (protocolWidget)
{
QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
if (centerStack)
{
centerStack->setCurrentWidget(protocolWidget);
}
}
>>>>>>> master
}
void MainWindow::connectWidgets()
{
if (linechartWidget)
{
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)),
linechartWidget, SLOT(addSystem(UASInterface*)));
connect(UASManager::instance(), SIGNAL(activeUASSet(int)),
linechartWidget, SLOT(selectSystem(int)));
connect(linechartWidget, SIGNAL(logfileWritten(QString)),
this, SLOT(loadDataView(QString)));
}
if (infoDockWidget && infoDockWidget->widget())
{
connect(mavlink, SIGNAL(receiveLossChanged(int, float)),
infoDockWidget->widget(), SLOT(updateSendLoss(int, float)));
}
if (mapWidget && waypointsDockWidget->widget())
{
// clear path create on the map
connect(waypointsDockWidget->widget(), SIGNAL(clearPathclicked()), mapWidget, SLOT(clearPath()));
// add Waypoint widget in the WaypointList widget when mouse clicked
connect(mapWidget, SIGNAL(captureMapCoordinateClick(QPointF)), waypointsDockWidget->widget(), SLOT(addWaypointMouse(QPointF)));
// it notifies that a waypoint global goes to do create
//connect(mapWidget, SIGNAL(createGlobalWP(bool, QPointF)), waypointsDockWidget->widget(), SLOT(setIsWPGlobal(bool, QPointF)));
//connect(mapWidget, SIGNAL(sendGeometryEndDrag(QPointF,int)), waypointsDockWidget->widget(), SLOT(waypointGlobalChanged(QPointF,int)) );
// it notifies that a waypoint global goes to do create and a map graphic too
connect(waypointsDockWidget->widget(), SIGNAL(createWaypointAtMap(QPointF)), mapWidget, SLOT(createWaypointGraphAtMap(QPointF)));
// it notifies that a waypoint global change it¥s position by spinBox on Widget WaypointView
//connect(waypointsDockWidget->widget(), SIGNAL(changePositionWPGlobalBySpinBox(int,float,float)), mapWidget, SLOT(changeGlobalWaypointPositionBySpinBox(int,float,float)));
// connect(waypointsDockWidget->widget(), SIGNAL(changePositionWPGlobalBySpinBox(int,float,float)), mapWidget, SLOT(changeGlobalWaypointPositionBySpinBox(int,float,float)));
connect(slugsCamControlWidget->widget(),SIGNAL(viewCamBorderAtMap(bool)),mapWidget,SLOT(drawBorderCamAtMap(bool)));
connect(slugsCamControlWidget->widget(),SIGNAL(changeCamPosition(double,double,QString)),mapWidget,SLOT(updateCameraPosition(double,double, QString)));
}
if (slugsHilSimWidget && slugsHilSimWidget->widget()){
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
slugsHilSimWidget->widget(), SLOT(activeUasSet(UASInterface*)));
}
if (slugsDataWidget && slugsDataWidget->widget()){
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
slugsDataWidget->widget(), SLOT(setActiveUAS(UASInterface*)));
}
}
<<<<<<< HEAD
void MainWindow::arrangeCommonCenterStack()
{
QStackedWidget *centerStack = new QStackedWidget(this);
if (!centerStack) return;
if (linechartWidget) centerStack->addWidget(linechartWidget);
if (protocolWidget) centerStack->addWidget(protocolWidget);
if (mapWidget) centerStack->addWidget(mapWidget);
#ifdef QGC_OSG_ENABLED
if (_3DWidget) centerStack->addWidget(_3DWidget);
#endif
#ifdef QGC_OSGEARTH_ENABLED
if (_3DMapWidget) centerStack->addWidget(_3DMapWidget);
#endif
#if (defined Q_OS_WIN) | (defined Q_OS_MAC)
if (gEarthWidget) centerStack->addWidget(gEarthWidget);
#endif
if (hudWidget) centerStack->addWidget(hudWidget);
if (dataplotWidget) centerStack->addWidget(dataplotWidget);
setCentralWidget(centerStack);
=======
// ONBOARD PARAMETERS
if (parametersDockWidget)
{
addDockWidget(Qt::RightDockWidgetArea, parametersDockWidget);
parametersDockWidget->show();
}
>>>>>>> master
}
void MainWindow::connectActions()
{
<<<<<<< HEAD
// Connect actions from ui
connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink()));
// Connect internal actions
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(UASCreated(UASInterface*)));
// Connect user interface controls
connect(ui.actionLiftoff, SIGNAL(triggered()), UASManager::instance(), SLOT(launchActiveUAS()));
connect(ui.actionLand, SIGNAL(triggered()), UASManager::instance(), SLOT(returnActiveUAS()));
connect(ui.actionEmergency_Land, SIGNAL(triggered()), UASManager::instance(), SLOT(stopActiveUAS()));
connect(ui.actionEmergency_Kill, SIGNAL(triggered()), UASManager::instance(), SLOT(killActiveUAS()));
connect(ui.actionConfiguration, SIGNAL(triggered()), UASManager::instance(), SLOT(configureActiveUAS()));
// User interface actions
connect(ui.actionPilotView, SIGNAL(triggered()), this, SLOT(loadPilotView()));
connect(ui.actionEngineerView, SIGNAL(triggered()), this, SLOT(loadEngineerView()));
connect(ui.actionOperatorView, SIGNAL(triggered()), this, SLOT(loadOperatorView()));
#ifdef QGC_OSG_ENABLED
connect(ui.action3DView, SIGNAL(triggered()), this, SLOT(load3DView()));
#else
ui.menuWindow->removeAction(ui.action3DView);
#endif
#ifdef QGC_OSGEARTH_ENABLED
connect(ui.action3DMapView, SIGNAL(triggered()), this, SLOT(load3DMapView()));
#else
ui.menuWindow->removeAction(ui.action3DMapView);
#endif
connect(ui.actionShow_full_view, SIGNAL(triggered()), this, SLOT(loadAllView()));
connect(ui.actionShow_MAVLink_view, SIGNAL(triggered()), this, SLOT(loadMAVLinkView()));
connect(ui.actionShow_data_analysis_view, SIGNAL(triggered()), this, SLOT(loadDataView()));
connect(ui.actionStyleConfig, SIGNAL(triggered()), this, SLOT(reloadStylesheet()));
connect(ui.actionGlobalOperatorView, SIGNAL(triggered()), this, SLOT(loadGlobalOperatorView()));
connect(ui.actionOnline_documentation, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(ui.actionCredits_Developers, SIGNAL(triggered()), this, SLOT(showCredits()));
connect(ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap()));
#if (defined Q_OS_WIN) | (defined Q_OS_MAC)
connect(ui.actionGoogleEarthView, SIGNAL(triggered()), this, SLOT(loadGoogleEarthView()));
#else
ui.menuWindow->removeAction(ui.actionGoogleEarthView);
#endif
// Joystick configuration
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
// Slugs View
connect(ui.actionShow_Slugs_View, SIGNAL(triggered()), this, SLOT(loadSlugsView()));
//GlobalOperatorView
// connect(ui.actionGlobalOperatorView,SIGNAL(triggered()),waypointsDockWidget->widget(),SLOT())
=======
//loadEngineerView();
>>>>>>> master
}
*/
src/ui/MainWindow.h
View file @
55cdf5db
...
...
@@ -138,17 +138,14 @@ public slots:
/** @brief Reload the CSS style sheet */
void
reloadStylesheet
();
void
closeEvent
(
QCloseEvent
*
event
);
/*
==========================================================
Potentially Deprecated
==========================================================
*/
void
loadPixhawkEngineerView
();
/** @brief Load view with all widgets */
void
loadAllView
();
void
loadWidgets
();
/** @brief Load data view, allowing to plot flight data */
...
...
@@ -228,13 +225,15 @@ protected:
}
TOOLS_WIDGET_NAMES
;
typedef
enum
_SETTINGS_SECTIONS
{
typedef
enum
_SETTINGS_SECTIONS
{
SECTION_MENU
,
SUB_SECTION_CHECKED
,
SUB_SECTION_LOCATION
,
}
SETTINGS_SECTIONS
;
typedef
enum
_VIEW_SECTIONS
{
typedef
enum
_VIEW_SECTIONS
{
VIEW_ENGINEER
,
VIEW_OPERATOR
,
VIEW_PILOT
,
...
...
@@ -301,6 +300,7 @@ protected:
/** @brief Keeps track of the current view */
VIEW_SECTIONS
currentView
;
bool
aboutToCloseFlag
;
QStatusBar
*
statusBar
;
QStatusBar
*
createStatusBar
();
...
...
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