Commit d8efa558 authored by Michael Carpenter's avatar Michael Carpenter

Addition of Armed/Disarmed indicator on ApmToolbar

parent eb59fcb5
......@@ -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
......
......@@ -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)
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment