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
Hide 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()
...
@@ -71,6 +71,18 @@ void UASManager::run()
void
UASManager
::
addUAS
(
UASInterface
*
uas
)
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
// Only execute if there is no UAS at this index
if
(
!
systems
.
contains
(
uas
->
getUASID
()))
if
(
!
systems
.
contains
(
uas
->
getUASID
()))
{
{
...
@@ -79,7 +91,7 @@ void UASManager::addUAS(UASInterface* uas)
...
@@ -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 there is no active UAS yet, set the first one as the active UAS
if
(
activeUAS
==
NULL
)
if
(
firstUAS
)
{
{
setActiveUAS
(
uas
);
setActiveUAS
(
uas
);
}
}
...
...
src/ui/DebugConsole.cc
View file @
55cdf5db
...
@@ -205,30 +205,30 @@ void DebugConsole::paintEvent(QPaintEvent *event)
...
@@ -205,30 +205,30 @@ void DebugConsole::paintEvent(QPaintEvent *event)
{
{
Q_UNUSED
(
event
);
Q_UNUSED
(
event
);
// Update bandwidth
// Update bandwidth
if
(
holdOn
)
//
if (holdOn)
{
//
{
//qDebug() << "Data rate:" << dataRate/1000.0f << "kB/s";
//
//qDebug() << "Data rate:" << dataRate/1000.0f << "kB/s";
QString
rate
(
"data rate: %1"
);
//
QString rate("data rate: %1");
rate
.
arg
(
dataRate
);
//
rate.arg(dataRate);
QPainter
painter
(
this
);
//
QPainter painter(this);
painter
.
setRenderHint
(
QPainter
::
HighQualityAntialiasing
);
//
painter.setRenderHint(QPainter::HighQualityAntialiasing);
painter
.
translate
(
width
()
/
5.0
f
,
height
()
/
5.0
f
);
//
painter.translate(width()/5.0f, height()/5.0f);
//QFont font("Bitstream Vera Sans");
//
//QFont font("Bitstream Vera Sans");
QFont
font
=
painter
.
font
();
//
QFont font = painter.font();
font
.
setPixelSize
((
int
)(
60.0
f
));
//
font.setPixelSize((int)(60.0f));
QFontMetrics
metrics
=
QFontMetrics
(
font
);
//
QFontMetrics metrics = QFontMetrics(font);
int
border
=
qMax
(
4
,
metrics
.
leading
());
//
int border = qMax(4, metrics.leading());
QRect
rect
=
metrics
.
boundingRect
(
0
,
0
,
width
()
-
2
*
border
,
int
(
height
()
*
0.125
),
//
QRect rect = metrics.boundingRect(0, 0, width() - 2*border, int(height()*0.125),
Qt
::
AlignLeft
|
Qt
::
TextWordWrap
,
rate
);
//
Qt::AlignLeft | Qt::TextWordWrap, rate);
painter
.
setPen
(
QColor
(
255
,
50
,
50
));
//
painter.setPen(QColor(255, 50, 50));
painter
.
setRenderHint
(
QPainter
::
TextAntialiasing
);
//
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
);
//
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
//
//Qt::AlignRight | Qt::TextWordWrap
}
//
}
}
}
void
DebugConsole
::
receiveBytes
(
LinkInterface
*
link
,
QByteArray
bytes
)
void
DebugConsole
::
receiveBytes
(
LinkInterface
*
link
,
QByteArray
bytes
)
...
...
src/ui/HDDisplay.cc
View file @
55cdf5db
...
@@ -134,7 +134,7 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) :
...
@@ -134,7 +134,7 @@ HDDisplay::HDDisplay(QStringList* plotList, QWidget *parent) :
if
(
!
QFile
::
exists
(
fontFileName
))
qDebug
()
<<
"ERROR! font file: "
<<
fontFileName
<<
" DOES NOT EXIST!"
;
if
(
!
QFile
::
exists
(
fontFileName
))
qDebug
()
<<
"ERROR! font file: "
<<
fontFileName
<<
" DOES NOT EXIST!"
;
fontDatabase
.
addApplicationFont
(
fontFileName
);
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
;
if
(
font
.
family
()
!=
fontFamilyName
)
qDebug
()
<<
"ERROR! Font not loaded: "
<<
fontFamilyName
;
// Connect with UAS
// Connect with UAS
...
@@ -151,7 +151,7 @@ HDDisplay::~HDDisplay()
...
@@ -151,7 +151,7 @@ HDDisplay::~HDDisplay()
void
HDDisplay
::
enableGLRendering
(
bool
enable
)
void
HDDisplay
::
enableGLRendering
(
bool
enable
)
{
{
Q_UNUSED
(
enable
)
}
}
void
HDDisplay
::
triggerUpdate
()
void
HDDisplay
::
triggerUpdate
()
...
...
src/ui/HUD.cc
View file @
55cdf5db
...
@@ -150,8 +150,16 @@ HUD::HUD(int width, int height, QWidget* parent)
...
@@ -150,8 +150,16 @@ HUD::HUD(int width, int height, QWidget* parent)
if
(
!
QFile
::
exists
(
fontFileName
))
qDebug
()
<<
"ERROR! font file: "
<<
fontFileName
<<
" DOES NOT EXIST!"
;
if
(
!
QFile
::
exists
(
fontFileName
))
qDebug
()
<<
"ERROR! font file: "
<<
fontFileName
<<
" DOES NOT EXIST!"
;
fontDatabase
.
addApplicationFont
(
fontFileName
);
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.0
f
*
scalingFactor
*
1.2
f
+
0.5
f
)));
if
(
font
.
family
()
!=
fontFamilyName
)
qDebug
()
<<
"ERROR! Font not loaded: "
<<
fontFamilyName
;
QFont
*
fontPtr
=
&
font
;
if
(
!
fontPtr
)
{
qDebug
()
<<
"ERROR! FONT NOT LOADED!"
;
}
else
{
if
(
font
.
family
()
!=
fontFamilyName
)
qDebug
()
<<
"ERROR! WRONG FONT LOADED: "
<<
fontFamilyName
;
}
// Connect with UAS
// Connect with UAS
UASManager
*
manager
=
UASManager
::
instance
();
UASManager
*
manager
=
UASManager
::
instance
();
...
...
src/ui/MainWindow.cc
View file @
55cdf5db
...
@@ -48,11 +48,14 @@
...
@@ -48,11 +48,14 @@
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
),
QMainWindow
(
parent
),
toolsMenuActions
(),
toolsMenuActions
(),
currentView
(
VIEW_MAVLINK
),
currentView
(
VIEW_OPERATOR
),
aboutToCloseFlag
(
false
),
settings
()
settings
()
{
{
this
->
hide
();
this
->
hide
();
this
->
setVisible
(
false
);
this
->
setVisible
(
false
);
// Get current settings
settings
.
sync
();
// Setup user interface
// Setup user interface
ui
.
setupUi
(
this
);
ui
.
setupUi
(
this
);
...
@@ -86,27 +89,28 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -86,27 +89,28 @@ MainWindow::MainWindow(QWidget *parent):
// Load previous widget setup
// Load previous widget setup
// // FIXME WORK IN PROGRESS
// // FIXME WORK IN PROGRESS
// QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
// QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
// QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
// QList<QDockWidget *> dockwidgets = qFindChildren<QDockWidget *>(this);
// if (dockwidgets.size())
// if (dockwidgets.size())
// {
// {
// settings.beginGroup("mainwindow/dockwidgets");
// settings.beginGroup("mainwindow/dockwidgets");
// for (int i = 0; i < dockwidgets.size(); ++i)
// for (int i = 0; i < dockwidgets.size(); ++i)
// {
// {
// QDockWidget *dockWidget = dockwidgets.at(i);
// QDockWidget *dockWidget = dockwidgets.at(i);
// if (dockWidget->parentWidget() == this)
// if (dockWidget->parentWidget() == this)
// {
// {
// if (settings.contains(dockWidget->windowTitle()))
// if (settings.contains(dockWidget->windowTitle()))
// {
// {
// dockWidget->setVisible(settings.value(dockWidget->windowTitle(), dockWidget->isVisible()).toBool());
// dockWidget->setVisible(settings.value(dockWidget->windowTitle(), dockWidget->isVisible()).toBool());
// }
// }
// }
// }
// }
// }
// settings.endGroup();
// settings.endGroup();
// }
// }
// // Select the right perspective
// Enable and update view
// Enable and update view
this
->
show
();
this
->
show
();
...
@@ -283,79 +287,80 @@ void MainWindow::addToCentralWidgetsMenu ( QWidget* widget,
...
@@ -283,79 +287,80 @@ void MainWindow::addToCentralWidgetsMenu ( QWidget* widget,
const
QString
title
,
const
QString
title
,
const
char
*
slotName
,
const
char
*
slotName
,
TOOLS_WIDGET_NAMES
centralWidget
){
TOOLS_WIDGET_NAMES
centralWidget
){
QAction
*
tempAction
;
QAction
*
tempAction
;
// Add the separator that will separate tools from central Widgets
// Add the separator that will separate tools from central Widgets
if
(
!
toolsMenuActions
[
CENTRAL_SEPARATOR
]){
if
(
!
toolsMenuActions
[
CENTRAL_SEPARATOR
]){
tempAction
=
ui
.
menuTools
->
addSeparator
();
tempAction
=
ui
.
menuTools
->
addSeparator
();
toolsMenuActions
[
CENTRAL_SEPARATOR
]
=
tempAction
;
toolsMenuActions
[
CENTRAL_SEPARATOR
]
=
tempAction
;
tempAction
->
setData
(
CENTRAL_SEPARATOR
);
tempAction
->
setData
(
CENTRAL_SEPARATOR
);
}
}
tempAction
=
ui
.
menuTools
->
addAction
(
title
);
tempAction
=
ui
.
menuTools
->
addAction
(
title
);
tempAction
->
setCheckable
(
true
);
tempAction
->
setCheckable
(
true
);
tempAction
->
setData
(
centralWidget
);
tempAction
->
setData
(
centralWidget
);
// populate the Hashes
// populate the Hashes
toolsMenuActions
[
centralWidget
]
=
tempAction
;
toolsMenuActions
[
centralWidget
]
=
tempAction
;
dockWidgets
[
centralWidget
]
=
widget
;
dockWidgets
[
centralWidget
]
=
widget
;
QString
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
currentView
);
QString
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
currentView
);
if
(
!
settings
.
contains
(
chKey
)){
if
(
!
settings
.
contains
(
chKey
)){
settings
.
setValue
(
chKey
,
false
);
settings
.
setValue
(
chKey
,
false
);
tempAction
->
setChecked
(
false
);
tempAction
->
setChecked
(
false
);
}
}
// else {
// else {
// tempAction->setChecked(settings.value(chKey).toBool());
// tempAction->setChecked(settings.value(chKey).toBool());
// }
// }
// connect the action
// connect the action
connect
(
tempAction
,
SIGNAL
(
triggered
()),
this
,
slotName
);
connect
(
tempAction
,
SIGNAL
(
triggered
()),
this
,
slotName
);
}
}
void
MainWindow
::
showCentralWidget
()
void
MainWindow
::
showCentralWidget
()
{
{
QAction
*
senderAction
=
qobject_cast
<
QAction
*>
(
sender
());
QAction
*
senderAction
=
qobject_cast
<
QAction
*>
(
sender
());
int
tool
=
senderAction
->
data
().
toInt
();
int
tool
=
senderAction
->
data
().
toInt
();
QString
chKey
;
QString
chKey
;
// check the current action
// check the current action
if
(
senderAction
&&
dockWidgets
[
tool
])
{
// uncheck all central widget actions
if
(
senderAction
&&
dockWidgets
[
tool
])
QHashIterator
<
int
,
QAction
*>
i
(
toolsMenuActions
);
{
while
(
i
.
hasNext
())
{
i
.
next
();
qDebug
()
<<
"shCW"
<<
i
.
key
()
<<
"read"
;
if
(
i
.
value
()
&&
i
.
value
()
->
data
().
toInt
()
>
255
){
i
.
value
()
->
setChecked
(
false
);
// update the settings
// uncheck all central widget actions
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
i
.
value
()
->
data
().
toInt
()),
currentView
);
QHashIterator
<
int
,
QAction
*>
i
(
toolsMenuActions
);
settings
.
setValue
(
chKey
,
false
);
while
(
i
.
hasNext
())
{
}
i
.
next
();
}
qDebug
()
<<
"shCW"
<<
i
.
key
()
<<
"read"
;
if
(
i
.
value
()
&&
i
.
value
()
->
data
().
toInt
()
>
255
){
i
.
value
()
->
setChecked
(
false
);
// update the settings
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
i
.
value
()
->
data
().
toInt
()),
currentView
);
settings
.
setValue
(
chKey
,
false
);
}
}
// check the current action
// check the current action
qDebug
()
<<
senderAction
->
text
();
qDebug
()
<<
senderAction
->
text
();
senderAction
->
setChecked
(
true
);
senderAction
->
setChecked
(
true
);
// update the central widget
// update the central widget
centerStack
->
setCurrentWidget
(
dockWidgets
[
tool
]);
centerStack
->
setCurrentWidget
(
dockWidgets
[
tool
]);
// store the selected central widget
// store the selected central widget
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
tool
),
currentView
);
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
tool
),
currentView
);
settings
.
setValue
(
chKey
,
true
);
settings
.
setValue
(
chKey
,
true
);
settings
.
sync
();
presentView
();
presentView
();
}
}
}
}
/**
/**
...
@@ -363,165 +368,195 @@ void MainWindow::showCentralWidget()
...
@@ -363,165 +368,195 @@ void MainWindow::showCentralWidget()
* enabled last time.
* enabled last time.
*/
*/
void
MainWindow
::
addToToolsMenu
(
QWidget
*
widget
,
void
MainWindow
::
addToToolsMenu
(
QWidget
*
widget
,
const
QString
title
,
const
QString
title
,
const
char
*
slotName
,
const
char
*
slotName
,
TOOLS_WIDGET_NAMES
tool
,
TOOLS_WIDGET_NAMES
tool
,
Qt
::
DockWidgetArea
location
)
Qt
::
DockWidgetArea
location
)
{
{
QAction
*
tempAction
;
QAction
*
tempAction
;
QString
posKey
,
chKey
;
QString
posKey
,
chKey
;
if
(
toolsMenuActions
[
CENTRAL_SEPARATOR
]){
if
(
toolsMenuActions
[
CENTRAL_SEPARATOR
]){
tempAction
=
new
QAction
(
title
,
this
);
tempAction
=
new
QAction
(
title
,
this
);
ui
.
menuTools
->
insertAction
(
toolsMenuActions
[
CENTRAL_SEPARATOR
],
ui
.
menuTools
->
insertAction
(
toolsMenuActions
[
CENTRAL_SEPARATOR
],
tempAction
);
tempAction
);
}
else
{
}
else
{
tempAction
=
ui
.
menuTools
->
addAction
(
title
);
tempAction
=
ui
.
menuTools
->
addAction
(
title
);
}
}
tempAction
->
setCheckable
(
true
);
tempAction
->
setCheckable
(
true
);
tempAction
->
setData
(
tool
);
tempAction
->
setData
(
tool
);
// populate the Hashes
// populate the Hashes
toolsMenuActions
[
tool
]
=
tempAction
;
toolsMenuActions
[
tool
]
=
tempAction
;
dockWidgets
[
tool
]
=
widget
;
dockWidgets
[
tool
]
=
widget
;
qDebug
()
<<
widget
;
qDebug
()
<<
widget
;
posKey
=
buildMenuKey
(
SUB_SECTION_LOCATION
,
tool
,
currentView
);
posKey
=
buildMenuKey
(
SUB_SECTION_LOCATION
,
tool
,
currentView
);
if
(
!
settings
.
contains
(
posKey
)){
if
(
!
settings
.
contains
(
posKey
)){
settings
.
setValue
(
posKey
,
location
);
settings
.
setValue
(
posKey
,
location
);
dockWidgetLocations
[
tool
]
=
location
;
dockWidgetLocations
[
tool
]
=
location
;
}
else
{
}
else
{
dockWidgetLocations
[
tool
]
=
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
posKey
).
toInt
());
dockWidgetLocations
[
tool
]
=
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
posKey
).
toInt
());
}
}
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
tool
,
currentView
);
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
tool
,
currentView
);
if
(
!
settings
.
contains
(
chKey
))
if
(
!
settings
.
contains
(
chKey
))
{
{
settings
.
setValue
(
chKey
,
false
);
settings
.
setValue
(
chKey
,
false
);
tempAction
->
setChecked
(
false
);
tempAction
->
setChecked
(
false
);
}
}
else
else
{
{
tempAction
->
setChecked
(
settings
.
value
(
chKey
).
toBool
());
tempAction
->
setChecked
(
settings
.
value
(
chKey
).
toBool
());
widget
->
setVisible
(
settings
.
value
(
chKey
).
toBool
());
widget
->
setVisible
(
settings
.
value
(
chKey
).
toBool
());
}
}
// connect the action
// connect the action
connect
(
tempAction
,
SIGNAL
(
triggered
()),
this
,
slotName
);
connect
(
tempAction
,
SIGNAL
(
triggered
()),
this
,
slotName
);
connect
(
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]),
connect
(
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]),
SIGNAL
(
visibilityChanged
(
bool
)),
this
,
SLOT
(
updateVisibilitySettings
(
bool
)));
SIGNAL
(
visibilityChanged
(
bool
)),
this
,
SLOT
(
updateVisibilitySettings
(
bool
)));
connect
(
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]),
connect
(
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]),
SIGNAL
(
dockLocationChanged
(
Qt
::
DockWidgetArea
)),
this
,
SLOT
(
updateLocationSettings
(
Qt
::
DockWidgetArea
)));
SIGNAL
(
dockLocationChanged
(
Qt
::
DockWidgetArea
)),
this
,
SLOT
(
updateLocationSettings
(
Qt
::
DockWidgetArea
)));
}
}
void
MainWindow
::
showToolWidget
(){
void
MainWindow
::
showToolWidget
()
QAction
*
temp
=
qobject_cast
<
QAction
*>
(
sender
());
{
int
tool
=
temp
->
data
().
toInt
();
QAction
*
temp
=
qobject_cast
<
QAction
*>
(
sender
());
int
tool
=
temp
->
data
().
toInt
();
if
(
temp
&&
dockWidgets
[
tool
]){
if
(
temp
&&
dockWidgets
[
tool
])
if
(
temp
->
isChecked
()){
{
addDockWidget
(
dockWidgetLocations
[
tool
],
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]));
if
(
temp
->
isChecked
())
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
])
->
show
();
{
}
else
{
addDockWidget
(
dockWidgetLocations
[
tool
],
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]));
removeDockWidget
(
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
]));
qobject_cast
<
QDockWidget
*>
(
dockWidgets
[
tool
])
->
show
();
}
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
();
}
}
QString
chKey
=
buildMenuKey
(
SUB_SECTION_CHECKED
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
tool
),
currentView
);
settings
.
setValue
(
chKey
,
temp
->
isChecked
());
}
}
}
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
;
bool
tempVisible
;
QDockWidget
*
tempWidget
=
static_cast
<
QDockWidget
*>
(
dockWidgets
[
widget
]);
Qt
::
DockWidgetArea
tempLocation
;
QDockWidget
*
tempWidget
=
static_cast
<
QDockWidget
*>
(
dockWidgets
[
widget
]);
tempVisible
=
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
widget
,
view
)).
toBool
();
tempVisible
=
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
widget
,
view
)).
toBool
();
if
(
tempWidget
)
{
toolsMenuActions
[
widget
]
->
setChecked
(
tempVisible
);
}
if
(
tempWidget
){
toolsMenuActions
[
widget
]
->
setChecked
(
tempVisible
);
}
//qDebug() << buildMenuKey (SUB_SECTION_CHECKED,widget,view) << tempVisible;
//qDebug() << buildMenuKey (SUB_SECTION_CHECKED,widget,view) << tempVisible
;
tempLocation
=
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
widget
,
view
)).
toInt
())
;
tempLocation
=
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
widget
,
view
)).
toInt
());
if
(
tempWidget
&&
tempVisible
)
{
addDockWidget
(
tempLocation
,
tempWidget
);
tempWidget
->
show
();
}
if
(
tempWidget
&&
tempVisible
){
}
addDockWidget
(
tempLocation
,
tempWidget
);
tempWidget
->
show
();
}
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
;
apType
=
(
UASManager
::
instance
()
&&
UASManager
::
instance
()
->
silentGetActiveUAS
())
?
UASManager
::
instance
()
->
getActiveUAS
()
->
getAutopilotType
()
:
-
1
;
return
(
QString
::
number
(
apType
)
+
"/"
+
QString
::
number
(
SECTION_MENU
)
+
"/"
+
QString
::
number
(
view
)
+
"/"
+
QString
::
number
(
tool
)
+
"/"
+
QString
::
number
(
section
)
+
"/"
);
}
}
QString
MainWindow
::
buildMenuKey
(
SETTINGS_SECTIONS
section
,
TOOLS_WIDGET_NAMES
tool
,
VIEW_SECTIONS
view
){
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
// Key is built as follows: autopilot_type/section_menu/view/tool/section
{
int
apType
;
//settings.setValue("geometry", saveGeometry());
//settings.setValue("windowState", saveState());
aboutToCloseFlag
=
true
;
settings
.
setValue
(
"VIEW_ON_APPLICATION_CLOSE"
,
currentView
);
settings
.
sync
();
QMainWindow
::
closeEvent
(
event
);
}
apType
=
(
UASManager
::
instance
()
&&
UASManager
::
instance
()
->
silentGetActiveUAS
())
?
void
MainWindow
::
updateVisibilitySettings
(
bool
vis
)
UASManager
::
instance
()
->
getActiveUAS
()
->
getAutopilotType
()
:
{
-
1
;
// This is commented since when the application closes
// sets the visibility to false.
return
(
QString
::
number
(
apType
)
+
"/"
+
// TODO: A workaround is needed. The QApplication::aboutToQuit
QString
::
number
(
SECTION_MENU
)
+
"/"
+
// did not work
QString
::
number
(
view
)
+
"/"
+
QString
::
number
(
tool
)
+
"/"
+
QString
::
number
(
section
)
+
"/"
);
}
void
MainWindow
::
updateVisibilitySettings
(
bool
vis
){
if
(
!
aboutToCloseFlag
)
Q_UNUSED
(
vis
);
{
// This is commented since when the application closes
QDockWidget
*
temp
=
qobject_cast
<
QDockWidget
*>
(
sender
());
// sets the visibility to false.
if
(
temp
)
// TODO: A workaround is needed. The QApplication::aboutToQuit
{
// did not work
QHashIterator
<
int
,
QWidget
*>
i
(
dockWidgets
);
while
(
i
.
hasNext
())
/*
{
QDockWidget* temp = qobject_cast<QDockWidget *>(sender());
i
.
next
();
if
((
static_cast
<
QDockWidget
*>
(
dockWidgets
[
i
.
key
()]))
==
temp
)
QHashIterator<int, QWidget*> i(dockWidgets);
{
while (i.hasNext()) {
// QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(i.key()), currentView);
i.next();
// qDebug() << "Key in visibility changed" << chKey;
if ((static_cast <QDockWidget *>(dockWidgets[i.key()])) == temp){
// settings.setValue(chKey,vis);
QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(i.key()));
// settings.sync();
qDebug() << "Key in visibility changed" << chKey;
toolsMenuActions
[
i
.
key
()]
->
setChecked
(
vis
);
settings.setValue(chKey,vis);
break
;
toolsMenuActions[i.key()]->setChecked(vis);
}
break;
}
}
}
}
}
*/
}
}
void
MainWindow
::
updateLocationSettings
(
Qt
::
DockWidgetArea
location
){
void
MainWindow
::
updateLocationSettings
(
Qt
::
DockWidgetArea
location
)
QDockWidget
*
temp
=
qobject_cast
<
QDockWidget
*>
(
sender
());
{
QDockWidget
*
temp
=
qobject_cast
<
QDockWidget
*>
(
sender
());
QHashIterator
<
int
,
QWidget
*>
i
(
dockWidgets
);
QHashIterator
<
int
,
QWidget
*>
i
(
dockWidgets
);
while
(
i
.
hasNext
())
{
while
(
i
.
hasNext
())
i
.
next
();
{
if
((
static_cast
<
QDockWidget
*>
(
dockWidgets
[
i
.
key
()]))
==
temp
){
i
.
next
();
QString
posKey
=
buildMenuKey
(
SUB_SECTION_LOCATION
,
static_cast
<
TOOLS_WIDGET_NAMES
>
(
i
.
key
()),
currentView
);
if
((
static_cast
<
QDockWidget
*>
(
dockWidgets
[
i
.
key
()]))
==
temp
)
settings
.
setValue
(
posKey
,
location
);
{
break
;
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);
// //FIXME: free memory in destructor
// slugsCamControlWidget->hide();
// joystick = new JoystickInput();
//>>>>>>> master
// //FIXME: free memory in destructor
// joystick = new JoystickInput();
//>>>>>>> master
}
}
/**
/**
...
@@ -571,13 +606,13 @@ void MainWindow::connectSlugsWidgets()
...
@@ -571,13 +606,13 @@ void MainWindow::connectSlugsWidgets()
}
}
if
(
slugsHilSimWidget
&&
slugsHilSimWidget
->
widget
()){
if
(
slugsHilSimWidget
&&
slugsHilSimWidget
->
widget
()){
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
slugsHilSimWidget
->
widget
(),
SLOT
(
activeUasSet
(
UASInterface
*
)));
slugsHilSimWidget
->
widget
(),
SLOT
(
activeUasSet
(
UASInterface
*
)));
}
}
if
(
slugsDataWidget
&&
slugsDataWidget
->
widget
()){
if
(
slugsDataWidget
&&
slugsDataWidget
->
widget
()){
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
slugsDataWidget
->
widget
(),
SLOT
(
setActiveUAS
(
UASInterface
*
)));
slugsDataWidget
->
widget
(),
SLOT
(
setActiveUAS
(
UASInterface
*
)));
}
}
...
@@ -598,10 +633,10 @@ void MainWindow::arrangeCommonCenterStack()
...
@@ -598,10 +633,10 @@ void MainWindow::arrangeCommonCenterStack()
void
MainWindow
::
arrangePxCenterStack
()
void
MainWindow
::
arrangePxCenterStack
()
{
{
if
(
!
centerStack
)
{
if
(
!
centerStack
)
{
qDebug
()
<<
"Center Stack not Created!"
;
qDebug
()
<<
"Center Stack not Created!"
;
return
;
return
;
}
}
if
(
linechartWidget
)
centerStack
->
addWidget
(
linechartWidget
);
if
(
linechartWidget
)
centerStack
->
addWidget
(
linechartWidget
);
...
@@ -622,15 +657,15 @@ void MainWindow::arrangePxCenterStack()
...
@@ -622,15 +657,15 @@ void MainWindow::arrangePxCenterStack()
void
MainWindow
::
arrangeSlugsCenterStack
()
void
MainWindow
::
arrangeSlugsCenterStack
()
{
{
if
(
!
centerStack
)
{
if
(
!
centerStack
)
{
qDebug
()
<<
"Center Stack not Created!"
;
qDebug
()
<<
"Center Stack not Created!"
;
return
;
return
;
}
}
if
(
linechartWidget
)
centerStack
->
addWidget
(
linechartWidget
);
if
(
linechartWidget
)
centerStack
->
addWidget
(
linechartWidget
);
if
(
hudWidget
)
centerStack
->
addWidget
(
hudWidget
);
if
(
hudWidget
)
centerStack
->
addWidget
(
hudWidget
);
}
}
...
@@ -785,10 +820,10 @@ void MainWindow::connectCommonActions()
...
@@ -785,10 +820,10 @@ void MainWindow::connectCommonActions()
void
MainWindow
::
connectPxActions
()
void
MainWindow
::
connectPxActions
()
{
{
ui
.
actionJoystickSettings
->
setVisible
(
true
);
ui
.
actionJoystickSettings
->
setVisible
(
true
);
// Joystick configuration
// Joystick configuration
connect
(
ui
.
actionJoystickSettings
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
configure
()));
connect
(
ui
.
actionJoystickSettings
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
configure
()));
}
}
...
@@ -948,58 +983,77 @@ void MainWindow::UASCreated(UASInterface* uas)
...
@@ -948,58 +983,77 @@ void MainWindow::UASCreated(UASInterface* uas)
// TODO Stylesheet reloading should in theory not be necessary
// TODO Stylesheet reloading should in theory not be necessary
reloadStylesheet
();
reloadStylesheet
();
switch
(
uas
->
getAutopilotType
()){
switch
(
uas
->
getAutopilotType
())
case
(
MAV_AUTOPILOT_GENERIC
):
{
case
(
MAV_AUTOPILOT_ARDUPILOTMEGA
):
case
(
MAV_AUTOPILOT_SLUGS
):
case
(
MAV_AUTOPILOT_PIXHAWK
):
{
{
// Build Slugs Widgets
// Build Pixhawk Widgets
buildSlugsWidgets
();
buildPxWidgets
();
// Connect Slugs Widgets
// Connect Pixhawk Widgets
connectSlugsWidgets
();
connectPxWidgets
();
// Arrange Slugs Centerstack
// Arrange Pixhawk Centerstack
arrangeSlugsCenterStack
();
arrangePxCenterStack
();
// Connect Slugs Actions
// Connect Pixhawk Actions
connectSlugsActions
();
connectPxActions
();
// FIXME: This type checking might be redundant
// FIXME: This type checking might be redundant
// if (slugsDataWidget) {
// Check which type this UAS is of
// SlugsDataSensorView* dataWidget = dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget());
// PxQuadMAV* mav = dynamic_cast<PxQuadMAV*>(uas);
// if (dataWidget) {
// if (mav) loadPixhawkEngineerView();
// SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas);
}
break
;
// if (mav2) {
(
dynamic_cast
<
SlugsDataSensorView
*>
(
slugsDataWidget
->
widget
()))
->
addUAS
(
uas
);
case
(
MAV_AUTOPILOT_SLUGS
):
// //loadSlugsView();
{
// loadGlobalOperatorView();
// Build Slugs Widgets
// }
buildSlugsWidgets
();
// }
// }
// Connect Slugs Widgets
}
connectSlugsWidgets
();
break
;
default:
// Arrange Slugs Centerstack
case
(
MAV_AUTOPILOT_GENERIC
):
arrangeSlugsCenterStack
();
case
(
MAV_AUTOPILOT_ARDUPILOTMEGA
):
case
(
MAV_AUTOPILOT_PIXHAWK
):
// Connect Slugs Actions
{
connectSlugsActions
();
// Build Pixhawk Widgets
buildPxWidgets
();
// FIXME: This type checking might be redundant
// if (slugsDataWidget) {
// Connect Pixhawk Widgets
// SlugsDataSensorView* dataWidget = dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget());
connectPxWidgets
();
// if (dataWidget) {
// SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas);
// Arrange Pixhawk Centerstack
// if (mav2) {
arrangePxCenterStack
();
(
dynamic_cast
<
SlugsDataSensorView
*>
(
slugsDataWidget
->
widget
()))
->
addUAS
(
uas
);
// //loadSlugsView();
// Connect Pixhawk Actions
// loadGlobalOperatorView();
connectPxActions
();
// }
// }
}
// }
break
;
}
break
;
}
loadEngineerView
();
// Change the view only if this is the first UAS
// 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
();
}
}
}
}
}
...
@@ -1065,11 +1119,11 @@ void MainWindow::clearView()
...
@@ -1065,11 +1119,11 @@ void MainWindow::clearView()
void
MainWindow
::
loadEngineerView
()
void
MainWindow
::
loadEngineerView
()
{
{
clearView
();
clearView
();
currentView
=
VIEW_ENGINEER
;
currentView
=
VIEW_ENGINEER
;
presentView
();
presentView
();
}
}
void
MainWindow
::
loadOperatorView
()
void
MainWindow
::
loadOperatorView
()
...
@@ -1104,324 +1158,199 @@ void MainWindow::presentView()
...
@@ -1104,324 +1158,199 @@ void MainWindow::presentView()
#ifdef QGC_OSG_ENABLED
#ifdef QGC_OSG_ENABLED
// 3D map
// 3D map
if
(
_3DWidget
)
if
(
_3DWidget
)
{
{
if
(
centerStack
)
if
(
centerStack
)
{
{
//map3DWidget->setActive(true);
//map3DWidget->setActive(true);
centerStack
->
setCurrentWidget
(
_3DWidget
);
centerStack
->
setCurrentWidget
(
_3DWidget
);
}
}
}
}
#endif
#endif
qDebug
()
<<
"LC"
;
qDebug
()
<<
"LC"
;
showTheCentralWidget
(
CENTRAL_LINECHART
,
currentView
);
showTheCentralWidget
(
CENTRAL_LINECHART
,
currentView
);
if
(
linechartWidget
)
if
(
linechartWidget
)
{
{
qDebug
()
<<
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_LINECHART
,
currentView
)
<<
qDebug
()
<<
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_LINECHART
,
currentView
)
<<
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_LINECHART
,
currentView
)).
toBool
()
;
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_LINECHART
,
currentView
)).
toBool
()
;
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_LINECHART
,
currentView
)).
toBool
()){
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_LINECHART
,
currentView
)).
toBool
()){
if
(
centerStack
)
{
if
(
centerStack
)
{
linechartWidget
->
setActive
(
true
);
linechartWidget
->
setActive
(
true
);
centerStack
->
setCurrentWidget
(
linechartWidget
);
centerStack
->
setCurrentWidget
(
linechartWidget
);
}
}
}
else
{
}
else
{
linechartWidget
->
setActive
(
false
);
linechartWidget
->
setActive
(
false
);
}
}
}
}
// MAP
// MAP
qDebug
()
<<
"MAP"
;
qDebug
()
<<
"MAP"
;
showTheCentralWidget
(
CENTRAL_MAP
,
currentView
);
showTheCentralWidget
(
CENTRAL_MAP
,
currentView
);
// PROTOCOL
// PROTOCOL
qDebug
()
<<
"CP"
;
qDebug
()
<<
"CP"
;
showTheCentralWidget
(
CENTRAL_PROTOCOL
,
currentView
);
showTheCentralWidget
(
CENTRAL_PROTOCOL
,
currentView
);
// HEAD UP DISPLAY
// HEAD UP DISPLAY
showTheCentralWidget
(
CENTRAL_HUD
,
currentView
);
showTheCentralWidget
(
CENTRAL_HUD
,
currentView
);
qDebug
()
<<
"HUD"
;
qDebug
()
<<
"HUD"
;
if
(
hudWidget
){
if
(
hudWidget
){
qDebug
()
<<
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_HUD
,
currentView
)
<<
qDebug
()
<<
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_HUD
,
currentView
)
<<
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_HUD
,
currentView
)).
toBool
();
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_HUD
,
currentView
)).
toBool
();
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_HUD
,
currentView
)).
toBool
()){
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
CENTRAL_HUD
,
currentView
)).
toBool
()){
if
(
centerStack
)
{
if
(
centerStack
)
{
centerStack
->
setCurrentWidget
(
hudWidget
);
centerStack
->
setCurrentWidget
(
hudWidget
);
hudWidget
->
start
();
hudWidget
->
start
();
}
}
}
else
{
}
else
{
hudWidget
->
stop
();
hudWidget
->
stop
();
}
}
}
}
// Show docked widgets based on current view and autopilot type
// Show docked widgets based on current view and autopilot type
// UAS CONTROL
// UAS CONTROL
showTheWidget
(
MENU_UAS_CONTROL
,
currentView
);
showTheWidget
(
MENU_UAS_CONTROL
,
currentView
);
// UAS LIST
// UAS LIST
showTheWidget
(
MENU_UAS_LIST
,
currentView
);
showTheWidget
(
MENU_UAS_LIST
,
currentView
);
// WAYPOINT LIST
// WAYPOINT LIST
showTheWidget
(
MENU_WAYPOINTS
,
currentView
);
showTheWidget
(
MENU_WAYPOINTS
,
currentView
);
// UAS STATUS
// UAS STATUS
showTheWidget
(
MENU_STATUS
,
currentView
);
showTheWidget
(
MENU_STATUS
,
currentView
);
// DETECTION
// DETECTION
showTheWidget
(
MENU_DETECTION
,
currentView
);
showTheWidget
(
MENU_DETECTION
,
currentView
);
// DEBUG CONSOLE
// DEBUG CONSOLE
showTheWidget
(
MENU_DEBUG_CONSOLE
,
currentView
);
showTheWidget
(
MENU_DEBUG_CONSOLE
,
currentView
);
// ONBOARD PARAMETERS
// ONBOARD PARAMETERS
showTheWidget
(
MENU_PARAMETERS
,
currentView
);
showTheWidget
(
MENU_PARAMETERS
,
currentView
);
// WATCHDOG
// WATCHDOG
showTheWidget
(
MENU_WATCHDOG
,
currentView
);
showTheWidget
(
MENU_WATCHDOG
,
currentView
);
// HUD
// HUD
showTheWidget
(
MENU_HUD
,
currentView
);
showTheWidget
(
MENU_HUD
,
currentView
);
if
(
headUpDockWidget
)
if
(
headUpDockWidget
)
{
{
HUD
*
tmpHud
=
dynamic_cast
<
HUD
*>
(
headUpDockWidget
->
widget
()
);
HUD
*
tmpHud
=
dynamic_cast
<
HUD
*>
(
headUpDockWidget
->
widget
()
);
if
(
tmpHud
){
if
(
tmpHud
){
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HUD
,
currentView
)).
toBool
()){
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HUD
,
currentView
)).
toBool
()){
tmpHud
->
start
();
tmpHud
->
start
();
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HUD
,
currentView
)).
toInt
()),
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HUD
,
currentView
)).
toInt
()),
hsiDockWidget
);
hsiDockWidget
);
headUpDockWidget
->
show
();
headUpDockWidget
->
show
();
}
else
{
}
else
{
tmpHud
->
stop
();
tmpHud
->
stop
();
headUpDockWidget
->
hide
();
headUpDockWidget
->
hide
();
}
}
}
}
}
}
// RC View
// RC View
showTheWidget
(
MENU_RC_VIEW
,
currentView
);
showTheWidget
(
MENU_RC_VIEW
,
currentView
);
// SLUGS DATA
// SLUGS DATA
showTheWidget
(
MENU_SLUGS_DATA
,
currentView
);
showTheWidget
(
MENU_SLUGS_DATA
,
currentView
);
// SLUGS PID
// SLUGS PID
showTheWidget
(
MENU_SLUGS_PID
,
currentView
);
showTheWidget
(
MENU_SLUGS_PID
,
currentView
);
// SLUGS HIL
// SLUGS HIL
showTheWidget
(
MENU_SLUGS_HIL
,
currentView
);
showTheWidget
(
MENU_SLUGS_HIL
,
currentView
);
// SLUGS CAMERA
// SLUGS CAMERA
showTheWidget
(
MENU_SLUGS_CAMERA
,
currentView
);
showTheWidget
(
MENU_SLUGS_CAMERA
,
currentView
);
// HORIZONTAL SITUATION INDICATOR
// HORIZONTAL SITUATION INDICATOR
showTheWidget
(
MENU_HSI
,
currentView
);
showTheWidget
(
MENU_HSI
,
currentView
);
if
(
hsiDockWidget
)
if
(
hsiDockWidget
)
{
{
HSIDisplay
*
hsi
=
dynamic_cast
<
HSIDisplay
*>
(
hsiDockWidget
->
widget
()
);
HSIDisplay
*
hsi
=
dynamic_cast
<
HSIDisplay
*>
(
hsiDockWidget
->
widget
()
);
if
(
hsi
){
if
(
hsi
){
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HSI
,
currentView
)).
toBool
()){
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HSI
,
currentView
)).
toBool
()){
hsi
->
start
();
hsi
->
start
();
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HSI
,
currentView
)).
toInt
()),
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HSI
,
currentView
)).
toInt
()),
hsiDockWidget
);
hsiDockWidget
);
hsiDockWidget
->
show
();
hsiDockWidget
->
show
();
}
else
{
}
else
{
hsi
->
stop
();
hsi
->
stop
();
hsiDockWidget
->
hide
();
hsiDockWidget
->
hide
();
}
}
}
}
// HEAD DOWN 1
showTheWidget
(
MENU_HDD_1
,
currentView
);
if
(
headDown1DockWidget
)
{
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown1DockWidget
->
widget
());
if
(
hdd
)
{
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HDD_1
,
currentView
)).
toBool
())
{
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HDD_1
,
currentView
)).
toInt
()),
headDown1DockWidget
);
headDown1DockWidget
->
show
();
hdd
->
start
();
}
else
{
headDown1DockWidget
->
hide
();;
hdd
->
stop
();
}
}
}
// HEAD DOWN 2
showTheWidget
(
MENU_HDD_2
,
currentView
);
if
(
headDown2DockWidget
)
{
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown2DockWidget
->
widget
());
if
(
hdd
){
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HDD_2
,
currentView
)).
toBool
()){
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HDD_2
,
currentView
)).
toInt
()),
headDown2DockWidget
);
headDown2DockWidget
->
show
();
hdd
->
start
();
}
else
{
headDown2DockWidget
->
hide
();
hdd
->
stop
();
}
}
}
}
}
this
->
show
();
}
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
();
// HEAD DOWN 1
showTheWidget
(
MENU_HDD_1
,
currentView
);
if
(
headDown1DockWidget
)
if
(
headDown1DockWidget
)
{
{
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown1DockWidget
->
widget
());
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown1DockWidget
->
widget
());
if
(
hdd
)
if
(
hdd
)
{
{
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HDD_1
,
currentView
)).
toBool
())
{
addDockWidget
(
Qt
::
RightDockWidgetArea
,
headDown1DockWidget
);
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HDD_1
,
currentView
)).
toInt
()),
headDown1DockWidget
->
show
();
headDown1DockWidget
);
hdd
->
start
();
headDown1DockWidget
->
show
();
hdd
->
start
();
}
else
{
headDown1DockWidget
->
hide
();;
hdd
->
stop
();
}
}
}
}
}
// HEAD DOWN 2
showTheWidget
(
MENU_HDD_2
,
currentView
);
if
(
headDown2DockWidget
)
if
(
headDown2DockWidget
)
{
{
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown2DockWidget
->
widget
());
HDDisplay
*
hdd
=
dynamic_cast
<
HDDisplay
*>
(
headDown2DockWidget
->
widget
());
if
(
hdd
)
if
(
hdd
){
{
if
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
MENU_HDD_2
,
currentView
)).
toBool
()){
addDockWidget
(
Qt
::
RightDockWidgetArea
,
headDown2DockWidget
);
addDockWidget
(
static_cast
<
Qt
::
DockWidgetArea
>
(
settings
.
value
(
buildMenuKey
(
SUB_SECTION_LOCATION
,
MENU_HDD_2
,
currentView
)).
toInt
()),
headDown2DockWidget
->
show
();
headDown2DockWidget
);
hdd
->
start
();
headDown2DockWidget
->
show
();
hdd
->
start
();
}
else
{
headDown2DockWidget
->
hide
();
hdd
->
stop
();
}
}
}
}
}
//<<<<<<< HEAD
//=======
//}
//void MainWindow::loadOperatorView()
//{
// clearView();
// // MAP
// if (mapWidget)
// {
// QStackedWidget *centerStack = dynamic_cast<QStackedWidget*>(centralWidget());
// if (centerStack)
// {
// centerStack->setCurrentWidget(mapWidget);
// }
// }
//>>>>>>> master
// UAS CONTROL
this
->
show
();
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
void
MainWindow
::
showTheCentralWidget
(
TOOLS_WIDGET_NAMES
centralWidget
,
VIEW_SECTIONS
view
)
if
(
detectionDockWidget
)
{
{
bool
tempVisible
;
addDockWidget
(
Qt
::
RightDockWidgetArea
,
detectionDockWidget
);
QWidget
*
tempWidget
=
dockWidgets
[
centralWidget
];
detectionDockWidget
->
show
();
}
// LINE CHART
tempVisible
=
settings
.
value
(
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
view
)).
toBool
();
if
(
linechartWidget
)
qDebug
()
<<
buildMenuKey
(
SUB_SECTION_CHECKED
,
centralWidget
,
view
)
<<
tempVisible
;
if
(
toolsMenuActions
[
centralWidget
])
{
{
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
toolsMenuActions
[
centralWidget
]
->
setChecked
(
tempVisible
);
if
(
centerStack
)
{
linechartWidget
->
setActive
(
true
);
centerStack
->
setCurrentWidget
(
linechartWidget
);
}
}
}
// ONBOARD PARAMETERS
if
(
centerStack
&&
tempWidget
&&
tempVisible
)
if
(
parametersDockWidget
)
{
{
addDockWidget
(
Qt
::
RightDockWidgetArea
,
parametersDockWidget
);
centerStack
->
setCurrentWidget
(
tempWidget
);
parametersDockWidget
->
show
();
}
}
}
}
void
MainWindow
::
loadWidgets
()
void
MainWindow
::
loadWidgets
()
{
{
//
loadOperatorView();
loadOperatorView
();
loadMAVLinkView
();
//
loadMAVLinkView();
//loadPilotView();
//loadPilotView();
}
}
...
@@ -1457,415 +1386,54 @@ void MainWindow::loadDataView(QString fileName)
...
@@ -1457,415 +1386,54 @@ void MainWindow::loadDataView(QString fileName)
void
MainWindow
::
load3DMapView
()
void
MainWindow
::
load3DMapView
()
{
{
#ifdef QGC_OSGEARTH_ENABLED
#ifdef QGC_OSGEARTH_ENABLED
clearView
();
clearView
();
// 3D map
if
(
_3DMapWidget
)
{
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
if
(
centerStack
)
{
//map3DWidget->setActive(true);
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
// 3D map
if
(
hsiDockWidget
)
if
(
_3DMapWidget
)
{
{
HSIDisplay
*
hsi
=
dynamic_cast
<
HSIDisplay
*>
(
hsiDockWidget
->
widget
()
);
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
if
(
hsi
)
if
(
centerStack
)
{
{
hsi
->
start
();
//map3DWidget->setActive(true);
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
hsiDockWidget
);
centerStack
->
setCurrentWidget
(
_3DMapWidget
);
hsiDockWidget
->
show
();
}
}
}
}
#endif
#endif
}
}
void
MainWindow
::
loadGoogleEarthView
()
void
MainWindow
::
loadGoogleEarthView
()
{
{
#if (defined Q_OS_WIN) | (defined Q_OS_MAC)
clearView
();
// 3D map
if
(
gEarthWidget
)
{
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
if
(
centerStack
)
{
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
}
void
MainWindow
::
load3DView
()
{
#ifdef QGC_OSG_ENABLED
clearView
();
// 3D map
if
(
_3DWidget
)
{
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
if
(
centerStack
)
{
//map3DWidget->setActive(true);
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)
#if (defined Q_OS_WIN) | (defined Q_OS_MAC)
gEarthWidget = new QGCGoogleEarthView(this);
clearView
();
#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));
=======
// 3D map
if (
protocol
Widget)
if
(
gEarth
Widget
)
{
{
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
if
(
centerStack
)
if
(
centerStack
)
{
{
centerStack->setCurrentWidget(
protocol
Widget);
centerStack
->
setCurrentWidget
(
gEarth
Widget
);
}
}
}
}
>>>>>>> master
#endif
}
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
::
load3DView
()
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
#ifdef QGC_OSG_ENABLED
if (_3DWidget) centerStack->addWidget(_3DWidget);
clearView
();
#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);
// 3D map
=======
if
(
_3DWidget
)
// ONBOARD PARAMETERS
if (parametersDockWidget)
{
{
addDockWidget(Qt::RightDockWidgetArea, parametersDockWidget);
QStackedWidget
*
centerStack
=
dynamic_cast
<
QStackedWidget
*>
(
centralWidget
());
parametersDockWidget->show();
if
(
centerStack
)
{
//map3DWidget->setActive(true);
centerStack
->
setCurrentWidget
(
_3DWidget
);
}
}
}
>>>>>>> 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
#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:
...
@@ -138,17 +138,14 @@ public slots:
/** @brief Reload the CSS style sheet */
/** @brief Reload the CSS style sheet */
void
reloadStylesheet
();
void
reloadStylesheet
();
void
closeEvent
(
QCloseEvent
*
event
);
/*
/*
==========================================================
==========================================================
Potentially Deprecated
Potentially Deprecated
==========================================================
==========================================================
*/
*/
void
loadPixhawkEngineerView
();
/** @brief Load view with all widgets */
void
loadAllView
();
void
loadWidgets
();
void
loadWidgets
();
/** @brief Load data view, allowing to plot flight data */
/** @brief Load data view, allowing to plot flight data */
...
@@ -228,13 +225,15 @@ protected:
...
@@ -228,13 +225,15 @@ protected:
}
TOOLS_WIDGET_NAMES
;
}
TOOLS_WIDGET_NAMES
;
typedef
enum
_SETTINGS_SECTIONS
{
typedef
enum
_SETTINGS_SECTIONS
{
SECTION_MENU
,
SECTION_MENU
,
SUB_SECTION_CHECKED
,
SUB_SECTION_CHECKED
,
SUB_SECTION_LOCATION
,
SUB_SECTION_LOCATION
,
}
SETTINGS_SECTIONS
;
}
SETTINGS_SECTIONS
;
typedef
enum
_VIEW_SECTIONS
{
typedef
enum
_VIEW_SECTIONS
{
VIEW_ENGINEER
,
VIEW_ENGINEER
,
VIEW_OPERATOR
,
VIEW_OPERATOR
,
VIEW_PILOT
,
VIEW_PILOT
,
...
@@ -301,6 +300,7 @@ protected:
...
@@ -301,6 +300,7 @@ protected:
/** @brief Keeps track of the current view */
/** @brief Keeps track of the current view */
VIEW_SECTIONS
currentView
;
VIEW_SECTIONS
currentView
;
bool
aboutToCloseFlag
;
QStatusBar
*
statusBar
;
QStatusBar
*
statusBar
;
QStatusBar
*
createStatusBar
();
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