Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
40202972
Commit
40202972
authored
Aug 26, 2013
by
Lorenz Meier
Browse files
Added periodic check for ports to QGC toolbar to not depend on port state on power up
parent
baafca2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/ui/QGCToolBar.cc
View file @
40202972
...
...
@@ -221,6 +221,9 @@ void QGCToolBar::createUI()
loadSettings
();
connect
(
&
portBoxTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateComboBox
()));
portBoxTimer
.
start
(
500
);
changed
=
false
;
}
...
...
@@ -647,25 +650,29 @@ void QGCToolBar::removeLink(LinkInterface* link)
}
void
QGCToolBar
::
updateComboBox
()
{
portComboBox
->
clear
();
//
portComboBox->clear();
if
(
currentLink
)
{
SerialLink
*
slink
=
qobject_cast
<
SerialLink
*>
(
currentLink
);
QList
<
QString
>
portlist
=
slink
->
getCurrentPorts
();
foreach
(
QString
port
,
portlist
)
{
portComboBox
->
addItem
(
port
,
port
);
foreach
(
QString
port
,
portlist
)
{
if
(
portComboBox
->
findText
(
port
)
==
-
1
)
{
portComboBox
->
addItem
(
port
,
port
);
}
}
portComboBox
->
setCurrentIndex
(
portComboBox
->
findData
(
slink
->
getPortName
()));
if
(
slink
->
getPortName
().
trimmed
().
length
()
>
0
)
{
portComboBox
->
setCurrentIndex
(
portComboBox
->
findData
(
slink
->
getPortName
()));
portComboBox
->
setEditText
(
slink
->
getPortName
());
}
else
{
if
(
portlist
.
length
()
>
0
)
{
portComboBox
->
setEditText
(
portlist
.
fir
st
());
portComboBox
->
setEditText
(
portlist
.
la
st
());
}
else
{
...
...
src/ui/QGCToolBar.h
View file @
40202972
...
...
@@ -31,6 +31,7 @@ This file is part of the QGROUNDCONTROL project
#include
<QLabel>
#include
<QProgressBar>
#include
<QComboBox>
#include
<QTimer>
#include
"UASInterface.h"
#include
"QGCMAVLinkLogPlayer.h"
#include
"SerialLink.h"
...
...
@@ -84,13 +85,13 @@ public slots:
void
clearStatusString
();
/** @brief Set an activity action as checked in menu */
void
advancedActivityTriggered
(
QAction
*
action
);
void
updateComboBox
();
protected:
void
storeSettings
();
void
loadSettings
();
void
createUI
();
void
resetToolbarUI
();
void
updateComboBox
();
UASInterface
*
mav
;
QLabel
*
symbolLabel
;
QLabel
*
toolBarNameLabel
;
...
...
@@ -108,6 +109,7 @@ protected:
QGCMAVLinkLogPlayer
*
player
;
QComboBox
*
portComboBox
;
QComboBox
*
baudcomboBox
;
QTimer
portBoxTimer
;
bool
changed
;
float
batteryPercent
;
float
batteryVoltage
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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