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
359f8bd1
Commit
359f8bd1
authored
Jul 11, 2013
by
Bill Bonney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APMToolbar as a docking widget [complete] + missing files
parent
a01da581
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
229 additions
and
53 deletions
+229
-53
qgroundcontrol.pro
qgroundcontrol.pro
+1
-0
ApmToolBar.qml
qml/ApmToolBar.qml
+63
-10
Button.qml
qml/components/Button.qml
+1
-1
SerialLink.cc
src/comm/SerialLink.cc
+18
-13
SerialLink.h
src/comm/SerialLink.h
+1
-1
CommConfigurationWindow.cc
src/ui/CommConfigurationWindow.cc
+1
-1
MainWindow.cc
src/ui/MainWindow.cc
+47
-14
MainWindow.h
src/ui/MainWindow.h
+1
-1
MainWindow.ui
src/ui/MainWindow.ui
+5
-1
apmtoolbar.cpp
src/ui/apmtoolbar.cpp
+82
-9
apmtoolbar.h
src/ui/apmtoolbar.h
+9
-2
No files found.
qgroundcontrol.pro
View file @
359f8bd1
...
@@ -778,6 +778,7 @@ OTHER_FILES += \
...
@@ -778,6 +778,7 @@ OTHER_FILES += \
OTHER_FILES
+=
\
OTHER_FILES
+=
\
qml
/
ApmToolBar
.
qml
\
qml
/
ApmToolBar
.
qml
\
qml
/
components
/
Button
.
qml
\
qml
/
components
/
Button
.
qml
\
qml
/
components
/
TextButton
.
qml
\
qml
/
resources
/
apmplanner
/
toolbar
/
connect
.
png
\
qml
/
resources
/
apmplanner
/
toolbar
/
connect
.
png
\
qml
/
resources
/
apmplanner
/
toolbar
/
flightplanner
.
png
\
qml
/
resources
/
apmplanner
/
toolbar
/
flightplanner
.
png
\
qml
/
resources
/
apmplanner
/
toolbar
/
helpwizard
.
png
\
qml
/
resources
/
apmplanner
/
toolbar
/
helpwizard
.
png
\
...
...
qml/ApmToolBar.qml
View file @
359f8bd1
...
@@ -4,21 +4,46 @@ import "./components"
...
@@ -4,21 +4,46 @@ import "./components"
Rectangle
{
Rectangle
{
id
:
toolbar
id
:
toolbar
width
:
parent
.
width
property
alias
backgroundColor
:
toolbar
.
color
property
alias
linkNameLabel
:
linkDevice
.
label
property
alias
baudrateLabel
:
baudrate
.
label
width
:
1024
<
parent
.
width
?
1024
:
parent
.
width
height
:
72
height
:
72
color
:
"
black
"
color
:
"
black
"
border.color
:
"
black
"
border.color
:
"
black
"
Connections
{
target
:
globalObj
onMAVConnected
:
{
console
.
log
(
"
Change Connection
"
+
connected
)
if
(
connect
){
console
.
log
(
"
connected
"
)
// connectButton.image = "./resources/apmplanner/toolbar/disconnect.png"
}
else
{
console
.
log
(
"
disconnected
"
)
// connectButton.image = "./resources/apmplanner/toolbar/connect.png"
}
}
}
Row
{
Row
{
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
spacing
:
2
spacing
:
2
Rectangle
{
width
:
5
height
:
parent
.
height
color
:
"
black
"
}
Button
{
Button
{
id
:
flightDataView
id
:
flightDataView
label
:
"
FLIGHT DATA
"
label
:
"
FLIGHT DATA
"
image
:
"
./resources/apmplanner/toolbar/flightdata.png
"
image
:
"
./resources/apmplanner/toolbar/flightdata.png
"
onClicked
:
{
onClicked
:
{
globalObj
.
select
FlightView
()
globalObj
.
trigger
FlightView
()
}
}
}
}
...
@@ -26,7 +51,7 @@ Rectangle {
...
@@ -26,7 +51,7 @@ Rectangle {
id
:
flightPlanView
id
:
flightPlanView
label
:
"
FLIGHT PLAN
"
label
:
"
FLIGHT PLAN
"
image
:
"
./resources/apmplanner/toolbar/flightplanner.png
"
image
:
"
./resources/apmplanner/toolbar/flightplanner.png
"
onClicked
:
globalObj
.
select
FlightPlanView
()
onClicked
:
globalObj
.
trigger
FlightPlanView
()
}
}
Button
{
Button
{
...
@@ -34,7 +59,7 @@ Rectangle {
...
@@ -34,7 +59,7 @@ Rectangle {
label
:
"
HARDWARE
"
label
:
"
HARDWARE
"
image
:
"
./resources/apmplanner/toolbar/hardwareconfig.png
"
image
:
"
./resources/apmplanner/toolbar/hardwareconfig.png
"
margins
:
8
margins
:
8
onClicked
:
globalObj
.
select
HardwareView
()
onClicked
:
globalObj
.
trigger
HardwareView
()
}
}
Button
{
Button
{
...
@@ -42,34 +67,62 @@ Rectangle {
...
@@ -42,34 +67,62 @@ Rectangle {
label
:
"
SOFTWARE
"
label
:
"
SOFTWARE
"
image
:
"
./resources/apmplanner/toolbar/softwareconfig.png
"
image
:
"
./resources/apmplanner/toolbar/softwareconfig.png
"
margins
:
8
margins
:
8
onClicked
:
globalObj
.
select
SoftwareView
()
onClicked
:
globalObj
.
trigger
SoftwareView
()
}
}
Button
{
Button
{
id
:
simualtionView
id
:
simualtionView
label
:
"
SIMULATION
"
label
:
"
SIMULATION
"
image
:
"
./resources/apmplanner/toolbar/simulation.png
"
image
:
"
./resources/apmplanner/toolbar/simulation.png
"
onClicked
:
globalObj
.
select
SimulationView
()
onClicked
:
globalObj
.
trigger
SimulationView
()
}
}
Button
{
Button
{
id
:
terminalView
id
:
terminalView
label
:
"
TERMINAL
"
label
:
"
TERMINAL
"
image
:
"
./resources/apmplanner/toolbar/terminal.png
"
image
:
"
./resources/apmplanner/toolbar/terminal.png
"
onClicked
:
globalObj
.
select
TerminalView
()
onClicked
:
globalObj
.
trigger
TerminalView
()
}
}
}
}
Row
{
Row
{
anchors.
lef
t
:
parent
.
right
anchors.
righ
t
:
parent
.
right
spacing
:
2
spacing
:
2
TextButton
{
id
:
linkDevice
label
:
"
none
"
minWidth
:
100
onClicked
:
globalObj
.
showConnectionDialog
()
}
TextButton
{
id
:
baudrate
label
:
"
none
"
minWidth
:
100
onClicked
:
globalObj
.
showConnectionDialog
()
}
Rectangle
{
width
:
5
height
:
parent
.
height
color
:
"
black
"
}
Button
{
Button
{
id
:
connectButton
id
:
connectButton
label
:
"
CONNECT
"
label
:
"
CONNECT
"
image
:
"
./resources/apmplanner/toolbar/connect.png
"
image
:
"
./resources/apmplanner/toolbar/connect.png
"
onClicked
:
globalObj
.
connect
()
onClicked
:
globalObj
.
connectMAV
()
}
Rectangle
{
anchors.right
:
parent
.
right
width
:
5
height
:
parent
.
height
color
:
"
black
"
}
}
}
}
}
}
qml/components/Button.qml
View file @
359f8bd1
...
@@ -38,7 +38,7 @@ Rectangle {
...
@@ -38,7 +38,7 @@ Rectangle {
signal
buttonClick
()
signal
buttonClick
()
onButtonClick
:
{
onButtonClick
:
{
console
.
log
(
buttonLabel
.
text
+
"
clicked
.
"
)
console
.
log
(
buttonLabel
.
text
+
"
clicked
calling signal
"
)
clicked
()
clicked
()
}
}
...
...
src/comm/SerialLink.cc
View file @
359f8bd1
...
@@ -27,14 +27,18 @@ SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl,
...
@@ -27,14 +27,18 @@ SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl,
m_stopp
(
false
),
m_stopp
(
false
),
m_reqReset
(
false
)
m_reqReset
(
false
)
{
{
qDebug
()
<<
"create SerialLink "
<<
portname
<<
baudRate
<<
hardwareFlowControl
<<
parity
<<
dataBits
<<
stopBits
;
// Setup settings
// Setup settings
m_portName
=
portname
.
trimmed
();
m_portName
=
portname
.
trimmed
();
if
(
m_portName
==
""
&&
getCurrentPorts
()
->
size
()
>
0
)
if
(
m_portName
==
""
&&
getCurrentPorts
()
->
size
()
>
0
)
{
{
m_portName
=
m_ports
->
first
().
trimmed
();
m_portName
=
m_ports
->
first
().
trimmed
();
}
}
qDebug
()
<<
"m_portName "
<<
m_portName
;
// Set unique ID and add link to the list of links
// Set unique ID and add link to the list of links
m_id
=
getNextLinkId
();
m_id
=
getNextLinkId
();
...
@@ -61,14 +65,15 @@ SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl,
...
@@ -61,14 +65,15 @@ SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl,
m_stopBits
=
stopBits
;
m_stopBits
=
stopBits
;
// Set the port name
// Set the port name
if
(
m_portName
==
""
)
// if (m_portName == "")
{
// {
m_name
=
tr
(
"Serial Link "
)
+
QString
::
number
(
getId
());
// m_name = tr("Serial Link ") + QString::number(getId());
}
// }
else
// else
{
// {
m_name
=
portname
.
trimmed
();
// m_name = portname.trimmed();
}
// }
loadSettings
();
loadSettings
();
}
}
void
SerialLink
::
requestReset
()
void
SerialLink
::
requestReset
()
...
@@ -187,7 +192,7 @@ void SerialLink::run()
...
@@ -187,7 +192,7 @@ void SerialLink::run()
m_bitsReceivedTotal
+=
readData
.
length
()
*
8
;
m_bitsReceivedTotal
+=
readData
.
length
()
*
8
;
}
}
}
else
{
}
else
{
qDebug
()
<<
"readyReadTime #"
<<
__LINE__
;
//
qDebug() << "readyReadTime #"<< __LINE__;
}
}
...
@@ -460,7 +465,7 @@ int SerialLink::getId()
...
@@ -460,7 +465,7 @@ int SerialLink::getId()
QString
SerialLink
::
getName
()
QString
SerialLink
::
getName
()
{
{
return
m_
n
ame
;
return
m_
portN
ame
;
}
}
/**
/**
...
@@ -695,11 +700,11 @@ bool SerialLink::setPortName(QString portName)
...
@@ -695,11 +700,11 @@ bool SerialLink::setPortName(QString portName)
if
((
portName
!=
m_portName
)
if
((
portName
!=
m_portName
)
&&
(
portName
.
trimmed
().
length
()
>
0
))
{
&&
(
portName
.
trimmed
().
length
()
>
0
))
{
m_portName
=
portName
.
trimmed
();
m_portName
=
portName
.
trimmed
();
m_name
=
tr
(
"serial port "
)
+
portName
.
trimmed
();
// [TODO] Do we need this?
//
m_name = tr("serial port ") + portName.trimmed(); // [TODO] Do we need this?
if
(
m_port
)
if
(
m_port
)
m_port
->
setPortName
(
portName
);
m_port
->
setPortName
(
portName
);
emit
nameChanged
(
m_
n
ame
);
// [TODO] maybe we can eliminate this
emit
nameChanged
(
m_
portN
ame
);
// [TODO] maybe we can eliminate this
return
accepted
;
return
accepted
;
}
}
return
false
;
return
false
;
...
...
src/comm/SerialLink.h
View file @
359f8bd1
...
@@ -148,7 +148,7 @@ protected:
...
@@ -148,7 +148,7 @@ protected:
int
m_stopBits
;
int
m_stopBits
;
int
m_parity
;
int
m_parity
;
QString
m_portName
;
QString
m_portName
;
QString
m_name
;
//
QString m_name;
int
m_timeout
;
int
m_timeout
;
int
m_id
;
int
m_id
;
...
...
src/ui/CommConfigurationWindow.cc
View file @
359f8bd1
...
@@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -55,7 +55,7 @@ This file is part of the QGROUNDCONTROL project
#include "LinkManager.h"
#include "LinkManager.h"
#include "MainWindow.h"
#include "MainWindow.h"
CommConfigurationWindow
::
CommConfigurationWindow
(
LinkInterface
*
link
,
ProtocolInterface
*
protocol
,
QWidget
*
parent
)
:
QWidget
(
NULL
)
CommConfigurationWindow
::
CommConfigurationWindow
(
LinkInterface
*
link
,
ProtocolInterface
*
protocol
,
QWidget
*
parent
)
:
QWidget
(
parent
)
{
{
this
->
link
=
link
;
this
->
link
=
link
;
...
...
src/ui/MainWindow.cc
View file @
359f8bd1
...
@@ -181,15 +181,6 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -181,15 +181,6 @@ MainWindow::MainWindow(QWidget *parent):
actions
<<
ui
.
actionSoftwareConfig
;
actions
<<
ui
.
actionSoftwareConfig
;
toolBar
->
setPerspectiveChangeActions
(
actions
);
toolBar
->
setPerspectiveChangeActions
(
actions
);
// We only want one of these.
apmToolBar
=
new
APMToolBar
(
this
);
apmToolBar
->
setFlightViewAction
(
ui
.
actionFlightView
);
apmToolBar
->
setFlightPlanViewAction
(
ui
.
actionMissionView
);
apmToolBar
->
setHardwareViewAction
(
ui
.
actionHardwareConfig
);
apmToolBar
->
setSoftwareViewAction
(
ui
.
actionSoftwareConfig
);
apmToolBar
->
setSimulationViewAction
(
ui
.
actionSimulation_View
);
apmToolBar
->
setTerminalViewAction
(
ui
.
actionSimulation_View
);
// Add actions for advanced users (displayed in dropdown under "advanced")
// Add actions for advanced users (displayed in dropdown under "advanced")
QList
<
QAction
*>
advancedActions
;
QList
<
QAction
*>
advancedActions
;
advancedActions
<<
ui
.
actionSimulation_View
;
advancedActions
<<
ui
.
actionSimulation_View
;
...
@@ -200,8 +191,6 @@ MainWindow::MainWindow(QWidget *parent):
...
@@ -200,8 +191,6 @@ MainWindow::MainWindow(QWidget *parent):
setStatusBar
(
customStatusBar
);
setStatusBar
(
customStatusBar
);
statusBar
()
->
setSizeGripEnabled
(
true
);
statusBar
()
->
setSizeGripEnabled
(
true
);
emit
initStatusChanged
(
"Building common widgets."
);
emit
initStatusChanged
(
"Building common widgets."
);
buildCommonWidgets
();
buildCommonWidgets
();
...
@@ -616,9 +605,17 @@ void MainWindow::buildCommonWidgets()
...
@@ -616,9 +605,17 @@ void MainWindow::buildCommonWidgets()
createDockWidget
(
pilotView
,
new
PrimaryFlightDisplay
(
320
,
240
,
this
),
tr
(
"Primary Flight Display"
),
"PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET"
,
VIEW_FLIGHT
,
Qt
::
LeftDockWidgetArea
,
this
->
width
()
/
1.8
);
createDockWidget
(
pilotView
,
new
PrimaryFlightDisplay
(
320
,
240
,
this
),
tr
(
"Primary Flight Display"
),
"PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET"
,
VIEW_FLIGHT
,
Qt
::
LeftDockWidgetArea
,
this
->
width
()
/
1.8
);
// Add Our new 'toolbar'
// Add Our new 'toolbar'
qDebug
()
<<
"width"
<<
this
->
width
();
// Create the APM Toolbar
APMToolBar
*
apmToolBar
=
new
APMToolBar
(
this
);
apmToolBar
->
setFlightViewAction
(
ui
.
actionFlightView
);
apmToolBar
->
setFlightPlanViewAction
(
ui
.
actionMissionView
);
apmToolBar
->
setHardwareViewAction
(
ui
.
actionHardwareConfig
);
apmToolBar
->
setSoftwareViewAction
(
ui
.
actionSoftwareConfig
);
apmToolBar
->
setSimulationViewAction
(
ui
.
actionSimulation_View
);
apmToolBar
->
setTerminalViewAction
(
ui
.
actionSimulation_View
);
createDockWidget
(
pilotView
,
apmToolBar
,
tr
(
"APM Tool Bar"
),
"APM_TOOLBAR_DOCKWIDGET"
,
VIEW_FLIGHT
,
Qt
::
TopDockWidgetArea
,
this
->
width
(),
70
);
createDockWidget
(
pilotView
,
apmToolBar
,
tr
(
"APM Tool Bar"
),
"APM_TOOLBAR_DOCKWIDGET"
,
VIEW_FLIGHT
,
Qt
::
TopDockWidgetArea
,
this
->
width
(),
70
);
QGCTabbedInfoView
*
infoview
=
new
QGCTabbedInfoView
(
this
);
QGCTabbedInfoView
*
infoview
=
new
QGCTabbedInfoView
(
this
);
infoview
->
addSource
(
mavlinkDecoder
);
infoview
->
addSource
(
mavlinkDecoder
);
createDockWidget
(
pilotView
,
infoview
,
tr
(
"Info View"
),
"UAS_INFO_INFOVIEW_DOCKWIDGET"
,
VIEW_FLIGHT
,
Qt
::
LeftDockWidgetArea
);
createDockWidget
(
pilotView
,
infoview
,
tr
(
"Info View"
),
"UAS_INFO_INFOVIEW_DOCKWIDGET"
,
VIEW_FLIGHT
,
Qt
::
LeftDockWidgetArea
);
...
@@ -864,7 +861,15 @@ void MainWindow::loadDockWidget(QString name)
...
@@ -864,7 +861,15 @@ void MainWindow::loadDockWidget(QString name)
else
if
(
name
==
"APM_TOOLBAR_DOCKWIDGET"
)
else
if
(
name
==
"APM_TOOLBAR_DOCKWIDGET"
)
{
{
// Add Our new 'toolbar'
// Add Our new 'toolbar'
createDockWidget
(
centerStack
->
currentWidget
(),
apmToolBar
,
tr
(
"APM Tool Bar"
),
"APM_TOOLBAR_DOCKWIDGET"
,
VIEW_FLIGHT
,
Qt
::
TopDockWidgetArea
,
this
->
width
(),
70
);
// Create the APM Toolbar
APMToolBar
*
apmToolBar
=
new
APMToolBar
(
this
);
apmToolBar
->
setFlightViewAction
(
ui
.
actionFlightView
);
apmToolBar
->
setFlightPlanViewAction
(
ui
.
actionMissionView
);
apmToolBar
->
setHardwareViewAction
(
ui
.
actionHardwareConfig
);
apmToolBar
->
setSoftwareViewAction
(
ui
.
actionSoftwareConfig
);
apmToolBar
->
setSimulationViewAction
(
ui
.
actionSimulation_View
);
apmToolBar
->
setTerminalViewAction
(
ui
.
actionSimulation_View
);
createDockWidget
(
centerStack
->
currentWidget
(),
apmToolBar
,
tr
(
"APM Tool Bar"
),
"APM_TOOLBAR_DOCKWIDGET"
,
currentView
,
Qt
::
TopDockWidgetArea
,
this
->
width
(),
70
);
}
}
else
else
{
{
...
@@ -1651,6 +1656,29 @@ void MainWindow::addLink()
...
@@ -1651,6 +1656,29 @@ void MainWindow::addLink()
}
}
}
}
bool
MainWindow
::
configLink
(
LinkInterface
*
link
)
{
// Go searching for this link's configuration window
QList
<
QAction
*>
actions
=
ui
.
menuNetwork
->
actions
();
bool
found
(
false
);
const
int32_t
&
linkIndex
(
LinkManager
::
instance
()
->
getLinks
().
indexOf
(
link
));
const
int32_t
&
linkID
(
LinkManager
::
instance
()
->
getLinks
()[
linkIndex
]
->
getId
());
foreach
(
QAction
*
action
,
actions
)
{
if
(
action
->
data
().
toInt
()
==
linkID
)
{
// LinkManager::instance()->getLinks().indexOf(link)
found
=
true
;
action
->
trigger
();
// Show the Link Config Dialog
}
}
return
found
;
}
void
MainWindow
::
addLink
(
LinkInterface
*
link
)
void
MainWindow
::
addLink
(
LinkInterface
*
link
)
{
{
// IMPORTANT! KEEP THESE TWO LINES
// IMPORTANT! KEEP THESE TWO LINES
...
@@ -1680,7 +1708,7 @@ void MainWindow::addLink(LinkInterface *link)
...
@@ -1680,7 +1708,7 @@ void MainWindow::addLink(LinkInterface *link)
if
(
!
found
)
if
(
!
found
)
{
// || udp
{
// || udp
CommConfigurationWindow
*
commWidget
=
new
CommConfigurationWindow
(
link
,
mavlink
,
this
);
CommConfigurationWindow
*
commWidget
=
new
CommConfigurationWindow
(
link
,
mavlink
,
NULL
);
commsWidgetList
.
append
(
commWidget
);
commsWidgetList
.
append
(
commWidget
);
connect
(
commWidget
,
SIGNAL
(
destroyed
(
QObject
*
)),
this
,
SLOT
(
commsWidgetDestroyed
(
QObject
*
)));
connect
(
commWidget
,
SIGNAL
(
destroyed
(
QObject
*
)),
this
,
SLOT
(
commsWidgetDestroyed
(
QObject
*
)));
QAction
*
action
=
commWidget
->
getAction
();
QAction
*
action
=
commWidget
->
getAction
();
...
@@ -1696,6 +1724,11 @@ void MainWindow::addLink(LinkInterface *link)
...
@@ -1696,6 +1724,11 @@ void MainWindow::addLink(LinkInterface *link)
}
}
}
}
}
}
//void MainWindow::configLink(LinkInterface *link)
//{
//}
void
MainWindow
::
commsWidgetDestroyed
(
QObject
*
obj
)
void
MainWindow
::
commsWidgetDestroyed
(
QObject
*
obj
)
{
{
if
(
commsWidgetList
.
contains
(
obj
))
if
(
commsWidgetList
.
contains
(
obj
))
...
...
src/ui/MainWindow.h
View file @
359f8bd1
...
@@ -151,6 +151,7 @@ public slots:
...
@@ -151,6 +151,7 @@ public slots:
/** @brief Add a communication link */
/** @brief Add a communication link */
void
addLink
();
void
addLink
();
void
addLink
(
LinkInterface
*
link
);
void
addLink
(
LinkInterface
*
link
);
bool
configLink
(
LinkInterface
*
link
);
void
configure
();
void
configure
();
/** @brief Set the currently controlled UAS */
/** @brief Set the currently controlled UAS */
void
setActiveUAS
(
UASInterface
*
uas
);
void
setActiveUAS
(
UASInterface
*
uas
);
...
@@ -404,7 +405,6 @@ protected:
...
@@ -404,7 +405,6 @@ protected:
QPointer
<
QGCToolBar
>
toolBar
;
QPointer
<
QGCToolBar
>
toolBar
;
QPointer
<
QGCStatusBar
>
customStatusBar
;
QPointer
<
QGCStatusBar
>
customStatusBar
;
QPointer
<
APMToolBar
>
apmToolBar
;
QPointer
<
DebugConsole
>
debugConsole
;
QPointer
<
DebugConsole
>
debugConsole
;
...
...
src/ui/MainWindow.ui
View file @
359f8bd1
...
@@ -284,7 +284,7 @@
...
@@ -284,7 +284,7 @@
</property>
</property>
<property
name=
"icon"
>
<property
name=
"icon"
>
<iconset
resource=
"../../qgroundcontrol.qrc"
>
<iconset
resource=
"../../qgroundcontrol.qrc"
>
<normaloff>
:/files/images/
status/weather-overcast.svg
</normaloff>
:/files/images/status/weather-overcas
t.svg
</iconset>
<normaloff>
:/files/images/
categories/applications-internet.svg
</normaloff>
:/files/images/categories/applications-interne
t.svg
</iconset>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Mission
</string>
<string>
Mission
</string>
...
@@ -496,6 +496,10 @@
...
@@ -496,6 +496,10 @@
</property>
</property>
</action>
</action>
<action
name=
"actionSoftwareConfig"
>
<action
name=
"actionSoftwareConfig"
>
<property
name=
"icon"
>
<iconset
resource=
"../../qgroundcontrol.qrc"
>
<normaloff>
:/files/images/categories/applications-system.svg
</normaloff>
:/files/images/categories/applications-system.svg
</iconset>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Software
</string>
<string>
Software
</string>
</property>
</property>
...
...
src/ui/apmtoolbar.cpp
View file @
359f8bd1
#include <QDebug>
#include <QDebug>
#include <QDeclarativeContext>
#include <QDeclarativeContext>
#include <QGraphicsObject>
#include <QGraphicsObject>
#include "LinkManager.h"
#include "MainWindow.h"
#include "apmtoolbar.h"
#include "apmtoolbar.h"
APMToolBar
::
APMToolBar
(
QWidget
*
parent
)
:
APMToolBar
::
APMToolBar
(
QWidget
*
parent
)
:
QDeclarativeView
(
parent
)
QDeclarativeView
(
parent
)
{
{
// Configure our QML object
// Configure our QML object
this
->
rootContext
()
->
setContextProperty
(
"globalObj"
,
this
);
this
->
rootContext
()
->
setContextProperty
(
"globalObj"
,
this
);
setSource
(
QUrl
::
fromLocalFile
(
"qml/ApmToolBar.qml"
));
setSource
(
QUrl
::
fromLocalFile
(
"qml/ApmToolBar.qml"
));
setResizeMode
(
QDeclarativeView
::
SizeRootObjectToView
);
setResizeMode
(
QDeclarativeView
::
SizeRootObjectToView
);
QObject
*
root
=
rootObject
();
connect
(
LinkManager
::
instance
(),
SIGNAL
(
newLink
(
LinkInterface
*
)),
this
,
SLOT
(
updateLinkDisplay
(
LinkInterface
*
)));
}
}
void
APMToolBar
::
setFlightViewAction
(
QAction
*
action
)
void
APMToolBar
::
setFlightViewAction
(
QAction
*
action
)
{
{
connect
(
this
,
SIGNAL
(
select
FlightView
()),
action
,
SIGNAL
(
triggered
()));
connect
(
this
,
SIGNAL
(
trigger
FlightView
()),
action
,
SIGNAL
(
triggered
()));
}
}
void
APMToolBar
::
setFlightPlanViewAction
(
QAction
*
action
)
void
APMToolBar
::
setFlightPlanViewAction
(
QAction
*
action
)
{
{
connect
(
this
,
SIGNAL
(
select
FlightPlanView
()),
action
,
SIGNAL
(
triggered
()));
connect
(
this
,
SIGNAL
(
trigger
FlightPlanView
()),
action
,
SIGNAL
(
triggered
()));
}
}
void
APMToolBar
::
setHardwareViewAction
(
QAction
*
action
)
void
APMToolBar
::
setHardwareViewAction
(
QAction
*
action
)
{
{
connect
(
this
,
SIGNAL
(
select
HardwareView
()),
action
,
SIGNAL
(
triggered
()));
connect
(
this
,
SIGNAL
(
trigger
HardwareView
()),
action
,
SIGNAL
(
triggered
()));
}
}
void
APMToolBar
::
setSoftwareViewAction
(
QAction
*
action
)
void
APMToolBar
::
setSoftwareViewAction
(
QAction
*
action
)
{
{
connect
(
this
,
SIGNAL
(
select
SoftwareView
()),
action
,
SIGNAL
(
triggered
()));
connect
(
this
,
SIGNAL
(
trigger
SoftwareView
()),
action
,
SIGNAL
(
triggered
()));
}
}
void
APMToolBar
::
setSimulationViewAction
(
QAction
*
action
)
void
APMToolBar
::
setSimulationViewAction
(
QAction
*
action
)
{
{
connect
(
this
,
SIGNAL
(
selectSimual
tionView
()),
action
,
SIGNAL
(
triggered
()));
connect
(
this
,
SIGNAL
(
triggerSimula
tionView
()),
action
,
SIGNAL
(
triggered
()));
}
}
void
APMToolBar
::
setTerminalViewAction
(
QAction
*
action
)
void
APMToolBar
::
setTerminalViewAction
(
QAction
*
action
)
{
{
connect
(
this
,
SIGNAL
(
selectTerminalView
()),
action
,
SIGNAL
(
triggered
()));
connect
(
this
,
SIGNAL
(
triggerTerminalView
()),
action
,
SIGNAL
(
triggered
()));
}
void
APMToolBar
::
setConnectMAVAction
(
QAction
*
action
)
{
connect
(
this
,
SIGNAL
(
connectMAV
()),
action
,
SIGNAL
(
triggered
()));
}
}
void
APMToolBar
::
selectFlightView
()
void
APMToolBar
::
selectFlightView
()
{
{
qDebug
()
<<
"APMToolBar: SelectFlightView"
;
qDebug
()
<<
"APMToolBar: SelectFlightView"
;
//
emit triggerFlightView();
emit
triggerFlightView
();
}
}
void
APMToolBar
::
selectFlightPlanView
()
void
APMToolBar
::
selectFlightPlanView
()
{
{
qDebug
()
<<
"APMToolBar: SelectFlightPlanView"
;
qDebug
()
<<
"APMToolBar: SelectFlightPlanView"
;
emit
triggerFlightPlanView
();
}
}
void
APMToolBar
::
selectHardwareView
()
void
APMToolBar
::
selectHardwareView
()
{
{
qDebug
()
<<
"APMToolBar: selectHardwareView"
;
qDebug
()
<<
"APMToolBar: selectHardwareView"
;
emit
triggerHardwareView
();
}
}
void
APMToolBar
::
selectSoftwareView
()
void
APMToolBar
::
selectSoftwareView
()
{
{
qDebug
()
<<
"APMToolBar: selectSoftwareView"
;
qDebug
()
<<
"APMToolBar: selectSoftwareView"
;
emit
triggerSoftwareView
();
}
}
void
APMToolBar
::
selectSimulationView
()
void
APMToolBar
::
selectSimulationView
()
...
@@ -76,6 +90,65 @@ void APMToolBar::selectTerminalView()
...
@@ -76,6 +90,65 @@ void APMToolBar::selectTerminalView()
void
APMToolBar
::
connectMAV
()
void
APMToolBar
::
connectMAV
()
{
{
qDebug
()
<<
"APMToolBar: connect"
;
qDebug
()
<<
"APMToolBar: connectMAV "
;
bool
connected
=
LinkManager
::
instance
()
->
getLinks
().
last
()
->
isConnected
();
bool
result
;
if
(
!
connected
&&
LinkManager
::
instance
()
->
getLinks
().
count
()
<
3
)
{
// No Link so prompt to connect one
MainWindow
::
instance
()
->
addLink
();
}
else
if
(
!
connected
)
{
// Need to Connect Link
result
=
LinkManager
::
instance
()
->
getLinks
().
last
()
->
connect
();
}
else
if
(
connected
&&
LinkManager
::
instance
()
->
getLinks
().
count
()
>
2
)
{
// result need to be the opposite of success.
result
=
!
LinkManager
::
instance
()
->
getLinks
().
last
()
->
disconnect
();
}
qDebug
()
<<
"result = "
<<
result
;
emit
MAVConnected
(
result
);
}
APMToolBar
::~
APMToolBar
()
{
qDebug
()
<<
"Destory APM Toolbar"
;
}
void
APMToolBar
::
showConnectionDialog
()
{
// Displays a UI where the user can select a MAV Link.
qDebug
()
<<
"APMToolBar: showConnectionDialog link count ="
<<
LinkManager
::
instance
()
->
getLinks
().
count
();
LinkInterface
*
link
=
LinkManager
::
instance
()
->
getLinks
().
last
();
bool
result
;
if
(
link
&&
LinkManager
::
instance
()
->
getLinks
().
count
()
>=
3
)
{
// Serial Link so prompt to config it
result
=
MainWindow
::
instance
()
->
configLink
(
link
);
if
(
!
result
)
qDebug
()
<<
"Link Config Failed!"
;
}
else
{
// No Link so prompt to create one
MainWindow
::
instance
()
->
addLink
();
}
}
}
void
APMToolBar
::
updateLinkDisplay
(
LinkInterface
*
newLink
)
{
qDebug
()
<<
"APMToolBar: updateLinkDisplay"
;
QObject
*
object
=
rootObject
();
if
(
newLink
){
qint64
baudrate
=
newLink
->
getNominalDataRate
();
object
->
setProperty
(
"baudrateLabel"
,
QString
::
number
(
baudrate
));
QString
linkName
=
newLink
->
getName
();
object
->
setProperty
(
"linkNameLabel"
,
linkName
);
}
}
src/ui/apmtoolbar.h
View file @
359f8bd1
...
@@ -4,11 +4,14 @@
...
@@ -4,11 +4,14 @@
#include <QAction>