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
19bffaa8
Commit
19bffaa8
authored
Jul 08, 2017
by
Don Gagne
Committed by
GitHub
Jul 08, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5420 from DonLakeFlyer/MavlinkDecoder
Delay creation of MAVLinkDecoder until it is needed
parents
3a372c82
d6bcee73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
14 deletions
+25
-14
MainWindow.cc
src/ui/MainWindow.cc
+23
-13
MainWindow.h
src/ui/MainWindow.h
+2
-1
No files found.
src/ui/MainWindow.cc
View file @
19bffaa8
...
...
@@ -108,10 +108,11 @@ void MainWindow::deleteInstance(void)
/// by MainWindow::_create method. Hence no other code should have access to
/// constructor.
MainWindow
::
MainWindow
()
:
_lowPowerMode
(
false
)
,
_showStatusBar
(
false
)
,
_mainQmlWidgetHolder
(
NULL
)
,
_forceClose
(
false
)
:
_mavlinkDecoder
(
NULL
)
,
_lowPowerMode
(
false
)
,
_showStatusBar
(
false
)
,
_mainQmlWidgetHolder
(
NULL
)
,
_forceClose
(
false
)
{
_instance
=
this
;
...
...
@@ -272,10 +273,13 @@ MainWindow::MainWindow()
MainWindow
::~
MainWindow
()
{
// Enforce thread-safe shutdown of the mavlink decoder
mavlinkDecoder
->
finish
();
mavlinkDecoder
->
wait
(
1000
);
mavlinkDecoder
->
deleteLater
();
if
(
_mavlinkDecoder
)
{
// Enforce thread-safe shutdown of the mavlink decoder
_mavlinkDecoder
->
finish
();
_mavlinkDecoder
->
wait
(
1000
);
_mavlinkDecoder
->
deleteLater
();
_mavlinkDecoder
=
NULL
;
}
// This needs to happen before we get into the QWidget dtor
// otherwise the QML engine reads freed data and tries to
...
...
@@ -290,12 +294,18 @@ QString MainWindow::_getWindowGeometryKey()
}
#ifndef __mobile__
void
MainWindow
::
_buildCommonWidgets
(
void
)
MAVLinkDecoder
*
MainWindow
::
_mavLinkDecoderInstance
(
void
)
{
// Add generic MAVLink decoder
mavlinkDecoder
=
new
MAVLinkDecoder
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
());
connect
(
mavlinkDecoder
.
data
(),
&
MAVLinkDecoder
::
valueChanged
,
this
,
&
MainWindow
::
valueChanged
);
if
(
_mavlinkDecoder
)
{
_mavlinkDecoder
=
new
MAVLinkDecoder
(
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
());
connect
(
_mavlinkDecoder
,
&
MAVLinkDecoder
::
valueChanged
,
this
,
&
MainWindow
::
valueChanged
);
}
return
_mavlinkDecoder
;
}
void
MainWindow
::
_buildCommonWidgets
(
void
)
{
// Log player
// TODO: Make this optional with a preferences setting or under a "View" menu
logPlayer
=
new
QGCMAVLinkLogPlayer
(
statusBar
());
...
...
@@ -363,7 +373,7 @@ bool MainWindow::_createInnerDockWidget(const QString& widgetName)
widget
=
new
HILDockWidget
(
widgetName
,
action
,
this
);
break
;
case
ANALYZE
:
widget
=
new
Linecharts
(
widgetName
,
action
,
mavlinkDecoder
,
this
);
widget
=
new
Linecharts
(
widgetName
,
action
,
_mavLinkDecoderInstance
()
,
this
);
break
;
}
if
(
widget
)
{
...
...
src/ui/MainWindow.h
View file @
19bffaa8
...
...
@@ -127,7 +127,6 @@ protected:
QSettings
settings
;
QPointer
<
MAVLinkDecoder
>
mavlinkDecoder
;
QGCMAVLinkLogPlayer
*
logPlayer
;
#ifdef QGC_MOUSE_ENABLED_WIN
/** @brief 3d Mouse support (WIN only) */
...
...
@@ -181,7 +180,9 @@ private:
void
_showDockWidget
(
const
QString
&
name
,
bool
show
);
void
_loadVisibleWidgetsSettings
(
void
);
void
_storeVisibleWidgetsSettings
(
void
);
MAVLinkDecoder
*
_mavLinkDecoderInstance
(
void
);
MAVLinkDecoder
*
_mavlinkDecoder
;
bool
_lowPowerMode
;
///< If enabled, QGC reduces the update rates of all widgets
bool
_showStatusBar
;
QVBoxLayout
*
_centralLayout
;
...
...
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