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
0209f4ad
Commit
0209f4ad
authored
Sep 11, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Log replay
parent
7f9de5e1
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
242 additions
and
125 deletions
+242
-125
MainWindow.cc
src/ui/MainWindow.cc
+12
-9
MainWindow.h
src/ui/MainWindow.h
+13
-0
QGCMAVLinkLogPlayer.cc
src/ui/QGCMAVLinkLogPlayer.cc
+114
-43
QGCMAVLinkLogPlayer.h
src/ui/QGCMAVLinkLogPlayer.h
+5
-0
QGCMAVLinkLogPlayer.ui
src/ui/QGCMAVLinkLogPlayer.ui
+19
-45
QGCToolBar.cc
src/ui/QGCToolBar.cc
+73
-27
QGCToolBar.h
src/ui/QGCToolBar.h
+6
-1
No files found.
src/ui/MainWindow.cc
View file @
0209f4ad
...
...
@@ -127,6 +127,15 @@ MainWindow::MainWindow(QWidget *parent):
centerStack
=
new
QStackedWidget
(
this
);
setCentralWidget
(
centerStack
);
// Load Toolbar
toolBar
=
new
QGCToolBar
(
this
);
this
->
addToolBar
(
toolBar
);
// Add actions
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionOperatorsView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionEngineersView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionPilotsView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionUnconnectedView
);
buildCommonWidgets
();
connectCommonWidgets
();
...
...
@@ -181,14 +190,6 @@ MainWindow::MainWindow(QWidget *parent):
fgLink
=
new
QGCFlightGearLink
();
fgLink
->
connectSimulation
();
// Load Toolbar
toolBar
=
new
QGCToolBar
(
this
);
this
->
addToolBar
(
toolBar
);
// Add actions
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionOperatorsView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionEngineersView
);
toolBar
->
addPerspectiveChangeAction
(
ui
.
actionPilotsView
);
// Connect link
if
(
autoReconnect
)
{
...
...
@@ -408,7 +409,9 @@ void MainWindow::buildCommonWidgets()
if
(
!
logPlayerDockWidget
)
{
logPlayerDockWidget
=
new
QDockWidget
(
tr
(
"MAVLink Log Player"
),
this
);
logPlayerDockWidget
->
setWidget
(
new
QGCMAVLinkLogPlayer
(
mavlink
,
this
)
);
logPlayer
=
new
QGCMAVLinkLogPlayer
(
mavlink
,
this
);
toolBar
->
setLogPlayer
(
logPlayer
);
logPlayerDockWidget
->
setWidget
(
logPlayer
);
logPlayerDockWidget
->
setObjectName
(
"MAVLINK_LOG_PLAYER_DOCKWIDGET"
);
addTool
(
logPlayerDockWidget
,
tr
(
"MAVLink Log Replay"
),
Qt
::
RightDockWidgetArea
);
}
...
...
src/ui/MainWindow.h
View file @
0209f4ad
...
...
@@ -75,6 +75,7 @@ This file is part of the QGROUNDCONTROL project
#include "SlugsPadCameraControl.h"
#include "UASControlParameters.h"
#include "QGCFlightGearLink.h"
#include "QGCMAVLinkLogPlayer.h"
class
QGCMapTool
;
...
...
@@ -210,6 +211,17 @@ public slots:
*/
void
showCentralWidget
();
public:
QGCMAVLinkLogPlayer
*
getLogPlayer
()
{
return
logPlayer
;
}
MAVLinkProtocol
*
getMAVLink
()
{
return
mavlink
;
}
protected:
MainWindow
(
QWidget
*
parent
=
0
);
...
...
@@ -342,6 +354,7 @@ protected:
QPointer
<
QGCToolBar
>
toolBar
;
QGCMAVLinkLogPlayer
*
logPlayer
;
// Popup widgets
JoystickWidget
*
joystickWidget
;
...
...
src/ui/QGCMAVLinkLogPlayer.cc
View file @
0209f4ad
This diff is collapsed.
Click to expand it.
src/ui/QGCMAVLinkLogPlayer.h
View file @
0209f4ad
...
...
@@ -29,6 +29,10 @@ public:
~
QGCMAVLinkLogPlayer
();
public
slots
:
/** @brief Toggle between play and pause */
void
playPauseToggle
();
/** @brief Play / pause the log */
void
playPause
(
bool
play
);
/** @brief Replay the logfile */
void
play
();
/** @brief Pause the logfile */
...
...
@@ -64,6 +68,7 @@ protected:
int
loopCounter
;
bool
mavlinkLogFormat
;
int
binaryBaudRate
;
bool
isPlaying
;
static
const
int
packetLen
=
MAVLINK_MAX_PACKET_LEN
;
static
const
int
timeLen
=
sizeof
(
quint64
);
void
changeEvent
(
QEvent
*
e
);
...
...
src/ui/QGCMAVLinkLogPlayer.ui
View file @
0209f4ad
...
...
@@ -75,32 +75,6 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"5"
>
<widget
class=
"QToolButton"
name=
"pauseButton"
>
<property
name=
"toolTip"
>
<string>
Pause the logfile
</string>
</property>
<property
name=
"statusTip"
>
<string>
Pause the logfile
</string>
</property>
<property
name=
"whatsThis"
>
<string>
Pause the logfile
</string>
</property>
<property
name=
"text"
>
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<normaloff>
:/images/actions/media-playback-pause.svg
</normaloff>
:/images/actions/media-playback-pause.svg
</iconset>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"speedLabel"
>
<property
name=
"toolTip"
>
...
...
@@ -117,7 +91,23 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"4"
>
<item
row=
"4"
column=
"0"
colspan=
"6"
>
<widget
class=
"QSlider"
name=
"positionSlider"
>
<property
name=
"maximum"
>
<number>
10000
</number>
</property>
<property
name=
"pageStep"
>
<number>
100
</number>
</property>
<property
name=
"tracking"
>
<bool>
false
</bool>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"3"
column=
"5"
>
<widget
class=
"QToolButton"
name=
"playButton"
>
<property
name=
"toolTip"
>
<string>
Start to replay the logfile
</string>
...
...
@@ -132,7 +122,7 @@
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../
mavground
.qrc"
>
<iconset
resource=
"../../
qgroundcontrol
.qrc"
>
<normaloff>
:/images/actions/media-playback-start.svg
</normaloff>
:/images/actions/media-playback-start.svg
</iconset>
</property>
<property
name=
"checkable"
>
...
...
@@ -140,26 +130,10 @@
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
colspan=
"6"
>
<widget
class=
"QSlider"
name=
"positionSlider"
>
<property
name=
"maximum"
>
<number>
10000
</number>
</property>
<property
name=
"pageStep"
>
<number>
100
</number>
</property>
<property
name=
"tracking"
>
<bool>
false
</bool>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include
location=
"../../
mavground
.qrc"
/>
<include
location=
"../../
qgroundcontrol
.qrc"
/>
</resources>
<connections/>
</ui>
src/ui/QGCToolBar.cc
View file @
0209f4ad
...
...
@@ -25,6 +25,7 @@ This file is part of the QGROUNDCONTROL project
#include <QLabel>
#include "QGCToolBar.h"
#include "UASManager.h"
#include "MainWindow.h"
QGCToolBar
::
QGCToolBar
(
QWidget
*
parent
)
:
QToolBar
(
parent
),
...
...
@@ -33,14 +34,84 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
mav
(
NULL
)
{
setObjectName
(
"QGC_TOOLBAR"
);
createCustomWidgets
();
toggleLoggingAction
=
new
QAction
(
QIcon
(
":"
),
"Logging"
,
this
);
toggleLoggingAction
->
setCheckable
(
true
);
logReplayAction
=
new
QAction
(
QIcon
(
":"
),
"Replay"
,
this
);
logReplayAction
->
setCheckable
(
true
);
addSeparator
();
addAction
(
toggleLoggingAction
);
addAction
(
logReplayAction
);
// CREATE TOOLBAR ITEMS
// Add internal actions
// Add MAV widget
symbolButton
=
new
QToolButton
(
this
);
nameLabel
=
new
QLabel
(
"------"
,
this
);
modeLabel
=
new
QLabel
(
"------"
,
this
);
stateLabel
=
new
QLabel
(
"------"
,
this
);
wpLabel
=
new
QLabel
(
"---"
,
this
);
distlabel
=
new
QLabel
(
"--- ---- m"
,
this
);
messageLabel
=
new
QLabel
(
"No system messages."
,
this
);
//symbolButton->setIcon(":");
symbolButton
->
setStyleSheet
(
"QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px; background-color: none; }"
);
addWidget
(
symbolButton
);
addWidget
(
nameLabel
);
addWidget
(
modeLabel
);
addWidget
(
stateLabel
);
addWidget
(
wpLabel
);
addWidget
(
distlabel
);
addWidget
(
messageLabel
);
// DONE INITIALIZING BUTTONS
setActiveUAS
(
UASManager
::
instance
()
->
getActiveUAS
());
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
}
void
QGCToolBar
::
setLogPlayer
(
QGCMAVLinkLogPlayer
*
player
)
{
connect
(
toggleLoggingAction
,
SIGNAL
(
triggered
(
bool
)),
player
,
SLOT
(
playPause
(
bool
)));
connect
(
logReplayAction
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
logging
(
bool
)));
}
void
QGCToolBar
::
logging
(
bool
enabled
)
{
// Stop logging in any case
MainWindow
::
instance
()
->
getMAVLink
()
->
enableLogging
(
false
);
if
(
enabled
)
{
QString
fileName
=
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Specify MAVLink log file name"
),
QDesktopServices
::
storageLocation
(
QDesktopServices
::
DesktopLocation
),
tr
(
"MAVLink Logfile (*.mavlink *.log *.bin);;"
));
if
(
!
fileName
.
endsWith
(
".mavlink"
))
{
fileName
.
append
(
".mavlink"
);
}
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
();
}
else
{
MainWindow
::
instance
()
->
getMAVLink
()
->
setLogfileName
(
fileName
);
MainWindow
::
instance
()
->
getMAVLink
()
->
enableLogging
(
true
);
}
}
}
void
QGCToolBar
::
addPerspectiveChangeAction
(
QAction
*
action
)
{
addAction
(
action
);
insertAction
(
toggleLoggingAction
,
action
);
}
void
QGCToolBar
::
setActiveUAS
(
UASInterface
*
active
)
...
...
@@ -75,32 +146,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
void
QGCToolBar
::
createCustomWidgets
()
{
// Add internal actions
// Add MAV widget
symbolButton
=
new
QToolButton
(
this
);
nameLabel
=
new
QLabel
(
"------"
,
this
);
modeLabel
=
new
QLabel
(
"------"
,
this
);
stateLabel
=
new
QLabel
(
"------"
,
this
);
wpLabel
=
new
QLabel
(
"---"
,
this
);
distlabel
=
new
QLabel
(
"--- ---- m"
,
this
);
messageLabel
=
new
QLabel
(
"No system messages."
,
this
);
//symbolButton->setIcon(":");
symbolButton
->
setStyleSheet
(
"QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px; background-color: none; }"
);
addWidget
(
symbolButton
);
addWidget
(
nameLabel
);
addWidget
(
modeLabel
);
addWidget
(
stateLabel
);
addWidget
(
wpLabel
);
addWidget
(
distlabel
);
addWidget
(
messageLabel
);
toggleLoggingAction
=
new
QAction
(
QIcon
(
":"
),
"Start Logging"
,
this
);
logReplayAction
=
new
QAction
(
QIcon
(
":"
),
"Start Replay"
,
this
);
//addAction(toggleLoggingAction);
//addAction(logReplayAction);
addSeparator
();
}
void
QGCToolBar
::
updateState
(
UASInterface
*
system
,
QString
name
,
QString
description
)
...
...
src/ui/QGCToolBar.h
View file @
0209f4ad
...
...
@@ -29,13 +29,14 @@ This file is part of the QGROUNDCONTROL project
#include <QToolButton>
#include <QLabel>
#include "UASInterface.h"
#include "QGCMAVLinkLogPlayer.h"
class
QGCToolBar
:
public
QToolBar
{
Q_OBJECT
public:
explicit
QGCToolBar
(
QWidget
*
parent
=
0
);
explicit
QGCToolBar
(
QWidget
*
parent
=
0
);
void
addPerspectiveChangeAction
(
QAction
*
action
);
~
QGCToolBar
();
...
...
@@ -52,6 +53,10 @@ public slots:
void
setSystemType
(
UASInterface
*
uas
,
unsigned
int
systemType
);
/** @brief Received system text message */
void
receiveTextMessage
(
int
uasid
,
int
componentid
,
int
severity
,
QString
text
);
/** @brief Start / stop logging */
void
logging
(
bool
enabled
);
/** @brief Set log playing component */
void
setLogPlayer
(
QGCMAVLinkLogPlayer
*
player
);
protected:
void
createCustomWidgets
();
...
...
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