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
0c9de33c
Commit
0c9de33c
authored
Apr 23, 2013
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overhauled activity selection and logfile replay options
parent
55d7b98f
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
427 additions
and
261 deletions
+427
-261
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
MainWindow.cc
src/ui/MainWindow.cc
+65
-23
MainWindow.h
src/ui/MainWindow.h
+6
-0
MainWindow.ui
src/ui/MainWindow.ui
+18
-3
QGCHilXPlaneConfiguration.cc
src/ui/QGCHilXPlaneConfiguration.cc
+2
-2
QGCHilXPlaneConfiguration.ui
src/ui/QGCHilXPlaneConfiguration.ui
+21
-35
QGCMAVLinkLogPlayer.cc
src/ui/QGCMAVLinkLogPlayer.cc
+1
-1
QGCMAVLinkLogPlayer.h
src/ui/QGCMAVLinkLogPlayer.h
+8
-0
QGCMAVLinkLogPlayer.ui
src/ui/QGCMAVLinkLogPlayer.ui
+61
-61
QGCStatusBar.cc
src/ui/QGCStatusBar.cc
+132
-0
QGCStatusBar.h
src/ui/QGCStatusBar.h
+61
-0
QGCToolBar.cc
src/ui/QGCToolBar.cc
+48
-127
QGCToolBar.h
src/ui/QGCToolBar.h
+2
-9
No files found.
qgroundcontrol.pro
View file @
0c9de33c
...
@@ -340,6 +340,7 @@ HEADERS += src/MG.h \
...
@@ -340,6 +340,7 @@ HEADERS += src/MG.h \
libs
/
qextserialport
/
qextserialenumerator
.
h
\
libs
/
qextserialport
/
qextserialenumerator
.
h
\
src
/
QGCGeo
.
h
\
src
/
QGCGeo
.
h
\
src
/
ui
/
QGCToolBar
.
h
\
src
/
ui
/
QGCToolBar
.
h
\
src
/
ui
/
QGCStatusBar
.
h
\
src
/
ui
/
QGCMAVLinkInspector
.
h
\
src
/
ui
/
QGCMAVLinkInspector
.
h
\
src
/
ui
/
MAVLinkDecoder
.
h
\
src
/
ui
/
MAVLinkDecoder
.
h
\
src
/
ui
/
WaypointViewOnlyView
.
h
\
src
/
ui
/
WaypointViewOnlyView
.
h
\
...
@@ -503,6 +504,7 @@ SOURCES += src/main.cc \
...
@@ -503,6 +504,7 @@ SOURCES += src/main.cc \
src
/
ui
/
map
/
QGCMapTool
.
cc
\
src
/
ui
/
map
/
QGCMapTool
.
cc
\
src
/
ui
/
map
/
QGCMapToolBar
.
cc
\
src
/
ui
/
map
/
QGCMapToolBar
.
cc
\
src
/
ui
/
QGCToolBar
.
cc
\
src
/
ui
/
QGCToolBar
.
cc
\
src
/
ui
/
QGCStatusBar
.
cc
\
src
/
ui
/
QGCMAVLinkInspector
.
cc
\
src
/
ui
/
QGCMAVLinkInspector
.
cc
\
src
/
ui
/
MAVLinkDecoder
.
cc
\
src
/
ui
/
MAVLinkDecoder
.
cc
\
src
/
ui
/
WaypointViewOnlyView
.
cc
\
src
/
ui
/
WaypointViewOnlyView
.
cc
\
...
...
src/ui/MainWindow.cc
View file @
0c9de33c
...
@@ -57,6 +57,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -57,6 +57,7 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLinkMessageSender.h"
#include "QGCMAVLinkMessageSender.h"
#include "QGCRGBDView.h"
#include "QGCRGBDView.h"
#include "QGCFirmwareUpdate.h"
#include "QGCFirmwareUpdate.h"
#include "QGCStatusBar.h"
#ifdef QGC_OSG_ENABLED
#ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h"
#include "Q3DWidgetFactory.h"
...
@@ -141,7 +142,7 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -141,7 +142,7 @@ MainWindow::MainWindow(QWidget *parent):
configureWindowName
();
configureWindowName
();
// Setup corners
// Setup corners
setCorner
(
Qt
::
BottomRightCorner
,
Qt
::
Right
DockWidgetArea
);
setCorner
(
Qt
::
BottomRightCorner
,
Qt
::
Bottom
DockWidgetArea
);
// Setup UI state machines
// Setup UI state machines
centerStackActionGroup
->
setExclusive
(
true
);
centerStackActionGroup
->
setExclusive
(
true
);
...
@@ -152,10 +153,14 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -152,10 +153,14 @@ MainWindow::MainWindow(QWidget *parent):
// Load Toolbar
// Load Toolbar
toolBar
=
new
QGCToolBar
(
this
);
toolBar
=
new
QGCToolBar
(
this
);
this
->
addToolBar
(
toolBar
);
this
->
addToolBar
(
toolBar
);
// Add actions
// Add actions
(inverted order due to insert)
toolBar
->
addPerspectiveChangeAction
(
ui
.
action
Operators
View
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
action
Simulation_
View
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionEngineersView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionEngineersView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionPilotsView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionPilotsView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionOperatorsView
);
customStatusBar
=
new
QGCStatusBar
(
this
);
this
->
setStatusBar
(
customStatusBar
);
emit
initStatusChanged
(
"Building common widgets."
);
emit
initStatusChanged
(
"Building common widgets."
);
...
@@ -373,6 +378,10 @@ void MainWindow::buildCommonWidgets()
...
@@ -373,6 +378,10 @@ void MainWindow::buildCommonWidgets()
// Add generic MAVLink decoder
// Add generic MAVLink decoder
mavlinkDecoder
=
new
MAVLinkDecoder
(
mavlink
,
this
);
mavlinkDecoder
=
new
MAVLinkDecoder
(
mavlink
,
this
);
// Log player
logPlayer
=
new
QGCMAVLinkLogPlayer
(
mavlink
,
customStatusBar
);
customStatusBar
->
setLogPlayer
(
logPlayer
);
// Dock widgets
// Dock widgets
if
(
!
controlDockWidget
)
if
(
!
controlDockWidget
)
{
{
...
@@ -418,15 +427,15 @@ void MainWindow::buildCommonWidgets()
...
@@ -418,15 +427,15 @@ void MainWindow::buildCommonWidgets()
addTool
(
debugConsoleDockWidget
,
tr
(
"Communication Console"
),
Qt
::
BottomDockWidgetArea
);
addTool
(
debugConsoleDockWidget
,
tr
(
"Communication Console"
),
Qt
::
BottomDockWidgetArea
);
}
}
if
(
!
logPlayerDockWidget
)
//
if (!logPlayerDockWidget)
{
//
{
logPlayerDockWidget
=
new
QDockWidget
(
tr
(
"MAVLink Log Player"
),
this
);
//
logPlayerDockWidget = new QDockWidget(tr("MAVLink Log Player"), this);
logPlayer
=
new
QGCMAVLinkLogPlayer
(
mavlink
,
this
);
//
logPlayer = new QGCMAVLinkLogPlayer(mavlink, this);
tool
Bar
->
setLogPlayer
(
logPlayer
);
// customStatus
Bar->setLogPlayer(logPlayer);
logPlayerDockWidget
->
setWidget
(
logPlayer
);
//
logPlayerDockWidget->setWidget(logPlayer);
logPlayerDockWidget
->
setObjectName
(
"MAVLINK_LOG_PLAYER_DOCKWIDGET"
);
//
logPlayerDockWidget->setObjectName("MAVLINK_LOG_PLAYER_DOCKWIDGET");
addTool
(
logPlayerDockWidget
,
tr
(
"MAVLink Log Replay"
),
Qt
::
RightDockWidgetArea
);
//
addTool(logPlayerDockWidget, tr("MAVLink Log Replay"), Qt::RightDockWidgetArea);
}
//
}
if
(
!
mavlinkInspectorWidget
)
if
(
!
mavlinkInspectorWidget
)
{
{
...
@@ -664,7 +673,7 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
...
@@ -664,7 +673,7 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
// Add simulation configuration widget
// Add simulation configuration widget
UAS
*
mav
=
dynamic_cast
<
UAS
*>
(
uas
);
UAS
*
mav
=
dynamic_cast
<
UAS
*>
(
uas
);
if
(
mav
)
if
(
mav
&&
!
hilDocks
.
contains
(
mav
->
getUASID
())
)
{
{
QGCHilConfiguration
*
hconf
=
new
QGCHilConfiguration
(
mav
,
this
);
QGCHilConfiguration
*
hconf
=
new
QGCHilConfiguration
(
mav
,
this
);
QString
hilDockName
=
tr
(
"HIL Config (%1)"
).
arg
(
uas
->
getUASName
());
QString
hilDockName
=
tr
(
"HIL Config (%1)"
).
arg
(
uas
->
getUASName
());
...
@@ -672,11 +681,13 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
...
@@ -672,11 +681,13 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
hilDock
->
setWidget
(
hconf
);
hilDock
->
setWidget
(
hconf
);
hilDock
->
setObjectName
(
QString
(
"HIL_CONFIG_%1"
).
arg
(
uas
->
getUASID
()));
hilDock
->
setObjectName
(
QString
(
"HIL_CONFIG_%1"
).
arg
(
uas
->
getUASID
()));
addTool
(
hilDock
,
hilDockName
,
Qt
::
RightDockWidgetArea
);
addTool
(
hilDock
,
hilDockName
,
Qt
::
RightDockWidgetArea
);
hilDocks
.
insert
(
mav
->
getUASID
(),
hilDock
);
if
(
currentView
!=
VIEW_SIMULATION
)
hilDock
->
hide
();
else
hilDock
->
show
();
}
}
// Reload view state in case new widgets were added
loadViewState
();
}
}
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
...
@@ -1035,6 +1046,7 @@ void MainWindow::connectCommonActions()
...
@@ -1035,6 +1046,7 @@ void MainWindow::connectCommonActions()
perspectives
->
addAction
(
ui
.
actionEngineersView
);
perspectives
->
addAction
(
ui
.
actionEngineersView
);
perspectives
->
addAction
(
ui
.
actionMavlinkView
);
perspectives
->
addAction
(
ui
.
actionMavlinkView
);
perspectives
->
addAction
(
ui
.
actionPilotsView
);
perspectives
->
addAction
(
ui
.
actionPilotsView
);
perspectives
->
addAction
(
ui
.
actionSimulation_View
);
perspectives
->
addAction
(
ui
.
actionOperatorsView
);
perspectives
->
addAction
(
ui
.
actionOperatorsView
);
perspectives
->
addAction
(
ui
.
actionFirmwareUpdateView
);
perspectives
->
addAction
(
ui
.
actionFirmwareUpdateView
);
perspectives
->
addAction
(
ui
.
actionUnconnectedView
);
perspectives
->
addAction
(
ui
.
actionUnconnectedView
);
...
@@ -1044,6 +1056,7 @@ void MainWindow::connectCommonActions()
...
@@ -1044,6 +1056,7 @@ void MainWindow::connectCommonActions()
if
(
currentView
==
VIEW_ENGINEER
)
ui
.
actionEngineersView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_ENGINEER
)
ui
.
actionEngineersView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_MAVLINK
)
ui
.
actionMavlinkView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_MAVLINK
)
ui
.
actionMavlinkView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_PILOT
)
ui
.
actionPilotsView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_PILOT
)
ui
.
actionPilotsView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_SIMULATION
)
ui
.
actionSimulation_View
->
setChecked
(
true
);
if
(
currentView
==
VIEW_OPERATOR
)
ui
.
actionOperatorsView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_OPERATOR
)
ui
.
actionOperatorsView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_FIRMWAREUPDATE
)
ui
.
actionFirmwareUpdateView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_FIRMWAREUPDATE
)
ui
.
actionFirmwareUpdateView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_UNCONNECTED
)
ui
.
actionUnconnectedView
->
setChecked
(
true
);
if
(
currentView
==
VIEW_UNCONNECTED
)
ui
.
actionUnconnectedView
->
setChecked
(
true
);
...
@@ -1072,6 +1085,7 @@ void MainWindow::connectCommonActions()
...
@@ -1072,6 +1085,7 @@ void MainWindow::connectCommonActions()
// Views actions
// Views actions
connect
(
ui
.
actionPilotsView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadPilotView
()));
connect
(
ui
.
actionPilotsView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadPilotView
()));
connect
(
ui
.
actionSimulation_View
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadSimulationView
()));
connect
(
ui
.
actionEngineersView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadEngineerView
()));
connect
(
ui
.
actionEngineersView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadEngineerView
()));
connect
(
ui
.
actionOperatorsView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadOperatorView
()));
connect
(
ui
.
actionOperatorsView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadOperatorView
()));
connect
(
ui
.
actionUnconnectedView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadUnconnectedView
()));
connect
(
ui
.
actionUnconnectedView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadUnconnectedView
()));
...
@@ -1383,6 +1397,9 @@ void MainWindow::UASCreated(UASInterface* uas)
...
@@ -1383,6 +1397,9 @@ void MainWindow::UASCreated(UASInterface* uas)
}
}
}
}
// HIL
showHILConfigurationWidget
(
uas
);
// Line chart
// Line chart
if
(
!
linechartWidget
)
if
(
!
linechartWidget
)
{
{
...
@@ -1440,6 +1457,9 @@ void MainWindow::UASCreated(UASInterface* uas)
...
@@ -1440,6 +1457,9 @@ void MainWindow::UASCreated(UASInterface* uas)
case
VIEW_PILOT
:
case
VIEW_PILOT
:
loadPilotView
();
loadPilotView
();
break
;
break
;
case
VIEW_SIMULATION
:
loadSimulationView
();
break
;
case
VIEW_UNCONNECTED
:
case
VIEW_UNCONNECTED
:
loadUnconnectedView
();
loadUnconnectedView
();
break
;
break
;
...
@@ -1532,8 +1552,7 @@ void MainWindow::loadViewState()
...
@@ -1532,8 +1552,7 @@ void MainWindow::loadViewState()
waypointsDockWidget
->
hide
();
waypointsDockWidget
->
hide
();
infoDockWidget
->
hide
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
show
();
debugConsoleDockWidget
->
show
();
logPlayerDockWidget
->
show
();
//mavlinkInspectorWidget->show();
mavlinkInspectorWidget
->
show
();
//mavlinkSenderWidget->show();
//mavlinkSenderWidget->show();
parametersDockWidget
->
show
();
parametersDockWidget
->
show
();
hsiDockWidget
->
hide
();
hsiDockWidget
->
hide
();
...
@@ -1551,7 +1570,7 @@ void MainWindow::loadViewState()
...
@@ -1551,7 +1570,7 @@ void MainWindow::loadViewState()
waypointsDockWidget
->
hide
();
waypointsDockWidget
->
hide
();
infoDockWidget
->
hide
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
hide
();
debugConsoleDockWidget
->
hide
();
logPlayerDockWidget
->
hide
();
//
logPlayerDockWidget->hide();
mavlinkInspectorWidget
->
hide
();
mavlinkInspectorWidget
->
hide
();
parametersDockWidget
->
hide
();
parametersDockWidget
->
hide
();
hsiDockWidget
->
show
();
hsiDockWidget
->
show
();
...
@@ -1569,7 +1588,7 @@ void MainWindow::loadViewState()
...
@@ -1569,7 +1588,7 @@ void MainWindow::loadViewState()
waypointsDockWidget
->
hide
();
waypointsDockWidget
->
hide
();
infoDockWidget
->
hide
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
hide
();
debugConsoleDockWidget
->
hide
();
logPlayerDockWidget
->
hide
();
//
logPlayerDockWidget->hide();
mavlinkInspectorWidget
->
show
();
mavlinkInspectorWidget
->
show
();
//mavlinkSenderWidget->show();
//mavlinkSenderWidget->show();
parametersDockWidget
->
hide
();
parametersDockWidget
->
hide
();
...
@@ -1588,7 +1607,7 @@ void MainWindow::loadViewState()
...
@@ -1588,7 +1607,7 @@ void MainWindow::loadViewState()
waypointsDockWidget
->
hide
();
waypointsDockWidget
->
hide
();
infoDockWidget
->
hide
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
hide
();
debugConsoleDockWidget
->
hide
();
logPlayerDockWidget
->
hide
();
//
logPlayerDockWidget->hide();
mavlinkInspectorWidget
->
hide
();
mavlinkInspectorWidget
->
hide
();
//mavlinkSenderWidget->hide();
//mavlinkSenderWidget->hide();
parametersDockWidget
->
hide
();
parametersDockWidget
->
hide
();
...
@@ -1607,7 +1626,7 @@ void MainWindow::loadViewState()
...
@@ -1607,7 +1626,7 @@ void MainWindow::loadViewState()
waypointsDockWidget
->
show
();
waypointsDockWidget
->
show
();
infoDockWidget
->
hide
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
show
();
debugConsoleDockWidget
->
show
();
logPlayerDockWidget
->
show
();
//
logPlayerDockWidget->show();
parametersDockWidget
->
hide
();
parametersDockWidget
->
hide
();
hsiDockWidget
->
hide
();
hsiDockWidget
->
hide
();
headDown1DockWidget
->
hide
();
headDown1DockWidget
->
hide
();
...
@@ -1618,6 +1637,18 @@ void MainWindow::loadViewState()
...
@@ -1618,6 +1637,18 @@ void MainWindow::loadViewState()
video2DockWidget
->
hide
();
video2DockWidget
->
hide
();
mavlinkInspectorWidget
->
hide
();
mavlinkInspectorWidget
->
hide
();
break
;
break
;
case
VIEW_SIMULATION
:
centerStack
->
setCurrentWidget
(
mapWidget
);
controlDockWidget
->
show
();
waypointsDockWidget
->
show
();
parametersDockWidget
->
show
();
mavlinkInspectorWidget
->
hide
();
foreach
(
int
key
,
hilDocks
.
keys
())
{
hilDocks
.
value
(
key
)
->
show
();
}
break
;
case
VIEW_UNCONNECTED
:
case
VIEW_UNCONNECTED
:
case
VIEW_FULL
:
case
VIEW_FULL
:
default:
default:
...
@@ -1627,7 +1658,7 @@ void MainWindow::loadViewState()
...
@@ -1627,7 +1658,7 @@ void MainWindow::loadViewState()
waypointsDockWidget
->
hide
();
waypointsDockWidget
->
hide
();
infoDockWidget
->
hide
();
infoDockWidget
->
hide
();
debugConsoleDockWidget
->
show
();
debugConsoleDockWidget
->
show
();
logPlayerDockWidget
->
show
();
//
logPlayerDockWidget->show();
parametersDockWidget
->
hide
();
parametersDockWidget
->
hide
();
hsiDockWidget
->
hide
();
hsiDockWidget
->
hide
();
headDown1DockWidget
->
hide
();
headDown1DockWidget
->
hide
();
...
@@ -1692,6 +1723,17 @@ void MainWindow::loadPilotView()
...
@@ -1692,6 +1723,17 @@ void MainWindow::loadPilotView()
}
}
}
}
void
MainWindow
::
loadSimulationView
()
{
if
(
currentView
!=
VIEW_SIMULATION
)
{
storeViewState
();
currentView
=
VIEW_SIMULATION
;
ui
.
actionSimulation_View
->
setChecked
(
true
);
loadViewState
();
}
}
void
MainWindow
::
loadMAVLinkView
()
void
MainWindow
::
loadMAVLinkView
()
{
{
if
(
currentView
!=
VIEW_MAVLINK
)
if
(
currentView
!=
VIEW_MAVLINK
)
...
...
src/ui/MainWindow.h
View file @
0c9de33c
...
@@ -86,6 +86,7 @@ class QGCMapTool;
...
@@ -86,6 +86,7 @@ class QGCMapTool;
class
QGCMAVLinkMessageSender
;
class
QGCMAVLinkMessageSender
;
class
QGCFirmwareUpdate
;
class
QGCFirmwareUpdate
;
class
QSplashScreen
;
class
QSplashScreen
;
class
QGCStatusBar
;
/**
/**
* @brief Main Application Window
* @brief Main Application Window
...
@@ -159,6 +160,8 @@ public slots:
...
@@ -159,6 +160,8 @@ public slots:
void
loadUnconnectedView
();
void
loadUnconnectedView
();
/** @brief Load view for pilot */
/** @brief Load view for pilot */
void
loadPilotView
();
void
loadPilotView
();
/** @brief Load view for simulation */
void
loadSimulationView
();
/** @brief Load view for engineer */
/** @brief Load view for engineer */
void
loadEngineerView
();
void
loadEngineerView
();
/** @brief Load view for operator */
/** @brief Load view for operator */
...
@@ -260,6 +263,7 @@ protected:
...
@@ -260,6 +263,7 @@ protected:
VIEW_ENGINEER
,
VIEW_ENGINEER
,
VIEW_OPERATOR
,
VIEW_OPERATOR
,
VIEW_PILOT
,
VIEW_PILOT
,
VIEW_SIMULATION
,
VIEW_MAVLINK
,
VIEW_MAVLINK
,
VIEW_FIRMWAREUPDATE
,
VIEW_FIRMWAREUPDATE
,
VIEW_UNCONNECTED
,
///< View in unconnected mode, when no UAS is available
VIEW_UNCONNECTED
,
///< View in unconnected mode, when no UAS is available
...
@@ -367,11 +371,13 @@ protected:
...
@@ -367,11 +371,13 @@ protected:
QPointer
<
QDockWidget
>
slugsCamControlWidget
;
QPointer
<
QDockWidget
>
slugsCamControlWidget
;
QPointer
<
QGCToolBar
>
toolBar
;
QPointer
<
QGCToolBar
>
toolBar
;
QPointer
<
QGCStatusBar
>
customStatusBar
;
QPointer
<
QDockWidget
>
mavlinkInspectorWidget
;
QPointer
<
QDockWidget
>
mavlinkInspectorWidget
;
QPointer
<
MAVLinkDecoder
>
mavlinkDecoder
;
QPointer
<
MAVLinkDecoder
>
mavlinkDecoder
;
QPointer
<
QDockWidget
>
mavlinkSenderWidget
;
QPointer
<
QDockWidget
>
mavlinkSenderWidget
;
QGCMAVLinkLogPlayer
*
logPlayer
;
QGCMAVLinkLogPlayer
*
logPlayer
;
QMap
<
int
,
QDockWidget
*>
hilDocks
;
// Popup widgets
// Popup widgets
JoystickWidget
*
joystickWidget
;
JoystickWidget
*
joystickWidget
;
...
...
src/ui/MainWindow.ui
View file @
0c9de33c
...
@@ -323,7 +323,7 @@
...
@@ -323,7 +323,7 @@
<normaloff>
:/files/images/status/weather-overcast.svg
</normaloff>
:/files/images/status/weather-overcast.svg
</iconset>
<normaloff>
:/files/images/status/weather-overcast.svg
</normaloff>
:/files/images/status/weather-overcast.svg
</iconset>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Operator
</string>
<string>
Mission
</string>
</property>
</property>
<property
name=
"shortcut"
>
<property
name=
"shortcut"
>
<string>
Meta+O
</string>
<string>
Meta+O
</string>
...
@@ -338,7 +338,7 @@
...
@@ -338,7 +338,7 @@
<normaloff>
:/files/images/apps/utilities-system-monitor.svg
</normaloff>
:/files/images/apps/utilities-system-monitor.svg
</iconset>
<normaloff>
:/files/images/apps/utilities-system-monitor.svg
</normaloff>
:/files/images/apps/utilities-system-monitor.svg
</iconset>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Engineer
</string>
<string>
Development
</string>
</property>
</property>
<property
name=
"shortcut"
>
<property
name=
"shortcut"
>
<string>
Meta+E
</string>
<string>
Meta+E
</string>
...
@@ -377,7 +377,7 @@
...
@@ -377,7 +377,7 @@
<normaloff>
:/files/images/status/network-wireless-encrypted.svg
</normaloff>
:/files/images/status/network-wireless-encrypted.svg
</iconset>
<normaloff>
:/files/images/status/network-wireless-encrypted.svg
</normaloff>
:/files/images/status/network-wireless-encrypted.svg
</iconset>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Pilo
t
</string>
<string>
Fligh
t
</string>
</property>
</property>
<property
name=
"shortcut"
>
<property
name=
"shortcut"
>
<string>
Meta+P
</string>
<string>
Meta+P
</string>
...
@@ -488,6 +488,21 @@
...
@@ -488,6 +488,21 @@
<string>
Update the firmware of one of the connected autopilots
</string>
<string>
Update the firmware of one of the connected autopilots
</string>
</property>
</property>
</action>
</action>
<action
name=
"actionSimulation_View"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../qgroundcontrol.qrc"
>
<normaloff>
:/files/images/control/launch.svg
</normaloff>
:/files/images/control/launch.svg
</iconset>
</property>
<property
name=
"text"
>
<string>
Simulation View
</string>
</property>
<property
name=
"toolTip"
>
<string>
Open the simulation view
</string>
</property>
</action>
</widget>
</widget>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<resources>
<resources>
...
...
src/ui/QGCHilXPlaneConfiguration.cc
View file @
0c9de33c
...
@@ -23,8 +23,8 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
...
@@ -23,8 +23,8 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget *
if
(
xplane
)
if
(
xplane
)
{
{
connect
(
ui
->
randomAttitudeButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomAttitude
()));
//
connect(ui->randomAttitudeButton, SIGNAL(clicked()), link, SLOT(setRandomAttitude()));
connect
(
ui
->
randomPositionButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomPosition
()));
//
connect(ui->randomPositionButton, SIGNAL(clicked()), link, SLOT(setRandomPosition()));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
selectAirframe
(
QString
)));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
selectAirframe
(
QString
)));
ui
->
airframeComboBox
->
setCurrentIndex
(
link
->
getAirFrameIndex
());
ui
->
airframeComboBox
->
setCurrentIndex
(
link
->
getAirFrameIndex
());
}
}
...
...
src/ui/QGCHilXPlaneConfiguration.ui
View file @
0c9de33c
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
24
3
</width>
<width>
24
9
</width>
<height>
261
</height>
<height>
100
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
...
@@ -17,13 +17,26 @@
...
@@ -17,13 +17,26 @@
<property
name=
"margin"
>
<property
name=
"margin"
>
<number>
0
</number>
<number>
0
</number>
</property>
</property>
<item
row=
"
0"
column=
"0
"
>
<item
row=
"
3"
column=
"0"
colspan=
"2
"
>
<widget
class=
"Q
Label"
name=
"label
"
>
<widget
class=
"Q
PushButton"
name=
"startButton
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Airframe
</string>
<string>
Start
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"5"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"0"
column=
"1"
colspan=
"3"
>
<item
row=
"0"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"airframeComboBox"
>
<widget
class=
"QComboBox"
name=
"airframeComboBox"
>
<property
name=
"editable"
>
<property
name=
"editable"
>
...
@@ -100,20 +113,6 @@
...
@@ -100,20 +113,6 @@
</item>
</item>
</widget>
</widget>
</item>
</item>
<item
row=
"5"
column=
"2"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomPositionButton"
>
<property
name=
"text"
>
<string>
Random POS
</string>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomAttitudeButton"
>
<property
name=
"text"
>
<string>
Random ATT
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"hostLabel"
>
<widget
class=
"QLabel"
name=
"hostLabel"
>
<property
name=
"text"
>
<property
name=
"text"
>
...
@@ -121,26 +120,13 @@
...
@@ -121,26 +120,13 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
3"
column=
"0"
colspan=
"2
"
>
<item
row=
"
0"
column=
"0
"
>
<widget
class=
"Q
PushButton"
name=
"startButton
"
>
<widget
class=
"Q
Label"
name=
"label
"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Start
</string>
<string>
Airframe
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"6"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</layout>
</widget>
</widget>
<resources/>
<resources/>
...
...
src/ui/QGCMAVLinkLogPlayer.cc
View file @
0c9de33c
...
@@ -26,7 +26,7 @@ QGCMAVLinkLogPlayer::QGCMAVLinkLogPlayer(MAVLinkProtocol* mavlink, QWidget *pare
...
@@ -26,7 +26,7 @@ QGCMAVLinkLogPlayer::QGCMAVLinkLogPlayer(MAVLinkProtocol* mavlink, QWidget *pare
ui
(
new
Ui
::
QGCMAVLinkLogPlayer
)
ui
(
new
Ui
::
QGCMAVLinkLogPlayer
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
ui
->
grid
Layout
->
setAlignment
(
Qt
::
AlignTop
);
ui
->
horizontal
Layout
->
setAlignment
(
Qt
::
AlignTop
);
// Connect protocol
// Connect protocol
connect
(
this
,
SIGNAL
(
bytesReady
(
LinkInterface
*
,
QByteArray
)),
mavlink
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
connect
(
this
,
SIGNAL
(
bytesReady
(
LinkInterface
*
,
QByteArray
)),
mavlink
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
...
...
src/ui/QGCMAVLinkLogPlayer.h
View file @
0c9de33c
...
@@ -37,6 +37,14 @@ public:
...
@@ -37,6 +37,14 @@ public:
return
logFile
.
isOpen
();
return
logFile
.
isOpen
();
}
}
/**
* @brief Set the last log file name
* @param filename
*/
void
setLastLogFile
(
const
QString
&
filename
)
{
lastLogDirectory
=
filename
;
}
public
slots
:
public
slots
:
/** @brief Toggle between play and pause */
/** @brief Toggle between play and pause */
void
playPauseToggle
();
void
playPauseToggle
();
...
...
src/ui/QGCMAVLinkLogPlayer.ui
View file @
0c9de33c
...
@@ -6,76 +6,64 @@
...
@@ -6,76 +6,64 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
407
</width>
<width>
789
</width>
<height>
152
</height>
<height>
38
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
Form
</string>
<string>
Form
</string>
</property>
</property>
<layout
class=
"Q
GridLayout"
name=
"gridLayout"
columnstretch=
"1,0,0,0,0,0
"
>
<layout
class=
"Q
HBoxLayout"
name=
"horizontalLayout
"
>
<property
name=
"
horizontalSpacing
"
>
<property
name=
"
margin
"
>
<number>
12
</number>
<number>
4
</number>
</property>
</property>
<item
row=
"0"
column=
"0"
colspan=
"3"
>
<item>
<widget
class=
"QLabel"
name=
"logFileNameLabel"
>
<widget
class=
"QSlider"
name=
"positionSlider"
>
<property
name=
"text"
>
<property
name=
"maximum"
>
<string>
Please choose logfile
</string>
<number>
10000
</number>
</property>
</widget>
</item>
<item
row=
"0"
column=
"3"
colspan=
"3"
>
<widget
class=
"QPushButton"
name=
"selectFileButton"
>
<property
name=
"toolTip"
>
<string>
Select the logfile to replay
</string>
</property>
</property>
<property
name=
"
statusTi
p"
>
<property
name=
"
pageSte
p"
>
<
string>
Select the logfile to replay
</string
>
<
number>
100
</number
>
</property>
</property>
<property
name=
"
whatsThis
"
>
<property
name=
"
tracking
"
>
<
string>
Select the logfile to replay
</string
>
<
bool>
false
</bool
>
</property>
</property>
<property
name=
"
text
"
>
<property
name=
"
orientation
"
>
<
string>
Select File
</string
>
<
enum>
Qt::Horizontal
</enum
>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"1"
column=
"1"
colspan=
"5"
>
<item>
<widget
class=
"Q
Slider"
name=
"speedSlider
"
>
<widget
class=
"Q
ToolButton"
name=
"playButton
"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
S
et the replay speed
</string>
<string>
S
tart to replay the logfile
</string>
</property>
</property>
<property
name=
"statusTip"
>
<property
name=
"statusTip"
>
<string>
S
et the replay speed
</string>
<string>
S
tart to replay the logfile
</string>
</property>
</property>
<property
name=
"whatsThis"
>
<property
name=
"whatsThis"
>
<string>
Set the replay speed
</string>
<string>
Start to replay the logfile
</string>
</property>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
</property>
<property
name=
"
value
"
>
<property
name=
"
text
"
>
<
number>
50
</number
>
<
string>
...
</string
>
</property>
</property>
<property
name=
"sliderPosition"
>
<property
name=
"icon"
>
<number>
50
</number>
<iconset
resource=
"../../qgroundcontrol.qrc"
>
<normaloff>
:/files/images/actions/media-playback-start.svg
</normaloff>
:/files/images/actions/media-playback-start.svg
</iconset>
</property>
</property>
<property
name=
"
orientation
"
>
<property
name=
"
checkable
"
>
<
enum>
Qt::Horizontal
</enum
>
<
bool>
true
</bool
>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"0"
colspan=
"3"
>
<item>
<widget
class=
"QLabel"
name=
"logStatsLabel"
>
<widget
class=
"QLabel"
name=
"logStatsLabel"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
No logfile selected..
</string>
<string>
No logfile selected..
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"1"
column=
"0"
>
<item>
<widget
class=
"QLabel"
name=
"speedLabel"
>
<widget
class=
"QLabel"
name=
"speedLabel"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
Current replay speed
</string>
<string>
Current replay speed
</string>
...
@@ -91,42 +79,54 @@
...
@@ -91,42 +79,54 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"4"
column=
"0"
colspan=
"6"
>
<item>
<widget
class=
"QSlider"
name=
"
position
Slider"
>
<widget
class=
"QSlider"
name=
"
speed
Slider"
>
<property
name=
"
maximum
"
>
<property
name=
"
toolTip
"
>
<
number>
10000
</number
>
<
string>
Set the replay speed
</string
>
</property>
</property>
<property
name=
"pageStep"
>
<property
name=
"statusTip"
>
<string>
Set the replay speed
</string>
</property>
<property
name=
"whatsThis"
>
<string>
Set the replay speed
</string>
</property>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
<number>
100
</number>
</property>
</property>
<property
name=
"tracking"
>
<property
name=
"value"
>
<bool>
false
</bool>
<number>
50
</number>
</property>
<property
name=
"sliderPosition"
>
<number>
50
</number>
</property>
</property>
<property
name=
"orientation"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
<enum>
Qt::Horizontal
</enum>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"3"
column=
"5"
>
<item>
<widget
class=
"QToolButton"
name=
"playButton"
>
<widget
class=
"QLabel"
name=
"logFileNameLabel"
>
<property
name=
"text"
>
<string>
Please choose logfile
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"selectFileButton"
>
<property
name=
"toolTip"
>
<property
name=
"toolTip"
>
<string>
S
tart to replay the logfile
</string>
<string>
S
elect the logfile to replay
</string>
</property>
</property>
<property
name=
"statusTip"
>
<property
name=
"statusTip"
>
<string>
S
tart to replay the logfile
</string>
<string>
S
elect the logfile to replay
</string>
</property>
</property>
<property
name=
"whatsThis"
>
<property
name=
"whatsThis"
>
<string>
S
tart to replay the logfile
</string>
<string>
S
elect the logfile to replay
</string>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
...
</string>
<string>
Select File
</string>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../qgroundcontrol.qrc"
>
<normaloff>
:/files/images/actions/media-playback-start.svg
</normaloff>
:/files/images/actions/media-playback-start.svg
</iconset>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
</property>
</widget>
</widget>
</item>
</item>
...
...
src/ui/QGCStatusBar.cc
0 → 100644
View file @
0c9de33c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2013 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include <QToolButton>
#include <QLabel>
#include <QSpacerItem>
#include "QGCStatusBar.h"
#include "UASManager.h"
#include "MainWindow.h"
QGCStatusBar
::
QGCStatusBar
(
QWidget
*
parent
)
:
QStatusBar
(
parent
),
toggleLoggingButton
(
NULL
),
player
(
NULL
),
changed
(
true
),
lastLogDirectory
(
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
))
{
setObjectName
(
"QGC_STATUSBAR"
);
toggleLoggingButton
=
new
QPushButton
(
"Logging"
,
this
);
toggleLoggingButton
->
setCheckable
(
true
);
addWidget
(
toggleLoggingButton
);
loadSettings
();
}
void
QGCStatusBar
::
setLogPlayer
(
QGCMAVLinkLogPlayer
*
player
)
{
this
->
player
=
player
;
addPermanentWidget
(
player
);
connect
(
toggleLoggingButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
logging
(
bool
)));
// XXX Mutex issue if called like this
// toggleLoggingButton->blockSignals(true);
// toggleLoggingButton->setChecked(MainWindow::instance()->getMAVLink()->loggingEnabled());
// toggleLoggingButton->blockSignals(false);
}
void
QGCStatusBar
::
logging
(
bool
checked
)
{
// Stop logging in any case
MainWindow
::
instance
()
->
getMAVLink
()
->
enableLogging
(
false
);
if
(
!
checked
&&
player
)
{
player
->
setLastLogFile
(
lastLogDirectory
);
}
// If the user is enabling logging
if
(
checked
)
{
// Prompt the user for a filename/location to save to
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Specify MAVLink log file to save to"
),
lastLogDirectory
,
tr
(
"MAVLink Logfile (*.mavlink *.log *.bin);;"
));
// Check that they didn't cancel out
if
(
fileName
.
isNull
())
{
toggleLoggingButton
->
setChecked
(
false
);
return
;
}
// Make sure the file's named properly
if
(
!
fileName
.
endsWith
(
".mavlink"
))
{
fileName
.
append
(
".mavlink"
);
}
// Check that we can save the logfile
QFileInfo
file
(
fileName
);
if
((
file
.
exists
()
&&
!
file
.
isWritable
()))
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Critical
);
msgBox
.
setText
(
tr
(
"The selected logfile is not writable"
));
msgBox
.
setInformativeText
(
tr
(
"Please make sure that the file %1 is writable or select a different file"
).
arg
(
fileName
));
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
msgBox
.
exec
();
}
// Otherwise we're off and logging
else
{
MainWindow
::
instance
()
->
getMAVLink
()
->
setLogfileName
(
fileName
);
MainWindow
::
instance
()
->
getMAVLink
()
->
enableLogging
(
true
);
lastLogDirectory
=
file
.
absoluteDir
().
absolutePath
();
//save last log directory
}
}
}
void
QGCStatusBar
::
loadSettings
()
{
QSettings
settings
;
settings
.
beginGroup
(
"QGC_MAVLINKLOGPLAYER"
);
lastLogDirectory
=
settings
.
value
(
"LAST_LOG_DIRECTORY"
,
lastLogDirectory
).
toString
();
settings
.
endGroup
();
}
void
QGCStatusBar
::
storeSettings
()
{
QSettings
settings
;
settings
.
beginGroup
(
"QGC_MAVLINKLOGPLAYER"
);
settings
.
setValue
(
"LAST_LOG_DIRECTORY"
,
lastLogDirectory
);
settings
.
endGroup
();
settings
.
sync
();
}
QGCStatusBar
::~
QGCStatusBar
()
{
storeSettings
();
if
(
toggleLoggingButton
)
toggleLoggingButton
->
deleteLater
();
}
src/ui/QGCStatusBar.h
0 → 100644
View file @
0c9de33c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2013 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef QGCSTATUSBAR_H
#define QGCSTATUSBAR_H
#include <QStatusBar>
#include <QAction>
#include <QToolButton>
#include <QPushButton>
#include <QLabel>
#include <QProgressBar>
#include "UASInterface.h"
#include "QGCMAVLinkLogPlayer.h"
class
QGCStatusBar
:
public
QStatusBar
{
Q_OBJECT
public:
explicit
QGCStatusBar
(
QWidget
*
parent
=
0
);
void
addPerspectiveChangeAction
(
QAction
*
action
);
~
QGCStatusBar
();
public
slots
:
/** @brief Start / stop logging */
void
logging
(
bool
checked
);
/** @brief Set log playing component */
void
setLogPlayer
(
QGCMAVLinkLogPlayer
*
player
);
protected:
void
storeSettings
();
void
loadSettings
();
QPushButton
*
toggleLoggingButton
;
QGCMAVLinkLogPlayer
*
player
;
bool
changed
;
QString
lastLogDirectory
;
};
#endif // QGCSTATUSBAR_H
src/ui/QGCToolBar.cc
View file @
0c9de33c
...
@@ -30,8 +30,6 @@ This file is part of the QGROUNDCONTROL project
...
@@ -30,8 +30,6 @@ This file is part of the QGROUNDCONTROL project
QGCToolBar
::
QGCToolBar
(
QWidget
*
parent
)
:
QGCToolBar
::
QGCToolBar
(
QWidget
*
parent
)
:
QToolBar
(
parent
),
QToolBar
(
parent
),
toggleLoggingAction
(
NULL
),
logReplayAction
(
NULL
),
mav
(
NULL
),
mav
(
NULL
),
player
(
NULL
),
player
(
NULL
),
changed
(
true
),
changed
(
true
),
...
@@ -40,19 +38,43 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
...
@@ -40,19 +38,43 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
wpId
(
0
),
wpId
(
0
),
wpDistance
(
0
),
wpDistance
(
0
),
systemArmed
(
false
),
systemArmed
(
false
),
lastLogDirectory
(
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
)
),
currentLink
(
NULL
),
currentLink
(
NULL
)
firstAction
(
NULL
)
{
{
setObjectName
(
"QGC_TOOLBAR"
);
setObjectName
(
"QGC_TOOLBAR"
);
toggleLoggingAction
=
new
QAction
(
QIcon
(
":"
),
"Logging"
,
this
);
// Do not load UI, wait for actions
toggleLoggingAction
->
setCheckable
(
true
);
}
logReplayAction
=
new
QAction
(
QIcon
(
":"
),
"Replay"
,
this
);
logReplayAction
->
setCheckable
(
false
);
addAction
(
toggleLoggingAction
);
void
QGCToolBar
::
heartbeatTimeout
(
bool
timeout
,
unsigned
int
ms
)
addAction
(
logReplayAction
);
{
// set timeout label visible
if
(
timeout
)
{
// Alternate colors to increase visibility
if
((
ms
/
1000
)
%
2
==
0
)
{
toolBarTimeoutLabel
->
setStyleSheet
(
QString
(
"QLabel { margin: 0px 2px; font: 14px; color: %1; background-color: %2; }"
).
arg
(
QGC
::
colorDarkWhite
.
name
()).
arg
(
QGC
::
colorMagenta
.
name
()));
}
else
{
toolBarTimeoutLabel
->
setStyleSheet
(
QString
(
"QLabel { margin: 0px 2px; font: 14px; color: %1; background-color: %2; }"
).
arg
(
QGC
::
colorDarkWhite
.
name
()).
arg
(
QGC
::
colorMagenta
.
dark
(
250
).
name
()));
}
toolBarTimeoutLabel
->
setText
(
tr
(
"CONNECTION LOST: %1 s"
).
arg
((
ms
/
1000.0
f
),
2
,
'f'
,
1
,
' '
));
}
else
{
// Check if loss text is present, reset once
if
(
toolBarTimeoutLabel
->
text
()
!=
""
)
{
toolBarTimeoutLabel
->
setText
(
""
);
toolBarTimeoutLabel
->
setStyleSheet
(
QString
(
""
));
}
}
}
void
QGCToolBar
::
createUI
()
{
// CREATE TOOLBAR ITEMS
// CREATE TOOLBAR ITEMS
// Add internal actions
// Add internal actions
// Add MAV widget
// Add MAV widget
...
@@ -145,113 +167,15 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
...
@@ -145,113 +167,15 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
loadSettings
();
loadSettings
();
}
}
void
QGCToolBar
::
heartbeatTimeout
(
bool
timeout
,
unsigned
int
ms
)
{
// set timeout label visible
if
(
timeout
)
{
// Alternate colors to increase visibility
if
((
ms
/
1000
)
%
2
==
0
)
{
toolBarTimeoutLabel
->
setStyleSheet
(
QString
(
"QLabel { margin: 0px 2px; font: 14px; color: %1; background-color: %2; }"
).
arg
(
QGC
::
colorDarkWhite
.
name
()).
arg
(
QGC
::
colorMagenta
.
name
()));
}
else
{
toolBarTimeoutLabel
->
setStyleSheet
(
QString
(
"QLabel { margin: 0px 2px; font: 14px; color: %1; background-color: %2; }"
).
arg
(
QGC
::
colorDarkWhite
.
name
()).
arg
(
QGC
::
colorMagenta
.
dark
(
250
).
name
()));
}
toolBarTimeoutLabel
->
setText
(
tr
(
"CONNECTION LOST: %1 s"
).
arg
((
ms
/
1000.0
f
),
2
,
'f'
,
1
,
' '
));
}
else
{
// Check if loss text is present, reset once
if
(
toolBarTimeoutLabel
->
text
()
!=
""
)
{
toolBarTimeoutLabel
->
setText
(
""
);
toolBarTimeoutLabel
->
setStyleSheet
(
QString
(
""
));
}
}
}
void
QGCToolBar
::
setLogPlayer
(
QGCMAVLinkLogPlayer
*
player
)
{
this
->
player
=
player
;
connect
(
toggleLoggingAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
logging
(
bool
)));
connect
(
logReplayAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
playLogFile
(
bool
)));
}
void
QGCToolBar
::
playLogFile
(
bool
checked
)
{
// Check if player exists
if
(
player
)
{
// If a logfile is already replayed, stop the replay
// and select a new logfile
if
(
player
->
isPlayingLogFile
())
{
player
->
playPause
(
false
);
if
(
checked
)
{
if
(
!
player
->
selectLogFile
(
lastLogDirectory
))
return
;
}
}
// If no replaying happens already, start it
else
{
if
(
!
player
->
selectLogFile
(
lastLogDirectory
))
return
;
}
player
->
playPause
(
checked
);
}
}
void
QGCToolBar
::
logging
(
bool
checked
)
{
// Stop logging in any case
MainWindow
::
instance
()
->
getMAVLink
()
->
enableLogging
(
false
);
// If the user is enabling logging
if
(
checked
)
{
// Prompt the user for a filename/location to save to
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Specify MAVLink log file to save to"
),
lastLogDirectory
,
tr
(
"MAVLink Logfile (*.mavlink *.log *.bin);;"
));
// Check that they didn't cancel out
if
(
fileName
.
isNull
())
{
toggleLoggingAction
->
setChecked
(
false
);
return
;
}
// Make sure the file's named properly
if
(
!
fileName
.
endsWith
(
".mavlink"
))
{
fileName
.
append
(
".mavlink"
);
}
// Check that we can save the logfile
QFileInfo
file
(
fileName
);
if
((
file
.
exists
()
&&
!
file
.
isWritable
()))
{
QMessageBox
msgBox
;
msgBox
.
setIcon
(
QMessageBox
::
Critical
);
msgBox
.
setText
(
tr
(
"The selected logfile is not writable"
));
msgBox
.
setInformativeText
(
tr
(
"Please make sure that the file %1 is writable or select a different file"
).
arg
(
fileName
));
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
msgBox
.
exec
();
}
// Otherwise we're off and logging
else
{
MainWindow
::
instance
()
->
getMAVLink
()
->
setLogfileName
(
fileName
);
MainWindow
::
instance
()
->
getMAVLink
()
->
enableLogging
(
true
);
lastLogDirectory
=
file
.
absoluteDir
().
absolutePath
();
//save last log directory
}
}
}
void
QGCToolBar
::
addPerspectiveChangeAction
(
QAction
*
action
)
void
QGCToolBar
::
addPerspectiveChangeAction
(
QAction
*
action
)
{
{
insertAction
(
toggleLoggingAction
,
action
);
if
(
firstAction
)
{
insertAction
(
firstAction
,
action
);
}
else
{
addAction
(
action
);
firstAction
=
action
;
createUI
();
}
}
}
void
QGCToolBar
::
setActiveUAS
(
UASInterface
*
active
)
void
QGCToolBar
::
setActiveUAS
(
UASInterface
*
active
)
...
@@ -508,6 +432,7 @@ void QGCToolBar::removeLink(LinkInterface* link)
...
@@ -508,6 +432,7 @@ void QGCToolBar::removeLink(LinkInterface* link)
void
QGCToolBar
::
updateLinkState
(
bool
connected
)
void
QGCToolBar
::
updateLinkState
(
bool
connected
)
{
{
Q_UNUSED
(
connected
);
if
(
currentLink
&&
currentLink
->
isConnected
())
if
(
currentLink
&&
currentLink
->
isConnected
())
{
{
connectButton
->
setText
(
tr
(
"Disconnect"
));
connectButton
->
setText
(
tr
(
"Disconnect"
));
...
@@ -543,7 +468,6 @@ void QGCToolBar::loadSettings()
...
@@ -543,7 +468,6 @@ void QGCToolBar::loadSettings()
{
{
QSettings
settings
;
QSettings
settings
;
settings
.
beginGroup
(
"QGC_TOOLBAR"
);
settings
.
beginGroup
(
"QGC_TOOLBAR"
);
lastLogDirectory
=
settings
.
value
(
"LAST_LOG_DIRECTORY"
,
lastLogDirectory
).
toString
();
settings
.
endGroup
();
settings
.
endGroup
();
}
}
...
@@ -551,7 +475,6 @@ void QGCToolBar::storeSettings()
...
@@ -551,7 +475,6 @@ void QGCToolBar::storeSettings()
{
{
QSettings
settings
;
QSettings
settings
;
settings
.
beginGroup
(
"QGC_TOOLBAR"
);
settings
.
beginGroup
(
"QGC_TOOLBAR"
);
settings
.
setValue
(
"LAST_LOG_DIRECTORY"
,
lastLogDirectory
);
settings
.
endGroup
();
settings
.
endGroup
();
settings
.
sync
();
settings
.
sync
();
}
}
...
@@ -565,6 +488,4 @@ void QGCToolBar::clearStatusString()
...
@@ -565,6 +488,4 @@ void QGCToolBar::clearStatusString()
QGCToolBar
::~
QGCToolBar
()
QGCToolBar
::~
QGCToolBar
()
{
{
storeSettings
();
storeSettings
();
if
(
toggleLoggingAction
)
toggleLoggingAction
->
deleteLater
();
if
(
logReplayAction
)
logReplayAction
->
deleteLater
();
}
}
src/ui/QGCToolBar.h
View file @
0c9de33c
...
@@ -61,12 +61,6 @@ public slots:
...
@@ -61,12 +61,6 @@ public slots:
void
setSystemType
(
UASInterface
*
uas
,
unsigned
int
systemType
);
void
setSystemType
(
UASInterface
*
uas
,
unsigned
int
systemType
);
/** @brief Received system text message */
/** @brief Received system text message */
void
receiveTextMessage
(
int
uasid
,
int
componentid
,
int
severity
,
QString
text
);
void
receiveTextMessage
(
int
uasid
,
int
componentid
,
int
severity
,
QString
text
);
/** @brief Start / stop logging */
void
logging
(
bool
checked
);
/** @brief Start playing logfile */
void
playLogFile
(
bool
checked
);
/** @brief Set log playing component */
void
setLogPlayer
(
QGCMAVLinkLogPlayer
*
player
);
/** @brief Update battery charge state */
/** @brief Update battery charge state */
void
updateBatteryRemaining
(
UASInterface
*
uas
,
double
voltage
,
double
percent
,
int
seconds
);
void
updateBatteryRemaining
(
UASInterface
*
uas
,
double
voltage
,
double
percent
,
int
seconds
);
/** @brief Update current waypoint */
/** @brief Update current waypoint */
...
@@ -88,9 +82,8 @@ protected:
...
@@ -88,9 +82,8 @@ protected:
void
createCustomWidgets
();
void
createCustomWidgets
();
void
storeSettings
();
void
storeSettings
();
void
loadSettings
();
void
loadSettings
();
void
createUI
();
QAction
*
toggleLoggingAction
;
QAction
*
logReplayAction
;
UASInterface
*
mav
;
UASInterface
*
mav
;
QToolButton
*
symbolButton
;
QToolButton
*
symbolButton
;
QLabel
*
toolBarNameLabel
;
QLabel
*
toolBarNameLabel
;
...
@@ -117,8 +110,8 @@ protected:
...
@@ -117,8 +110,8 @@ protected:
quint64
lastSystemMessageTimeMs
;
quint64
lastSystemMessageTimeMs
;
QTimer
updateViewTimer
;
QTimer
updateViewTimer
;
bool
systemArmed
;
bool
systemArmed
;
QString
lastLogDirectory
;
LinkInterface
*
currentLink
;
LinkInterface
*
currentLink
;
QAction
*
firstAction
;
};
};
#endif // QGCTOOLBAR_H
#endif // QGCTOOLBAR_H
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