diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 70501c599037375b9ef93956412e718f02e9c6e0..ce11196f392a21a6b612d5418f0d697a77f8701c 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -801,7 +801,8 @@ unix:!macx:!symbian: LIBS += -losg OTHER_FILES += \ dongfang_notes.txt \ src/ui/dongfang-scrapyard.txt \ - qml/components/DigitalDisplay.qml + qml/components/DigitalDisplay.qml \ + qml/components/StatusDisplay.qml OTHER_FILES += \ qml/ApmToolBar.qml \ diff --git a/qml/ApmToolBar.qml b/qml/ApmToolBar.qml index 6065598aed9114ce9e207010116a247dc1cd52f5..c147e66c3e31efd6810ac1821d75b51b9de68d7b 100644 --- a/qml/ApmToolBar.qml +++ b/qml/ApmToolBar.qml @@ -10,7 +10,7 @@ Rectangle { property alias baudrateLabel: baudrate.label property bool connected: false property bool armed: false - property string armedstr: "Disarmed" + property string armedstr: "DISARMED" width: toolbar.width height: 72 @@ -19,12 +19,14 @@ Rectangle { onArmedChanged: { if (armed) { - armedText.text = "Armed" - armedText.color = "Red" + statusDisplay.statusText = "ARMED" + statusDisplay.statusTextColor = "red" + statusDisplay.statusBackgroundColor = "#FF880000" } else { - armedText.text = "Disarmed" - armedText.color = "Green" + statusDisplay.statusText = "DISARMED" + statusDisplay.statusTextColor = "yellow" + statusDisplay.statusBackgroundColor = "black" } } @@ -110,19 +112,19 @@ Rectangle { image: "./resources/apmplanner/toolbar/terminal.png" onClicked: globalObj.triggerTerminalView() } - Rectangle { - width:150 + + Rectangle { // Spacer + width: 5 height: parent.height - Text { - id: armedText; - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 20 - color: "green" - text: "Disarmed" - } - color:"black" + color: "black" + } + + StatusDisplay { + id: statusDisplay + width: 110 + statusText: "DISARMED" + statusTextColor: "yellow" + statusBackgroundColor: "black" } Rectangle { // Spacer diff --git a/qml/components/DigitalDisplay.qml b/qml/components/DigitalDisplay.qml index be69b6712bdf2033e376100ae256e059ffd8756b..dc70d0149c9b9e79a4a5dc508815a94dc23c9450 100644 --- a/qml/components/DigitalDisplay.qml +++ b/qml/components/DigitalDisplay.qml @@ -5,7 +5,7 @@ Rectangle { property alias title: displayTitle.text property string textValue: "none" - width: 100 + width: 110 height: parent.height/3 anchors.verticalCenter: parent.verticalCenter border.color: "white" diff --git a/qml/components/StatusDisplay.qml b/qml/components/StatusDisplay.qml new file mode 100644 index 0000000000000000000000000000000000000000..9d4f6ade628325a3025b0e133e63913c9e5314e3 --- /dev/null +++ b/qml/components/StatusDisplay.qml @@ -0,0 +1,24 @@ +import QtQuick 1.1 + +Rectangle { + id: statusDisplay + property alias statusText: armedText.text + property alias statusTextColor: armedText.color + property alias statusBackgroundColor: statusDisplay.color + + width: 100 + height: parent.height/3 + anchors.verticalCenter: parent.verticalCenter + radius: 3 + border.color: "white" + border.width: 1 + + Text { + id: armedText + anchors.centerIn: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 20 + } + +} diff --git a/src/ui/apmtoolbar.cpp b/src/ui/apmtoolbar.cpp index 2f4595cc6403c7875c9f150f790655c44dd1e87d..b676dff1b48127821d0fe1607975e7b2975b49a0 100644 --- a/src/ui/apmtoolbar.cpp +++ b/src/ui/apmtoolbar.cpp @@ -33,15 +33,27 @@ void APMToolBar::activeUasSet(UASInterface *uas) } if (m_uas) { - disconnect(m_uas,SIGNAL(armingChanged(bool)),this,SLOT(armingChanged(bool))); + disconnect(m_uas,SIGNAL(armingChanged(bool)), + this,SLOT(armingChanged(bool))); + disconnect(uas,SIGNAL(armingChanged(int, QString)), + this,SLOT(armingChanged(int, QString))); } - connect(uas,SIGNAL(armingChanged(bool)),this,SLOT(armingChanged(bool))); + connect(uas,SIGNAL(armingChanged(bool)), + this,SLOT(armingChanged(bool))); + connect(uas,SIGNAL(armingChanged(int, QString)), + this,SLOT(armingChanged(int, QString))); + } void APMToolBar::armingChanged(bool armed) { this->rootObject()->setProperty("armed",armed); } +void APMToolBar::armingChanged(int sysId, QString armingState) +{ + qDebug() << "APMToolBar: sysid " << sysId << " armState" << armingState; +} + void APMToolBar::setFlightViewAction(QAction *action) { connect(this, SIGNAL(triggerFlightView()), action, SIGNAL(triggered())); diff --git a/src/ui/apmtoolbar.h b/src/ui/apmtoolbar.h index 9d5608d97590385d7de256233c0b9aca250bb9ed..5bed5a224e0fb9e802f325cbe64d1b3ad2f9e310 100644 --- a/src/ui/apmtoolbar.h +++ b/src/ui/apmtoolbar.h @@ -33,8 +33,6 @@ signals: void MAVConnected(bool connected); public slots: - void armingChanged(bool armed); - void activeUasSet(UASInterface *uas); void selectFlightView(); void selectFlightPlanView(); void selectHardwareView(); @@ -46,6 +44,10 @@ public slots: void showConnectionDialog(); void setConnection(bool connection); + void activeUasSet(UASInterface *uas); + void armingChanged(int sysId, QString armingState); + void armingChanged(bool armed); + void updateLinkDisplay(LinkInterface *newLink); private: