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
96d573bc
Commit
96d573bc
authored
Jun 11, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change for an initial SeriaLink, and QGCToolBar having a selection menu next to the connect button
parent
1f55e9c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
2 deletions
+63
-2
QGCCore.cc
src/QGCCore.cc
+6
-0
QGCToolBar.cc
src/ui/QGCToolBar.cc
+54
-1
QGCToolBar.h
src/ui/QGCToolBar.h
+3
-1
No files found.
src/QGCCore.cc
View file @
96d573bc
...
...
@@ -52,6 +52,7 @@ This file is part of the QGROUNDCONTROL project
#endif
#include "UDPLink.h"
#include "MAVLinkSimulationLink.h"
#include "SerialLink.h"
/**
...
...
@@ -157,6 +158,11 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
MAVLinkSimulationLink
*
simulationLink
=
new
MAVLinkSimulationLink
(
":/demo-log.txt"
);
simulationLink
->
disconnect
();
//We want to have a default serial link available for "quick" connecting.
SerialLink
*
slink
=
new
SerialLink
();
MainWindow
::
instance
()
->
addLink
(
slink
);
mainWindow
=
MainWindow
::
instance
(
splashScreen
);
// Remove splash screen
...
...
src/ui/QGCToolBar.cc
View file @
96d573bc
...
...
@@ -24,6 +24,7 @@ This file is part of the QGROUNDCONTROL project
#include <QToolButton>
#include <QLabel>
#include <QSpacerItem>
#include "SerialLink.h"
#include "QGCToolBar.h"
#include "UASManager.h"
#include "MainWindow.h"
...
...
@@ -160,6 +161,11 @@ void QGCToolBar::createUI()
spacer
->
setStyleSheet
(
"* { margin: 0px; background-color: transparent; min-height: 24px}"
);
addWidget
(
spacer
);
portComboBox
=
new
QComboBox
(
this
);
portComboBox
->
setToolTip
(
tr
(
"Choose the COM port to use"
));
portComboBox
->
setEnabled
(
true
);
portComboBox
->
setMinimumWidth
(
200
);
addWidget
(
portComboBox
);
connectButton
=
new
QPushButton
(
tr
(
"Connect"
),
this
);
connectButton
->
setToolTip
(
tr
(
"Connect wireless link to MAV"
));
connectButton
->
setCheckable
(
true
);
...
...
@@ -523,12 +529,15 @@ void QGCToolBar::addLink(LinkInterface* link)
connect
(
currentLink
,
SIGNAL
(
connected
(
bool
)),
this
,
SLOT
(
updateLinkState
(
bool
)));
updateLinkState
(
link
->
isConnected
());
}
updateComboBox
();
}
void
QGCToolBar
::
removeLink
(
LinkInterface
*
link
)
{
if
(
link
==
currentLink
)
{
currentLink
=
NULL
;
//portComboBox->setEnabled(false);
//portComboBox->clear();
// XXX magic number
if
(
LinkManager
::
instance
()
->
getLinks
().
count
()
>
2
)
{
currentLink
=
LinkManager
::
instance
()
->
getLinks
().
last
();
...
...
@@ -537,6 +546,32 @@ void QGCToolBar::removeLink(LinkInterface* link)
connectButton
->
setText
(
tr
(
"New Link"
));
}
}
updateComboBox
();
}
void
QGCToolBar
::
updateComboBox
()
{
portComboBox
->
clear
();
for
(
int
i
=
0
;
i
<
LinkManager
::
instance
()
->
getLinks
().
count
();
i
++
)
{
SerialLink
*
slink
=
qobject_cast
<
SerialLink
*>
(
LinkManager
::
instance
()
->
getLinks
()[
i
]);
if
(
slink
)
{
//It's a serial link
QVector
<
QString
>
*
portlist
=
slink
->
getCurrentPorts
();
//if (!slink->isConnected())
//{
for
(
int
j
=
0
;
j
<
portlist
->
size
();
j
++
)
{
portComboBox
->
addItem
(
"Serial port:"
+
QString
::
number
(
i
)
+
":"
+
portlist
->
at
(
j
));
}
//}
//We only really want to display from unconnected sources.
}
else
{
portComboBox
->
addItem
(
LinkManager
::
instance
()
->
getLinks
()[
i
]
->
getName
());
}
}
}
void
QGCToolBar
::
updateLinkState
(
bool
connected
)
...
...
@@ -566,7 +601,25 @@ void QGCToolBar::connectLink(bool connect)
{
MainWindow
::
instance
()
->
addLink
();
}
else
if
(
connect
)
{
LinkManager
::
instance
()
->
getLinks
().
last
()
->
connect
();
if
(
portComboBox
->
currentText
().
split
(
":"
).
count
()
>
2
)
{
int
linknum
=
portComboBox
->
currentText
().
split
(
":"
)[
1
].
toInt
();
SerialLink
*
link
=
qobject_cast
<
SerialLink
*>
(
LinkManager
::
instance
()
->
getLinks
().
at
(
linknum
));
if
(
link
)
{
QString
portname
=
portComboBox
->
currentText
().
split
(
":"
)[
2
];
if
(
portname
.
indexOf
(
'-'
)
!=
-
1
)
{
portname
=
portname
.
split
(
"-"
)[
0
];
}
link
->
setPortName
(
portname
.
trimmed
());
}
link
->
connect
();
}
else
{
LinkManager
::
instance
()
->
getLinks
().
last
()
->
connect
();
}
}
else
if
(
!
connect
&&
LinkManager
::
instance
()
->
getLinks
().
count
()
>
2
)
{
LinkManager
::
instance
()
->
getLinks
().
last
()
->
disconnect
();
}
...
...
src/ui/QGCToolBar.h
View file @
96d573bc
...
...
@@ -30,6 +30,7 @@ This file is part of the QGROUNDCONTROL project
#include <QPushButton>
#include <QLabel>
#include <QProgressBar>
#include <QComboBox>
#include "UASInterface.h"
#include "QGCMAVLinkLogPlayer.h"
...
...
@@ -88,7 +89,7 @@ protected:
void
storeSettings
();
void
loadSettings
();
void
createUI
();
void
updateComboBox
();
UASInterface
*
mav
;
QToolButton
*
symbolButton
;
QLabel
*
toolBarNameLabel
;
...
...
@@ -103,6 +104,7 @@ protected:
QProgressBar
*
toolBarBatteryBar
;
QLabel
*
toolBarBatteryVoltageLabel
;
QGCMAVLinkLogPlayer
*
player
;
QComboBox
*
portComboBox
;
bool
changed
;
float
batteryPercent
;
float
batteryVoltage
;
...
...
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