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
d8efa558
Commit
d8efa558
authored
Jul 31, 2013
by
Michael Carpenter
Browse files
Addition of Armed/Disarmed indicator on ApmToolbar
parent
eb59fcb5
Changes
3
Hide whitespace changes
Inline
Side-by-side
qml/ApmToolBar.qml
View file @
d8efa558
...
...
@@ -9,12 +9,25 @@ Rectangle {
property
alias
linkNameLabel
:
linkDevice
.
label
property
alias
baudrateLabel
:
baudrate
.
label
property
bool
connected
:
false
property
bool
armed
:
false
property
string
armedstr
:
"
Disarmed
"
width
:
toolbar
.
width
height
:
72
color
:
"
black
"
border.color
:
"
black
"
onArmedChanged
:
{
if
(
armed
)
{
armedText
.
text
=
"
Armed
"
armedText
.
color
=
"
Red
"
}
else
{
armedText
.
text
=
"
Disarmed
"
armedText
.
color
=
"
Green
"
}
}
onConnectedChanged
:
{
if
(
connected
){
console
.
log
(
"
APM Tool BAR QML: connected
"
)
...
...
@@ -97,6 +110,20 @@ Rectangle {
image
:
"
./resources/apmplanner/toolbar/terminal.png
"
onClicked
:
globalObj
.
triggerTerminalView
()
}
Rectangle
{
width
:
150
height
:
parent
.
height
Text
{
id
:
armedText
;
anchors.fill
:
parent
verticalAlignment
:
Text
.
AlignVCenter
horizontalAlignment
:
Text
.
AlignHCenter
font.pixelSize
:
20
color
:
"
green
"
text
:
"
Disarmed
"
}
color
:
"
black
"
}
Rectangle
{
// Spacer
width
:
5
...
...
src/ui/apmtoolbar.cpp
View file @
d8efa558
...
...
@@ -7,7 +7,7 @@
#include
"apmtoolbar.h"
APMToolBar
::
APMToolBar
(
QWidget
*
parent
)
:
QDeclarativeView
(
parent
)
QDeclarativeView
(
parent
)
,
m_uas
(
0
)
{
// Configure our QML object
setSource
(
QUrl
::
fromLocalFile
(
"qml/ApmToolBar.qml"
));
...
...
@@ -21,6 +21,25 @@ APMToolBar::APMToolBar(QWidget *parent):
}
setConnection
(
false
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUasSet
(
UASInterface
*
)));
activeUasSet
(
UASManager
::
instance
()
->
getActiveUAS
());
}
void
APMToolBar
::
activeUasSet
(
UASInterface
*
uas
)
{
if
(
!
uas
)
{
return
;
}
if
(
m_uas
)
{
disconnect
(
m_uas
,
SIGNAL
(
armingChanged
(
bool
)),
this
,
SLOT
(
armingChanged
(
bool
)));
}
connect
(
uas
,
SIGNAL
(
armingChanged
(
bool
)),
this
,
SLOT
(
armingChanged
(
bool
)));
}
void
APMToolBar
::
armingChanged
(
bool
armed
)
{
this
->
rootObject
()
->
setProperty
(
"armed"
,
armed
);
}
void
APMToolBar
::
setFlightViewAction
(
QAction
*
action
)
...
...
src/ui/apmtoolbar.h
View file @
d8efa558
...
...
@@ -3,6 +3,7 @@
#include
<QAction>
#include
<QDeclarativeView>
#include
"UASInterface.h"
class
LinkInterface
;
...
...
@@ -32,6 +33,8 @@ signals:
void
MAVConnected
(
bool
connected
);
public
slots
:
void
armingChanged
(
bool
armed
);
void
activeUasSet
(
UASInterface
*
uas
);
void
selectFlightView
();
void
selectFlightPlanView
();
void
selectHardwareView
();
...
...
@@ -44,6 +47,9 @@ public slots:
void
setConnection
(
bool
connection
);
void
updateLinkDisplay
(
LinkInterface
*
newLink
);
private:
UASInterface
*
m_uas
;
};
#endif // APMTOOLBAR_H
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